Skip to content

Commit

Permalink
unify configure command line saving with configure.exe
Browse files Browse the repository at this point in the history
that is, save it to config.opt and recall it when -redo is used (and do
not write it again in this case).

a trivial config.status is still created, as having it is very
convenient when shadow-building.

Task-number: QTBUG-38792
Change-Id: I5e9f7374d6bfc60c427cbfd5e9b3e68bfcaae9f2
Reviewed-by: Lars Knoll <[email protected]>
  • Loading branch information
ossilator committed Aug 18, 2016
1 parent fd3e12e commit 672c0b3
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 10 deletions.
3 changes: 3 additions & 0 deletions config_help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ Configure meta:
-help, -h ............ Display this help screen
-verbose, -v ......... Print verbose messages during configuration
-continue ............ Continue configure despite errors
-redo ................ Re-configure with previously used options.
Additional options may be passed, but will not be
saved for later use by -redo.

Build options:

Expand Down
51 changes: 41 additions & 10 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,45 @@ if [ x"$1" = x"-top-level" ]; then
shift
fi

# later cache the command line in config.status
OPT_CMDLINE=
CFG_REDO=no
OPT_CMDLINE= # excluding -verbose (for config.opt)
QMAKE_CMDLINE= # including -verbose (for actual parsing)
set -f # suppress globbing in for loop
SAVED_IFS=$IFS
IFS='
'
for i in "$@"; do
case $i in
-redo|--redo)
if ! test -f config.opt; then
echo >&2 "No config.opt present - cannot redo configuration."
exit 1
fi
for a in `cat config.opt`; do
OPT_CMDLINE="$OPT_CMDLINE
$a"
QMAKE_CMDLINE="$QMAKE_CMDLINE
$a"
done
CFG_REDO=yes # suppress repeated config.opt writeout
continue
;;
-v|-verbose|--verbose|-no-v|-no-verbose|--no-verbose)
;;
*)
OPT_CMDLINE="$OPT_CMDLINE
$i"
;;
esac
QMAKE_CMDLINE="$QMAKE_CMDLINE
$i"
if [ "x$i" != "x-v" ]; then
[ -z "${i##* *}" ] && i="'$i'"
OPT_CMDLINE="$OPT_CMDLINE $i"
fi
done
set --
for i in $QMAKE_CMDLINE; do
set -- "$@" "$i"
done
set +f
IFS=$SAVED_IFS

# initialize global variables
DEVICE_VARS_FILE=.device.vars
Expand Down Expand Up @@ -1928,14 +1957,16 @@ fi
#-------------------------------------------------------------------------------
# finally save the executed command to another script
#-------------------------------------------------------------------------------
if [ `basename $0` != "config.status" ]; then
CONFIG_STATUS="$relpath/$relconf$OPT_CMDLINE"
if [ $CFG_REDO = no ]; then
echo "$OPT_CMDLINE" | grep '\-confirm\-license' >/dev/null 2>&1 || OPT_CMDLINE="$OPT_CMDLINE
-confirm-license"

echo "$CONFIG_STATUS" | grep '\-confirm\-license' >/dev/null 2>&1 || CONFIG_STATUS="$CONFIG_STATUS -confirm-license"
# skip first line, as it's always empty due to unconditional field separation
echo "$OPT_CMDLINE" | tail -n +2 > "$outpath/config.opt"

[ -f "$outpath/config.status" ] && rm -f "$outpath/config.status"
echo "#!/bin/sh" > "$outpath/config.status"
echo "$CONFIG_STATUS \"\$@\"" >> "$outpath/config.status"
echo "$relpath/$relconf -redo \"\$@\"" >> "$outpath/config.status"
chmod +x "$outpath/config.status"
fi

Expand Down

0 comments on commit 672c0b3

Please sign in to comment.