Alessandro Vermeulen Alessandro Vermeulen's blog about languages, programming, Computer Science and the Web.

10Feb/100

Debian Lenny and the Haskell Platform

Currently there is no package for the Haskell-Platform in Debian stable. However, the source of this platform and GHC is available for download at ghc and platform.

However, there are some issues to solve when installing the platform from source. Mainly you'll be missing several packages. The following commands worked at my own Debian machine. If you find out that's something is missing that was apparently already installed on my machine, don't hesitate to leave a comment.

The following commands are all executed as root.
First we need to download the sources, I'm using the x86 sources, but feel free to use the x64 version:

cd /tmp
wget http://www.haskell.org/ghc/dist/6.10.4/ghc-6.10.4-i386-unknown-linux-n.tar.bz2
wget http://hackage.haskell.org/platform/2009.2.0.2/haskell-platform-2009.2.0.2.tar.gz

Now we need to extract these sources:

tar xvf ghc-6.10.4-i386-unknown-linux-n.tar.bz2
tar xvzf haskell-platform-2009.2.0.2.tar.gz

Before we do any other stuff, let's ensure that we have all the packages and libraries we need before continuing.

apt-get install build-essential libghc6-opengl-dev libghc6-glut-dev libeditline-dev libedit2 libedit-dev

Also make sure that you apply this patch to the platform, the bug has been around for some time now but hasn't been fixed apparently, it can be found at bug #84:

patch -p0 haskell-platform-2009.2.0.2/scripts/install.sh
Index: haskell-platform-2009.2.0.2/scripts/install.sh
===================================================================
--- haskell-platform-2009.2.0.2.orig/scripts/install.sh
+++ haskell-platform-2009.2.0.2/scripts/install.sh
@@ -34,13 +34,23 @@ install_pkg () {
   fi
 }
+# Is this exact version of the package already installed?
+is_pkg_installed () {
+  PKG_VER=$1
+  grep " ${PKG_VER} " installed.packages > /dev/null 2>&1
+}
+
 # Actually do something!
 cd packages
 for pkg in `cat platform.packages`; do
-  cd "${pkg}" || die "The directory for the component ${PKG} is missing"
-  echo "Installing ${pkg}..."
-  install_pkg ${pkg}
-  cd ..
+  if is_pkg_installed "${pkg}"; then
+    echo "Platform package ${pkg} is already installed. Skipping..."
+  else
+    cd "${pkg}" || die "The directory for the component ${PKG} is missing"
+    echo "Installing ${pkg}..."
+    install_pkg ${pkg}
+    cd ..
+  fi
 done
 echo

Now go to the ghc dir and build it.

cd ghc-6.10.4
./configure
make install

And if all of this goes well you can now go to the haskell-platform dir and install it:

cd ../haskell-platform-2009.2.0.2/
./configure
make
make install

And done! :)