-
Notifications
You must be signed in to change notification settings - Fork 1
/
cabal-arm-force
43 lines (36 loc) · 1.33 KB
/
cabal-arm-force
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
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
#A WORKAROUND for https://github.com/haskell/cabal/issues/2085
export CABAL_ENV=--builddir=dist/arm
export CABAL_BLD="--with-ghc=arm-unknown-linux-gnueabihf-ghc
--with-ghc-pkg=arm-unknown-linux-gnueabihf-ghc-pkg
--with-ld=arm-linux-gnueabihf-ld
--with-strip=arm-linux-gnueabihf-strip
--with-gcc=arm-linux-gnueabihf-gcc
--hsc2hs-options=--cross-compile"
export CABAL_CFG="--flags=-th --configure-option=--host=arm-linux-gnueabihf --disable-shared"
function install {
pkg=$1
tmpDir=`mktemp -d`
pushd $tmpDir
cabal unpack $pkg
cd $pkg*
ghc ./$(find Setup.*hs) -o setup
./setup configure $CABAL_BLD $CABAL_CFG
./setup build
sudo ./setup install
popd
rm -rf $tmpDir
}
tail=${@:2}
# Some extra options, depending on what command was invoked.
case $1 in
install) install $tail;;
configure) cabal $CABAL_ENV $CABAL_BLD $CABAL_CFG "$@" ;;
build) cabal $CABAL_ENV $CABAL_BLD "$@";;
rebuild) cabal clean
cabal $CABAL_ENV $CABAL_BLD $CABAL_CFG configure $tail
cabal $CABAL_ENV $CABAL_BLD build $tail ;;
list|info|update) echo "not supported" ;;
"") echo "not supported" ;;
*) cabal "$@" ;;
esac