2015-03-06 14:31:28 -08:00
#!/bin/sh
2014-01-08 23:54:52 -05:00
set -e
2015-03-06 21:07:42 -08:00
2015-03-06 21:24:27 -08:00
print_help ( ) {
2015-03-10 16:41:11 -07:00
echo "Run build.sh from inside the ihaskell directory to install packages in this repository:"
echo " ./build.sh ihaskell # Install ihaskell and its dependencies"
echo " ./build.sh quick # Install ihaskell, but not its dependencies"
echo " ./build.sh all # Install ihaskell, dependencies, and all display packages"
echo " ./build.sh display # Install ihaskell and display libraries"
2015-03-06 21:07:42 -08:00
echo
2015-03-10 16:41:11 -07:00
echo "If this is your first time installing ihaskell, run './build.sh ihaskell'."
2015-03-06 21:07:42 -08:00
}
2014-01-08 19:22:51 -05:00
2015-03-10 16:41:11 -07:00
# Verify that we're in the ihaskell directory.
2014-03-09 12:10:37 -07:00
if [ ! -e ihaskell.cabal ] ; then
2015-03-06 21:07:42 -08:00
print_help;
2014-03-09 12:10:37 -07:00
exit 1
fi
2014-02-28 21:16:15 -08:00
2015-03-06 21:07:42 -08:00
if [ $# -lt 1 ] ; then
print_help;
exit 1
fi
2015-03-06 21:12:51 -08:00
if [ ! $1 = "all" ] && [ ! $1 = "ihaskell" ] && [ ! $1 = "display" ] && [ ! $1 = "quick" ] ; then
2015-03-06 21:07:42 -08:00
print_help;
exit 1;
fi
2014-02-28 21:16:15 -08:00
# What to install.
INSTALLS = ""
2014-01-08 19:22:51 -05:00
2015-03-02 21:20:17 -08:00
# Remove my kernelspec
rm -rf ~/.ipython/kernels/haskell
2014-02-28 21:16:15 -08:00
# Compile dependencies.
2014-02-06 22:34:39 -08:00
if [ $# -gt 0 ] ; then
2015-03-06 21:07:42 -08:00
if [ $1 = "all" ] || [ $1 = "ihaskell" ] ; then
2014-11-23 15:07:59 -08:00
INSTALLS = " $INSTALLS ghc-parser ipython-kernel "
2014-02-06 22:34:39 -08:00
fi
fi
2015-03-06 21:07:42 -08:00
# Always make ihaskell itself
2014-02-28 21:16:15 -08:00
INSTALLS = " $INSTALLS . "
2014-01-06 13:26:32 -05:00
2014-02-28 21:16:15 -08:00
# Install ihaskell-display packages.
2014-01-11 22:33:42 -07:00
if [ $# -gt 0 ] ; then
2015-03-06 21:07:42 -08:00
if [ $1 = "display" ] || [ $1 = "all" ] ; then
2014-01-11 22:33:42 -07:00
# Install all the display libraries
cd ihaskell-display
2015-03-06 21:11:30 -08:00
for dir in ` ls`
2014-01-11 22:33:42 -07:00
do
2014-02-28 21:16:15 -08:00
INSTALLS = " $INSTALLS ihaskell-display/ $dir "
2014-01-11 22:33:42 -07:00
done
2014-02-28 21:16:15 -08:00
cd ..
2014-01-11 22:33:42 -07:00
fi
fi
2014-02-28 21:16:15 -08:00
# Clean all required directories, just in case.
TOP = ` pwd `
for pkg in $INSTALLS
do
cd ./$pkg
cabal clean
cd $TOP
done
# Stick a "./" before everything.
INSTALL_DIRS = ` echo $INSTALLS | tr ' ' '\n' | sed 's#^#./#' | tr ' ' '\n' `
2015-03-05 09:44:00 -05:00
2015-03-24 02:11:58 -04:00
echo CMD: cabal install --constraint "arithmoi -llvm" -j $INSTALL_DIRS --force-reinstalls --max-backjumps= -1 --reorder-goals
2015-03-06 21:45:24 -08:00
cabal install --constraint "arithmoi -llvm" -j $INSTALL_DIRS --force-reinstalls --max-backjumps= -1 --reorder-goals
2015-03-15 20:13:42 +01:00
2015-03-16 06:18:55 +01:00
if hash ihaskell 2>/dev/null; then
2015-03-25 21:47:45 -07:00
ihaskell install 2>/dev/null || echo " The command \"ihaskell install\" failed. Please check your 'ipython --version'. 3.0 or up is required but it is $( ipython --version) ! "
2015-03-16 06:18:55 +01:00
else
2015-03-25 21:47:45 -07:00
echo "Reminder: run 'ihaskell install' to install the IHaskell kernel to Jupyter."
2015-03-16 06:18:55 +01:00
fi