Created
July 30, 2012 22:52
-
-
Save dysinger/3211447 to your computer and use it in GitHub Desktop.
Install Haskell from Scratch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -eux | |
ARCH=${ARCH:-x86_64} | |
CORES=$(sysctl -n hw.ncpu) | |
GHC=${GHC:-7.4.2} | |
CABAL=${CABAL:-0.14.0} | |
PLATFORM=${PLATFORM:-2012.2.0.0} | |
[[ ! -d /usr/local/src ]] && mkdir -p /usr/local/src | |
cd /tmp | |
[[ ! -f ghc-${GHC}-${ARCH}-apple-darwin.tar.bz2 ]] && \ | |
curl -O http://www.haskell.org/ghc/dist/${GHC}/ghc-${GHC}-${ARCH}-apple-darwin.tar.bz2 | |
[[ ! -d ghc-${GHC} ]] && \ | |
tar xf ghc-${GHC}-${ARCH}-apple-darwin.tar.bz2 | |
cd ghc-${GHC} | |
./configure --prefix=/tmp | |
make install | |
export PATH=/tmp/bin:$PATH | |
cd /tmp | |
[[ ! -f cabal-install-${CABAL}.tar.gz ]] && \ | |
curl -O http://hackage.haskell.org/packages/archive/cabal-install/${CABAL}/cabal-install-${CABAL}.tar.gz | |
[[ ! -d cabal-install-${CABAL} ]] && \ | |
tar xf cabal-install-${CABAL}.tar.gz | |
cd cabal-install-${CABAL} | |
rm -rf ~/.cabal ~/.ghc | |
PREFIX=/tmp bash ./bootstrap.sh --global | |
cabal update | |
cabal install --global --prefix=/tmp happy | |
cabal install --global --prefix=/tmp alex | |
cd /usr/local/src | |
[[ ! -f ghc-${GHC}-src.tar.bz2 ]] && \ | |
curl -O http://www.haskell.org/ghc/dist/${GHC}/ghc-${GHC}-src.tar.bz2 | |
[[ ! -d ghc-${GHC} ]] && tar xf ghc-${GHC}-src.tar.bz2 | |
cd ghc-${GHC} | |
# http://hackage.haskell.org/trac/ghc/ticket/7040 x86_64 problem | |
curl http://hackage.haskell.org/trac/ghc/raw-attachment/ticket/7040/ghc7040.patch | patch -p1 | |
./configure --build=${ARCH}-apple-darwin | |
make -j${CORES} | |
make install | |
export PATH=/usr/local/bin:$PATH | |
cd /usr/local/src | |
[[ ! -f haskell-platform-${PLATFORM}.tar.gz ]] && \ | |
curl -O http://lambda.haskell.org/platform/download/${PLATFORM}/haskell-platform-${PLATFORM}.tar.gz | |
[[ ! -d haskell-platform-${PLATFORM} ]] && \ | |
tar xf haskell-platform-${PLATFORM}.tar.gz | |
cd haskell-platform-${PLATFORM} | |
make clean | |
./configure --enable-unsupported-ghc-version | |
make -j${CORES} | |
make install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment