git-annex/standalone/android/install-haskell-packages

132 lines
2.9 KiB
Text
Raw Normal View History

#!/bin/bash
# Bootstraps from an empty cabal to all the necessary haskell packages
# being installed, with the necessary patches to work on Android.
#
2013-09-22 19:13:31 +01:00
# You should install ghc-android first.
#
# The cabal.config is used to pin the haskell packages to the last
# versions that have been gotten working. To update, delete the
# cabal.config, run this script with an empty cabal and fix up the broken
# patches, and then use cabal freeze to generate a new cabal.config.
set -e
2013-09-22 15:58:13 -04:00
if [ ! -d haskell-patches ]; then
cd standalone/android
fi
setupcabal () {
# Some packages fail to install in a non unicode locale.
LANG=en_US.UTF-8
export LANG
}
patched () {
pkg=$1
2014-02-07 17:57:04 -04:00
ver=$2
if [ -z "$ver" ]; then
2014-10-14 17:04:39 -04:00
ver="$(grep " $pkg " ../cabal.config | cut -d= -f 3 | sed 's/,$//')"
fi
2014-02-07 17:57:04 -04:00
if [ -z "$ver" ]; then
cabal unpack --pristine $pkg
2014-02-07 17:57:04 -04:00
else
cabal unpack --pristine $pkg-$ver
2014-02-07 17:57:04 -04:00
fi
cd $pkg*
git init
git config user.name dummy
git config user.email dummy@example.com
git add .
git commit -m "pre-patched state of $pkg"
ln -sf ../../cabal.config
for patch in ../../haskell-patches/${pkg}_* ../../../no-th/haskell-patches/${pkg}_*; do
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
fi
done
2014-10-15 14:37:21 -04:00
if [ -e config.sub ]; then
cp /usr/share/misc/config.sub .
fi
if [ -e config.guess ]; then
cp /usr/share/misc/config.guess .
fi
cabal install # --force-reinstalls --reinstall
rm -f cabal.config
rm -rf $pkg*
cd ..
}
installgitannexdeps () {
pushd ../..
ln -sf standalone/android/cabal.config
2016-03-09 13:39:00 -04:00
cabal install --only-dependencies --flags="-magicmime -concurrentoutput" "$@" # --force-reinstalls --reinstall
rm -f cabal.config
popd
2013-05-08 12:30:39 -04:00
}
install_pkgs () {
rm -rf tmp
mkdir tmp
cd tmp
2014-10-15 14:37:21 -04:00
cat <<EOF
EOF
patched network
2013-09-23 00:14:48 +00:00
patched unix-time
patched lifted-base
patched zlib
patched MissingH
2013-10-18 19:11:39 -04:00
patched distributive
patched comonad
patched iproute
patched primitive
patched socks
patched vector
patched stm-chans
patched persistent
patched profunctors
patched skein
patched lens
2014-02-07 14:52:17 -04:00
patched certificate
patched x509-system
patched persistent-template
2014-02-07 18:38:46 -04:00
patched system-filepath
patched optparse-applicative
2013-09-22 19:13:31 +01:00
patched wai-app-static
patched yesod-routes
patched shakespeare
patched yesod-core
patched yesod-persistent
patched yesod-form
patched crypto-numbers
2015-05-22 14:39:50 -04:00
patched clock
patched yesod-auth
patched yesod
2013-12-27 00:32:29 -04:00
patched process-conduit
2014-02-08 13:03:44 -04:00
patched DAV
2013-12-27 00:32:29 -04:00
patched yesod-static
patched dns
2014-03-12 12:25:32 -04:00
patched unbounded-delays
patched uuid
cd ..
2013-09-23 10:25:21 -04:00
installgitannexdeps -fAndroid -f-Pairing
2013-05-09 13:08:24 -04:00
}
2014-10-15 14:37:21 -04:00
cabal update
setupcabal
# Install packages for host ghc.
installgitannexdeps
# Install packages for cross ghc, with patches as necessary.
PATH=$HOME/.ghc/$(cat abiversion)/bin:$HOME/.ghc/$(cat abiversion)/arm-linux-androideabi/bin:$PATH
cabal update
install_pkgs