Remove ghctags (#16274)
[ghc.git] / hadrian / build.cabal.sh
1 #!/usr/bin/env bash
2
3 CABAL=cabal
4 CABFLAGS="--disable-documentation --disable-profiling --disable-library-profiling"
5
6 # It is currently more robust to pass Cabal an absolute path to the project file.
7 PROJ="$PWD/hadrian/cabal.project"
8
9 set -euo pipefail
10
11 if ! [ -f "$PROJ" ]; then
12 echo "Current working directory must be GHC's top-level folder"
13 exit 2
14 fi
15
16 if ! type "$CABAL" > /dev/null; then
17 echo "Please make sure 'cabal' is in your PATH"
18 exit 2
19 fi
20
21 CABVERSTR=$("$CABAL" --numeric-version)
22 CABVER=( ${CABVERSTR//./ } )
23
24 if [ "${CABVER[0]}" -gt 2 -o "${CABVER[0]}" -eq 2 -a "${CABVER[1]}" -ge 2 ];
25 then
26 "$CABAL" --project-file="$PROJ" new-build $CABFLAGS -j exe:hadrian
27 # use new-exec instead of new-run to make sure that the build-tools (alex & happy) are in PATH
28 "$CABAL" --project-file="$PROJ" new-exec $CABFLAGS hadrian -- \
29 --directory "$PWD" \
30 "$@"
31 else
32 echo "Cabal version is too old; you need at least cabal-install 2.2"
33 exit 2
34 fi