qt5base-lts/config.tests/unix/arch.test
Mark Brand af7a0ee55f config.tests/arch: make distclean on the test, not qt
Additionally, qmake no longer needs -o since we are in the project
directory.

Change-Id: I89dbe829c064663b653e8f747f0849d63ceb367e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2012-09-14 00:06:41 +02:00

62 lines
1.5 KiB
Bash
Executable File

#!/bin/sh
QMKSPEC=$1
VERBOSE=$2
SRCDIR=$3
OUTDIR=$4
RESULTFILE=$5
VARPREFIX=$6
shift 6
LFLAGS="$SYSROOT_FLAG"
CXXFLAGS="$SYSROOT_FLAG"
while [ "$#" -gt 0 ]; do
PARAM=$1
case $PARAM in
-sdk)
LFLAGS="$LFLAGS -Wl,-syslibroot,$2"
CXXFLAGS="$CXXFLAGS -isysroot $2"
shift
;;
*) ;;
esac
shift
done
# 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"
cd "$OUTDIR/config.tests/arch"
[ -f Makefile ] && $MAKE distclean >/dev/null 2>&1
OUTDIR=$OUTDIR "$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "QT_BUILD_TREE=$OUTDIR" "LIBS+=$LFLAGS" "QMAKE_CXXFLAGS+=$CXXFLAGS" "$SRCDIR/config.tests/arch/arch.pro" >/dev/null 2>&1 || echo "qmake is broken" >&2
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
if strings - $binary 2>/dev/null | \
awk -F: '/==Qt=magic=Qt== Architecture/ { print "'$VARPREFIX'_ARCH=\"" $2 "\"" }
/==Qt=magic=Qt== Sub-architecture/ { print "'$VARPREFIX'_CPUFEATURES=\"" $2 "\"" }' > "$RESULTFILE"
then
[ "$VERBOSE" = "yes" ] && echo " Found architecture in binary" && \
cat "$RESULTFILE"
else
[ "$VERBOSE" = "yes" ] && echo "Unable to determine architecture!"
exit 2
fi
$MAKE distclean >/dev/null 2>&1