git-annex/standalone/android/install-haskell-packages
2013-09-22 01:50:01 -04:00

115 lines
2.4 KiB
Bash
Executable file

#!/bin/sh
# Bootstraps from an empty cabal to all the necessary haskell packages
# being installed, with the necessary patches to work on Android.
#
# Note that the newest version of packages is installed.
# It attempts to reuse patches for older versions, but
# new versions of packages often break cross-compilation by adding TH,
# etc
#
# Needs some extra C libraries and packages to be installed
# on the host system:
# libgnutls-dev libxml2-dev libgsasl7-dev pkg-config c2hs
#
# Also needs some C libraries to be installed inside the cross-compiler
# lib directory (~/.ghc/android-14/arm-linux-androideabi-4.7/arm-linux-androideabi/sysroot/usr/lib/)
# , cross-compiled for Android: libgnutls libxml2
set -e
cabalopts="$@"
cabalinstall () {
echo cabal install "$@" "$cabalopts"
eval cabal install "$@" "$cabalopts"
}
patched () {
pkg=$1
shift 1
cabal unpack $pkg
cd $pkg*
git init
git add .
git commit -m "pre-patched state of $pkg"
for patch in ../../haskell-patches/${pkg}_*; do
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
done
cabalinstall "$@"
rm -rf $pkg*
cd ..
}
unpatched () {
cabalinstall "$@"
}
installgitannexdeps () {
echo cabal install git-annex --only-dependencies
cabal install git-annex --only-dependencies "$@"
}
install_pkgs () {
rm -rf tmp
mkdir tmp
cd tmp
patched network
patched lifted-base
patched zlib
patched process
patched MissingH
patched bloomfilter
patched SafeSemaphore
patched unordered-containers
patched comonad
patched HTTP
patched MonadCatchIO-transformers
patched distributive
patched iproute
patched primitive
patched socks
patched entropy
patched vector
patched wai-app-static
patched persistent
patched profunctors
patched skein
patched lens
patched shakespeare
patched shakespeare-css
patched shakespeare-js
patched DAV
patched persistent-template
patched hamlet
patched yesod-core
patched yesod-persistent
patched yesod-form
patched yesod-auth
patched yesod
installgitannexdeps -f-Pairing -f-XMPP
cd ..
rm -rf tmp
}
echo
echo
echo native build
echo
cabal update
installgitannexdeps
echo
echo
echo cross build
echo
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
cabal update
install_pkgs