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 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`
|
|
|
|
|
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
|
2020-12-17 20:44:21 +00:00
|
|
|
determineOptFilePath()
|
2019-04-30 10:36:00 +00:00
|
|
|
{
|
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
|
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
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------
|
2019-07-23 02:03:51 +00:00
|
|
|
# initialize variables
|
2011-04-27 10:05:43 +00:00
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
OPT_HELP=
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# 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"
|
|
|
|
;;
|
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
|
|
|
*)
|
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
|
|
|
}
|
2020-12-17 20:44:21 +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
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2020-12-17 20:44:21 +00:00
|
|
|
checkTopLevelBuild "$@"
|
|
|
|
parseCommandline "$@"
|
|
|
|
handleHelp
|
|
|
|
determineOptFilePath "$@"
|
|
|
|
optfilename=config.opt
|
|
|
|
if [ -z "$optfile" ]; then # only write optfile if not currently redoing
|
|
|
|
optfilepath=${outpathPrefix}${optfilename}
|
|
|
|
> "$optfilepath"
|
|
|
|
for arg in "$@"; do
|
|
|
|
if [ "$arg" = "-top-level" ]; then
|
|
|
|
continue
|
2016-06-11 20:49:01 +00:00
|
|
|
fi
|
2020-12-17 20:44:21 +00:00
|
|
|
echo $arg >> "$optfilepath"
|
|
|
|
done
|
2011-04-27 10:05:43 +00:00
|
|
|
fi
|
|
|
|
|
2020-12-17 20:44:21 +00:00
|
|
|
top_level_arg=
|
2016-08-23 18:03:50 +00:00
|
|
|
if [ -n "$CFG_TOPLEVEL" ]; then
|
2020-12-17 20:44:21 +00:00
|
|
|
top_level_arg=-DTOP_LEVEL=TRUE
|
2016-08-23 18:03:50 +00:00
|
|
|
cd ..
|
|
|
|
fi
|
2013-06-18 13:11:11 +00:00
|
|
|
|
2020-12-17 20:44:21 +00:00
|
|
|
cmake "-DOPTFILE=$optfilename" $top_level_arg -P "$relpath/cmake/QtProcessConfigureArgs.cmake"
|