From 8c0787cfa1a906ebe25907515d86050303b127e7 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 31 Jul 2019 10:55:14 +0200 Subject: Fix dependency_libs entry of .la files Libtool cannot cope with absolute paths in the dependency_libs entry. We split absolute paths into -L and -l here. Change-Id: I30bf11e490d1993d2a4d88c114e07bbae12def6d Fixes: QTBUG-76625 Reviewed-by: Kai Koehne --- qmake/generators/unix/unixmake2.cpp | 38 ++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) (limited to 'qmake') diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index d9bcccf2e2..abc37149a9 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -1450,7 +1450,36 @@ UnixMakefileGenerator::libtoolFileName(bool fixify) void UnixMakefileGenerator::writeLibtoolFile() { + auto fixDependencyLibs + = [this](const ProStringList &libs) + { + ProStringList result; + for (auto lib : libs) { + auto fi = fileInfo(lib.toQString()); + if (fi.isAbsolute()) { + const QString libDirArg = "-L" + fi.path(); + if (!result.contains(libDirArg)) + result += libDirArg; + QString namespec = fi.fileName(); + int dotPos = namespec.lastIndexOf('.'); + if (dotPos != -1 && namespec.startsWith("lib")) { + namespec.truncate(dotPos); + namespec.remove(0, 3); + } else { + debug_msg(1, "Ignoring dependency library %s", + lib.toLatin1().constData()); + continue; + } + result += "-l" + namespec; + } else { + result += lib; + } + } + return result; + }; + QString fname = libtoolFileName(), lname = fname; + debug_msg(1, "Writing libtool file %s", fname.toLatin1().constData()); mkdir(fileInfo(fname).path()); int slsh = lname.lastIndexOf(Option::dir_sep); if(slsh != -1) @@ -1488,12 +1517,11 @@ UnixMakefileGenerator::writeLibtoolFile() << ".a'\n\n"; t << "# Libraries that this one depends upon.\n"; + static const ProKey libVars[] = { "LIBS", "QMAKE_LIBS" }; ProStringList libs; - libs << "LIBS" << "QMAKE_LIBS"; - t << "dependency_libs='"; - for (ProStringList::ConstIterator it = libs.begin(); it != libs.end(); ++it) - t << fixLibFlags((*it).toKey()).join(' ') << ' '; - t << "'\n\n"; + for (auto var : libVars) + libs += fixLibFlags(var); + t << "dependency_libs='" << fixDependencyLibs(libs).join(' ') << "'\n\n"; t << "# Version information for " << lname << "\n"; int maj = project->first("VER_MAJ").toInt(); -- cgit v1.2.3 From e66f247ccf345f1d303a92e53c21bb53d96c5af2 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 9 Aug 2019 15:54:00 +0200 Subject: Doc: Extend QMake's documentation of RC_FILE and RES_FILE RC_FILE is not an internal variable that "rarely needs to be modified". Mention that it's about Windows resources and link to the corresponding section. RES_FILE: Add link to RC_FILE and the more general section. Also rephrase "compiled Windows resource file" to "Windows resource compiler's output file" which is more precise. Fixes: QTBUG-8709 Change-Id: I19c61e6a9505d45fc13fefbcd0ba9441191aa42e Reviewed-by: Kai Koehne Reviewed-by: Kavindra Palaraja --- qmake/doc/src/qmake-manual.qdoc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'qmake') diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index d3148a1e62..2e2962f86c 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -2541,10 +2541,8 @@ \section1 RC_FILE - Specifies the name of the resource file for the application. - The value of this variable is typically handled by - qmake or \l{#QMAKESPEC}{qmake.conf} and rarely - needs to be modified. + Windows only. Specifies the name of the Windows resource file (.rc) for the + target. See \l{Adding Windows Resource Files}. \target RC_CODEPAGE \section1 RC_CODEPAGE @@ -2607,7 +2605,9 @@ \section1 RES_FILE - Specifies the name of the compiled Windows resource file for the target. + Windows only. Specifies the name of the Windows resource compiler's output + file for this target. See \l{RC_FILE} and \l{Adding Windows Resource Files}. + The value of this variable is typically handled by qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. -- cgit v1.2.3