2013-12-17 03:05:00 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# Bootstraps from an empty cabal (plus apt-get build-dep git-annex)
|
2015-05-31 18:05:05 +00:00
|
|
|
# to all the necessary haskell packages being installed.
|
|
|
|
# Some packages are patched for wider portability.
|
2013-12-17 03:05:00 +00:00
|
|
|
#
|
2014-12-04 01:25:46 +00:00
|
|
|
# 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.
|
2013-12-17 03:05:00 +00:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2014-07-04 17:58:09 +00:00
|
|
|
if [ ! -d haskell-patches ]; then
|
2013-12-17 03:05:00 +00:00
|
|
|
cd standalone/linux
|
|
|
|
fi
|
|
|
|
|
|
|
|
cabalopts="$@"
|
|
|
|
|
|
|
|
cabalinstall () {
|
2014-08-14 01:14:44 +00:00
|
|
|
echo cabal install -j1 "$@" "$cabalopts"
|
|
|
|
eval cabal install -j1 "$@" "$cabalopts"
|
2013-12-17 03:05:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
patched () {
|
|
|
|
pkg=$1
|
2014-12-04 01:25:46 +00:00
|
|
|
ver=$2
|
|
|
|
if [ -z "$ver" ]; then
|
|
|
|
ver="$(grep " $pkg " ../cabal.config | cut -d= -f 3 | sed 's/,$//')"
|
|
|
|
fi
|
|
|
|
if [ -z "$ver" ]; then
|
2014-12-04 05:02:36 +00:00
|
|
|
cabal unpack --pristine $pkg
|
2014-12-04 01:25:46 +00:00
|
|
|
else
|
2014-12-04 05:02:36 +00:00
|
|
|
cabal unpack --pristine $pkg-$ver
|
2014-12-04 01:25:46 +00:00
|
|
|
fi
|
2013-12-17 03:05:00 +00:00
|
|
|
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"
|
2014-12-04 01:25:46 +00:00
|
|
|
ln -sf ../../cabal.config
|
2014-03-10 17:53:01 +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
|
|
|
|
fi
|
|
|
|
done
|
2014-09-13 01:01:40 +00:00
|
|
|
cabalinstall
|
2014-12-04 01:25:46 +00:00
|
|
|
rm -f cabal.config
|
2013-12-17 03:05:00 +00:00
|
|
|
cd ..
|
2014-12-04 01:25:46 +00:00
|
|
|
rm -rf $pkg*
|
2013-12-17 03:05:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
installgitannexdeps () {
|
|
|
|
pushd ../..
|
2014-12-04 01:25:46 +00:00
|
|
|
ln -sf standalone/linux/cabal.config
|
2013-12-17 03:05:00 +00:00
|
|
|
echo cabal install --only-dependencies "$@"
|
2014-12-04 01:11:22 +00:00
|
|
|
cabal install -j1 --only-dependencies "$@"
|
2014-12-04 01:25:46 +00:00
|
|
|
rm -f cabal.config
|
2013-12-17 03:05:00 +00:00
|
|
|
popd
|
|
|
|
}
|
|
|
|
|
|
|
|
install_pkgs () {
|
|
|
|
rm -rf tmp
|
|
|
|
mkdir tmp
|
|
|
|
cd tmp
|
|
|
|
|
2014-03-10 17:29:24 +00:00
|
|
|
patched network
|
2013-12-17 03:05:00 +00:00
|
|
|
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
installgitannexdeps
|
|
|
|
}
|
|
|
|
|
|
|
|
cabal update
|
2014-07-15 01:18:24 +00:00
|
|
|
|
|
|
|
# Some packages fail to install in a non unicode locale.
|
|
|
|
LANG=C.UTF-8
|
|
|
|
export LANG
|
|
|
|
|
2013-12-17 03:05:00 +00:00
|
|
|
install_pkgs
|