normalize QMAKE_DEFAULT_{LIB,INC}DIRS
the consumers of these variables use the strings for naive text-based "subtraction", which of course doesn't work particularly well when the paths contain "../", "./", and trailing slashes. Task-number: QTBUG-33714 Change-Id: I893c90e6f5c7cf18c9e6cb1e5be825a16509a2a4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
This commit is contained in:
parent
e7c5891927
commit
c026405093
23
configure
vendored
23
configure
vendored
@ -3032,6 +3032,21 @@ unset tty
|
|||||||
|
|
||||||
eval `LC_ALL=C $TEST_COMPILER $SYSROOT_FLAG $TEST_COMPILER_CXXFLAGS -xc++ -E -v - < /dev/null 2>&1 > /dev/null | $AWK '
|
eval `LC_ALL=C $TEST_COMPILER $SYSROOT_FLAG $TEST_COMPILER_CXXFLAGS -xc++ -E -v - < /dev/null 2>&1 > /dev/null | $AWK '
|
||||||
BEGIN { ORS = ""; FS = "="; incs = 0; libs = 0; }
|
BEGIN { ORS = ""; FS = "="; incs = 0; libs = 0; }
|
||||||
|
|
||||||
|
function normalize(dir)
|
||||||
|
{
|
||||||
|
do {
|
||||||
|
odir = dir
|
||||||
|
gsub(/\\/[^/]+\\/\\.\\./, "", dir)
|
||||||
|
} while (dir != odir);
|
||||||
|
do {
|
||||||
|
odir = dir
|
||||||
|
gsub(/\\/\\./, "", dir)
|
||||||
|
} while (dir != odir);
|
||||||
|
sub("/$", "", dir);
|
||||||
|
return dir;
|
||||||
|
}
|
||||||
|
|
||||||
function quote(s)
|
function quote(s)
|
||||||
{
|
{
|
||||||
# We only handle spaces
|
# We only handle spaces
|
||||||
@ -3047,14 +3062,16 @@ function quote(s)
|
|||||||
/^\#include </ { yup=1; print "DEFAULT_INCDIRS=\""; next }
|
/^\#include </ { yup=1; print "DEFAULT_INCDIRS=\""; next }
|
||||||
/^End of search/ { yup=0; print "\"\n" }
|
/^End of search/ { yup=0; print "\"\n" }
|
||||||
/ \(framework directory\)$/ { next }
|
/ \(framework directory\)$/ { next }
|
||||||
yup { print quote(substr($0, 2)) " "; ++incs }
|
yup { print quote(normalize(substr($0, 2))) " "; ++incs }
|
||||||
|
|
||||||
# extract from one line like LIBRARY_PATH=/one/path:/another/path:...
|
# extract from one line like LIBRARY_PATH=/one/path:/another/path:...
|
||||||
$1 == "LIBRARY_PATH" {
|
$1 == "LIBRARY_PATH" {
|
||||||
libs = split($2, library_paths, ":");
|
libs = split($2, library_paths, ":");
|
||||||
print "DEFAULT_LIBDIRS=\"";
|
print "DEFAULT_LIBDIRS=\"";
|
||||||
for (lib in library_paths)
|
for (lib in library_paths) {
|
||||||
print quote(library_paths[lib]) " ";
|
dir = normalize(library_paths[lib]);
|
||||||
|
print quote(dir) " ";
|
||||||
|
}
|
||||||
print "\"\n"
|
print "\"\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user