2013-09-22 23:30:44 +00:00
|
|
|
#!/bin/bash
|
2013-05-07 23:36:49 +00:00
|
|
|
# Bootstraps from an empty cabal to all the necessary haskell packages
|
|
|
|
# being installed, with the necessary patches to work on Android.
|
|
|
|
#
|
2013-09-22 18:13:31 +00:00
|
|
|
# You should install ghc-android first.
|
|
|
|
#
|
2014-08-15 14:58:04 +00:00
|
|
|
# Note that the newest version of packages are installed.
|
2013-09-22 05:27:15 +00:00
|
|
|
# It attempts to reuse patches for older versions, but
|
|
|
|
# new versions of packages often break cross-compilation by adding TH,
|
|
|
|
# etc
|
2013-09-23 21:39:53 +00:00
|
|
|
#
|
|
|
|
# Future work: Convert to using the method used here:
|
|
|
|
# https://github.com/kaoskorobase/ghc-ios-cabal-scripts/
|
2013-05-07 23:36:49 +00:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2013-09-22 19:58:13 +00:00
|
|
|
if [ ! -d haskell-patches ]; then
|
|
|
|
cd standalone/android
|
|
|
|
fi
|
|
|
|
|
2013-05-09 02:33:30 +00:00
|
|
|
cabalopts="$@"
|
|
|
|
|
2014-05-26 01:25:04 +00:00
|
|
|
setupcabal () {
|
|
|
|
cabal update
|
|
|
|
|
|
|
|
# Workaround for http://www.reddit.com/r/haskell/comments/26045a/if_youre_finding_cabal_cant_build_your_project/
|
|
|
|
# should be able to remove this eventually.
|
|
|
|
cabal install transformers-compat -fthree
|
|
|
|
cabal install mtl-2.1.3.1
|
2014-05-26 01:44:28 +00:00
|
|
|
|
|
|
|
# Some packages fail to install in a non unicode locale.
|
|
|
|
LANG=en_US.UTF-8
|
|
|
|
export LANG
|
2014-05-26 17:13:33 +00:00
|
|
|
|
|
|
|
# The android build chroot has recent versions of alex and happy
|
|
|
|
# installed here.
|
|
|
|
PATH=$HOME/bin:$PATH
|
|
|
|
export PATH
|
2014-05-26 01:25:04 +00:00
|
|
|
}
|
|
|
|
|
2013-05-09 02:33:30 +00:00
|
|
|
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
|
2014-02-07 21:57:04 +00:00
|
|
|
ver=$2
|
|
|
|
if [ -z "$ver" ]; then
|
|
|
|
cabal unpack $pkg
|
|
|
|
else
|
|
|
|
cabal unpack $pkg-$ver
|
|
|
|
fi
|
2013-09-22 05:27:15 +00:00
|
|
|
cd $pkg*
|
|
|
|
git init
|
2013-09-22 20:32:19 +00:00
|
|
|
git config user.name dummy
|
|
|
|
git config user.email dummy@example.com
|
2013-09-22 05:27:15 +00:00
|
|
|
git add .
|
|
|
|
git commit -m "pre-patched state of $pkg"
|
2013-12-18 21:41:17 +00:00
|
|
|
for patch in ../../haskell-patches/${pkg}_* ../../../no-th/haskell-patches/${pkg}_*; do
|
2013-12-17 03:05:00 +00:00
|
|
|
if [ -e "$patch" ]; then
|
|
|
|
echo trying $patch
|
|
|
|
if ! patch -p1 < $patch; then
|
|
|
|
echo "failed to apply $patch"
|
|
|
|
echo "please resolve this, replace the patch with a new version, and exit the subshell to continue"
|
|
|
|
$SHELL
|
|
|
|
fi
|
2013-09-22 05:27:15 +00:00
|
|
|
fi
|
|
|
|
done
|
2014-02-08 17:03:44 +00:00
|
|
|
cabalinstall
|
2013-09-22 05:27:15 +00:00
|
|
|
rm -rf $pkg*
|
|
|
|
cd ..
|
2013-05-07 23:36:49 +00:00
|
|
|
}
|
|
|
|
|
2013-09-22 05:27:15 +00:00
|
|
|
installgitannexdeps () {
|
2013-09-23 14:25:21 +00:00
|
|
|
pushd ../..
|
2013-11-11 04:03:24 +00:00
|
|
|
echo cabal install --only-dependencies "$@"
|
2013-09-22 23:30:44 +00:00
|
|
|
cabal install --only-dependencies "$@"
|
|
|
|
popd
|
2013-05-08 16:30:39 +00:00
|
|
|
}
|
|
|
|
|
2013-05-08 15:31:42 +00:00
|
|
|
install_pkgs () {
|
|
|
|
rm -rf tmp
|
|
|
|
mkdir tmp
|
|
|
|
cd tmp
|
2013-09-22 05:27:15 +00:00
|
|
|
patched network
|
2013-09-23 00:14:48 +00:00
|
|
|
patched unix-time
|
2013-09-22 05:27:15 +00:00
|
|
|
patched lifted-base
|
|
|
|
patched zlib
|
|
|
|
patched MissingH
|
2013-10-18 23:11:39 +00:00
|
|
|
patched distributive
|
2013-09-22 05:27:15 +00:00
|
|
|
patched comonad
|
|
|
|
patched iproute
|
|
|
|
patched primitive
|
|
|
|
patched socks
|
|
|
|
patched entropy
|
|
|
|
patched vector
|
2013-10-19 01:49:18 +00:00
|
|
|
patched stm-chans
|
2013-09-22 05:27:15 +00:00
|
|
|
patched persistent
|
|
|
|
patched profunctors
|
|
|
|
patched skein
|
|
|
|
patched lens
|
2014-02-07 18:52:17 +00:00
|
|
|
patched certificate
|
2014-02-11 02:50:51 +00:00
|
|
|
patched x509-system
|
2013-09-22 05:27:15 +00:00
|
|
|
patched persistent-template
|
2014-02-07 22:38:46 +00:00
|
|
|
patched system-filepath
|
2014-10-14 04:16:38 +00:00
|
|
|
patched optparse-applicative
|
2013-09-22 18:13:31 +00:00
|
|
|
patched wai-app-static
|
|
|
|
patched shakespeare
|
|
|
|
patched shakespeare-css
|
2013-12-27 04:32:29 +00:00
|
|
|
patched shakespeare-js
|
2013-09-22 18:13:31 +00:00
|
|
|
patched yesod-routes
|
2013-09-22 05:27:15 +00:00
|
|
|
patched yesod-core
|
|
|
|
patched yesod-persistent
|
|
|
|
patched yesod-form
|
2013-11-11 04:03:24 +00:00
|
|
|
patched crypto-numbers
|
2013-09-22 05:27:15 +00:00
|
|
|
patched yesod-auth
|
|
|
|
patched yesod
|
2013-12-30 02:13:19 +00:00
|
|
|
patched shakespeare-text
|
2013-12-27 04:32:29 +00:00
|
|
|
patched process-conduit
|
2014-02-08 17:03:44 +00:00
|
|
|
patched DAV
|
2013-12-27 04:32:29 +00:00
|
|
|
patched yesod-static
|
2013-11-11 04:03:24 +00:00
|
|
|
patched uuid
|
2013-12-03 17:14:49 +00:00
|
|
|
patched dns
|
2013-12-27 04:32:29 +00:00
|
|
|
patched gnutls
|
2014-03-12 16:25:32 +00:00
|
|
|
patched unbounded-delays
|
2013-05-08 15:31:42 +00:00
|
|
|
|
2013-09-22 05:27:15 +00:00
|
|
|
cd ..
|
2013-09-23 14:25:21 +00:00
|
|
|
|
|
|
|
installgitannexdeps -fAndroid -f-Pairing
|
2013-05-09 17:08:24 +00:00
|
|
|
}
|
|
|
|
|
2013-09-22 05:27:15 +00:00
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo native build
|
|
|
|
echo
|
2014-05-26 01:25:04 +00:00
|
|
|
setupcabal
|
2014-05-26 17:53:53 +00:00
|
|
|
installgitannexdeps
|
2013-05-09 02:33:30 +00:00
|
|
|
|
2013-09-22 05:27:15 +00:00
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo cross build
|
|
|
|
echo
|
2013-11-12 18:24:53 +00:00
|
|
|
PATH=$HOME/.ghc/$(cat abiversion)/bin:$HOME/.ghc/$(cat abiversion)/arm-linux-androideabi/bin:$PATH
|
2014-05-26 01:25:04 +00:00
|
|
|
setupcabal
|
2013-09-22 05:27:15 +00:00
|
|
|
install_pkgs
|