sdrangel: fix build on x86_64-darwin
[NixPkgs.git] / pkgs / build-support / bintools-wrapper / darwin-install_name_tool-wrapper.sh
blob376a7abfe41c2aab12b96f172dfc85588796b068
1 #! @shell@
2 # shellcheck shell=bash
4 set -eu -o pipefail +o posix
5 shopt -s nullglob
7 if (( "${NIX_DEBUG:-0}" >= 7 )); then
8 set -x
9 fi
11 source @signingUtils@
13 extraAfter=()
14 extraBefore=()
15 params=("$@")
17 input=
19 pprev=
20 prev=
21 for p in \
22 ${extraBefore+"${extraBefore[@]}"} \
23 ${params+"${params[@]}"} \
24 ${extraAfter+"${extraAfter[@]}"}
26 if [ "$pprev" != "-change" ] && [[ "$prev" != -* ]] && [[ "$p" != -* ]]; then
27 input="$p"
29 pprev="$prev"
30 prev="$p"
31 done
33 # Optionally print debug info.
34 if (( "${NIX_DEBUG:-0}" >= 1 )); then
35 # Old bash workaround, see above.
36 echo "extra flags before to @prog@:" >&2
37 printf " %q\n" ${extraBefore+"${extraBefore[@]}"} >&2
38 echo "original flags to @prog@:" >&2
39 printf " %q\n" ${params+"${params[@]}"} >&2
40 echo "extra flags after to @prog@:" >&2
41 printf " %q\n" ${extraAfter+"${extraAfter[@]}"} >&2
44 @prog@ \
45 ${extraBefore+"${extraBefore[@]}"} \
46 ${params+"${params[@]}"} \
47 ${extraAfter+"${extraAfter[@]}"}
49 sign "$input"