Make only install target in libffi.
[hadrian.git] / build.cabal.sh
1 #!/usr/bin/env bash
2
3 set -euo pipefail
4
5 # readlink on os x, doesn't support -f, to prevent the
6 # need of installing coreutils (e.g. through brew, just
7 # for readlink, we use the follownig substitute.
8 #
9 # source: http://stackoverflow.com/a/1116890
10 function rl {
11 TARGET_FILE="$1"
12
13 cd "$(dirname "$TARGET_FILE")"
14 TARGET_FILE="$(basename "$TARGET_FILE")"
15
16 # Iterate down a (possible) chain of symlinks
17 while [ -L "$TARGET_FILE" ]
18 do
19 TARGET_FILE="$(readlink "$TARGET_FILE")"
20 cd "$(dirname "$TARGET_FILE")"
21 TARGET_FILE="$(basename "$TARGET_FILE")"
22 done
23
24 # Compute the canonicalized name by finding the physical path
25 # for the directory we're in and appending the target file.
26 PHYS_DIR="$(pwd -P)"
27 RESULT="$PHYS_DIR/$TARGET_FILE"
28 echo "$RESULT"
29 }
30
31 absoluteRoot="$(dirname "$(rl "$0")")"
32 cd "$absoluteRoot"
33
34 # Initialize sandbox if necessary
35 if ! ( cabal sandbox hc-pkg list 2>&1 > /dev/null ); then
36 cabal sandbox init
37 cabal install \
38 --dependencies-only \
39 --disable-library-profiling \
40 --disable-shared
41 fi
42
43 cabal run hadrian -- \
44 --lint \
45 --directory "$absoluteRoot/.." \
46 --colour \
47 "$@"