Skip to content

Commit

Permalink
move qdevice.pri creation to qmake-based configure system
Browse files Browse the repository at this point in the history
Change-Id: I06540c3b6d98303bd9a218feedfb529993477ed6
Reviewed-by: Lars Knoll <[email protected]>
Reviewed-by: BogDan Vatra <[email protected]>
Reviewed-by: Jake Petroules <[email protected]>
  • Loading branch information
ossilator committed Dec 13, 2016
1 parent b6b44b3 commit 8861b82
Show file tree
Hide file tree
Showing 10 changed files with 176 additions and 329 deletions.
157 changes: 1 addition & 156 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,6 @@ done
set +f
IFS=$SAVED_IFS

# initialize global variables
DEVICE_VARS_FILE=.device.vars
:> "$DEVICE_VARS_FILE"

#-------------------------------------------------------------------------------
# utility functions
#-------------------------------------------------------------------------------
Expand All @@ -142,18 +138,7 @@ expandQMakeConf()
echo "WARNING: Unable to find file $conf_file" >&2
continue
fi
expandQMakeConf "$conf_file" "$2"
;;
*load\(device_config\)*)
conf_file="$2"
if [ -z "$conf_file" ]; then
continue
fi
if [ ! -f "$conf_file" ]; then
echo "WARNING: Unable to find file $conf_file" >&2
continue
fi
expandQMakeConf "$conf_file" "$2"
expandQMakeConf "$conf_file"
;;
*)
echo "$line"
Expand Down Expand Up @@ -298,32 +283,6 @@ getQMakeConf()
getSingleQMakeVariable "$1" "$specvals"
}

getXQMakeConf()
{
if [ -z "$xspecvals" ]; then
xspecvals=`expandQMakeConf "$XQMAKESPEC/qmake.conf" "$DEVICE_VARS_FILE" | extractQMakeVariables`
if [ "$XPLATFORM_MAC" = "yes" ]; then xspecvals=$(macSDKify "$xspecvals"); fi
fi
getSingleQMakeVariable "$1" "$xspecvals"
}

#-------------------------------------------------------------------------------
# device options
#-------------------------------------------------------------------------------
DeviceVar()
{
case "$1" in
set)
eq="="
;;
*)
echo >&2 "BUG: wrong command to DeviceVar: $1"
;;
esac

echo "$2" "$eq" "$3" >> "$DEVICE_VARS_FILE"
}

resolveDeviceMkspec()
{
result=$(find "$relpath/mkspecs/devices/" -type d -name "*$1*" | sed "s,^$relpath/mkspecs/,,")
Expand Down Expand Up @@ -420,17 +379,8 @@ OPT_SHADOW=maybe
OPT_VERBOSE=no
OPT_HELP=
CFG_SILENT=no
OPT_MAC_SDK=
CFG_DEV=no

# Android vars
CFG_DEFAULT_ANDROID_NDK_ROOT=$ANDROID_NDK_ROOT
CFG_DEFAULT_ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT
CFG_DEFAULT_ANDROID_PLATFORM=android-16
CFG_DEFAULT_ANDROID_TARGET_ARCH=armeabi-v7a
CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION=4.9
CFG_DEFAULT_ANDROID_NDK_HOST=$ANDROID_NDK_HOST

#-------------------------------------------------------------------------------
# parse command line arguments
#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -550,14 +500,6 @@ while [ "$#" -gt 0 ]; do
external-hostbindir)
CFG_HOST_QT_TOOLS_PATH="$VAL"
;;
sdk)
if [ "$BUILD_ON_MAC" = "yes" ]; then
DeviceVar set QMAKE_MAC_SDK "$VAL"
OPT_MAC_SDK="$VAL"
else
UNKNOWN_OPT=yes
fi
;;
platform)
PLATFORM="$VAL"
;;
Expand All @@ -568,11 +510,6 @@ while [ "$#" -gt 0 ]; do
XPLATFORM=`resolveDeviceMkspec $VAL`
[ "$XPLATFORM" = "undefined" ] && exit 101
;;
device-option)
DEV_VAR=`echo $VAL | cut -d '=' -f 1`
DEV_VAL=`echo $VAL | cut -d '=' -f 2-`
DeviceVar set $DEV_VAR "$DEV_VAL"
;;
optimized-qmake|optimized-tools)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_RELEASE_TOOLS="$VAL"
Expand Down Expand Up @@ -601,24 +538,6 @@ while [ "$#" -gt 0 ]; do
# need to keep this here, to ensure qmake is built silently
CFG_SILENT="$VAL"
;;
android-sdk)
CFG_DEFAULT_ANDROID_SDK_ROOT="$VAL"
;;
android-ndk)
CFG_DEFAULT_ANDROID_NDK_ROOT="$VAL"
;;
android-ndk-platform)
CFG_DEFAULT_ANDROID_PLATFORM="$VAL"
;;
android-ndk-host)
CFG_DEFAULT_ANDROID_NDK_HOST="$VAL"
;;
android-arch)
CFG_DEFAULT_ANDROID_TARGET_ARCH="$VAL"
;;
android-toolchain-version)
CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION="$VAL"
;;
*)
;;
esac
Expand Down Expand Up @@ -834,60 +753,6 @@ esac
# command line and environment validation
#-------------------------------------------------------------------------------

