summaryrefslogtreecommitdiffstats
path: root/scripts/makepkg.sh.in
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/makepkg.sh.in')
-rw-r--r--scripts/makepkg.sh.in15
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 580f16ce..025f7564 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -2624,6 +2624,16 @@ while true; do
shift
done
+# attempt to consume any extra argv as environment variables. this supports
+# overriding (e.g. CC=clang) as well as overriding (e.g. CFLAGS+=' -g').
+extra_environment=()
+while [[ $1 ]]; do
+ if [[ $1 = [_[:alpha:]]*([[:alnum:]_])?(+)=* ]]; then
+ extra_environment+=("$1")
+ fi
+ shift
+done
+
# setup signal traps
trap 'clean_up' 0
for signal in TERM HUP QUIT; do
@@ -2706,6 +2716,11 @@ if [[ ! -w $BUILDDIR ]]; then
exit 1
fi
+# override settings from extra variables on commandline, if any
+if (( ${#extra_environment[*]} )); then
+ export "${extra_environment[@]}"
+fi
+
PKGDEST=${_PKGDEST:-$PKGDEST}
PKGDEST=${PKGDEST:-$startdir} #default to $startdir if undefined
if (( ! (NOBUILD || GENINTEG) )) && [[ ! -w $PKGDEST ]]; then