2017-08-02 18:48:51 +02:00
|
|
|
#! @shell@
|
|
|
|
set -e -o pipefail
|
|
|
|
shopt -s nullglob
|
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.
|
2014-10-10 14:25: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-06-26 06:43:06 +02:00
|
|
|
if [ -n "$NIX_@infixSalt@_GNAT_WRAPPER_EXEC_HOOK" ]; then
|
|
|
|
source "$NIX_@infixSalt@_GNAT_WRAPPER_EXEC_HOOK"
|
2010-01-17 00:09:27 +01:00
|
|
|
fi
|
|
|
|
|
2017-08-02 18:48:51 +02:00
|
|
|
exec @prog@ "${extraBefore[@]}" "$@" "${extraAfter[@]}"
|