forked from fcitx5-android/prebuilder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-cabal
executable file
·33 lines (26 loc) · 914 Bytes
/
build-cabal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env bash
# stolen from hadrian
CABAL="${CABAL:-cabal}"
GHC="${GHC:-ghc}"
CABFLAGS=("--with-compiler=$GHC" "--disable-documentation" "--disable-profiling" "--disable-library-profiling" $CABFLAGS)
PROJ="$PWD/prebuilder.cabal"
set -euo pipefail
if ! [ -f "$PROJ" ]; then
echo "Current working directory must be prebuilder's top-level folder"
exit 2
fi
if ! type "$CABAL" > /dev/null; then
echo "Please make sure 'cabal' is in your PATH"
exit 2
fi
CABVERSTR=$("$CABAL" --numeric-version)
CABVER=( ${CABVERSTR//./ } )
if [ "${CABVER[0]}" -gt 2 -o "${CABVER[0]}" -eq 2 -a "${CABVER[1]}" -ge 2 ];
then
"$CABAL" build "${CABFLAGS[@]}" -j exe:prebuilder
# use exec instead of new-run to make sure that the libime tools can be accessed
"$CABAL" exec "${CABFLAGS[@]}" prebuilder -- "$@"
else
echo "Cabal version is too old; you need at least cabal-install 2.2"
exit 2
fi