2011-04-27 10:05:43 +00:00
|
|
|
#!/bin/sh
|
2022-05-10 10:06:48 +00:00
|
|
|
# Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
# Copyright (C) 2016 Intel Corporation.
|
|
|
|
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# script initialization
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
# the directory of this script is the "source tree"
|
2022-11-18 10:31:02 +00:00
|
|
|
relpath=`dirname "$0"`
|
2011-04-27 10:05:43 +00:00
|
|
|
relpath=`(cd "$relpath"; /bin/pwd)`
|
|
|
|
# the current directory is the "build tree" or "object tree"
|
|
|
|
outpath=`/bin/pwd`
|
2022-11-18 10:31:02 +00:00
|
|
|
outpathPrefix=$outpath
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2013-06-18 13:11:11 +00:00
|
|
|
# do this early so we don't store it in config.status
|
|
|
|
CFG_TOPLEVEL=
|
2022-11-18 10:31:02 +00:00
|
|
|
|
|
|
|
SAVED_IFS=$IFS
|
|
|
|
IFS='
|
|
|
|
'
|
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"`
|
2023-01-23 13:42:52 +00:00
|
|
|
outpathPrefix="$outpathPrefix/.."
|
2019-09-30 08:40:35 +00:00
|
|
|
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
|
|
|
{
|
2022-11-18 10:31:02 +00:00
|
|
|
> "${outpathPrefix}/config.redo.in"
|
2016-07-06 12:41:09 +00:00
|
|
|
set -f # suppress globbing in for loop
|
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)
|
2022-11-18 10:31:02 +00:00
|
|
|
optfile=${outpathPrefix}/config.opt
|
|
|
|
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
|
|
|
|
;;
|
|
|
|
*)
|
2022-11-18 10:31:02 +00:00
|
|
|
# If redo-ing, write the rest of parameters into the config.redo.in file
|
|
|
|
echo \"$i\" >> "${outpathPrefix}/config.redo.in"
|
2016-07-06 12:41:09 +00:00
|
|
|
;;
|
|
|
|
esac
|
2014-11-18 19:21:09 +00:00
|
|
|
done
|
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
|
|
|
|
--*)
|
2013-12-05 18:44:09 +00:00
|
|
|
VAR=`echo $1 | sed 's,^--\(.*\),\1,'`
|
2011-04-27 10:05:43 +00:00
|
|
|
VAL=yes
|
|
|
|
;;
|
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
|
|
|
|
|
|
|
|
case "$VAR" in
|
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
|
|
|
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
|
|
|
|
done
|
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 "$@"
|
2022-11-11 13:48:57 +00:00
|
|
|
|
2022-11-18 10:31:02 +00:00
|
|
|
optfilepath=${outpathPrefix}/config.opt
|
|
|
|
opttmpfilepath=${outpathPrefix}/config.opt.in
|
|
|
|
|
|
|
|
redofilepath=${outpathPrefix}/config.redo
|
|
|
|
redotmpfilepath=${outpathPrefix}/config.redo.in
|
|
|
|
|
2022-11-11 13:48:57 +00:00
|
|
|
fresh_requested_arg=
|
2020-12-17 20:44:21 +00:00
|
|
|
if [ -z "$optfile" ]; then # only write optfile if not currently redoing
|
2022-11-18 10:31:02 +00:00
|
|
|
> "$opttmpfilepath"
|
|
|
|
> "$redotmpfilepath"
|
|
|
|
|
|
|
|
for arg in "$@"; do echo \"$arg\" >> "$opttmpfilepath"; done
|
|
|
|
|
|
|
|
cmake -DIN_FILE="${opttmpfilepath}" -DOUT_FILE="${optfilepath}" -DIGNORE_ARGS=-top-level -P "${relpath}/cmake/QtWriteArgsFile.cmake"
|
2022-11-11 13:48:57 +00:00
|
|
|
else
|
2022-11-18 10:31:02 +00:00
|
|
|
# In case config.opt.in is missing for some reason
|
|
|
|
if [ ! -f "$opttmpfilepath" ]; then
|
|
|
|
> "$opttmpfilepath"
|
|
|
|
for arg in `cat $optfile`; do echo \"$arg\" >> "$opttmpfilepath"; done
|
|
|
|
fi
|
|
|
|
|
|
|
|
cmake -DIN_FILE="${opttmpfilepath}" -DREDO_FILE="${redotmpfilepath}" -DOUT_FILE="${redofilepath}" -DIGNORE_ARGS=-top-level -P "${relpath}/cmake/QtWriteArgsFile.cmake"
|
|
|
|
optfilepath=${redofilepath}
|
2022-11-11 13:48:57 +00:00
|
|
|
fresh_requested_arg=-DFRESH_REQUESTED=TRUE
|
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
|
|
|
|
2022-11-18 10:31:02 +00:00
|
|
|
cmake "-DOPTFILE=${optfilepath}" ${top_level_arg} ${fresh_requested_arg} -P "${relpath}/cmake/QtProcessConfigureArgs.cmake"
|
|
|
|
|
|
|
|
IFS=$SAVED_IFS
|