summaryrefslogtreecommitdiffstats
path: root/config.tests/unix
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2012-03-27 14:43:45 -0300
committerQt by Nokia <qt-info@nokia.com>2012-05-30 17:27:56 +0200
commit1533bfc5fcc4ec5865c1de606504b6aba8a5f6fe (patch)
tree01fcdf5c915e19be1fc79363fda08c8b6d6a2750 /config.tests/unix
parentd17cf14185eb84863549e0119c8b7bd20db78580 (diff)
Improve the architecture-detection mechanism
For the Unix part, this now obeys the -v option, printing the full command-line it used to compile, allowing testers to identify why something went wrong. Unfortunately, it requires a full compilation cycle, instead of just preprocessing. Just one more among the many on Unix, but maybe a noticeable slow-down on Windows. Change-Id: I654b70d99887e04c96731a5b91be9ad555e4d8fe Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
Diffstat (limited to 'config.tests/unix')
-rwxr-xr-xconfig.tests/unix/arch.test41
1 files changed, 41 insertions, 0 deletions
diff --git a/config.tests/unix/arch.test b/config.tests/unix/arch.test
new file mode 100755
index 0000000000..2a6e12de56
--- /dev/null
+++ b/config.tests/unix/arch.test
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+QMKSPEC=$1
+VERBOSE=$2
+SRCDIR=$3
+OUTDIR=$4
+RESULTFILE=$5
+
+# debuggery
+[ "$VERBOSE" = "yes" ] && echo "Determining architecture... ($*)"
+
+# build a test program but don't run it
+test -d "$OUTDIR/config.tests/arch" || mkdir -p "$OUTDIR/config.tests/arch"
+[ -f Makefile ] && $MAKE distclean >/dev/null 2>&1
+"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "QT_BUILD_TREE=$OUTDIR" "LIBS+=$SYSROOT_FLAG" "QMAKE_CXXFLAGS+=$SYSROOT_FLAG" "$SRCDIR/config.tests/arch/arch.pro" -o "$OUTDIR/config.tests/arch/Makefile" >/dev/null 2>&1 || echo "qmake is broken" >&2
+cd "$OUTDIR/config.tests/arch"
+
+
+ARCH=""
+[ "$VERBOSE" = "yes" ] && $MAKE || $MAKE >/dev/null 2>&1
+
+if [ -f ./arch.exe ]; then
+ binary=./arch.exe
+elif [ -f ./arch ]; then
+ binary=./arch
+else
+ [ "$VERBOSE" = "yes" ] && echo "Unable to determine architecture!"
+ exit 2
+fi
+
+ARCH=`strings - $binary 2>/dev/null | awk -F: '/==Qt=magic=Qt==/ { print $2 }'` ||
+{
+ [ "$VERBOSE" = "yes" ] && echo "Unable to determine architecture!"
+ exit 2
+}
+
+$MAKE distclean >/dev/null 2>&1
+
+[ "$VERBOSE" = "yes" ] && echo " Found '$ARCH' in binary"
+
+echo "$ARCH" > $5