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 <kai.koehne@qt.io>
This commit is contained in:
parent
455963ce49
commit
8c0787cfa1
@ -1450,7 +1450,36 @@ UnixMakefileGenerator::libtoolFileName(bool fixify)
|
|||||||
void
|
void
|
||||||
UnixMakefileGenerator::writeLibtoolFile()
|
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;
|
QString fname = libtoolFileName(), lname = fname;
|
||||||
|
debug_msg(1, "Writing libtool file %s", fname.toLatin1().constData());
|
||||||
mkdir(fileInfo(fname).path());
|
mkdir(fileInfo(fname).path());
|
||||||
int slsh = lname.lastIndexOf(Option::dir_sep);
|
int slsh = lname.lastIndexOf(Option::dir_sep);
|
||||||
if(slsh != -1)
|
if(slsh != -1)
|
||||||
@ -1488,12 +1517,11 @@ UnixMakefileGenerator::writeLibtoolFile()
|
|||||||
<< ".a'\n\n";
|
<< ".a'\n\n";
|
||||||
|
|
||||||
t << "# Libraries that this one depends upon.\n";
|
t << "# Libraries that this one depends upon.\n";
|
||||||
|
static const ProKey libVars[] = { "LIBS", "QMAKE_LIBS" };
|
||||||
ProStringList libs;
|
ProStringList libs;
|
||||||
libs << "LIBS" << "QMAKE_LIBS";
|
for (auto var : libVars)
|
||||||
t << "dependency_libs='";
|
libs += fixLibFlags(var);
|
||||||
for (ProStringList::ConstIterator it = libs.begin(); it != libs.end(); ++it)
|
t << "dependency_libs='" << fixDependencyLibs(libs).join(' ') << "'\n\n";
|
||||||
t << fixLibFlags((*it).toKey()).join(' ') << ' ';
|
|
||||||
t << "'\n\n";
|
|
||||||
|
|
||||||
t << "# Version information for " << lname << "\n";
|
t << "# Version information for " << lname << "\n";
|
||||||
int maj = project->first("VER_MAJ").toInt();
|
int maj = project->first("VER_MAJ").toInt();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user