Skip to content

Commit

Permalink
qmake: rework .prl filename construction
Browse files Browse the repository at this point in the history
instead of trying to reverse-engineer it from the final target including
extension and possible bundle path, construct the basename explicitly.
this avoids that we mangle the filename if the actual target contains a
period for some reason.

Task-number: QTBUG-70097
Change-Id: I0bae9f010ab82e258680830250f8e28656f09d67
Reviewed-by: Thiago Macieira <[email protected]>
  • Loading branch information
ossilator authored and liangqi committed Aug 30, 2018
1 parent 19b12ac commit 999d4d5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 16 deletions.
13 changes: 1 addition & 12 deletions qmake/generators/makefile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1102,18 +1102,7 @@ MakefileGenerator::write()
QString
MakefileGenerator::prlFileName(bool fixify)
{
QString ret = project->first("TARGET_PRL").toQString();
if(ret.isEmpty())
ret = project->first("TARGET").toQString();
int slsh = ret.lastIndexOf(Option::dir_sep);
if(slsh != -1)
ret.remove(0, slsh);
if(!ret.endsWith(Option::prl_ext)) {
int dot = ret.indexOf('.');
if(dot != -1)
ret.truncate(dot);
ret += Option::prl_ext;
}
QString ret = project->first("PRL_TARGET") + Option::prl_ext;
if(!project->isEmpty("QMAKE_BUNDLE"))
ret.prepend(project->first("QMAKE_BUNDLE") + Option::dir_sep);
if(fixify) {
Expand Down
7 changes: 6 additions & 1 deletion qmake/generators/unix/unixmake2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1244,7 +1244,8 @@ void UnixMakefileGenerator::init2()
if(!project->isEmpty("TARGET"))
project->values("TARGET").first().prepend(project->first("DESTDIR"));
} else if (project->isActiveConfig("staticlib")) {
project->values("TARGET").first().prepend(project->first("QMAKE_PREFIX_STATICLIB"));
project->values("PRL_TARGET") =
project->values("TARGET").first().prepend(project->first("QMAKE_PREFIX_STATICLIB"));
project->values("TARGET").first() += "." + project->first("QMAKE_EXTENSION_STATICLIB");
if(project->values("QMAKE_AR_CMD").isEmpty())
project->values("QMAKE_AR_CMD").append("$(AR) $(DESTDIR)$(TARGET) $(OBJECTS)");
Expand Down Expand Up @@ -1278,6 +1279,7 @@ void UnixMakefileGenerator::init2()
QString prefix;
if(!project->isActiveConfig("no_plugin_name_prefix"))
prefix = "lib";
project->values("PRL_TARGET").prepend(prefix + project->first("TARGET"));
project->values("TARGET_x.y.z").append(prefix +
project->first("TARGET") + "." +
project->first("QMAKE_EXTENSION_PLUGIN"));
Expand All @@ -1291,6 +1293,7 @@ void UnixMakefileGenerator::init2()
"." + project->first("VER_MAJ"));
project->values("TARGET") = project->values("TARGET_x.y.z");
} else if (!project->isEmpty("QMAKE_HPUX_SHLIB")) {
project->values("PRL_TARGET").prepend("lib" + project->first("TARGET"));
project->values("TARGET_").append("lib" + project->first("TARGET") + ".sl");
if(project->isActiveConfig("lib_version_first"))
project->values("TARGET_x").append("lib" + project->first("VER_MAJ") + "." +
Expand All @@ -1300,6 +1303,7 @@ void UnixMakefileGenerator::init2()
project->first("VER_MAJ"));
project->values("TARGET") = project->values("TARGET_x");
} else if (!project->isEmpty("QMAKE_AIX_SHLIB")) {
project->values("PRL_TARGET").prepend("lib" + project->first("TARGET"));
project->values("TARGET_").append(project->first("QMAKE_PREFIX_STATICLIB") + project->first("TARGET")
+ "." + project->first("QMAKE_EXTENSION_STATICLIB"));
if(project->isActiveConfig("lib_version_first")) {
Expand Down Expand Up @@ -1331,6 +1335,7 @@ void UnixMakefileGenerator::init2()
}
project->values("TARGET") = project->values("TARGET_x.y.z");
} else {
project->values("PRL_TARGET").prepend("lib" + project->first("TARGET"));
project->values("TARGET_").append("lib" + project->first("TARGET") + "." +
project->first("QMAKE_EXTENSION_SHLIB"));
if(project->isActiveConfig("lib_version_first")) {
Expand Down
2 changes: 0 additions & 2 deletions qmake/generators/win32/mingw_make.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,6 @@ void MingwMakefileGenerator::init()
return;
}

project->values("TARGET_PRL").append(project->first("TARGET"));

processVars();

project->values("QMAKE_LIBS") += project->values("RES_FILE");
Expand Down
3 changes: 2 additions & 1 deletion qmake/generators/win32/winmakefile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ void Win32MakefileGenerator::processVars()
if (project->first("TEMPLATE").endsWith("aux"))
return;

project->values("QMAKE_ORIG_TARGET") = project->values("TARGET");
project->values("PRL_TARGET") =
project->values("QMAKE_ORIG_TARGET") = project->values("TARGET");
if (project->isEmpty("QMAKE_PROJECT_NAME"))
project->values("QMAKE_PROJECT_NAME") = project->values("QMAKE_ORIG_TARGET");
else if (project->first("TEMPLATE").startsWith("vc"))
Expand Down

0 comments on commit 999d4d5

Please sign in to comment.