8861b82f9e
Change-Id: I06540c3b6d98303bd9a218feedfb529993477ed6 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: BogDan Vatra <bogdan@kdab.com> Reviewed-by: Jake Petroules <jake.petroules@qt.io>
1048 lines
31 KiB
Bash
Executable File
1048 lines
31 KiB
Bash
Executable File
#!/bin/sh
|
|
#############################################################################
|
|
##
|
|
## Copyright (C) 2016 The Qt Company Ltd.
|
|
## Copyright (C) 2016 Intel Corporation.
|
|
## Contact: https://www.qt.io/licensing/
|
|
##
|
|
## This file is the build configuration utility of the Qt Toolkit.
|
|
##
|
|
## $QT_BEGIN_LICENSE:GPL-EXCEPT$
|
|
## Commercial License Usage
|
|
## Licensees holding valid commercial Qt licenses may use this file in
|
|
## accordance with the commercial license agreement provided with the
|
|
## Software or, alternatively, in accordance with the terms contained in
|
|
## a written agreement between you and The Qt Company. For licensing terms
|
|
## and conditions see https://www.qt.io/terms-conditions. For further
|
|
## information use the contact form at https://www.qt.io/contact-us.
|
|
##
|
|
## GNU General Public License Usage
|
|
## Alternatively, this file may be used under the terms of the GNU
|
|
## General Public License version 3 as published by the Free Software
|
|
## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
## included in the packaging of this file. Please review the following
|
|
## information to ensure the GNU General Public License requirements will
|
|
## be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
##
|
|
## $QT_END_LICENSE$
|
|
##
|
|
#############################################################################
|
|
|
|
#-------------------------------------------------------------------------------
|
|
# script initialization
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# the name of this script
|
|
relconf=`basename $0`
|
|
# the directory of this script is the "source tree"
|
|
relpath=`dirname $0`
|
|
relpath=`(cd "$relpath"; /bin/pwd)`
|
|
# the current directory is the "build tree" or "object tree"
|
|
outpath=`/bin/pwd`
|
|
|
|
# where to find which..
|
|
unixtests="$relpath/config.tests/unix"
|
|
WHICH="$unixtests/which.test"
|
|
|
|
PERL=`$WHICH perl 2>/dev/null`
|
|
|
|
# find out which awk we want to use, prefer gawk, then nawk, then regular awk
|
|
AWK=
|
|
for e in gawk nawk awk; do
|
|
if "$WHICH" $e >/dev/null 2>&1 && ( $e -f /dev/null /dev/null ) >/dev/null 2>&1; then
|
|
AWK=$e
|
|
break
|
|
fi
|
|
done
|
|
|
|
# find a make command
|
|
if [ -z "$MAKE" ]; then
|
|
MAKE=
|
|
for mk in gmake make; do
|
|
if "$WHICH" $mk >/dev/null 2>&1; then
|
|
MAKE=`"$WHICH" $mk`
|
|
break
|
|
fi
|
|
done
|
|
if [ -z "$MAKE" ]; then
|
|
echo >&2 "You don't seem to have 'make' or 'gmake' in your PATH."
|
|
echo >&2 "Cannot proceed."
|
|
exit 1
|
|
fi
|
|
# export MAKE, we need it later in the config.tests
|
|
export MAKE
|
|
fi
|
|
|
|
# do this early so we don't store it in config.status
|
|
CFG_TOPLEVEL=
|
|
relpathMangled=$relpath
|
|
outpathPrefix=
|
|
if [ x"$1" = x"-top-level" ]; then
|
|
CFG_TOPLEVEL=yes
|
|
relpathMangled=`dirname "$relpath"`
|
|
outpathPrefix=../
|
|
shift
|
|
fi
|
|
|
|
OPT_CMDLINE= # expanded version for the script
|
|
QMAKE_CMDLINE= # verbatim version for qmake call
|
|
set -f # suppress globbing in for loop
|
|
SAVED_IFS=$IFS
|
|
IFS='
|
|
'
|
|
for i in "$@"; do
|
|
case $i in
|
|
-redo|--redo)
|
|
optfile=${outpathPrefix}config.opt
|
|
if test -n "$CFG_TOPLEVEL" && ! test -f $optfile; then
|
|
optfile=config.opt
|
|
fi
|
|
if ! test -f $optfile; then
|
|
echo >&2 "No config.opt present - cannot redo configuration."
|
|
exit 1
|
|
fi
|
|
for a in `cat $optfile`; do
|
|
OPT_CMDLINE="$OPT_CMDLINE
|
|
$a"
|
|
done
|
|
;;
|
|
*)
|
|
OPT_CMDLINE="$OPT_CMDLINE
|
|
$i"
|
|
;;
|
|
esac
|
|
QMAKE_CMDLINE="$QMAKE_CMDLINE
|
|
$i"
|
|
done
|
|
set --
|
|
for i in $OPT_CMDLINE; do
|
|
set -- "$@" "$i"
|
|
done
|
|
set +f
|
|
IFS=$SAVED_IFS
|
|
|
|
#-------------------------------------------------------------------------------
|
|
# utility functions
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# Helper function for getQMakeConf. It parses include statements in
|
|
# qmake.conf and prints out the expanded file
|
|
expandQMakeConf()
|
|
{
|
|
while read line; do case "$line" in
|
|
include*)
|
|
inc_file=`echo "$line" | sed -n -e '/^include.*(.*)/s/include.*(\(.*\)).*$/\1/p'`
|
|
current_dir=`dirname "$1"`
|
|
conf_file="$current_dir/$inc_file"
|
|
if [ ! -f "$conf_file" ]; then
|
|
echo "WARNING: Unable to find file $conf_file" >&2
|
|
continue
|
|
fi
|
|
expandQMakeConf "$conf_file"
|
|
;;
|
|
*)
|
|
echo "$line"
|
|
;;
|
|
esac; done < "$1"
|
|
}
|
|
|
|
extractQMakeVariables()
|
|
{
|
|
LC_ALL=C $AWK '
|
|
BEGIN {
|
|
values["LITERAL_WHITESPACE"] = " "
|
|
values["LITERAL_DOLLAR"] = "$"
|
|
}
|
|
/^[_A-Z0-9.]+[ \t]*\+?=/ {
|
|
valStart = index($0, "=") + 1
|
|
|
|
append = 0
|
|
if (substr($0, valStart - 2, 1) == "+") {
|
|
append = 1
|
|
}
|
|
|
|
variable = substr($0, 0, valStart - 2 - append)
|
|
value = substr($0, valStart)
|
|
gsub("[ \t]+", "", variable)
|
|
gsub("^[ \t]+", "", value)
|
|
gsub("[ \t]+$", "", value)
|
|
|
|
ovalue = ""
|
|
while (match(value, /\$\$(\{[_A-Z0-9.]+\}|[_A-Z0-9.]+)/)) {
|
|
ovalue = ovalue substr(value, 1, RSTART - 1)
|
|
var = substr(value, RSTART + 2, RLENGTH - 2)
|
|
value = substr(value, RSTART + RLENGTH)
|
|
if (var ~ /^\{/) {
|
|
var = substr(var, 2, length(var) - 2)
|
|
}
|
|
ovalue = ovalue values[var]
|
|
}
|
|
value = ovalue value
|
|
|
|
ovalue = ""
|
|
while (match(value, /\$\$system\(("[^"]*"|[^)]*)\)/)) {
|
|
ovalue = ovalue substr(value, 1, RSTART - 1)
|
|
cmd = substr(value, RSTART + 9, RLENGTH - 10)
|
|
gsub(/^"|"$/, "", cmd)
|
|
value = substr(value, RSTART + RLENGTH)
|
|
while ((cmd | getline line) > 0) {
|
|
ovalue = ovalue line
|
|
}
|
|
close(cmd)
|
|
}
|
|
value = ovalue value
|
|
|
|
combinedValue = values[variable]
|
|
if (append == 1 && length(combinedValue) > 0) {
|
|
combinedValue = combinedValue " " value
|
|
} else {
|
|
combinedValue = value
|
|
}
|
|
values[variable] = combinedValue
|
|
}
|
|
END {
|
|
for (var in values) {
|
|
print var "=" values[var]
|
|
}
|
|
}
|
|
'
|
|
}
|
|
|
|
getSingleQMakeVariable()
|
|
{
|
|
echo "$2" | $AWK "/^($1)=/ { print substr(\$0, index(\$0, \"=\") + 1) }"
|
|
}
|
|
|
|
macSDKify()
|
|
{
|
|
# Normally we take care of sysrootifying in sdk.prf, but configure extracts some
|
|
# values before qmake is even built, so we have to duplicate the logic here.
|
|
|
|
sdk=$(getSingleQMakeVariable "QMAKE_MAC_SDK" "$1")
|
|
if [ -z "$sdk" ]; then echo "QMAKE_MAC_SDK must be set when building on Mac" >&2; exit 1; fi
|
|
sysroot=$(/usr/bin/xcodebuild -sdk $sdk -version Path 2>/dev/null)
|
|
if [ -z "$sysroot" ]; then echo "Failed to resolve SDK path for '$sdk'" >&2; exit 1; fi
|
|
|
|
case "$sdk" in
|
|
macosx*)
|
|
version_min_flag="-mmacosx-version-min=$(getSingleQMakeVariable QMAKE_MACOSX_DEPLOYMENT_TARGET "$1")"
|
|
;;
|
|
iphoneos*)
|
|
version_min_flag="-miphoneos-version-min=$(getSingleQMakeVariable QMAKE_IOS_DEPLOYMENT_TARGET "$1")"
|
|
;;
|
|
iphonesimulator*)
|
|
version_min_flag="-mios-simulator-version-min=$(getSingleQMakeVariable QMAKE_IOS_DEPLOYMENT_TARGET "$1")"
|
|
;;
|
|
appletvos*)
|
|
version_min_flag="-mappletvos-version-min=$(getSingleQMakeVariable QMAKE_TVOS_DEPLOYMENT_TARGET "$1")"
|
|
;;
|
|
appletvsimulator*)
|
|
version_min_flag="-mtvos-simulator-version-min=$(getSingleQMakeVariable QMAKE_TVOS_DEPLOYMENT_TARGET "$1")"
|
|
;;
|
|
watchos*)
|
|
version_min_flag="-mwatchos-version-min=$(getSingleQMakeVariable QMAKE_WATCHOS_DEPLOYMENT_TARGET "$1")"
|
|
;;
|
|
watchsimulator*)
|
|
version_min_flag="-mwatchos-simulator-version-min=$(getSingleQMakeVariable QMAKE_WATCHOS_DEPLOYMENT_TARGET "$1")"
|
|
;;
|
|
*)
|
|
;;
|
|
esac
|
|
|
|
echo "$1" | while read line; do
|
|
case "$line" in
|
|
QMAKE_CC=*|QMAKE_CXX=*|QMAKE_FIX_RPATH=*|QMAKE_AR=*|QMAKE_RANLIB=*|QMAKE_LINK=*|QMAKE_LINK_SHLIB=*)
|
|
# Prefix tool with toolchain path
|
|
var=$(echo "$line" | cut -d '=' -f 1)
|
|
val=$(echo "$line" | cut -d '=' -f 2-)
|
|
sdk_val=$(/usr/bin/xcrun -sdk $sdk -find $(echo $val | cut -d ' ' -f 1))
|
|
val=$(echo $sdk_val $(echo $val | cut -s -d ' ' -f 2-))
|
|
echo "$var=$val"
|
|
;;
|
|
QMAKE_CFLAGS=*|QMAKE_CXXFLAGS=*)
|
|
echo "$line -isysroot $sysroot $version_min_flag"
|
|
;;
|
|
QMAKE_LFLAGS=*)
|
|
echo "$line -Wl,-syslibroot,$sysroot $version_min_flag"
|
|
;;
|
|
*)
|
|
echo "$line"
|
|
;;
|
|
esac
|
|
done
|
|
}
|
|
|
|
# relies on $QMAKESPEC being set correctly. parses include statements in
|
|
# qmake.conf and prints out the expanded file
|
|
getQMakeConf()
|
|
{
|
|
if [ -z "$specvals" ]; then
|
|
specvals=`expandQMakeConf "$QMAKESPEC/qmake.conf" | extractQMakeVariables`
|
|
if [ "$BUILD_ON_MAC" = "yes" ]; then specvals=$(macSDKify "$specvals"); fi
|
|
fi
|
|
getSingleQMakeVariable "$1" "$specvals"
|
|
}
|
|
|
|
resolveDeviceMkspec()
|
|
{
|
|
result=$(find "$relpath/mkspecs/devices/" -type d -name "*$1*" | sed "s,^$relpath/mkspecs/,,")
|
|
match_count=$(echo "$result" | wc -w)
|
|
if [ "$match_count" -gt 1 ]; then
|
|
echo >&2 "Error: Multiple matches for device '$1'. Candidates are:"
|
|
tabbed_result=$(echo "$result" | sed 's,^, ,')
|
|
echo >&2 "$tabbed_result"
|
|
echo "undefined"
|
|
elif [ "$match_count" -eq 0 ]; then
|
|
echo >&2 "Error: No device matching '$1'"
|
|
echo "undefined"
|
|
else
|
|
echo "$result"
|
|
fi
|
|
}
|
|
|
|
#-------------------------------------------------------------------------------
|
|
# operating system detection
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# need that throughout the script
|
|
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
|
|
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
|
|
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
|
|
|
|
BUILD_ON_MAC=no
|
|
if [ -d /System/Library/Frameworks/Carbon.framework ]; then
|
|
BUILD_ON_MAC=yes
|
|
fi
|
|
if [ "$OSTYPE" = "msys" ]; then
|
|
relpath=`(cd "$relpath"; pwd -W)`
|
|
outpath=`pwd -W`
|
|
fi
|
|
|
|
#-------------------------------------------------------------------------------
|
|
# Verify Xcode installation on Mac OS
|
|
#-------------------------------------------------------------------------------
|
|
|
|
if [ "$BUILD_ON_MAC" = "yes" ]; then
|
|
if ! /usr/bin/xcode-select --print-path >/dev/null 2>&1; then
|
|
echo >&2
|
|
echo " No Xcode is selected. Use xcode-select -switch to choose an Xcode" >&2
|
|
echo " version. See the xcode-select man page for more information." >&2
|
|
echo >&2
|
|
exit 2
|
|
fi
|
|
|
|
if ! /usr/bin/xcrun -find xcodebuild >/dev/null 2>&1; then
|
|
echo >&2
|
|
echo " Xcode not set up properly. You may need to confirm the license" >&2
|
|
echo " agreement by running /usr/bin/xcodebuild without arguments." >&2
|
|
echo >&2
|
|
exit 2
|
|
fi
|
|
fi
|
|
|
|
#-----------------------------------------------------------------------------
|
|
# Qt version detection
|
|
#-----------------------------------------------------------------------------
|
|
QT_VERSION=
|
|
QT_MAJOR_VERSION=
|
|
QT_MINOR_VERSION=0
|
|
QT_PATCH_VERSION=0
|
|
eval `sed -n -e 's/^MODULE_VERSION = \(\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*\)$/QT_VERSION=\1\
|
|
QT_MAJOR_VERSION=\2\
|
|
QT_MINOR_VERSION=\3\
|
|
QT_PATCH_VERSION=\4/p' < "$relpath"/.qmake.conf`
|
|
if [ -z "$QT_MAJOR_VERSION" ]; then
|
|
echo "Cannot process version from .qmake.conf"
|
|
echo "Cannot proceed."
|
|
exit 1
|
|
fi
|
|
|
|
#-------------------------------------------------------------------------------
|
|
# initalize variables
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# QTDIR may be set and point to an old or system-wide Qt installation
|
|
unset QTDIR
|
|
|
|
# initalize internal variables
|
|
CFG_RELEASE_TOOLS=no
|
|
|
|
XPLATFORM= # This seems to be the QMAKESPEC, like "linux-g++"
|
|
XPLATFORM_MAC=no # Whether target platform is macOS, iOS, tvOS, or watchOS
|
|
XPLATFORM_IOS=no # Whether target platform is iOS
|
|
XPLATFORM_TVOS=no # Whether target platform is tvOS
|
|
XPLATFORM_WATCHOS=no # Whether target platform is watchOS
|
|
XPLATFORM_ANDROID=no
|
|
XPLATFORM_MINGW=no # Whether target platform is MinGW (win32-g++*)
|
|
PLATFORM=
|
|
OPT_SHADOW=maybe
|
|
OPT_VERBOSE=no
|
|
OPT_HELP=
|
|
CFG_SILENT=no
|
|
CFG_DEV=no
|
|
|
|
#-------------------------------------------------------------------------------
|
|
# parse command line arguments
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# parse the arguments, setting things to "yes" or "no"
|
|
while [ "$#" -gt 0 ]; do
|
|
CURRENT_OPT="$1"
|
|
case "$1" in
|
|
#Autoconf style options
|
|
--enable-*)
|
|
VAR=`echo $1 | sed 's,^--enable-\(.*\),\1,'`
|
|
VAL=yes
|
|
;;
|
|
--disable-*)
|
|
VAR=`echo $1 | sed 's,^--disable-\(.*\),\1,'`
|
|
VAL=no
|
|
;;
|
|
--*=*)
|
|
VAR=`echo $1 | sed 's,^--\(.*\)=.*,\1,'`
|
|
VAL=`echo $1 | sed 's,^--.*=\(.*\),\1,'`
|
|
;;
|
|
--no-*)
|
|
VAR=`echo $1 | sed 's,^--no-\(.*\),\1,'`
|
|
VAL=no
|
|
;;
|
|
--*)
|
|
VAR=`echo $1 | sed 's,^--\(.*\),\1,'`
|
|
VAL=yes
|
|
;;
|
|
#Qt plugin options
|
|
-no-*-*|-plugin-*-*|-qt-*-*)
|
|
VAR=`echo $1 | sed 's,^-[^-]*-\(.*\),\1,'`
|
|
VAL=`echo $1 | sed 's,^-\([^-]*\).*,\1,'`
|
|
;;
|
|
#Qt style no options
|
|
-no-*)
|
|
VAR=`echo $1 | sed 's,^-no-\(.*\),\1,'`
|
|
VAL=no
|
|
;;
|
|
#Qt style options that pass an argument
|
|
-prefix| \
|
|
-docdir| \
|
|
-headerdir| \
|
|
-plugindir| \
|
|
-importdir| \
|
|
-qmldir| \
|
|
-archdatadir| \
|
|
-datadir| \
|
|
-libdir| \
|
|
-bindir| \
|
|
-libexecdir| \
|
|
-translationdir| \
|
|
-sysconfdir| \
|
|
-examplesdir| \
|
|
-testsdir| \
|
|
-hostdatadir| \
|
|
-hostbindir| \
|
|
-hostlibdir| \
|
|
-extprefix| \
|
|
-sysroot| \
|
|
-external-hostbindir| \
|
|
-make| \
|
|
-nomake| \
|
|
-skip| \
|
|
-platform| \
|
|
-xplatform| \
|
|
-device| \
|
|
-device-option| \
|
|
-sdk| \
|
|
-android-sdk| \
|
|
-android-ndk| \
|
|
-android-ndk-platform| \
|
|
-android-ndk-host| \
|
|
-android-arch| \
|
|
-android-toolchain-version)
|
|
VAR=`echo $1 | sed 's,^-\(.*\),\1,'`
|
|
shift
|
|
VAL="$1"
|
|
;;
|
|
#Qt style complex options in one command
|
|
-enable-*|-disable-*)
|
|
VAR=`echo $1 | sed 's,^-\([^-]*\)-.*,\1,'`
|
|
VAL=`echo $1 | sed 's,^-[^-]*-\(.*\),\1,'`
|
|
;;
|
|
#Qt Builtin/System style options
|
|
-no-*|-system-*|-qt-*)
|
|
VAR=`echo $1 | sed 's,^-[^-]*-\(.*\),\1,'`
|
|
VAL=`echo $1 | sed 's,^-\([^-]*\)-.*,\1,'`
|
|
;;
|
|
#Options that cannot be generalized
|
|
-hostprefix)
|
|
VAR=`echo $1 | sed 's,^-\(.*\),\1,'`
|
|
# this option may or may not be followed by an argument
|
|
if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
|
|
VAL=$outpath
|
|
else
|
|
shift;
|
|
VAL=$1
|
|
fi
|
|
;;
|
|
#General options, including Qt style yes options
|
|
-*)
|
|
VAR=`echo $1 | sed 's,^-\(.*\),\1,'`
|
|
VAL="yes"
|
|
;;
|
|
# most options don't need processing in the configure script, skip them. qmake will do the real validation
|
|
*)
|
|
shift
|
|
continue
|
|
;;
|
|
esac
|
|
|
|
shift
|
|
|
|
UNKNOWN_OPT=no
|
|
case "$VAR" in
|
|
external-hostbindir)
|
|
CFG_HOST_QT_TOOLS_PATH="$VAL"
|
|
;;
|
|
platform)
|
|
PLATFORM="$VAL"
|
|
;;
|
|
xplatform)
|
|
XPLATFORM="$VAL"
|
|
;;
|
|
device)
|
|
XPLATFORM=`resolveDeviceMkspec $VAL`
|
|
[ "$XPLATFORM" = "undefined" ] && exit 101
|
|
;;
|
|
optimized-qmake|optimized-tools)
|
|
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
|
|
CFG_RELEASE_TOOLS="$VAL"
|
|
fi
|
|
;;
|
|
developer-build)
|
|
CFG_DEV="yes"
|
|
;;
|
|
h|help)
|
|
if [ "$VAL" = "yes" ]; then
|
|
OPT_HELP="$VAL"
|
|
else
|
|
UNKNOWN_OPT=yes
|
|
fi
|
|
;;
|
|
v|verbose)
|
|
if [ "$VAL" = "yes" ]; then
|
|
OPT_VERBOSE=yes
|
|
elif [ "$VAL" = "no" ]; then
|
|
OPT_VERBOSE=no
|
|
else
|
|
UNKNOWN_OPT=yes
|
|
fi
|
|
;;
|
|
silent)
|
|
# need to keep this here, to ensure qmake is built silently
|
|
CFG_SILENT="$VAL"
|
|
;;
|
|
*)
|
|
;;
|
|
esac
|
|
if [ "$UNKNOWN_OPT" = "yes" ]; then
|
|
echo "${CURRENT_OPT}: invalid command-line switch"
|
|
ERROR=yes
|
|
fi
|
|
done
|
|
[ "x$ERROR" = "xyes" ] && exit 1
|
|
|
|
#-------------------------------------------------------------------------------
|
|
# help - interactive parts of the script _after_ this section please
|
|
#-------------------------------------------------------------------------------
|
|
|
|
if [ "$OPT_HELP" = "yes" ]; then
|
|
cat $relpath/config_help.txt
|
|
exit 0
|
|
fi
|
|
|
|
#-------------------------------------------------------------------------------
|
|
# platform detection
|
|
#-------------------------------------------------------------------------------
|
|
|
|
if [ -z "$PLATFORM" ]; then
|
|
PLATFORM_NOTES=
|
|
case "$UNAME_SYSTEM:$UNAME_RELEASE" in
|
|
Darwin:*)
|
|
PLATFORM=macx-clang
|
|
;;
|
|
AIX:*)
|
|
#PLATFORM=aix-g++
|
|
#PLATFORM=aix-g++-64
|
|
PLATFORM=aix-xlc
|
|
#PLATFORM=aix-xlc-64
|
|
PLATFORM_NOTES="
|
|
- Also available for AIX: aix-g++ aix-g++-64 aix-xlc-64
|
|
"
|
|
;;
|
|
GNU:*)
|
|
PLATFORM=hurd-g++
|
|
;;
|
|
dgux:*)
|
|
PLATFORM=dgux-g++
|
|
;;
|
|
# DYNIX/ptx:4*)
|
|
# PLATFORM=dynix-g++
|
|
# ;;
|
|
ULTRIX:*)
|
|
PLATFORM=ultrix-g++
|
|
;;
|
|
FreeBSD:*)
|
|
if [ "$(uname -r | cut -d. -f1)" -ge 10 ]; then
|
|
PLATFORM=freebsd-clang
|
|
PLATFORM_NOTES="
|
|
- Also available for FreeBSD: freebsd-g++
|
|
"
|
|
else
|
|
PLATFORM=freebsd-g++
|
|
PLATFORM_NOTES="
|
|
- Also available for FreeBSD: freebsd-clang
|
|
"
|
|
fi
|
|
;;
|
|
OpenBSD:*)
|
|
PLATFORM=openbsd-g++
|
|
;;
|
|
NetBSD:*)
|
|
PLATFORM=netbsd-g++
|
|
;;
|
|
BSD/OS:*|BSD/386:*)
|
|
PLATFORM=bsdi-g++
|
|
;;
|
|
IRIX*:*)
|
|
#PLATFORM=irix-g++
|
|
PLATFORM=irix-cc
|
|
#PLATFORM=irix-cc-64
|
|
PLATFORM_NOTES="
|
|
- Also available for IRIX: irix-g++ irix-cc-64
|
|
"
|
|
;;
|
|
HP-UX:*)
|
|
case "$UNAME_MACHINE" in
|
|
ia64)
|
|
#PLATFORM=hpuxi-acc-32
|
|
PLATFORM=hpuxi-acc-64
|
|
PLATFORM_NOTES="
|
|
- Also available for HP-UXi: hpuxi-acc-32
|
|
"
|
|
;;
|
|
*)
|
|
#PLATFORM=hpux-g++
|
|
PLATFORM=hpux-acc
|
|
#PLATFORM=hpux-acc-64
|
|
#PLATFORM=hpux-cc
|
|
#PLATFORM=hpux-acc-o64
|
|
PLATFORM_NOTES="
|
|
- Also available for HP-UX: hpux-g++ hpux-acc-64 hpux-acc-o64
|
|
"
|
|
;;
|
|
esac
|
|
;;
|
|
OSF1:*)
|
|
#PLATFORM=tru64-g++
|
|
PLATFORM=tru64-cxx
|
|
PLATFORM_NOTES="
|
|
- Also available for Tru64: tru64-g++
|
|
"
|
|
;;
|
|
Linux:*)
|
|
PLATFORM=linux-g++
|
|
PLATFORM_NOTES="
|
|
- Also available for Linux: linux-clang linux-kcc linux-icc linux-cxx
|
|
"
|
|
;;
|
|
SunOS:5*)
|
|
#PLATFORM=solaris-g++
|
|
PLATFORM=solaris-cc
|
|
#PLATFORM=solaris-cc64
|
|
PLATFORM_NOTES="
|
|
- Also available for Solaris: solaris-g++ solaris-cc-64
|
|
"
|
|
;;
|
|
ReliantUNIX-*:*|SINIX-*:*)
|
|
PLATFORM=reliant-cds
|
|
#PLATFORM=reliant-cds-64
|
|
PLATFORM_NOTES="
|
|
- Also available for Reliant UNIX: reliant-cds-64
|
|
"
|
|
;;
|
|
CYGWIN*:*)
|
|
PLATFORM=cygwin-g++
|
|
;;
|
|
LynxOS*:*)
|
|
PLATFORM=lynxos-g++
|
|
;;
|
|
OpenUNIX:*)
|
|
#PLATFORM=unixware-g++
|
|
PLATFORM=unixware-cc
|
|
PLATFORM_NOTES="
|
|
- Also available for OpenUNIX: unixware-g++
|
|
"
|
|
;;
|
|
UnixWare:*)
|
|
#PLATFORM=unixware-g++
|
|
PLATFORM=unixware-cc
|
|
PLATFORM_NOTES="
|
|
- Also available for UnixWare: unixware-g++
|
|
"
|
|
;;
|
|
SCO_SV:*)
|
|
#PLATFORM=sco-g++
|
|
PLATFORM=sco-cc
|
|
PLATFORM_NOTES="
|
|
- Also available for SCO OpenServer: sco-g++
|
|
"
|
|
;;
|
|
UNIX_SV:*)
|
|
PLATFORM=unixware-g++
|
|
;;
|
|
QNX:*)
|
|
PLATFORM=unsupported/qnx-g++
|
|
;;
|
|
*)
|
|
echo >&2
|
|
echo " The build script does not currently recognize all" >&2
|
|
echo " platforms supported by Qt." >&2
|
|
echo " Rerun this script with a -platform option listed to" >&2
|
|
echo " set the system/compiler combination you use." >&2
|
|
echo >&2
|
|
exit 2
|
|
esac
|
|
fi
|
|
|
|
[ -z "$XPLATFORM" ] && XPLATFORM="$PLATFORM"
|
|
|
|
case "$XPLATFORM" in
|
|
*win32-g++*)
|
|
XPLATFORM_MINGW=yes
|
|
;;
|
|
*qnx-*)
|
|
;;
|
|
*haiku-*)
|
|
;;
|
|
*ios*)
|
|
XPLATFORM_MAC=yes
|
|
XPLATFORM_IOS=yes
|
|
;;
|
|
*tvos*)
|
|
XPLATFORM_MAC=yes
|
|
XPLATFORM_TVOS=yes
|
|
;;
|
|
*watchos*)
|
|
XPLATFORM_MAC=yes
|
|
XPLATFORM_WATCHOS=yes
|
|
;;
|
|
*macx*)
|
|
XPLATFORM_MAC=yes
|
|
;;
|
|
*integrity*)
|
|
;;
|
|
# XPLATFORM_ANDROID should not be set for unsupported/android-g++
|
|
*unsupported*)
|
|
;;
|
|
*android-g++*)
|
|
XPLATFORM_ANDROID=g++
|
|
;;
|
|
*android-clang*)
|
|
XPLATFORM_ANDROID=clang
|
|
;;
|
|
esac
|
|
|
|
#-------------------------------------------------------------------------------
|
|
# command line and environment validation
|
|
#-------------------------------------------------------------------------------
|
|
|
|
if [ -d "$PLATFORM" ]; then
|
|
QMAKESPEC="$PLATFORM"
|
|
else
|
|
QMAKESPEC="$relpath/mkspecs/${PLATFORM}"
|
|
fi
|
|
if [ -d "$XPLATFORM" ]; then
|
|
XQMAKESPEC="$XPLATFORM"
|
|
else
|
|
XQMAKESPEC="$relpath/mkspecs/${XPLATFORM}"
|
|
fi
|
|
|
|
if [ "$BUILD_ON_MAC" = "yes" ]; then
|
|
if [ `basename $QMAKESPEC` = "macx-xcode" ] || [ `basename $XQMAKESPEC` = "macx-xcode" ]; then
|
|
echo >&2
|
|
echo " Platform 'macx-xcode' should not be used when building Qt/Mac." >&2
|
|
echo " Please build Qt/Mac with 'macx-clang' or 'macx-g++', then use" >&2
|
|
echo " the 'macx-xcode' spec for your application, and it will link to" >&2
|
|
echo " the Qt/Mac build using the settings of the original mkspec." >&2
|
|
echo >&2
|
|
exit 2
|
|
fi
|
|
fi
|
|
|
|
# check specified platforms are supported
|
|
if [ '!' -d "$QMAKESPEC" ]; then
|
|
echo
|
|
echo " The specified system/compiler is not supported:"
|
|
echo
|
|
echo " $QMAKESPEC"
|
|
echo
|
|
echo " Please see the README file for a complete list."
|
|
echo
|
|
exit 2
|
|
fi
|
|
if [ '!' -d "$XQMAKESPEC" ]; then
|
|
echo
|
|
echo " The specified system/compiler is not supported:"
|
|
echo
|
|
echo " $XQMAKESPEC"
|
|
echo
|
|
echo " Please see the README file for a complete list."
|
|
echo
|
|
exit 2
|
|
fi
|
|
if [ '!' -f "${XQMAKESPEC}/qplatformdefs.h" ]; then
|
|
echo
|
|
echo " The specified system/compiler port is not complete:"
|
|
echo
|
|
echo " $XQMAKESPEC/qplatformdefs.h"
|
|
echo
|
|
echo " Please information use the contact form at http://www.qt.io/contact-us"
|
|
echo
|
|
exit 2
|
|
fi
|
|
|
|
#-------------------------------------------------------------------------------
|
|
# build tree initialization
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# is this a shadow build?
|
|
if [ "$OPT_SHADOW" = "maybe" ]; then
|
|
OPT_SHADOW=no
|
|
if [ "$relpath" != "$outpath" ] && [ '!' -f "$outpath/configure" ]; then
|
|
if [ -h "$outpath" ]; then
|
|
[ "$relpath" -ef "$outpath" ] || OPT_SHADOW=yes
|
|
else
|
|
OPT_SHADOW=yes
|
|
fi
|
|
fi
|
|
fi
|
|
if [ "$OPT_SHADOW" = "yes" ]; then
|
|
if [ -f "$relpath/.qmake.cache" -o -f "$relpath/src/corelib/global/qconfig.h" -o -f "$relpath/src/corelib/global/qconfig.cpp" ]; then
|
|
echo >&2 "You cannot make a shadow build from a source tree containing a previous build."
|
|
echo >&2 "Cannot proceed."
|
|
exit 1
|
|
fi
|
|
[ "$OPT_VERBOSE" = "yes" ] && echo "Performing shadow build..."
|
|
fi
|
|
|
|
if [ "$OPT_SHADOW" = "yes" ]; then
|
|
echo "Preparing build tree..."
|
|
|
|
[ -d "$outpath/bin" ] || mkdir -p "$outpath/bin"
|
|
|
|
mkdir -p "$outpath/mkspecs"
|
|
fi
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# build qmake
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# symlink includes
|
|
if [ -e "$relpath/.git" ]; then
|
|
if [ -z "$PERL" ]; then
|
|
echo
|
|
echo "You need perl in your PATH to make a build from GIT."
|
|
echo "Cannot proceed."
|
|
exit 1
|
|
fi
|
|
|
|
"$relpath/bin/syncqt.pl" -version $QT_VERSION -minimal -module QtCore "$relpath" || exit 1
|
|
fi
|
|
|
|
# $1: input variable name (awk regexp)
|
|
# $2: optional output variable name
|
|
# $3: optional value transformation (sed command)
|
|
# relies on $QMAKESPEC, $COMPILER_CONF and $mkfile being set correctly, as the latter
|
|
# is where the resulting variable is written to
|
|
setBootstrapVariable()
|
|
{
|
|
getQMakeConf "$1" | echo ${2-$1} = `if [ -n "$3" ]; then sed "$3"; else cat; fi` >> "$mkfile"
|
|
}
|
|
|
|
# build qmake
|
|
echo "Creating qmake..."
|
|
mkdir -p "$outpath/qmake" || exit
|
|
|
|
in_mkfile=$relpath/qmake/Makefile.unix
|
|
mkfile=$outpath/qmake/Makefile
|
|
if [ -f "$mkfile" ]; then
|
|
[ "$CFG_DEV" = "yes" ] && "$WHICH" chflags >/dev/null 2>&1 && chflags nouchg "$mkfile"
|
|
rm -f "$mkfile"
|
|
fi
|
|
|
|
echo "########################################################################" > "$mkfile"
|
|
echo "## This file was autogenerated by configure, all changes will be lost ##" >> "$mkfile"
|
|
echo "########################################################################" >> "$mkfile"
|
|
EXTRA_CXXFLAGS="\$(QMAKE_CXXFLAGS) \$(QMAKE_CXXFLAGS_CXX11) \$(QMAKE_CXXFLAGS_SPLIT_SECTIONS)"
|
|
EXTRA_LFLAGS="\$(QMAKE_LFLAGS) \$(QMAKE_LFLAGS_GCSECTIONS)"
|
|
|
|
if [ "$PLATFORM" = "irix-cc" ] || [ "$PLATFORM" = "irix-cc-64" ]; then
|
|
EXTRA_LFLAGS="$EXTRA_LFLAGS -lm"
|
|
fi
|
|
|
|
[ "$CFG_SILENT" = "yes" ] && CC_TRANSFORM='s,^,\@,' || CC_TRANSFORM=
|
|
setBootstrapVariable QMAKE_CC CC "$CC_TRANSFORM"
|
|
setBootstrapVariable QMAKE_CXX CXX "$CC_TRANSFORM"
|
|
setBootstrapVariable QMAKE_CXXFLAGS
|
|
setBootstrapVariable QMAKE_CXXFLAGS_CXX11
|
|
setBootstrapVariable QMAKE_CXXFLAGS_SPLIT_SECTIONS
|
|
setBootstrapVariable QMAKE_LFLAGS
|
|
setBootstrapVariable QMAKE_LFLAGS_GCSECTIONS
|
|
|
|
if [ "$CFG_DEBUG" = "no" ] || [ "$CFG_RELEASE_TOOLS" = "yes" ]; then
|
|
setBootstrapVariable QMAKE_CXXFLAGS_RELEASE
|
|
EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(QMAKE_CXXFLAGS_RELEASE)"
|
|
else
|
|
setBootstrapVariable QMAKE_CXXFLAGS_DEBUG
|
|
EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(QMAKE_CXXFLAGS_DEBUG)"
|
|
fi
|
|
|
|
adjrelpath=`echo "$relpath" | sed 's/ /\\\\\\\\ /g'`
|
|
adjoutpath=`echo "$outpath" | sed 's/ /\\\\\\\\ /g'`
|
|
adjqmakespec=`echo "$QMAKESPEC" | sed 's/ /\\\\\\\\ /g'`
|
|
|
|
echo "BUILD_PATH = .." >> "$mkfile"
|
|
echo "SOURCE_PATH = $adjrelpath" >> "$mkfile"
|
|
if [ -e "$relpath/.git" ]; then
|
|
echo 'INC_PATH = $(BUILD_PATH)/include' >> "$mkfile"
|
|
else
|
|
echo 'INC_PATH = $(SOURCE_PATH)/include' >> "$mkfile"
|
|
fi
|
|
echo "QMAKESPEC = $adjqmakespec" >> "$mkfile"
|
|
echo "QT_VERSION = $QT_VERSION" >> "$mkfile"
|
|
echo "QT_MAJOR_VERSION = $QT_MAJOR_VERSION" >> "$mkfile"
|
|
echo "QT_MINOR_VERSION = $QT_MINOR_VERSION" >> "$mkfile"
|
|
echo "QT_PATCH_VERSION = $QT_PATCH_VERSION" >> "$mkfile"
|
|
echo "CONFIG_CXXFLAGS = $EXTRA_CXXFLAGS" >> "$mkfile"
|
|
echo "CONFIG_LFLAGS = $EXTRA_LFLAGS" >> "$mkfile"
|
|
echo "RM_F = rm -f" >> "$mkfile"
|
|
echo "RM_RF = rm -rf" >> "$mkfile"
|
|
|
|
case `basename "$PLATFORM"` in
|
|
win32-g++*)
|
|
cat "$in_mkfile.win32" >> "$mkfile"
|
|
;;
|
|
*)
|
|
cat "$in_mkfile.unix" >> "$mkfile"
|
|
if [ "$BUILD_ON_MAC" = "yes" ]; then
|
|
cat "$in_mkfile.macos" >> "$mkfile"
|
|
fi
|
|
;;
|
|
esac
|
|
echo >>"$mkfile"
|
|
|
|
if [ "$BUILD_ON_MAC" = "yes" ]; then
|
|
echo "EXTRA_CXXFLAGS += -MMD" >> "$mkfile"
|
|
cat "$in_mkfile" >> "$mkfile"
|
|
echo "-include \$(notdir \$(DEPEND_SRC:%.cpp=%.d))" >> "$mkfile"
|
|
else
|
|
cat "$in_mkfile" >> "$mkfile"
|
|
if "$WHICH" makedepend >/dev/null 2>&1 && grep 'depend:' "$mkfile" >/dev/null 2>&1; then
|
|
(cd "$outpath/qmake" && "$MAKE" -f "$mkfile" depend) >/dev/null 2>&1
|
|
sed 's,^.*/\([^/]*.o\):,\1:,g' "$mkfile" >"$mkfile.tmp"
|
|
sed "s,$outpath,$adjoutpath,g" "$mkfile.tmp" >"$mkfile"
|
|
rm "$mkfile.tmp"
|
|
fi
|
|
fi
|
|
|
|
if [ "$OPT_VERBOSE" = yes ]; then
|
|
# Show the output of make
|
|
(cd "$outpath/qmake"; "$MAKE") || exit 2
|
|
else
|
|
# Hide the output of make
|
|
# Use bash to print dots, if we have it, and stdout is a tty.
|
|
if test -t 1 && $WHICH bash > /dev/null 2>/dev/null; then
|
|
bash -c 'set -o pipefail
|
|
cd "$0/qmake"; "$1" | while read line; do
|
|
builtin echo -n .
|
|
done' "$outpath" "$MAKE" || exit 2
|
|
else
|
|
(cd "$outpath/qmake"; "$MAKE" -s) || exit 2
|
|
fi
|
|
echo "Done."
|
|
fi
|
|
|
|
#-------------------------------------------------------------------------------
|
|
# create a qt.conf for the Qt build tree itself
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# Note that this file is just sufficient to boot configure, by which it is
|
|
# replaced in-place with a version which is suitable for building all of Qt.
|
|
QTCONFFILE="$outpath/bin/qt.conf"
|
|
cat > "$QTCONFFILE" <<EOF
|
|
[EffectivePaths]
|
|
Prefix=..
|
|
[Paths]
|
|
TargetSpec=$XPLATFORM
|
|
HostSpec=$PLATFORM
|
|
EOF
|
|
if [ x"$relpath" != x"$outpath" ]; then
|
|
cat >> "$QTCONFFILE" <<EOF
|
|
[EffectiveSourcePaths]
|
|
Prefix=$relpath
|
|
EOF
|
|
fi
|
|
|
|
[ -z "$CFG_HOST_QT_TOOLS_PATH" ] && CFG_HOST_QT_TOOLS_PATH="$outpath/bin"
|
|
CFG_QMAKE_PATH="$CFG_HOST_QT_TOOLS_PATH/qmake"
|
|
|
|
#-------------------------------------------------------------------------------
|
|
# run configure tests
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# recreate command line for qmake
|
|
set -f
|
|
SAVED_IFS=$IFS
|
|
IFS='
|
|
'
|
|
for i in $QMAKE_CMDLINE; do
|
|
set -- "$@" "$i"
|
|
done
|
|
set +f
|
|
IFS=$SAVED_IFS
|
|
|
|
#-------------------------------------------------------------------------------
|
|
# configure and build top-level makefile
|
|
#-------------------------------------------------------------------------------
|
|
|
|
if [ -n "$CFG_TOPLEVEL" ]; then
|
|
cd ..
|
|
fi
|
|
|
|
"$CFG_QMAKE_PATH" -qtconf "$QTCONFFILE" "$relpathMangled" -- "$@" || exit
|
|
|
|
#-------------------------------------------------------------------------------
|
|
# final notes for the user
|
|
#-------------------------------------------------------------------------------
|
|
|
|
if [ -n "$PLATFORM_NOTES" ]; then
|
|
echo
|
|
echo "Platform notes:"
|
|
echo "$PLATFORM_NOTES"
|
|
else
|
|
echo
|
|
fi
|
|
|
|
QT_INSTALL_PREFIX=`sed -ne 's/^Prefix=//p' < "$outpath/qmake/builtin-qt.conf"`
|
|
MAKE=`basename "$MAKE"`
|
|
echo
|
|
echo Qt is now configured for building. Just run \'$MAKE\'.
|
|
if [ "$outpath" = "$QT_INSTALL_PREFIX" ]; then
|
|
echo Once everything is built, Qt is installed.
|
|
echo You should not run \'$MAKE install\'.
|
|
else
|
|
echo Once everything is built, you must run \'$MAKE install\'.
|
|
echo Qt will be installed into $QT_INSTALL_PREFIX
|
|
fi
|
|
echo
|
|
echo Prior to reconfiguration, make sure you remove any leftovers from
|
|
echo the previous build.
|
|
echo
|