if [ "$XPLATFORM_ANDROID" != "no" ]; then
if [ -z "$CFG_DEFAULT_ANDROID_NDK_HOST" ]; then
case $PLATFORM in
linux-*)
if [ -d "$CFG_DEFAULT_ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION/prebuilt/linux-x86" ]; then
CFG_DEFAULT_ANDROID_NDK_HOST=linux-x86
elif [ -d "$CFG_DEFAULT_ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION/prebuilt/linux-x86_64" ]; then
CFG_DEFAULT_ANDROID_NDK_HOST=linux-x86_64
fi
;;
macx-*)
CFG_DEFAULT_ANDROID_NDK_HOST=darwin-x86
if [ -d "$CFG_DEFAULT_ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION/prebuilt/darwin-x86_64" ]; then
CFG_DEFAULT_ANDROID_NDK_HOST=darwin-x86_64
fi
;;
win32-*)
CFG_DEFAULT_ANDROID_NDK_HOST=windows
if [ -d "$CFG_DEFAULT_ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION/prebuilt/windows-x86_64" ]; then
CFG_DEFAULT_ANDROID_NDK_HOST=windows-x86_64
fi
;;
esac
fi

if [ -z "$CFG_DEFAULT_ANDROID_NDK_ROOT" ]; then
echo
echo "Can not find Android NDK. Please use -android-ndk option to specify one"
exit 1
fi
if [ -z "$CFG_DEFAULT_ANDROID_SDK_ROOT" ]; then
echo
echo "Can not find Android SDK. Please use -android-sdk option to specify one"
exit 1
fi
if [ -z "CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION" ] || [ ! -d "$CFG_DEFAULT_ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION/prebuilt" ]; then
echo
echo "Can not detect Android NDK toolchain. Please use -android-toolchain-version to specify"
exit 1
fi
if [ -z "$CFG_DEFAULT_ANDROID_NDK_HOST" ] || [ ! -d "$CFG_DEFAULT_ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION/prebuilt/$CFG_DEFAULT_ANDROID_NDK_HOST" ]; then
echo
echo "Can not detect the android host. Please use -android-ndk-host option to specify one"
exit 1
fi

DeviceVar set DEFAULT_ANDROID_SDK_ROOT "$CFG_DEFAULT_ANDROID_SDK_ROOT"
DeviceVar set DEFAULT_ANDROID_NDK_ROOT "$CFG_DEFAULT_ANDROID_NDK_ROOT"
DeviceVar set DEFAULT_ANDROID_PLATFORM "$CFG_DEFAULT_ANDROID_PLATFORM"
DeviceVar set DEFAULT_ANDROID_NDK_HOST "$CFG_DEFAULT_ANDROID_NDK_HOST"
DeviceVar set DEFAULT_ANDROID_TARGET_ARCH "$CFG_DEFAULT_ANDROID_TARGET_ARCH"
DeviceVar set DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION "$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION"
fi

