ccef06da41
Was able to reuse many of the android patches, but several had to be re-done. On Android, ghc is a stage2 build, so can compile, but not run TH code. But debian's ghc on armel cannot even compile TH code, so it has to be patched out. Some haskell packages have been updated to new versions, including yesod and DAV, and their patches had to be redone. The Makefile now has 2 new targets. The first is run on a companion x86 system to do the build and get TH splices. Then the second target is run the same source tree on the arm system to build without needing TH. This commit was sponsored by Svenne Krap.
123 lines
2.4 KiB
Bash
Executable file
123 lines
2.4 KiB
Bash
Executable file
#!/bin/bash
|
|
# Bootstraps from an empty cabal to all the necessary haskell packages
|
|
# being installed, with the necessary patches to work on Android.
|
|
#
|
|
# You should install ghc-android first.
|
|
#
|
|
# 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
|
|
#
|
|
# Future work: Convert to using the method used here:
|
|
# https://github.com/kaoskorobase/ghc-ios-cabal-scripts/
|
|
|
|
set -e
|
|
|
|
if [ ! -d haskell-patches ]; then
|
|
cd standalone/android
|
|
fi
|
|
|
|
cabalopts="$@"
|
|
|
|
cabalinstall () {
|
|
echo cabal install "$@" "$cabalopts"
|
|
eval cabal install "$@" "$cabalopts"
|
|
}
|
|
|
|
patched () {
|
|
pkg=$1
|
|
shift 1
|
|
cabal unpack $pkg
|
|
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"
|
|
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
|
|
cabalinstall "$@"
|
|
rm -rf $pkg*
|
|
cd ..
|
|
}
|
|
|
|
installgitannexdeps () {
|
|
pushd ../..
|
|
echo cabal install --only-dependencies "$@"
|
|
cabal install --only-dependencies "$@"
|
|
popd
|
|
}
|
|
|
|
install_pkgs () {
|
|
rm -rf tmp
|
|
mkdir tmp
|
|
cd tmp
|
|
|
|
patched network
|
|
patched unix-time
|
|
patched lifted-base
|
|
patched zlib
|
|
patched process
|
|
patched MissingH
|
|
patched bloomfilter
|
|
patched SafeSemaphore
|
|
patched distributive
|
|
patched comonad
|
|
patched HTTP
|
|
patched MonadCatchIO-transformers
|
|
patched iproute
|
|
patched primitive
|
|
patched socks
|
|
patched entropy
|
|
patched vector
|
|
patched stm-chans
|
|
patched persistent
|
|
patched profunctors
|
|
patched skein
|
|
patched lens
|
|
patched persistent-template
|
|
patched wai-app-static
|
|
patched shakespeare
|
|
patched shakespeare-css
|
|
patched yesod-routes
|
|
patched yesod-core
|
|
patched yesod-persistent
|
|
patched yesod-form
|
|
patched crypto-numbers
|
|
patched yesod-auth
|
|
patched yesod
|
|
patched async
|
|
patched gnuidn
|
|
patched DAV
|
|
patched language-javascript
|
|
patched uuid
|
|
patched dns
|
|
|
|
cd ..
|
|
|
|
installgitannexdeps -fAndroid -f-Pairing
|
|
}
|
|
|
|
echo
|
|
echo
|
|
echo native build
|
|
echo
|
|
cabal update
|
|
installgitannexdeps
|
|
|
|
echo
|
|
echo
|
|
echo cross build
|
|
echo
|
|
PATH=$HOME/.ghc/$(cat abiversion)/bin:$HOME/.ghc/$(cat abiversion)/arm-linux-androideabi/bin:$PATH
|
|
cabal update
|
|
install_pkgs
|