commit:     5e16bcd72951e73dbb89fdaa9b0dee793acdc4e8
Author:     Davide Pesavento <pesa <AT> gentoo <DOT> org>
AuthorDate: Wed May  6 00:49:10 2015 +0000
Commit:     Davide Pesavento <pesa <AT> gentoo <DOT> org>
CommitDate: Wed May  6 00:49:10 2015 +0000
URL:        https://gitweb.gentoo.org/proj/qt.git/commit/?id=5e16bcd7

[qt4-build-multilib] Rewrite handling of toolchain and *FLAGS during configure

Previously we would directly patch the config.tests code in ${S}, but
this meant that the native ABI flags were being used for all ABIs, so
for example we were compiling 64-bit tests during the 32-bit build...

Switch to using the .qmake.cache file, that the configure already creates
inside the (ABI-specific) build dir.

Fixes bug #545106 and probably many more that haven't been discovered yet.

 eclass/qt4-build-multilib.eclass | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/eclass/qt4-build-multilib.eclass b/eclass/qt4-build-multilib.eclass
index 2c4de88..8a0d45c 100644
--- a/eclass/qt4-build-multilib.eclass
+++ b/eclass/qt4-build-multilib.eclass
@@ -198,7 +198,7 @@ qt4-build-multilib_src_prepare() {
                configure || die "sed SYSTEM_VARIABLES failed"
 
        # Reset QMAKE_*FLAGS_{RELEASE,DEBUG} variables,
-       # or they will override user's flags (.qmake.cache)
+       # or they will override the user's flags (via .qmake.cache)
        sed -i -e '/^SYSTEM_VARIABLES=/ i \
                QMakeVar set QMAKE_CFLAGS_RELEASE\
                QMakeVar set QMAKE_CFLAGS_DEBUG\
@@ -208,12 +208,16 @@ qt4-build-multilib_src_prepare() {
                QMakeVar set QMAKE_LFLAGS_DEBUG\n' \
                configure || die "sed QMAKE_*FLAGS_{RELEASE,DEBUG} failed"
 
-       # Respect CC, CXX, LINK and *FLAGS in config.tests
+       # Drop -nocache from qmake invocation in all configure tests, to ensure 
that the
+       # correct toolchain and build flags are picked up from 
config.tests/.qmake.cache
        find config.tests/unix -name '*.test' -type f -print0 | xargs -0 \
-               sed -i -e "/bin\/qmake/ s: \"\$SRCDIR/: \
-                       'QMAKE_CC=$(tc-getCC)'    'QMAKE_CXX=$(tc-getCXX)'      
'QMAKE_LINK=$(tc-getCXX)' \
-                       'QMAKE_CFLAGS+=${CFLAGS}' 'QMAKE_CXXFLAGS+=${CXXFLAGS}' 
'QMAKE_LFLAGS+=${LDFLAGS}'&:" \
-               || die "sed config.tests failed"
+               sed -i -e '/bin\/qmake/s/ -nocache//' || die "sed -nocache 
failed"
+
+       # compile.test needs additional patching so that it doesn't create 
another cache file
+       # inside the test subdir, which would incorrectly override 
config.tests/.qmake.cache
+       sed -i -e '/echo.*QT_BUILD_TREE.*\.qmake\.cache/d' \
+               -e '/bin\/qmake/s/ "$SRCDIR/ "QT_BUILD_TREE=$OUTDIR"&/' \
+               config.tests/unix/compile.test || die "sed compile.test failed"
 
        # Delete references to the obsolete /usr/X11R6 directory
        # On prefix, this also prevents looking at non-prefix stuff

Reply via email to