diff options
author | Oswald Buddenhagen <oswald.buddenhagen@digia.com> | 2013-10-10 18:05:36 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-16 17:10:15 +0200 |
commit | c0264050938c04723f7dc9295ef87cf41ab7a8ae (patch) | |
tree | d7c41524d2509e766fd6c2b71ba173f9deaa0eb0 | |
parent | e7c58919275b35b2b970f38ed6d23fcf3b715380 (diff) |
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>
-rwxr-xr-x | configure | 23 |
1 files changed, 20 insertions, 3 deletions
@@ -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 ' 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) { # We only handle spaces @@ -3047,14 +3062,16 @@ function quote(s) /^\#include </ { yup=1; print "DEFAULT_INCDIRS=\""; next } /^End of search/ { yup=0; print "\"\n" } / \(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:... $1 == "LIBRARY_PATH" { libs = split($2, library_paths, ":"); print "DEFAULT_LIBDIRS=\""; - for (lib in library_paths) - print quote(library_paths[lib]) " "; + for (lib in library_paths) { + dir = normalize(library_paths[lib]); + print quote(dir) " "; + } print "\"\n" } |