2013-05-07 23:36:49 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# Bootstraps from an empty cabal to all the necessary haskell packages
|
|
|
|
# being installed, with the necessary patches to work on Android.
|
|
|
|
#
|
|
|
|
# Packages are installed at specific versions we have patches for. Newer
|
|
|
|
# versions often break cross-compilation by adding TH, etc.
|
|
|
|
#
|
|
|
|
# Needs some extra C libraries to be installed inside the cross-compiler
|
|
|
|
# lib directory: libgnutls libxml2
|
2013-05-08 15:31:42 +00:00
|
|
|
#
|
2013-05-08 16:23:38 +00:00
|
|
|
# When run with "native" as a parameter, the same versions are installed
|
|
|
|
# in the host system. This is needed in order to use the EvilSplicer to
|
|
|
|
# expand Template Haskell.
|
2013-05-07 23:36:49 +00:00
|
|
|
|
|
|
|
# lib dir
|
|
|
|
set -e
|
|
|
|
|
2013-05-09 02:33:30 +00:00
|
|
|
if [ "$1" ]; then
|
|
|
|
mode="$1"
|
|
|
|
shift 1
|
|
|
|
fi
|
|
|
|
cabalopts="$@"
|
|
|
|
|
|
|
|
cabalinstall () {
|
|
|
|
echo cabal install "$@" "$cabalopts"
|
|
|
|
eval cabal install "$@" "$cabalopts"
|
2013-05-08 15:31:42 +00:00
|
|
|
}
|
2013-05-07 23:36:49 +00:00
|
|
|
|
|
|
|
patched () {
|
|
|
|
pkg=$1
|
|
|
|
version=$2
|
2013-05-08 15:31:42 +00:00
|
|
|
if [ "$native" ]; then
|
2013-05-09 02:33:30 +00:00
|
|
|
cabalinstall --force-reinstalls $pkg-$version
|
2013-05-08 15:31:42 +00:00
|
|
|
else
|
|
|
|
shift 2
|
|
|
|
cabal unpack $pkg-$version
|
|
|
|
cd $pkg-$version
|
|
|
|
for patch in ../../haskell-patches/${pkg}_*; do
|
|
|
|
echo applying $patch
|
|
|
|
patch -p1 < $patch
|
|
|
|
done
|
2013-05-09 02:33:30 +00:00
|
|
|
cabalinstall "$@"
|
2013-05-08 15:31:42 +00:00
|
|
|
cd ..
|
|
|
|
fi
|
2013-05-07 23:36:49 +00:00
|
|
|
}
|
|
|
|
|
2013-05-08 06:20:52 +00:00
|
|
|
unpatched () {
|
2013-05-09 20:09:43 +00:00
|
|
|
cabalinstall "$@"
|
2013-05-08 15:31:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
onlycross () {
|
|
|
|
if [ ! "$native" ]; then
|
2013-05-09 20:09:43 +00:00
|
|
|
eval "$@"
|
2013-05-08 15:31:42 +00:00
|
|
|
fi
|
2013-05-08 06:20:52 +00:00
|
|
|
}
|
|
|
|
|
2013-05-08 16:30:39 +00:00
|
|
|
onlynative () {
|
|
|
|
if [ "$native" ]; then
|
2013-05-09 20:09:43 +00:00
|
|
|
eval "$@"
|
2013-05-08 16:30:39 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2013-05-08 15:31:42 +00:00
|
|
|
install_pkgs () {
|
|
|
|
rm -rf tmp
|
|
|
|
mkdir tmp
|
|
|
|
cd tmp
|
2013-05-07 23:36:49 +00:00
|
|
|
|
2013-05-08 20:48:29 +00:00
|
|
|
onlycross unpatched bytestring-0.10.3.0 text-0.11.3.1 parsec-3.1.3
|
2013-05-08 15:31:42 +00:00
|
|
|
patched network 2.4.1.0
|
|
|
|
unpatched cereal-0.3.5.2
|
|
|
|
patched socks 0.4.2
|
|
|
|
unpatched hslogger-1.2.1
|
|
|
|
patched MissingH 1.2.0.0
|
|
|
|
patched unix-time 0.1.4
|
|
|
|
patched async 2.0.1.4
|
|
|
|
patched zlib 0.5.4.0
|
|
|
|
patched primitive 0.5.0.1
|
|
|
|
patched vector 0.10.0.1
|
|
|
|
patched distributive 0.3
|
|
|
|
unpatched hashable-1.1.2.5
|
|
|
|
patched case-insensitive 0.4.0.1
|
|
|
|
unpatched nats-0.1 semigroups-0.9 tagged-0.4.4 comonad-3.0.1.1 comonad-transformers-3.0.1
|
|
|
|
patched profunctors 3.3
|
|
|
|
patched split 0.2.1.2
|
|
|
|
unpatched monads-tf-0.1.0.1
|
|
|
|
onlycross patched gnutls 0.1.4
|
|
|
|
unpatched attoparsec-0.10.4.0 blaze-builder-0.3.1.1
|
|
|
|
patched syb 0.3.7
|
|
|
|
patched aeson 0.6.1.0
|
|
|
|
patched lifted-base 0.2.0.2
|
|
|
|
patched resourcet 0.4.4
|
|
|
|
patched monad-control 0.3.1.4
|
|
|
|
unpatched conduit-0.5.6
|
|
|
|
patched monad-logger 0.2.3.2
|
|
|
|
unpatched reflection-1.1.7 bifunctors-3.2 semigroupoids-3.0.2
|
|
|
|
unpatched bifunctors-3.2 comonads-fd-3.0.1 groupoids-3.0.1.1
|
|
|
|
unpatched profunctor-extras-3.3
|
|
|
|
patched lens 3.8.5
|
|
|
|
unpatched xml-types-0.3.3
|
|
|
|
patched libxml-sax 0.7.3
|
|
|
|
patched network-conduit 0.6.2.2
|
|
|
|
unpatched asn1-data-0.7.1 asn1-types-0.1.3 attoparsec-conduit-0.5.0.3
|
|
|
|
unpatched blaze-builder-conduit-0.5.0.3 blaze-markup-0.5.1.5 blaze-html-0.5.1.3
|
|
|
|
patched cipher-aes 0.1.7
|
|
|
|
unpatched crypto-api-0.10.2
|
|
|
|
unpatched cprng-aes-0.3.4
|
|
|
|
unpatched http-types-0.8.0 mime-types-0.1.0.3
|
2013-05-09 18:07:53 +00:00
|
|
|
patched certificate 1.3.7
|
2013-05-09 16:38:26 +00:00
|
|
|
unpatched system-fileio-0.3.11 tls-1.1.2
|
2013-05-08 15:31:42 +00:00
|
|
|
unpatched utf8-string-0.3.7
|
|
|
|
unpatched publicsuffixlist-0.1
|
|
|
|
unpatched xml-conduit-1.0.3.3
|
|
|
|
unpatched zlib-bindings-0.1.1.3 zlib-conduit-0.5.0.3
|
|
|
|
patched shakespeare 1.0.3
|
|
|
|
patched hamlet 1.1.6.1
|
|
|
|
patched xml-hamlet 0.4.0.3
|
|
|
|
unpatched certificate-1.3.7
|
|
|
|
unpatched dataenc-0.12 hxt-charproperties-9.1.1 \
|
|
|
|
hxt-regex-xmlschema-9.1.0 hxt-unicode-9.0.2 hxt-9.3.1.1
|
|
|
|
unpatched -f-templateHaskell QuickCheck-2.5.1.1
|
|
|
|
unpatched Crypto-4.2.5.1
|
|
|
|
patched HTTP 4000.2.8
|
|
|
|
patched hS3 0.5.7
|
|
|
|
patched file-embed 0.0.4.7
|
|
|
|
patched gsasl 0.3.5 \
|
|
|
|
--ghc-options=-I$HOME/.ghc/android-14/arm-linux-androideabi-4.7/arm-linux-androideabi/sysroot/usr/include/ \
|
2013-05-08 20:48:29 +00:00
|
|
|
--ld-options="-L$HOME/.ghc/android-14/arm-linux-androideabi-4.7/arm-linux-androideabi/sysroot/usr/lib/"
|
2013-05-08 15:31:42 +00:00
|
|
|
onlycross patched network-protocol-xmpp 0.4.4
|
2013-05-08 17:31:30 +00:00
|
|
|
onlynative network-protocol-xmpp
|
2013-05-08 15:31:42 +00:00
|
|
|
patched shakespeare-css 1.0.2
|
|
|
|
patched shakespeare-i18n 1.0.0.2
|
|
|
|
patched shakespeare-js 1.1.2
|
|
|
|
patched persistent 1.1.5.1
|
|
|
|
onlycross unpatched largeword-1.0.4 crypto-api-0.10.2 http-date-0.0.4 \
|
|
|
|
cryptohash-0.8.3 vault-0.2.0.4 unix-compat-0.4.1.1 \
|
|
|
|
crypto-conduit-0.4.3 wai-1.3.0.3
|
|
|
|
patched wai-app-static 1.3.1
|
|
|
|
onlycross patched wai-extra 1.3.2.1
|
|
|
|
patched yesod-routes 1.1.2
|
|
|
|
onlycross unpatched http-conduit-1.8.7.1
|
2013-05-08 16:08:24 +00:00
|
|
|
onlycross patched DAV 0.3
|
2013-05-08 16:30:39 +00:00
|
|
|
onlynative unpatched DAV
|
2013-05-08 15:31:42 +00:00
|
|
|
patched yesod-core 1.1.8
|
|
|
|
patched yesod-persistent 1.1.0.1
|
|
|
|
patched yesod-form 1.2.1.1
|
|
|
|
onlycross unpatched warp-1.3.7.2 yaml-0.8.2
|
|
|
|
patched yesod-default 1.1.3.2
|
|
|
|
patched yesod 1.1.8
|
|
|
|
patched yesod-static 1.1.2
|
2013-05-08 16:10:13 +00:00
|
|
|
unpatched ifelse-0.85
|
2013-05-08 16:16:03 +00:00
|
|
|
unpatched SafeSemaphore-0.9.0
|
2013-05-09 20:09:43 +00:00
|
|
|
if [ ! "$native" ]; then cabal install bloomfilter-1.2.6.10 --constraint 'bytestring >= 0.10.3.0'; fi
|
2013-05-09 02:33:30 +00:00
|
|
|
onlynative unpatched bloomfilter-1.2.6.10
|
2013-05-08 16:16:03 +00:00
|
|
|
unpatched edit-distance-0.2.1.2
|
|
|
|
unpatched uuid-1.2.12
|
|
|
|
unpatched json-0.7
|
2013-05-08 16:30:39 +00:00
|
|
|
unpatched SHA-1.6.1
|
|
|
|
onlycross unpatched data-endian-0.0.1
|
2013-05-09 15:35:01 +00:00
|
|
|
unpatched hinotify-0.3.5
|
2013-05-08 15:31:42 +00:00
|
|
|
|
|
|
|
cd ..
|
|
|
|
rm -rf tmp
|
|
|
|
}
|
|
|
|
|
2013-05-09 02:33:30 +00:00
|
|
|
native_install () {
|
|
|
|
echo "Native install"
|
2013-05-08 16:23:38 +00:00
|
|
|
native=1
|
|
|
|
if [ ! -e $HOME/.cabal/packages/hackage.haskell.org ]; then
|
|
|
|
cabal update
|
|
|
|
fi
|
|
|
|
install_pkgs
|
2013-05-09 02:33:30 +00:00
|
|
|
}
|
|
|
|
|
2013-05-09 17:08:24 +00:00
|
|
|
cross_path () {
|
|
|
|
PATH=$HOME/.ghc/android-14/arm-linux-androideabi-4.7/bin:$HOME/.ghc/android-14/arm-linux-androideabi-4.7/arm-linux-androideabi/bin:$PATH
|
|
|
|
}
|
|
|
|
|
2013-05-09 02:33:30 +00:00
|
|
|
cross_install () {
|
|
|
|
echo "Cross install"
|
2013-05-08 20:48:29 +00:00
|
|
|
native=
|
2013-05-09 17:08:24 +00:00
|
|
|
cross_path
|
2013-05-08 16:23:38 +00:00
|
|
|
if [ ! -e $HOME/.ghc/android-14/arm-linux-androideabi-4.7/cabal/packages/hackage.haskell.org ]; then
|
|
|
|
cabal update
|
|
|
|
fi
|
|
|
|
install_pkgs
|
2013-05-09 02:33:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case "$mode" in
|
|
|
|
native)
|
|
|
|
native_install
|
|
|
|
;;
|
|
|
|
cross)
|
|
|
|
cross_install
|
|
|
|
;;
|
2013-05-09 17:08:24 +00:00
|
|
|
cleancross)
|
|
|
|
# cross install, first removing all currently installed
|
|
|
|
# packages except those part of ghc
|
|
|
|
rm -f $(grep -l $HOME/.ghc/android-14/arm-linux-androideabi-4.7/.cabal/lib/ $HOME/.ghc/android-14/arm-linux-androideabi-4.7/lib/ghc-*/package.conf.d/*.conf)
|
|
|
|
cross_path
|
|
|
|
ghc-pkg recache
|
|
|
|
cross_install
|
|
|
|
;;
|
2013-05-09 02:33:30 +00:00
|
|
|
"")
|
|
|
|
cross_install
|
|
|
|
native_install
|
|
|
|
;;
|
|
|
|
esac
|