2011-04-27 10:05:43 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#############################################################################
|
|
|
|
##
|
2016-01-15 12:36:27 +00:00
|
|
|
## Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
## Copyright (C) 2016 Intel Corporation.
|
|
|
|
## Contact: https://www.qt.io/licensing/
|
2011-04-27 10:05:43 +00:00
|
|
|
##
|
|
|
|
## This file is the build configuration utility of the Qt Toolkit.
|
|
|
|
##
|
2016-01-15 12:36:27 +00:00
|
|
|
## $QT_BEGIN_LICENSE:GPL-EXCEPT$
|
2012-09-19 12:28:29 +00:00
|
|
|
## 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
|
2015-01-28 08:44:43 +00:00
|
|
|
## a written agreement between you and The Qt Company. For licensing terms
|
2016-01-15 12:36:27 +00:00
|
|
|
## and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
## information use the contact form at https://www.qt.io/contact-us.
|
2012-09-19 12:28:29 +00:00
|
|
|
##
|
2016-01-15 12:36:27 +00:00
|
|
|
## 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.
|
2011-04-27 10:05:43 +00:00
|
|
|
##
|
|
|
|
## $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`
|
|
|
|
|
2017-07-31 10:53:50 +00:00
|
|
|
WHICH="which"
|
2013-11-12 17:36:15 +00:00
|
|
|
|
2019-04-30 10:36:00 +00:00
|
|
|
PERL=
|
|
|
|
findPerl()
|
|
|
|
{
|
2013-11-12 17:36:15 +00:00
|
|
|
PERL=`$WHICH perl 2>/dev/null`
|
2019-04-30 10:36:00 +00:00
|
|
|
}
|
2013-11-12 17:36:15 +00:00
|
|
|
|
|
|
|
# find out which awk we want to use, prefer gawk, then nawk, then regular awk
|
|
|
|
AWK=
|
2019-04-30 10:36:00 +00:00
|
|
|
findAwk()
|
|
|
|
{
|
2013-11-12 17:36:15 +00:00
|
|
|
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
|
2019-04-30 10:36:00 +00:00
|
|
|
}
|
2013-11-12 17:36:15 +00:00
|
|
|
|
|
|
|
# find a make command
|
2019-04-30 10:36:00 +00:00
|
|
|
findMake()
|
|
|
|
{
|
2013-11-12 17:36:15 +00:00
|
|
|
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
|
2011-04-27 10:05:43 +00:00
|
|
|
fi
|
2019-04-30 10:36:00 +00:00
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2017-04-18 16:19:47 +00:00
|
|
|
# make sure qmake is not confused by these. recursion via Makefiles would
|
|
|
|
# be still affected, so just unsetting them here is not an option.
|
2019-04-30 10:36:00 +00:00
|
|
|
checkQMakeEnv()
|
|
|
|
{
|
2017-04-18 16:19:47 +00:00
|
|
|
if [ -n "$QMAKESPEC" ] || [ -n "$XQMAKESPEC" ] || \
|
|
|
|
[ -n "$QMAKEPATH" ] || [ -n "$QMAKEFEATURES" ]; then
|
|
|
|
echo >&2 "Please make sure to unset the QMAKESPEC, XQMAKESPEC, QMAKEPATH,"
|
|
|
|
echo >&2 "and QMAKEFEATURES environment variables prior to building Qt."
|
|
|
|
exit 1
|
|
|
|
fi
|
2019-04-30 10:36:00 +00:00
|
|
|
}
|
2017-04-18 16:19:47 +00:00
|
|
|
|
2013-06-18 13:11:11 +00:00
|
|
|
# do this early so we don't store it in config.status
|
|
|
|
CFG_TOPLEVEL=
|
2016-08-23 18:03:50 +00:00
|
|
|
outpathPrefix=
|
2019-04-30 10:36:00 +00:00
|
|
|
|
2019-09-30 08:40:35 +00:00
|
|
|
checkTopLevelBuild()
|
|
|
|
{
|
|
|
|
relpathMangled=$relpath
|
|
|
|
if [ x"$1" = x"-top-level" ]; then
|
|
|
|
CFG_TOPLEVEL=yes
|
|
|
|
relpathMangled=`dirname "$relpath"`
|
|
|
|
outpathPrefix=../
|
|
|
|
else
|
|
|
|
if [ -f ../.qmake.super ]; then
|
|
|
|
echo >&2 "ERROR: You cannot configure qtbase separately within a top-level build."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2016-11-15 19:49:43 +00:00
|
|
|
OPT_CMDLINE= # expanded version for the script
|
|
|
|
QMAKE_CMDLINE= # verbatim version for qmake call
|
2019-04-30 10:36:00 +00:00
|
|
|
getOptAndQMakeCmdLines()
|
|
|
|
{
|
2016-07-06 12:41:09 +00:00
|
|
|
set -f # suppress globbing in for loop
|
|
|
|
SAVED_IFS=$IFS
|
|
|
|
IFS='
|
|
|
|
'
|
2014-11-18 19:21:09 +00:00
|
|
|
for i in "$@"; do
|
2019-09-30 08:40:35 +00:00
|
|
|
if [ x"$i" = x"-top-level" ]; then
|
|
|
|
continue
|
|
|
|
fi
|
2016-07-06 12:41:09 +00:00
|
|
|
case $i in
|
|
|
|
-redo|--redo)
|
2016-08-23 18:03:50 +00:00
|
|
|
optfile=${outpathPrefix}config.opt
|
|
|
|
if test -n "$CFG_TOPLEVEL" && ! test -f $optfile; then
|
|
|
|
optfile=config.opt
|
|
|
|
fi
|
|
|
|
if ! test -f $optfile; then
|
2016-07-06 12:41:09 +00:00
|
|
|
echo >&2 "No config.opt present - cannot redo configuration."
|
|
|
|
exit 1
|
|
|
|
fi
|
2016-08-23 18:03:50 +00:00
|
|
|
for a in `cat $optfile`; do
|
2016-07-06 12:41:09 +00:00
|
|
|
OPT_CMDLINE="$OPT_CMDLINE
|
|
|
|
$a"
|
|
|
|
done
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
OPT_CMDLINE="$OPT_CMDLINE
|
|
|
|
$i"
|
|
|
|
;;
|
|
|
|
esac
|
2016-06-11 20:49:01 +00:00
|
|
|
QMAKE_CMDLINE="$QMAKE_CMDLINE
|
|
|
|
$i"
|
2014-11-18 19:21:09 +00:00
|
|
|
done
|
2016-07-06 12:41:09 +00:00
|
|
|
set --
|
2016-11-15 19:49:43 +00:00
|
|
|
for i in $OPT_CMDLINE; do
|
2016-07-06 12:41:09 +00:00
|
|
|
set -- "$@" "$i"
|
|
|
|
done
|
|
|
|
set +f
|
|
|
|
IFS=$SAVED_IFS
|
2019-04-30 10:36:00 +00:00
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# utility functions
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
# Helper function for getQMakeConf. It parses include statements in
|
|
|
|
# qmake.conf and prints out the expanded file
|
2013-03-05 12:17:39 +00:00
|
|
|
expandQMakeConf()
|
2011-04-27 10:05:43 +00:00
|
|
|
{
|
|
|
|
while read line; do case "$line" in
|
|
|
|
include*)
|
2013-12-05 18:44:09 +00:00
|
|
|
inc_file=`echo "$line" | sed -n -e '/^include.*(.*)/s/include.*(\(.*\)).*$/\1/p'`
|
2011-04-27 10:05:43 +00:00
|
|
|
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
|
2016-11-24 17:41:57 +00:00
|
|
|
expandQMakeConf "$conf_file"
|
2012-05-31 06:13:10 +00:00
|
|
|
;;
|
2011-04-27 10:05:43 +00:00
|
|
|
*)
|
|
|
|
echo "$line"
|
|
|
|
;;
|
|
|
|
esac; done < "$1"
|
|
|
|
}
|
|
|
|
|
2013-03-05 12:17:39 +00:00
|
|
|
extractQMakeVariables()
|
2012-01-31 11:49:53 +00:00
|
|
|
{
|
configure: fix expanding system commands in qmake parser with GNU awk < 4
qmake variables using $$system() were incorrectly parsed by the custom
qmake parser in the configure script, when using GNU awk 3.1.8 or
earlier. They are parsed correctly with GNU awk 4 or mawk.
This was occurring with such an assignement (from an extra mkspecs file):
QMAKE_CC = $$system($$CMD QMAKE_CC 2>/dev/null)
The custom qmake parser in the configure script first attempts to
expand $$UPPERCASE variables, before running $$system(), using this:
match(value, /\$\$(\{[_A-Z0-9.]+\}|[_A-Z0-9.]+)/)
But when using non-ASCII locales with GNU awk 3.1.8 or earlier,
$$system was expanded (to an empty string) because these earlier awk
versions match lowercase letters for the [A-Z] regexp, which is
traditionally used to match uppercase letters.
This behavior has been changed in GNU awk 4.0.0, which only matches
uppercase letters for [A-Z] by default. A workaround for earlier GNU
awk versions is to run awk with the C locale.
See GNU awk NEWS "Changes from 3.1.8 to 4.0.0":
25. Gawk now treats ranges of the form [d-h] as if they were in the C
locale, no matter what kind of regexp is being used, and even if
--posix. The latest POSIX standard allows this, and the documentation
has been updated. Maybe this will stop all the questions about
[a-z] matching uppercase letters.
THIS CHANGES BEHAVIOR!!!!
See also gawk.info "A.7 Regexp Ranges and Locales: A Long Sad Story"
Change-Id: Ibb3eb28738c3e77d496c634e1f5c9f630957e730
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-02-19 13:12:36 +00:00
|
|
|
LC_ALL=C $AWK '
|
2012-01-31 11:49:53 +00:00
|
|
|
BEGIN {
|
|
|
|
values["LITERAL_WHITESPACE"] = " "
|
|
|
|
values["LITERAL_DOLLAR"] = "$"
|
|
|
|
}
|
2012-02-25 12:48:49 +00:00
|
|
|
/^[_A-Z0-9.]+[ \t]*\+?=/ {
|
2012-01-31 11:49:53 +00:00
|
|
|
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)
|
2012-04-30 12:29:26 +00:00
|
|
|
if (var ~ /^\{/) {
|
2012-01-31 11:49:53 +00:00
|
|
|
var = substr(var, 2, length(var) - 2)
|
|
|
|
}
|
|
|
|
ovalue = ovalue values[var]
|
|
|
|
}
|
2012-10-26 13:04:02 +00:00
|
|
|
value = ovalue value
|
|
|
|
|
|
|
|
ovalue = ""
|
2013-03-02 17:28:57 +00:00
|
|
|
while (match(value, /\$\$system\(("[^"]*"|[^)]*)\)/)) {
|
2012-10-26 13:04:02 +00:00
|
|
|
ovalue = ovalue substr(value, 1, RSTART - 1)
|
|
|
|
cmd = substr(value, RSTART + 9, RLENGTH - 10)
|
2013-03-02 17:28:57 +00:00
|
|
|
gsub(/^"|"$/, "", cmd)
|
2012-10-26 13:04:02 +00:00
|
|
|
value = substr(value, RSTART + RLENGTH)
|
|
|
|
while ((cmd | getline line) > 0) {
|
|
|
|
ovalue = ovalue line
|
|
|
|
}
|
|
|
|
close(cmd)
|
|
|
|
}
|
|
|
|
value = ovalue value
|
2012-01-31 11:49:53 +00:00
|
|
|
|
|
|
|
combinedValue = values[variable]
|
|
|
|
if (append == 1 && length(combinedValue) > 0) {
|
2012-10-26 13:04:02 +00:00
|
|
|
combinedValue = combinedValue " " value
|
2012-01-31 11:49:53 +00:00
|
|
|
} else {
|
2012-10-26 13:04:02 +00:00
|
|
|
combinedValue = value
|
2012-01-31 11:49:53 +00:00
|
|
|
}
|
|
|
|
values[variable] = combinedValue
|
|
|
|
}
|
|
|
|
END {
|
|
|
|
for (var in values) {
|
|
|
|
print var "=" values[var]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
'
|
|
|
|
}
|
|
|
|
|
2013-03-05 12:17:39 +00:00
|
|
|
getSingleQMakeVariable()
|
2012-01-31 11:49:53 +00:00
|
|
|
{
|
|
|
|
echo "$2" | $AWK "/^($1)=/ { print substr(\$0, index(\$0, \"=\") + 1) }"
|
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2013-02-27 14:01:25 +00:00
|
|
|
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
|
2017-06-07 23:42:47 +00:00
|
|
|
sysroot=$(/usr/bin/xcrun --sdk $sdk --show-sdk-path 2>/dev/null)
|
2013-02-27 14:01:25 +00:00
|
|
|
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")"
|
|
|
|
;;
|
2016-02-16 14:29:59 +00:00
|
|
|
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")"
|
|
|
|
;;
|
2016-05-20 06:01:59 +00:00
|
|
|
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")"
|
|
|
|
;;
|
2013-02-27 14:01:25 +00:00
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2020-04-03 13:39:37 +00:00
|
|
|
hasCFlags=
|
2013-02-27 14:01:25 +00:00
|
|
|
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-)
|
2013-04-08 14:34:33 +00:00
|
|
|
sdk_val=$(/usr/bin/xcrun -sdk $sdk -find $(echo $val | cut -d ' ' -f 1))
|
2013-02-27 14:01:25 +00:00
|
|
|
val=$(echo $sdk_val $(echo $val | cut -s -d ' ' -f 2-))
|
|
|
|
echo "$var=$val"
|
|
|
|
;;
|
2020-04-03 13:39:37 +00:00
|
|
|
QMAKE_CFLAGS=*)
|
|
|
|
echo "$line -isysroot $sysroot $version_min_flag"
|
|
|
|
hasCFlags="true";
|
|
|
|
;;
|
|
|
|
QMAKE_CXXFLAGS=*|QMAKE_LFLAGS=*)
|
2013-02-27 14:01:25 +00:00
|
|
|
echo "$line -isysroot $sysroot $version_min_flag"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "$line"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
2020-04-03 13:39:37 +00:00
|
|
|
|
|
|
|
if [ -z "$hasCFlags" ]; then
|
|
|
|
echo "QMAKE_CFLAGS = -isysroot $sysroot $version_min_flag";
|
|
|
|
fi
|
2013-02-27 14:01:25 +00:00
|
|
|
}
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
# relies on $QMAKESPEC being set correctly. parses include statements in
|
|
|
|
# qmake.conf and prints out the expanded file
|
|
|
|
getQMakeConf()
|
|
|
|
{
|
2012-01-31 11:49:53 +00:00
|
|
|
if [ -z "$specvals" ]; then
|
2016-11-24 16:36:38 +00:00
|
|
|
specvals=`expandQMakeConf "$QMAKESPEC/qmake.conf" | extractQMakeVariables`
|
2013-02-27 14:01:25 +00:00
|
|
|
if [ "$BUILD_ON_MAC" = "yes" ]; then specvals=$(macSDKify "$specvals"); fi
|
2011-04-27 10:05:43 +00:00
|
|
|
fi
|
2013-03-05 12:17:39 +00:00
|
|
|
getSingleQMakeVariable "$1" "$specvals"
|
2012-01-31 11:49:53 +00:00
|
|
|
}
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# operating system detection
|
|
|
|
#-------------------------------------------------------------------------------
|
2019-04-30 10:36:00 +00:00
|
|
|
detectOperatingSystem()
|
|
|
|
{
|
2011-04-27 10:05:43 +00:00
|
|
|
# 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
|
2018-04-04 02:38:18 +00:00
|
|
|
if [ -d /System/Library/Frameworks/Cocoa.framework ]; then
|
2011-04-27 10:05:43 +00:00
|
|
|
BUILD_ON_MAC=yes
|
|
|
|
fi
|
2013-02-02 12:31:53 +00:00
|
|
|
if [ "$OSTYPE" = "msys" ]; then
|
2013-05-11 21:36:51 +00:00
|
|
|
relpath=`(cd "$relpath"; pwd -W)`
|
|
|
|
outpath=`pwd -W`
|
2013-02-02 12:31:53 +00:00
|
|
|
fi
|
2019-04-30 10:36:00 +00:00
|
|
|
}
|
2013-04-08 14:41:27 +00:00
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# Verify Xcode installation on Mac OS
|
|
|
|
#-------------------------------------------------------------------------------
|
2019-04-30 10:36:00 +00:00
|
|
|
maybeVerifyXcode()
|
|
|
|
{
|
2013-04-08 14:41:27 +00:00
|
|
|
if [ "$BUILD_ON_MAC" = "yes" ]; then
|
|
|
|
if ! /usr/bin/xcode-select --print-path >/dev/null 2>&1; then
|
|
|
|
echo >&2
|
2017-06-07 23:42:47 +00:00
|
|
|
echo " No Xcode selected. Please install Xcode via the App Store, " >&2
|
|
|
|
echo " or the command line developer tools via xcode-select --install, " >&2
|
|
|
|
echo " and use xcode-select --switch to choose the right installation. " >&2
|
|
|
|
echo " See the xcode-select man page for more information." >&2
|
2013-04-08 14:41:27 +00:00
|
|
|
echo >&2
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
|
2017-06-07 23:42:47 +00:00
|
|
|
# In the else case we are probably using a Command Line Tools installation
|
|
|
|
if /usr/bin/xcrun -find xcodebuild >/dev/null 2>&1; then
|
|
|
|
if ! /usr/bin/xcrun xcodebuild -license check 2>/dev/null; then
|
|
|
|
echo >&2
|
|
|
|
echo " Xcode setup not complete. You need to confirm the license" >&2
|
|
|
|
echo " agreement by running 'sudo xcrun xcodebuild -license accept'." >&2
|
|
|
|
echo >&2
|
|
|
|
exit 2
|
|
|
|
fi
|
2013-04-08 14:41:27 +00:00
|
|
|
fi
|
|
|
|
fi
|
2019-04-30 10:36:00 +00:00
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Qt version detection
|
|
|
|
#-----------------------------------------------------------------------------
|
2015-09-18 01:17:40 +00:00
|
|
|
QT_VERSION=
|
2011-04-27 10:05:43 +00:00
|
|
|
QT_MAJOR_VERSION=
|
|
|
|
QT_MINOR_VERSION=0
|
|
|
|
QT_PATCH_VERSION=0
|
2019-04-30 10:36:00 +00:00
|
|
|
detectQtVersion()
|
|
|
|
{
|
2015-09-18 01:17:40 +00:00
|
|
|
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`
|
2011-04-27 10:05:43 +00:00
|
|
|
if [ -z "$QT_MAJOR_VERSION" ]; then
|
2015-09-18 01:17:40 +00:00
|
|
|
echo "Cannot process version from .qmake.conf"
|
2011-04-27 10:05:43 +00:00
|
|
|
echo "Cannot proceed."
|
|
|
|
exit 1
|
|
|
|
fi
|
2019-04-30 10:36:00 +00:00
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
#-------------------------------------------------------------------------------
|
2019-07-23 02:03:51 +00:00
|
|
|
# initialize variables
|
2011-04-27 10:05:43 +00:00
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
# QTDIR may be set and point to an old or system-wide Qt installation
|
|
|
|
unset QTDIR
|
|
|
|
|
|
|
|
# initalize internal variables
|
2015-10-26 11:38:50 +00:00
|
|
|
CFG_RELEASE_TOOLS=no
|
2016-11-17 18:24:49 +00:00
|
|
|
PLATFORM=
|
2011-04-27 10:05:43 +00:00
|
|
|
OPT_SHADOW=maybe
|
|
|
|
OPT_VERBOSE=no
|
|
|
|
OPT_HELP=
|
|
|
|
CFG_SILENT=no
|
2013-11-12 20:29:38 +00:00
|
|
|
CFG_DEV=no
|
2019-04-30 10:36:00 +00:00
|
|
|
BUILD_WITH_CMAKE=no
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# parse command line arguments
|
|
|
|
#-------------------------------------------------------------------------------
|
2019-04-30 10:36:00 +00:00
|
|
|
parseCommandline()
|
|
|
|
{
|
2011-04-27 10:05:43 +00:00
|
|
|
# parse the arguments, setting things to "yes" or "no"
|
|
|
|
while [ "$#" -gt 0 ]; do
|
|
|
|
CURRENT_OPT="$1"
|
|
|
|
case "$1" in
|
|
|
|
#Autoconf style options
|
|
|
|
--enable-*)
|
2013-12-05 18:44:09 +00:00
|
|
|
VAR=`echo $1 | sed 's,^--enable-\(.*\),\1,'`
|
2011-04-27 10:05:43 +00:00
|
|
|
VAL=yes
|
|
|
|
;;
|
|
|
|
--disable-*)
|
2013-12-05 18:44:09 +00:00
|
|
|
VAR=`echo $1 | sed 's,^--disable-\(.*\),\1,'`
|
2011-04-27 10:05:43 +00:00
|
|
|
VAL=no
|
|
|
|
;;
|
|
|
|
--*=*)
|
2013-12-05 18:44:09 +00:00
|
|
|
VAR=`echo $1 | sed 's,^--\(.*\)=.*,\1,'`
|
|
|
|
VAL=`echo $1 | sed 's,^--.*=\(.*\),\1,'`
|
2011-04-27 10:05:43 +00:00
|
|
|
;;
|
|
|
|
--no-*)
|
2013-12-05 18:44:09 +00:00
|
|
|
VAR=`echo $1 | sed 's,^--no-\(.*\),\1,'`
|
2011-04-27 10:05:43 +00:00
|
|
|
VAL=no
|
|
|
|
;;
|
|
|
|
--*)
|
2013-12-05 18:44:09 +00:00
|
|
|
VAR=`echo $1 | sed 's,^--\(.*\),\1,'`
|
2011-04-27 10:05:43 +00:00
|
|
|
VAL=yes
|
|
|
|
;;
|
|
|
|
#Qt plugin options
|
|
|
|
-no-*-*|-plugin-*-*|-qt-*-*)
|
2013-12-05 18:44:09 +00:00
|
|
|
VAR=`echo $1 | sed 's,^-[^-]*-\(.*\),\1,'`
|
|
|
|
VAL=`echo $1 | sed 's,^-\([^-]*\).*,\1,'`
|
2011-04-27 10:05:43 +00:00
|
|
|
;;
|
|
|
|
#Qt style no options
|
|
|
|
-no-*)
|
2013-12-05 18:44:09 +00:00
|
|
|
VAR=`echo $1 | sed 's,^-no-\(.*\),\1,'`
|
2011-04-27 10:05:43 +00:00
|
|
|
VAL=no
|
|
|
|
;;
|
|
|
|
#Qt style options that pass an argument
|
2013-06-14 13:55:06 +00:00
|
|
|
-prefix| \
|
|
|
|
-docdir| \
|
|
|
|
-headerdir| \
|
|
|
|
-plugindir| \
|
|
|
|
-qmldir| \
|
|
|
|
-archdatadir| \
|
|
|
|
-datadir| \
|
|
|
|
-libdir| \
|
|
|
|
-bindir| \
|
|
|
|
-libexecdir| \
|
|
|
|
-translationdir| \
|
|
|
|
-sysconfdir| \
|
|
|
|
-examplesdir| \
|
|
|
|
-testsdir| \
|
|
|
|
-hostdatadir| \
|
|
|
|
-hostbindir| \
|
|
|
|
-hostlibdir| \
|
2013-08-09 11:34:04 +00:00
|
|
|
-extprefix| \
|
2013-06-14 13:55:06 +00:00
|
|
|
-sysroot| \
|
2015-10-12 07:55:30 +00:00
|
|
|
-external-hostbindir| \
|
2013-06-14 13:55:06 +00:00
|
|
|
-make| \
|
|
|
|
-nomake| \
|
|
|
|
-skip| \
|
|
|
|
-platform| \
|
|
|
|
-xplatform| \
|
|
|
|
-device| \
|
|
|
|
-device-option| \
|
|
|
|
-sdk| \
|
|
|
|
-android-sdk| \
|
|
|
|
-android-ndk| \
|
|
|
|
-android-ndk-platform| \
|
|
|
|
-android-ndk-host| \
|
2019-11-15 09:16:57 +00:00
|
|
|
-android-arch)
|
2013-12-05 18:44:09 +00:00
|
|
|
VAR=`echo $1 | sed 's,^-\(.*\),\1,'`
|
2011-04-27 10:05:43 +00:00
|
|
|
shift
|
|
|
|
VAL="$1"
|
|
|
|
;;
|
|
|
|
#Qt style complex options in one command
|
|
|
|
-enable-*|-disable-*)
|
2013-12-05 18:44:09 +00:00
|
|
|
VAR=`echo $1 | sed 's,^-\([^-]*\)-.*,\1,'`
|
|
|
|
VAL=`echo $1 | sed 's,^-[^-]*-\(.*\),\1,'`
|
2011-04-27 10:05:43 +00:00
|
|
|
;;
|
|
|
|
#Qt Builtin/System style options
|
|
|
|
-no-*|-system-*|-qt-*)
|
2013-12-05 18:44:09 +00:00
|
|
|
VAR=`echo $1 | sed 's,^-[^-]*-\(.*\),\1,'`
|
|
|
|
VAL=`echo $1 | sed 's,^-\([^-]*\)-.*,\1,'`
|
2011-04-27 10:05:43 +00:00
|
|
|
;;
|
|
|
|
#Options that cannot be generalized
|
|
|
|
-hostprefix)
|
2013-12-05 18:44:09 +00:00
|
|
|
VAR=`echo $1 | sed 's,^-\(.*\),\1,'`
|
2011-04-27 10:05:43 +00:00
|
|
|
# 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
|
2016-06-11 20:49:01 +00:00
|
|
|
;;
|
2012-04-02 17:14:19 +00:00
|
|
|
#General options, including Qt style yes options
|
2011-04-27 10:05:43 +00:00
|
|
|
-*)
|
2013-12-05 18:44:09 +00:00
|
|
|
VAR=`echo $1 | sed 's,^-\(.*\),\1,'`
|
2012-04-02 17:14:19 +00:00
|
|
|
VAL="yes"
|
2011-04-27 10:05:43 +00:00
|
|
|
;;
|
2016-06-11 20:49:01 +00:00
|
|
|
# most options don't need processing in the configure script, skip them. qmake will do the real validation
|
2011-04-27 10:05:43 +00:00
|
|
|
*)
|
|
|
|
shift
|
|
|
|
continue
|
2016-06-11 20:49:01 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
shift
|
|
|
|
|
|
|
|
UNKNOWN_OPT=no
|
|
|
|
case "$VAR" in
|
2015-10-12 07:55:30 +00:00
|
|
|
external-hostbindir)
|
|
|
|
CFG_HOST_QT_TOOLS_PATH="$VAL"
|
|
|
|
;;
|
2011-04-27 10:05:43 +00:00
|
|
|
platform)
|
|
|
|
PLATFORM="$VAL"
|
|
|
|
;;
|
2015-10-26 11:38:50 +00:00
|
|
|
optimized-qmake|optimized-tools)
|
|
|
|
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
|
|
|
|
CFG_RELEASE_TOOLS="$VAL"
|
|
|
|
fi
|
|
|
|
;;
|
2013-11-12 20:29:38 +00:00
|
|
|
developer-build)
|
|
|
|
CFG_DEV="yes"
|
|
|
|
;;
|
2016-06-11 20:49:01 +00:00
|
|
|
h|help)
|
|
|
|
if [ "$VAL" = "yes" ]; then
|
|
|
|
OPT_HELP="$VAL"
|
2011-04-27 10:05:43 +00:00
|
|
|
else
|
|
|
|
UNKNOWN_OPT=yes
|
|
|
|
fi
|
|
|
|
;;
|
2016-06-11 20:49:01 +00:00
|
|
|
v|verbose)
|
|
|
|
if [ "$VAL" = "yes" ]; then
|
|
|
|
OPT_VERBOSE=yes
|
|
|
|
elif [ "$VAL" = "no" ]; then
|
|
|
|
OPT_VERBOSE=no
|
2011-04-27 10:05:43 +00:00
|
|
|
else
|
|
|
|
UNKNOWN_OPT=yes
|
|
|
|
fi
|
|
|
|
;;
|
2016-06-11 20:49:01 +00:00
|
|
|
silent)
|
|
|
|
# need to keep this here, to ensure qmake is built silently
|
|
|
|
CFG_SILENT="$VAL"
|
2011-10-14 13:55:35 +00:00
|
|
|
;;
|
2019-04-30 10:36:00 +00:00
|
|
|
cmake)
|
|
|
|
BUILD_WITH_CMAKE=yes
|
|
|
|
;;
|
2020-10-01 10:22:50 +00:00
|
|
|
qmake)
|
|
|
|
BUILD_WITH_CMAKE=no
|
|
|
|
;;
|
2020-08-18 09:43:37 +00:00
|
|
|
redo)
|
2020-09-17 10:16:47 +00:00
|
|
|
if [ -f ${outpathPrefix}config.opt ]; then
|
|
|
|
if grep -e ^-cmake <${outpathPrefix}config.opt >/dev/null 2>&1; then
|
2020-08-18 09:43:37 +00:00
|
|
|
BUILD_WITH_CMAKE=yes
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
;;
|
2016-06-11 20:49:01 +00:00
|
|
|
*)
|
2011-04-27 10:05:43 +00:00
|
|
|
;;
|
2016-06-11 20:49:01 +00:00
|
|
|
esac
|
|
|
|
if [ "$UNKNOWN_OPT" = "yes" ]; then
|
|
|
|
echo "${CURRENT_OPT}: invalid command-line switch"
|
|
|
|
ERROR=yes
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
[ "x$ERROR" = "xyes" ] && exit 1
|
2019-04-30 10:36:00 +00:00
|
|
|
}
|
2016-06-11 20:49:01 +00:00
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# help - interactive parts of the script _after_ this section please
|
|
|
|
#-------------------------------------------------------------------------------
|
2019-04-30 10:36:00 +00:00
|
|
|
handleHelp()
|
|
|
|
{
|
2016-06-11 20:49:01 +00:00
|
|
|
if [ "$OPT_HELP" = "yes" ]; then
|
|
|
|
cat $relpath/config_help.txt
|
2016-12-23 19:34:38 +00:00
|
|
|
if [ -n "$CFG_TOPLEVEL" ]; then
|
|
|
|
IFS='
|
|
|
|
'
|
|
|
|
for i in $relpathMangled/qt*/config_help.txt; do
|
|
|
|
if [ x"$i" != x"$relpath/config_help.txt" ]; then
|
|
|
|
echo
|
|
|
|
cat "$i"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
2016-06-11 20:49:01 +00:00
|
|
|
exit 0
|
|
|
|
fi
|
2019-04-30 10:36:00 +00:00
|
|
|
}
|
2016-06-11 20:49:01 +00:00
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# platform detection
|
|
|
|
#-------------------------------------------------------------------------------
|
2017-01-03 15:59:36 +00:00
|
|
|
PLATFORM_NOTES=
|
2019-04-30 10:36:00 +00:00
|
|
|
detectPlatform()
|
|
|
|
{
|
2016-06-11 20:49:01 +00:00
|
|
|
if [ -z "$PLATFORM" ]; then
|
|
|
|
case "$UNAME_SYSTEM:$UNAME_RELEASE" in
|
|
|
|
Darwin:*)
|
|
|
|
PLATFORM=macx-clang
|
2011-04-27 10:05:43 +00:00
|
|
|
;;
|
2016-06-11 20:49:01 +00:00
|
|
|
AIX:*)
|
|
|
|
#PLATFORM=aix-g++
|
2017-04-18 21:52:10 +00:00
|
|
|
PLATFORM=aix-g++-64
|
|
|
|
PLATFORM_NOTES="AIX: aix-g++ aix-g++-64"
|
2011-04-27 10:05:43 +00:00
|
|
|
;;
|
2016-06-11 20:49:01 +00:00
|
|
|
GNU:*)
|
|
|
|
PLATFORM=hurd-g++
|
2011-04-27 10:05:43 +00:00
|
|
|
;;
|
2016-06-11 20:49:01 +00:00
|
|
|
FreeBSD:*)
|
|
|
|
if [ "$(uname -r | cut -d. -f1)" -ge 10 ]; then
|
|
|
|
PLATFORM=freebsd-clang
|
2017-01-03 15:59:36 +00:00
|
|
|
PLATFORM_NOTES="FreeBSD: freebsd-g++"
|
2012-03-02 16:43:52 +00:00
|
|
|
else
|
2016-06-11 20:49:01 +00:00
|
|
|
PLATFORM=freebsd-g++
|
2017-01-03 15:59:36 +00:00
|
|
|
PLATFORM_NOTES="FreeBSD: freebsd-clang"
|
2012-03-02 16:43:52 +00:00
|
|
|
fi
|
|
|
|
;;
|
2016-06-11 20:49:01 +00:00
|
|
|
OpenBSD:*)
|
|
|
|
PLATFORM=openbsd-g++
|
2012-03-02 16:43:52 +00:00
|
|
|
;;
|
2016-06-11 20:49:01 +00:00
|
|
|
NetBSD:*)
|
|
|
|
PLATFORM=netbsd-g++
|
2011-04-27 10:05:43 +00:00
|
|
|
;;
|
2016-06-11 20:49:01 +00:00
|
|
|
HP-UX:*)
|
|
|
|
case "$UNAME_MACHINE" in
|
|
|
|
ia64)
|
2017-04-18 21:52:10 +00:00
|
|
|
PLATFORM=hpuxi-g++-64
|
2016-06-11 20:49:01 +00:00
|
|
|
;;
|
|
|
|
esac
|
2013-12-20 15:14:31 +00:00
|
|
|
;;
|
2016-06-11 20:49:01 +00:00
|
|
|
Linux:*)
|
|
|
|
PLATFORM=linux-g++
|
2017-04-18 21:52:10 +00:00
|
|
|
PLATFORM_NOTES="Linux: linux-clang linux-icc"
|
2015-07-04 14:13:31 +00:00
|
|
|
;;
|
2016-06-11 20:49:01 +00:00
|
|
|
SunOS:5*)
|
2017-04-18 21:52:10 +00:00
|
|
|
#PLATFORM=solaris-g++-64
|
2016-06-11 20:49:01 +00:00
|
|
|
PLATFORM=solaris-cc
|
|
|
|
#PLATFORM=solaris-cc64
|
2017-04-18 21:52:10 +00:00
|
|
|
PLATFORM_NOTES="Solaris: solaris-g++-64 solaris-cc-64"
|
2011-04-27 10:05:43 +00:00
|
|
|
;;
|
2016-06-11 20:49:01 +00:00
|
|
|
CYGWIN*:*)
|
|
|
|
PLATFORM=cygwin-g++
|
2011-04-27 10:05:43 +00:00
|
|
|
;;
|
2016-06-11 20:49:01 +00:00
|
|
|
LynxOS*:*)
|
|
|
|
PLATFORM=lynxos-g++
|
2011-04-27 10:05:43 +00:00
|
|
|
;;
|
2016-06-11 20:49:01 +00:00
|
|
|
QNX:*)
|
|
|
|
PLATFORM=unsupported/qnx-g++
|
2014-12-09 10:45:29 +00:00
|
|
|
;;
|
2016-06-11 20:49:01 +00:00
|
|
|
*)
|
|
|
|
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
|
2017-01-03 15:59:36 +00:00
|
|
|
echo "$PLATFORM_NOTES" > "${outpathPrefix}.config.notes"
|
2019-04-30 10:36:00 +00:00
|
|
|
}
|
2016-06-11 20:49:01 +00:00
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# command line and environment validation
|
|
|
|
#-------------------------------------------------------------------------------
|
2019-04-30 10:36:00 +00:00
|
|
|
validateEnv()
|
|
|
|
{
|
2016-06-11 20:49:01 +00:00
|
|
|
if [ -d "$PLATFORM" ]; then
|
|
|
|
QMAKESPEC="$PLATFORM"
|
|
|
|
else
|
|
|
|
QMAKESPEC="$relpath/mkspecs/${PLATFORM}"
|
2015-08-07 12:28:14 +00:00
|
|
|
fi
|
2015-10-15 13:40:26 +00:00
|
|
|
|
2016-06-11 20:49:01 +00:00
|
|
|
if [ "$BUILD_ON_MAC" = "yes" ]; then
|
2016-11-16 14:13:52 +00:00
|
|
|
if [ `basename $QMAKESPEC` = "macx-xcode" ]; then
|
2016-06-11 20:49:01 +00:00
|
|
|
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
|
2011-04-27 10:05:43 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2016-06-11 20:49:01 +00:00
|
|
|
# check specified platforms are supported
|
|
|
|
if [ '!' -d "$QMAKESPEC" ]; then
|
2014-01-29 15:46:47 +00:00
|
|
|
echo
|
2016-06-11 20:49:01 +00:00
|
|
|
echo " The specified system/compiler is not supported:"
|
2014-01-29 15:46:47 +00:00
|
|
|
echo
|
2016-06-11 20:49:01 +00:00
|
|
|
echo " $QMAKESPEC"
|
|
|
|
echo
|
|
|
|
echo " Please see the README file for a complete list."
|
|
|
|
echo
|
|
|
|
exit 2
|
2014-01-29 15:46:47 +00:00
|
|
|
fi
|
2019-04-30 10:36:00 +00:00
|
|
|
}
|
2016-06-11 20:49:01 +00:00
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# build tree initialization
|
|
|
|
#-------------------------------------------------------------------------------
|
2019-04-30 10:36:00 +00:00
|
|
|
initBuildTree()
|
|
|
|
{
|
2016-06-11 20:49:01 +00:00
|
|
|
# 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
|
2012-10-25 19:38:13 +00:00
|
|
|
else
|
2016-06-11 20:49:01 +00:00
|
|
|
OPT_SHADOW=yes
|
2012-10-25 19:38:13 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
2016-06-11 20:49:01 +00:00
|
|
|
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
|
2011-04-27 10:05:43 +00:00
|
|
|
fi
|
2016-06-11 20:49:01 +00:00
|
|
|
[ "$OPT_VERBOSE" = "yes" ] && echo "Performing shadow build..."
|
2011-04-27 10:05:43 +00:00
|
|
|
fi
|
|
|
|
|
2016-06-11 20:49:01 +00:00
|
|
|
if [ "$OPT_SHADOW" = "yes" ]; then
|
|
|
|
echo "Preparing build tree..."
|
2015-07-11 05:09:15 +00:00
|
|
|
|
2016-06-11 20:49:01 +00:00
|
|
|
[ -d "$outpath/bin" ] || mkdir -p "$outpath/bin"
|
2015-10-15 13:04:17 +00:00
|
|
|
|
2016-06-11 20:49:01 +00:00
|
|
|
mkdir -p "$outpath/mkspecs"
|
2015-08-06 08:24:34 +00:00
|
|
|
fi
|
2019-04-30 10:36:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# $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"
|
|
|
|
}
|
2015-08-06 08:24:34 +00:00
|
|
|
|
2016-06-11 20:49:01 +00:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# build qmake
|
|
|
|
# -----------------------------------------------------------------------------
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2019-04-30 10:36:00 +00:00
|
|
|
buildQMake()
|
|
|
|
{
|
2016-06-11 20:49:01 +00:00
|
|
|
# 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
|
2015-09-08 23:35:33 +00:00
|
|
|
|
2016-06-11 20:49:01 +00:00
|
|
|
"$relpath/bin/syncqt.pl" -version $QT_VERSION -minimal -module QtCore "$relpath" || exit 1
|
2012-01-29 12:54:19 +00:00
|
|
|
fi
|
2016-06-11 20:49:01 +00:00
|
|
|
# build qmake
|
|
|
|
echo "Creating qmake..."
|
|
|
|
mkdir -p "$outpath/qmake" || exit
|
2016-11-18 17:11:41 +00:00
|
|
|
|
|
|
|
in_mkfile=$relpath/qmake/Makefile.unix
|
|
|
|
mkfile=$outpath/qmake/Makefile
|
2016-06-11 20:49:01 +00:00
|
|
|
if [ -f "$mkfile" ]; then
|
|
|
|
[ "$CFG_DEV" = "yes" ] && "$WHICH" chflags >/dev/null 2>&1 && chflags nouchg "$mkfile"
|
|
|
|
rm -f "$mkfile"
|
|
|
|
fi
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2016-06-11 20:49:01 +00:00
|
|
|
echo "########################################################################" > "$mkfile"
|
|
|
|
echo "## This file was autogenerated by configure, all changes will be lost ##" >> "$mkfile"
|
|
|
|
echo "########################################################################" >> "$mkfile"
|
2019-12-03 10:53:32 +00:00
|
|
|
EXTRA_CXXFLAGS="\$(QMAKE_CXXFLAGS) \$(QMAKE_CXXFLAGS_CXX1Z) \$(QMAKE_CXXFLAGS_SPLIT_SECTIONS)"
|
2016-06-11 20:49:01 +00:00
|
|
|
EXTRA_LFLAGS="\$(QMAKE_LFLAGS) \$(QMAKE_LFLAGS_GCSECTIONS)"
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2016-06-11 20:49:01 +00:00
|
|
|
[ "$CFG_SILENT" = "yes" ] && CC_TRANSFORM='s,^,\@,' || CC_TRANSFORM=
|
|
|
|
setBootstrapVariable QMAKE_CC CC "$CC_TRANSFORM"
|
|
|
|
setBootstrapVariable QMAKE_CXX CXX "$CC_TRANSFORM"
|
|
|
|
setBootstrapVariable QMAKE_CXXFLAGS
|
2020-04-03 13:39:37 +00:00
|
|
|
setBootstrapVariable QMAKE_CFLAGS
|
2019-12-03 10:53:32 +00:00
|
|
|
setBootstrapVariable QMAKE_CXXFLAGS_CXX1Z
|
2016-06-11 20:49:01 +00:00
|
|
|
setBootstrapVariable QMAKE_CXXFLAGS_SPLIT_SECTIONS
|
|
|
|
setBootstrapVariable QMAKE_LFLAGS
|
|
|
|
setBootstrapVariable QMAKE_LFLAGS_GCSECTIONS
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2016-06-11 20:49:01 +00:00
|
|
|
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)"
|
2011-04-27 10:05:43 +00:00
|
|
|
fi
|
|
|
|
|
2016-06-11 20:49:01 +00:00
|
|
|
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"
|
2016-11-18 15:27:15 +00:00
|
|
|
echo "CONFIG_CXXFLAGS = $EXTRA_CXXFLAGS" >> "$mkfile"
|
2020-04-03 13:39:37 +00:00
|
|
|
echo "CONFIG_CFLAGS = \$(QMAKE_CFLAGS)" >> "$mkfile"
|
2016-11-18 15:27:15 +00:00
|
|
|
echo "CONFIG_LFLAGS = $EXTRA_LFLAGS" >> "$mkfile"
|
2016-06-11 20:49:01 +00:00
|
|
|
echo "RM_F = rm -f" >> "$mkfile"
|
|
|
|
echo "RM_RF = rm -rf" >> "$mkfile"
|
2016-11-18 15:27:15 +00:00
|
|
|
|
|
|
|
case `basename "$PLATFORM"` in
|
2018-10-09 10:38:53 +00:00
|
|
|
win32-*g++*)
|
2016-11-18 15:27:15 +00:00
|
|
|
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"
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2016-06-11 20:49:01 +00:00
|
|
|
if [ "$BUILD_ON_MAC" = "yes" ]; then
|
|
|
|
echo "EXTRA_CXXFLAGS += -MMD" >> "$mkfile"
|
|
|
|
cat "$in_mkfile" >> "$mkfile"
|
|
|
|
echo "-include \$(notdir \$(DEPEND_SRC:%.cpp=%.d))" >> "$mkfile"
|
2011-04-27 10:05:43 +00:00
|
|
|
else
|
2016-06-11 20:49:01 +00:00
|
|
|
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
|
2011-04-27 10:05:43 +00:00
|
|
|
fi
|
|
|
|
|
2016-06-11 20:49:01 +00:00
|
|
|
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
|
2019-04-30 10:36:00 +00:00
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2016-06-11 20:49:01 +00:00
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# create a qt.conf for the Qt build tree itself
|
|
|
|
#-------------------------------------------------------------------------------
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2019-04-30 10:36:00 +00:00
|
|
|
createQtConf()
|
|
|
|
{
|
2016-11-24 17:41:48 +00:00
|
|
|
# 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.
|
2016-11-07 16:38:13 +00:00
|
|
|
QTCONFFILE="$outpath/bin/qt.conf"
|
|
|
|
cat > "$QTCONFFILE" <<EOF
|
|
|
|
[EffectivePaths]
|
|
|
|
Prefix=..
|
|
|
|
[Paths]
|
2016-11-16 14:13:52 +00:00
|
|
|
TargetSpec=dummy
|
2016-06-11 20:49:01 +00:00
|
|
|
HostSpec=$PLATFORM
|
|
|
|
EOF
|
|
|
|
if [ x"$relpath" != x"$outpath" ]; then
|
|
|
|
cat >> "$QTCONFFILE" <<EOF
|
|
|
|
[EffectiveSourcePaths]
|
|
|
|
Prefix=$relpath
|
2011-04-27 10:05:43 +00:00
|
|
|
EOF
|
|
|
|
fi
|
2019-04-30 10:36:00 +00:00
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------
|
2017-01-03 15:59:36 +00:00
|
|
|
# configure and build top-level makefile
|
2011-04-27 10:05:43 +00:00
|
|
|
#-------------------------------------------------------------------------------
|
2019-04-30 10:36:00 +00:00
|
|
|
createToplevelMakefile()
|
|
|
|
{
|
2016-06-11 20:49:01 +00:00
|
|
|
# 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
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2016-08-23 18:03:50 +00:00
|
|
|
if [ -n "$CFG_TOPLEVEL" ]; then
|
|
|
|
cd ..
|
|
|
|
fi
|
2013-06-18 13:11:11 +00:00
|
|
|
|
2017-01-03 16:44:15 +00:00
|
|
|
if [ -n "$CFG_HOST_QT_TOOLS_PATH" ]; then
|
|
|
|
"$CFG_HOST_QT_TOOLS_PATH/qmake" -qtconf "$QTCONFFILE" "$relpathMangled" -- "$@"
|
|
|
|
else
|
|
|
|
"$outpath/bin/qmake" "$relpathMangled" -- "$@"
|
|
|
|
fi
|
2019-04-30 10:36:00 +00:00
|
|
|
}
|
|
|
|
|
2020-09-17 10:16:47 +00:00
|
|
|
checkTopLevelBuild "$@"
|
2019-10-17 14:48:01 +00:00
|
|
|
parseCommandline "$@"
|
2019-04-30 10:36:00 +00:00
|
|
|
handleHelp
|
|
|
|
if [ "$BUILD_WITH_CMAKE" = "yes" ]; then
|
2020-07-02 20:40:28 +00:00
|
|
|
getOptAndQMakeCmdLines "$@"
|
2020-08-18 09:43:37 +00:00
|
|
|
optfilename=config.opt
|
2020-07-02 20:40:28 +00:00
|
|
|
if [ -z "$optfile" ]; then # only write optfile if not currently redoing
|
2020-07-16 11:27:30 +00:00
|
|
|
optfilepath=${outpathPrefix}${optfilename}
|
|
|
|
if [ -f "$optfilepath" ]; then rm "$optfilepath"; fi
|
2020-07-02 20:40:28 +00:00
|
|
|
for arg in "$@"; do
|
2020-09-17 10:16:47 +00:00
|
|
|
if [ "$arg" = "-top-level" ]; then
|
|
|
|
continue
|
|
|
|
fi
|
2020-07-16 11:27:30 +00:00
|
|
|
echo $arg >> "$optfilepath"
|
2020-07-02 20:40:28 +00:00
|
|
|
done
|
|
|
|
fi
|
2020-07-16 11:27:30 +00:00
|
|
|
|
2020-09-17 10:16:47 +00:00
|
|
|
top_level_arg=
|
2020-07-16 11:27:30 +00:00
|
|
|
if [ -n "$CFG_TOPLEVEL" ]; then
|
2020-09-17 10:16:47 +00:00
|
|
|
top_level_arg=-DTOP_LEVEL=TRUE
|
2020-07-16 11:27:30 +00:00
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
|
2020-09-17 10:16:47 +00:00
|
|
|
cmake "-DOPTFILE=$optfilename" $top_level_arg -P "$relpath/cmake/QtProcessConfigureArgs.cmake"
|
2019-04-30 10:36:00 +00:00
|
|
|
else
|
|
|
|
findPerl
|
|
|
|
findAwk
|
|
|
|
findMake
|
|
|
|
checkQMakeEnv
|
2019-10-17 14:48:01 +00:00
|
|
|
getOptAndQMakeCmdLines "$@"
|
2019-04-30 10:36:00 +00:00
|
|
|
detectOperatingSystem
|
|
|
|
maybeVerifyXcode
|
|
|
|
detectQtVersion
|
|
|
|
detectPlatform
|
|
|
|
validateEnv
|
|
|
|
initBuildTree
|
|
|
|
buildQMake
|
|
|
|
createQtConf
|
|
|
|
createToplevelMakefile
|
|
|
|
fi
|