Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1set -euo pipefail
2
3export PATH=$tools/bin
4
5cp -R $tools $out
6chmod -R u+w $out
7
8updateInstallName() {
9 local path="$1"
10
11 cp "$path" "$path.new"
12 install_name_tool -id "$path" "$path.new"
13 codesign -f -i "$(basename "$path")" -s - "$path.new"
14 mv -f "$path.new" "$path"
15}
16
17find $out/lib -type f -name '*.dylib' -print0 | while IFS= read -r -d $'\0' lib; do
18 updateInstallName "$lib"
19done
20
21# Provide a gunzip script.
22cat > $out/bin/gunzip <<EOF
23#!$out/bin/sh
24exec $out/bin/gzip -d "\$@"
25EOF
26chmod +x $out/bin/gunzip
27
28# Provide fgrep/egrep.
29echo "#! $out/bin/sh" > $out/bin/egrep
30echo "exec $out/bin/grep -E \"\$@\"" >> $out/bin/egrep
31echo "#! $out/bin/sh" > $out/bin/fgrep
32echo "exec $out/bin/grep -F \"\$@\"" >> $out/bin/fgrep
33
34cat >$out/bin/dsymutil << EOF
35#!$out/bin/sh
36EOF
37
38chmod +x $out/bin/egrep $out/bin/fgrep $out/bin/dsymutil