After installing GHC 6.10.1, you probably want to get cabal-install installed as quickly as possible, so you can grab all that Haskell library goodness from Hackage with the minimum of fuss. Once the Haskell Platform is available, this will be much easier, but until then we have to bootstrap cabal-install using just Cabal.
After a release I find myself doing this on multiple machines, so today I made a little script to automate it, and I thought I’d share it. Obviously it’s just a quick hack, only works with GHC 6.10.1, has no error-checking etc., but it does work on both Windows and Unix. Enjoy!
Update: Duncan Coutts pointed out to me that there’s a Windows cabal.exe binary available.
#!/bin/sh set -e for i in $TMPDIR /tmp c:/temp; do if test -d $i; then dir=$i break fi dir=$HOME done cd $dir wget http://hackage.haskell.org/packages/archive/zlib/0.5.0.0/zlib-0.5.0.0.tar.gz tar xzf zlib-0.5.0.0.tar.gz cd zlib-0.5.0.0 ghc --make Setup ./Setup configure --user ./Setup build ./Setup register --inplace --user cd $dir wget http://hackage.haskell.org/packages/archive/HTTP/3001.1.4/HTTP-3001.1.4.tar.gz tar xzf HTTP-3001.1.4.tar.gz cd HTTP-3001.1.4 ghc --make Setup ./Setup configure --user ./Setup build ./Setup register --inplace --user cd $dir wget http://hackage.haskell.org/packages/archive/cabal-install/0.6.0/cabal-install-0.6.0.tar.gz tar xzf cabal-install-0.6.0.tar.gz cd cabal-install-0.6.0 ghc --make Setup ./Setup configure --user ./Setup build # Don't need these libs any more... ghc-pkg unregister zlib-0.5.0.0 ghc-pkg unregister HTTP-3001.1.4 # Now use cabal-install to install itself and its dependencies ./dist/build/cabal/cabal update ./dist/build/cabal/cabal install cabal-install # Clean up... cd $dir rm -rf zlib-0.5.0.0* rm -rf HTTP-3001.1.4* rm -rf cabal-install-0.6.0* echo "ALL DONE!"
Advertisements
Since I hadn’t gotten around to fixing my previous fumbled attempt to install cabal-install, I went ahead and pulled the script here and I have to say, *fantastic*!
Just one thing to note, whatever version of ghc-pkg was on my machine didn’t like the `ghc-pkg unregister …’ lines, but rather `ghc-pkg unregister –user …’ was required.
It could just be me using ghc 6.8.2 from the Ubuntu package however?
— Lorenz
Pingback: A Plea For “cabal install” | Alson Kemp
This script was very useful, but I also needed an older version of ghc (to see why Agda more often runs out of memory when compiled with ghc-6.10). I’ve made a version of this script to install cabal-install on ghc-6.8.2. http://polytypic.wordpress.com/2009/01/21/cabal-install-installcabal-install-install/
The link should have been
http://polytypic.wordpress.com/2009/01/21/cabal-install-install/
/P
Pingback: More cabal-install bootstrapping « Polytypic
I’ve tried this on Mac OSX Leopard, and got:
Linking dist/build/cabal/cabal …
ld: in /private/var/folders/mw/mwJSf7ErEa4w8nWyKyyqD++++TY/-Tmp-/zlib-0.5.0.0/dist/build/libHSzlib-0.5.0.0.a, archive has no table of contents
— where can I stick ranlib after some ar happening here in zlib?
Cabal ought to be doing that. Maybe you need to upgrade Cabal first?