From 999d4d5777b098f9c1f311af4addad910e44ab62 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 23 Aug 2018 20:21:24 +0200 Subject: qmake: rework .prl filename construction 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 --- qmake/generators/makefile.cpp | 13 +------------ qmake/generators/unix/unixmake2.cpp | 7 ++++++- qmake/generators/win32/mingw_make.cpp | 2 -- qmake/generators/win32/winmakefile.cpp | 3 ++- 4 files changed, 9 insertions(+), 16 deletions(-) (limited to 'qmake') diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index cae179cc93..7c359071bf 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -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) { diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 2ed1866584..ab946fa439 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -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)"); @@ -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")); @@ -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") + "." + @@ -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")) { @@ -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")) { diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index 95f69dbbc3..13412e971a 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -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"); diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 3c730299be..1388e120e7 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -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")) -- cgit v1.2.3