2017-08-02 18:48:51 +02:00
|
|
|
#! @shell@
|
2017-08-03 21:34:23 +02:00
|
|
|
set -eu -o pipefail
|
2017-08-02 18:48:51 +02:00
|
|
|
shopt -s nullglob
|
2010-01-17 00:09:27 +01:00
|
|
|
|
2017-08-03 21:34:23 +02:00
|
|
|
# N.B. Gnat is not used during bootstrapping, so we don't need to
|
|
|
|
# worry about the old bash empty array `set -u` workarounds.
|
|
|
|
|
2010-01-17 00:09:27 +01:00
|
|
|
# Add the flags for the GNAT compiler proper.
|
2017-08-02 18:48:51 +02:00
|
|
|
extraAfter=("--GCC=@out@/bin/gcc")
|
2010-01-17 00:09:27 +01:00
|
|
|
extraBefore=()
|
|
|
|
|
2017-08-02 18:48:51 +02:00
|
|
|
## Add the flags that should be passed to the linker (and prevent
|
2017-06-26 06:43:06 +02:00
|
|
|
## `ld-wrapper' from adding NIX_@infixSalt@_LDFLAGS again).
|
|
|
|
#for i in $NIX_@infixSalt@_LDFLAGS_BEFORE; do
|
2017-08-02 18:48:51 +02:00
|
|
|
# extraBefore+=("-largs" "$i")
|
2010-01-17 00:09:27 +01:00
|
|
|
#done
|
2017-06-26 06:43:06 +02:00
|
|
|
#for i in $NIX_@infixSalt@_LDFLAGS; do
|
2017-08-02 18:48:51 +02:00
|
|
|
# if [ "${i:0:3}" = -L/ ]; then
|
|
|
|
# extraAfter+=("$i")
|
|
|
|
# else
|
|
|
|
# extraAfter+=("-largs" "$i")
|
|
|
|
# fi
|
|
|
|
#done
|
2017-06-26 06:43:06 +02:00
|
|
|
#export NIX_@infixSalt@_LDFLAGS_SET=1
|
2010-01-17 00:09:27 +01:00
|
|
|
|
|
|
|
# Optionally print debug info.
|
2017-08-03 21:34:23 +02:00
|
|
|
if [ -n "${NIX_DEBUG:-}" ]; then
|
2017-08-02 18:48:51 +02:00
|
|
|
echo "extra flags before to @prog@:" >&2
|
|
|
|
printf " %q\n" "${extraBefore[@]}" >&2
|
|
|
|
echo "original flags to @prog@:" >&2
|
|
|
|
printf " %q\n" "$@" >&2
|
|
|
|
echo "extra flags after to @prog@:" >&2
|
|
|
|
printf " %q\n" "${extraAfter[@]}" >&2
|
2010-01-17 00:09:27 +01:00
|
|
|
fi
|
|
|
|
|
2017-08-02 18:48:51 +02:00
|
|
|
exec @prog@ "${extraBefore[@]}" "$@" "${extraAfter[@]}"
|