The config.redo script can be executed to reconfigure a pre-existing qt build dir with the configure options that were last passed to the build. It just calls the original configure script with the -redo option. It's nicer than calling configure + -redo manually because you don't need to write out the full source path for configure. In qt 5 times this script was called config.status. On windows the script is called config.redo.bat. Rename the config.redo file that QtWriteArgsFile.cmake writes to to config.redo.last, so it doesn't conflict with the name of new config.redo script. Amends 5c40cb0f1a8fad03edb3ef0f97df15e9dd643bdf Pick-to: 6.5 Change-Id: Id47c56a24561410aec6fbaa79b13fc8a78d12ed0 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit 8ffb6ce64cb0183bf6805497b398463549c1ed8d) Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
169 lines
4.6 KiB
Bash
Executable File
169 lines
4.6 KiB
Bash
Executable File
#!/bin/sh
|
|
# 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
|
|
|
|
#-------------------------------------------------------------------------------
|
|
# 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`
|
|
outpathPrefix=$outpath
|
|
|
|
# do this early so we don't store it in config.status
|
|
CFG_TOPLEVEL=
|
|
|
|
SAVED_IFS=$IFS
|
|
IFS='
|
|
'
|
|
|
|
checkTopLevelBuild()
|
|
{
|
|
relpathMangled=$relpath
|
|
if [ x"$1" = x"-top-level" ]; then
|
|
CFG_TOPLEVEL=yes
|
|
relpathMangled=`dirname "$relpath"`
|
|
outpathPrefix="$outpathPrefix/.."
|
|
else
|
|
if [ -f ../.qmake.super ]; then
|
|
echo >&2 "ERROR: You cannot configure qtbase separately within a top-level build."
|
|
exit 1
|
|
fi
|
|
fi
|
|
}
|
|
|
|
OPT_CMDLINE= # expanded version for the script
|
|
determineOptFilePath()
|
|
{
|
|
> "${outpathPrefix}/config.redo.in"
|
|
set -f # suppress globbing in for loop
|
|
for i in "$@"; do
|
|
if [ x"$i" = x"-top-level" ]; then
|
|
continue
|
|
fi
|
|
case $i in
|
|
-redo|--redo)
|
|
optfile=${outpathPrefix}/config.opt
|
|
if ! test -f "$optfile"; then
|
|
echo >&2 "No config.opt present - cannot redo configuration."
|
|
exit 1
|
|
fi
|
|
;;
|
|
*)
|
|
# If redo-ing, write the rest of parameters into the config.redo.in file
|
|
echo \"$i\" >> "${outpathPrefix}/config.redo.in"
|
|
;;
|
|
esac
|
|
done
|
|
}
|
|
|
|
#-------------------------------------------------------------------------------
|
|
# initialize variables
|
|
#-------------------------------------------------------------------------------
|
|
|
|
OPT_HELP=
|
|
|
|
#-------------------------------------------------------------------------------
|
|
# parse command line arguments
|
|
#-------------------------------------------------------------------------------
|
|
parseCommandline()
|
|
{
|
|
# parse the arguments, setting things to "yes" or "no"
|
|
while [ "$#" -gt 0 ]; do
|
|
CURRENT_OPT="$1"
|
|
case "$1" in
|
|
#Autoconf style options
|
|
--*)
|
|
VAR=`echo $1 | sed 's,^--\(.*\),\1,'`
|
|
VAL=yes
|
|
;;
|
|
#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
|
|
|
|
case "$VAR" in
|
|
h|help)
|
|
if [ "$VAL" = "yes" ]; then
|
|
OPT_HELP="$VAL"
|
|
fi
|
|
;;
|
|
*)
|
|
;;
|
|
esac
|
|
done
|
|
}
|
|
|
|
#-------------------------------------------------------------------------------
|
|
# help - interactive parts of the script _after_ this section please
|
|
#-------------------------------------------------------------------------------
|
|
handleHelp()
|
|
{
|
|
if [ "$OPT_HELP" = "yes" ]; then
|
|
cat $relpath/config_help.txt
|
|
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
|
|
exit 0
|
|
fi
|
|
}
|
|
|
|
checkTopLevelBuild "$@"
|
|
parseCommandline "$@"
|
|
handleHelp
|
|
determineOptFilePath "$@"
|
|
|
|
optfilepath=${outpathPrefix}/config.opt
|
|
opttmpfilepath=${outpathPrefix}/config.opt.in
|
|
|
|
redofilepath=${outpathPrefix}/config.redo.last
|
|
redotmpfilepath=${outpathPrefix}/config.redo.in
|
|
|
|
fresh_requested_arg=
|
|
if [ -z "$optfile" ]; then # only write optfile if not currently redoing
|
|
> "$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"
|
|
else
|
|
# Rewriting config.opt into config.opt.in anyway. Allows for direct manipulation of config.opt
|
|
> "$opttmpfilepath"
|
|
for arg in `cat $optfile`; do echo \"$arg\" >> "$opttmpfilepath"; done
|
|
|
|
cmake -DIN_FILE="${opttmpfilepath}" -DREDO_FILE="${redotmpfilepath}" -DOUT_FILE="${redofilepath}" -DIGNORE_ARGS=-top-level -P "${relpath}/cmake/QtWriteArgsFile.cmake"
|
|
optfilepath=${redofilepath}
|
|
fresh_requested_arg=-DFRESH_REQUESTED=TRUE
|
|
fi
|
|
|
|
top_level_arg=
|
|
if [ -n "$CFG_TOPLEVEL" ]; then
|
|
top_level_arg=-DTOP_LEVEL=TRUE
|
|
cd ..
|
|
fi
|
|
|
|
cmake "-DOPTFILE=${optfilepath}" ${top_level_arg} ${fresh_requested_arg} -P "${relpath}/cmake/QtProcessConfigureArgs.cmake"
|
|
|
|
IFS=$SAVED_IFS
|