if [ -d "$PLATFORM" ]; then
QMAKESPEC="$PLATFORM"
else
Expand Down Expand Up @@ -975,15 +840,6 @@ if [ "$OPT_SHADOW" = "yes" ]; then
mkdir -p "$outpath/mkspecs"
fi

if [ "$XPLATFORM_ANDROID" = "no" ]; then
TEST_COMPILER=`getXQMakeConf QMAKE_CXX`
GCC_MACHINE_DUMP=
case "$TEST_COMPILER" in *g++) GCC_MACHINE_DUMP=$($TEST_COMPILER -dumpmachine);; esac
if [ -n "$GCC_MACHINE_DUMP" ]; then
DeviceVar set GCC_MACHINE_DUMP $($TEST_COMPILER -dumpmachine)
fi
fi

# -----------------------------------------------------------------------------
# build qmake
# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -1137,17 +993,6 @@ fi
[ -z "$CFG_HOST_QT_TOOLS_PATH" ] && CFG_HOST_QT_TOOLS_PATH="$outpath/bin"
CFG_QMAKE_PATH="$CFG_HOST_QT_TOOLS_PATH/qmake"

#-------------------------------------------------------------------------------
# write out device config before we run the test.
#-------------------------------------------------------------------------------
DEVICE_VARS_OUTFILE="$outpath/mkspecs/qdevice.pri"
if cmp -s "$DEVICE_VARS_FILE" "$DEVICE_VARS_OUTFILE"; then
rm -f "$DEVICE_VARS_FILE"
else
mv -f $DEVICE_VARS_FILE "$DEVICE_VARS_OUTFILE"
DEVICE_VARS_FILE="$DEVICE_VARS_OUTFILE"
fi

#-------------------------------------------------------------------------------
# run configure tests
#-------------------------------------------------------------------------------
Expand Down
19 changes: 15 additions & 4 deletions configure.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"debug-and-release": { "type": "boolean", "name": "debug_and_release" },
"developer-build": "void",
"device": "string",
"device-option": "string",
"device-option": "addString",
"force-asserts": { "type": "boolean", "name": "force_asserts" },
"force-debug-info": { "type": "boolean", "name": "force_debug_info" },
"force-pkg-config": { "type": "void", "name": "pkg-config" },
Expand Down Expand Up @@ -189,9 +189,9 @@

"testTypeDependencies": {
"linkerSupportsFlag": [ "use_gold_linker" ],
"verifySpec": [ "shared", "use_gold_linker", "compiler-flags", "gcc-sysroot", "qmakeargs" ],
"verifySpec": [ "shared", "use_gold_linker", "compiler-flags", "gcc-sysroot", "qmakeargs", "commit" ],
"compile": [ "verifyspec" ],
"detectPkgConfig": [ "cross_compile" ],
"detectPkgConfig": [ "cross_compile", "machineTuple" ],
"library": [ "pkg-config" ],
"getPkgConfigVariable": [ "pkg-config" ],
"neon": [ "architecture" ]
Expand All @@ -202,6 +202,10 @@
},

"tests": {
"machineTuple": {
"label": "machine tuple",
"type": "machineTuple"
},
"verifyspec": {
"label": "valid makespec",
"type": "verifySpec",
Expand Down Expand Up @@ -419,7 +423,14 @@

"features": {
"prepare": {
"output": [ "preparePaths" ]
"output": [ "prepareOptions", "preparePaths" ]
},
"machineTuple": {
"condition": "!config.linux || config.android || tests.machineTuple",
"output": [ "machineTuple" ]
},
"commit": {
"output": [ "commitOptions" ]
},
"android-style-assets": {
"label": "Android Style Assets",
Expand Down
Loading

0 comments on commit 8861b82

Please sign in to comment.