Bootstrapping cabal

12 03 2009

Often I have to install cabal onto a machine where I just have GHC 6.8.2 running. I’ve found the following little script quite practical to install the basics.  Once you have that installed, it is very easy to install other haskell packages with cabal.

#!/bin/bash
#
# Copyright 2009 Christophe Poucet. All Rights Reserved.
# Author: <christophe (dot) poucet (at) gmail (dot) com> (Christophe Poucet)
# License: BSD3

webroot=http://hackage.haskell.org/packages/archive

install_package() {
  local name=$1
  local version=$2

  wget $webroot/$name/$version/$name-$version.tar.gz
  tar xvzf $name-$version.tar.gz
  cd $name-$version
  runghc Setup configure
  runghc Setup build
  sudo runghc Setup install
  cd ..
  rm -rf $name-$version
  rm -f $name-$version.tar.gz
}

install_package mtl 1.1.0.2
install_package parsec 3.0.0
install_package network 2.2.0.1
install_package HTTP 4000.0.4
install_package zlib 0.5.0.0
install_package Cabal 1.6.0.2
install_package cabal-install 0.6.2

Actions

Information

3 responses

12 03 2009
lilac

FYI, the ‘cabal-install’ tarball on hackage includes a script ‘bootstrap.sh’ which does much the same as this (but seems to get by installing fewer packages).

12 03 2009
liesen

doesn’t bootstrap.sh (bundled with cabal-installed) do exactly this?

12 03 2009
cpoucet

I have not looked at the code of bootstrap.sh, but I can say that at the time, bootstrap.sh did not work for me while this did.

Leave a comment