1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-13 11:42:21 +00:00

package: check for same compiler flags between build runs

I've had ksh crash one too many times when returning to a previous
build directory as I forgot to restore the previously-used CCFLAGS.

bin/package, src/cmd/INIT/package.sh:
- Save each of CC, CCFLAGS, CCLDFLAGS, LDFLAGS, KSH_RELFLAGS on the
  first build run. On subsequent runs, compare and refuse to run if
  they changed, issuing an informative error message.
- Allow override by exporting FORCE_FLAGS. Don't tell anyone :)
This commit is contained in:
Martijn Dekker 2021-03-19 14:59:32 +00:00
parent 33d0f004de
commit 48e6dd989c
2 changed files with 68 additions and 0 deletions

View file

@ -5854,6 +5854,40 @@ cat $j $k
view) exit 0 ;;
esac
# check against previous compiler and flags
err=
for var in CC CCFLAGS CCLDFLAGS LDFLAGS KSH_RELFLAGS
do store=$INSTALLROOT/lib/package/gen/$var
eval "new=\$$var"
if test -e $store
then old=`cat $store`
case $old in
"$new") ;;
*) case $old in
'') old="(none)" ;;
*) old="'$old'" ;;
esac
case $new in
'') new="(none)" ;;
*) new="'$new'" ;;
esac
echo "$command: $var changed from $old to $new" >&2
err=y ;;
esac
else case $new in
'') ;;
*) echo "$new" ;;
esac > $store
fi
done
case $err,${FORCE_FLAGS+f} in
y,) echo "$command: This would likely break the build. Restore the flag(s)," >&2
echo "$command: or delete the build directory and rebuild from scratch." >&2
exit 1 ;;
esac
unset err var store old new
# all work under $INSTALLROOT/src
$make cd $INSTALLROOT/src

View file

@ -5854,6 +5854,40 @@ cat $j $k
view) exit 0 ;;
esac
# check against previous compiler and flags
err=
for var in CC CCFLAGS CCLDFLAGS LDFLAGS KSH_RELFLAGS
do store=$INSTALLROOT/lib/package/gen/$var
eval "new=\$$var"
if test -e $store
then old=`cat $store`
case $old in
"$new") ;;
*) case $old in
'') old="(none)" ;;
*) old="'$old'" ;;
esac
case $new in
'') new="(none)" ;;
*) new="'$new'" ;;
esac
echo "$command: $var changed from $old to $new" >&2
err=y ;;
esac
else case $new in
'') ;;
*) echo "$new" ;;
esac > $store
fi
done
case $err,${FORCE_FLAGS+f} in
y,) echo "$command: This would likely break the build. Restore the flag(s)," >&2
echo "$command: or delete the build directory and rebuild from scratch." >&2
exit 1 ;;
esac
unset err var store old new
# all work under $INSTALLROOT/src
$make cd $INSTALLROOT/src