[skip ci] correct formatting of casArray# in docs for casSmallArray#
[ghc.git] / build.nix.sh
1 #!/usr/bin/env nix-shell
2 #! nix-shell -i bash shell.nix
3
4 # This script sets up the build environment by invoking nix-shell shell.nix
5 # and then runs the hadrian executable.
6
7 function rl {
8 TARGET_FILE="$1"
9
10 cd "$(dirname "$TARGET_FILE")"
11 TARGET_FILE="$(basename "$TARGET_FILE")"
12
13 # Iterate down a (possible) chain of symlinks
14 while [ -L "$TARGET_FILE" ]
15 do
16 TARGET_FILE="$(readlink "$TARGET_FILE")"
17 cd "$(dirname "$TARGET_FILE")"
18 TARGET_FILE="$(basename "$TARGET_FILE")"
19 done
20
21 # Compute the canonicalized name by finding the physical path
22 # for the directory we're in and appending the target file.
23 PHYS_DIR="$(pwd -P)"
24 RESULT="$PHYS_DIR/$TARGET_FILE"
25 echo "$RESULT"
26 }
27
28 absoluteRoot="$(dirname "$(rl "$0")")"
29 echo $absoluteRoot
30 cd "$absoluteRoot"
31
32 hadrian \
33 --directory="$absoluteRoot/.." \
34 "$@"