2017-08-02 17:48:51 +01:00
|
|
|
#! @shell@
|
2017-10-16 22:31:44 +01:00
|
|
|
set -eu -o pipefail +o posix
|
2017-08-02 17:48:51 +01:00
|
|
|
shopt -s nullglob
|
2010-01-16 23:09:27 +00:00
|
|
|
|
2017-09-20 16:35:58 +01:00
|
|
|
if (( "${NIX_DEBUG:-0}" >= 7 )); then
|
|
|
|
set -x
|
|
|
|
fi
|
|
|
|
|
2017-08-03 20:34:23 +01: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-16 23:09:27 +00:00
|
|
|
# Add the flags for the GNAT compiler proper.
|
2017-08-02 17:48:51 +01:00
|
|
|
extraAfter=("--GCC=@out@/bin/gcc")
|
2010-01-16 23:09:27 +00:00
|
|
|
extraBefore=()
|
|
|
|
|
2017-08-02 17:48:51 +01:00
|
|
|
## Add the flags that should be passed to the linker (and prevent
|
2017-06-26 05:43:06 +01:00
|
|
|
## `ld-wrapper' from adding NIX_@infixSalt@_LDFLAGS again).
|
|
|
|
#for i in $NIX_@infixSalt@_LDFLAGS_BEFORE; do
|
2017-08-02 17:48:51 +01:00
|
|
|
# extraBefore+=("-largs" "$i")
|
2010-01-16 23:09:27 +00:00
|
|
|
#done
|
2017-06-26 05:43:06 +01:00
|
|
|
#for i in $NIX_@infixSalt@_LDFLAGS; do
|
2017-08-02 17:48:51 +01:00
|
|
|
# if [ "${i:0:3}" = -L/ ]; then
|
|
|
|
# extraAfter+=("$i")
|
|
|
|
# else
|
|
|
|
# extraAfter+=("-largs" "$i")
|
|
|
|
# fi
|
|
|
|
#done
|
2017-06-26 05:43:06 +01:00
|
|
|
#export NIX_@infixSalt@_LDFLAGS_SET=1
|
2010-01-16 23:09:27 +00:00
|
|
|
|
|
|
|
# Optionally print debug info.
|
2017-09-20 00:10:49 +01:00
|
|
|
if (( "${NIX_DEBUG:-0}" >= 1 )); then
|
2017-08-02 17:48:51 +01: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-16 23:09:27 +00:00
|
|
|
fi
|
|
|
|
|
2017-08-02 17:48:51 +01:00
|
|
|
exec @prog@ "${extraBefore[@]}" "$@" "${extraAfter[@]}"
|