Thursday, January 5, 2012

Haskell Platform 2011.4.0.0 from source

The Haskell Platform source file
haskell-platform-2011.4.0.0.tar.gz
is downloaded to <username>/Software and extracted to
<username>/Software/haskell-platform-2011.4.0.0

 Install the Haskell Platform to

/opt/haskell-platform-2011.4.0.0
The Haskell compiler is installed first from the directory
~/Software/ghc-7.0.4
to
/opt/haskell-platform-2011.4.0.0
As all needed libraries are in place already, everything goes easy:  

 
[prompt]:~/Software/ghc-7.0.4$ sudo ./configure --prefix=/opt/haskell-platform-2011.4.0.0
checking for path to top of build tree... /home/[user]/Software/ghc-7.0.4
Build platform inferred as: i386-unknown-linux
Host platform inferred as: i386-unknown-linux
Target platform inferred as: i386-unknown-linux
checking for perl... /usr/bin/perl

... ... ...

configure: creating ./config.status
config.status: creating extra-gcc-opts
config.status: creating mk/config.mk
config.status: creating mk/install.mk
****************************************************
Configuration done, ready to 'make install'
(see README and INSTALL files for more info.)
****************************************************
[prompt]:~/Software/ghc-7.0.4$ sudo make install
make -r --no-print-directory -f ghc.mk install BINDIST=YES NO_INCLUDE_DEPS=YES
/usr/bin/install -c -m 755 -d "/opt/haskell-platform-2011.4.0.0/share/man"
/usr/bin/install -c -m 755 -d "/opt/haskell-platform-2011.4.0.0/share/man/man1"
/usr/bin/install -c -m 644  docs/man/ghc.1 "/opt/haskell-platform-2011.4.0.0/share/man/man1"

... ... ...

/usr/bin/install -c -m 644  libraries/prologue.txt "/opt/haskell-platform-2011.4.0.0/share/doc/ghc/html/libraries/"
/usr/bin/install -c -m 755  libraries/gen_contents_index "/opt/haskell-platform-2011.4.0.0/share/doc/ghc/html/libraries/"
for i in docs/users_guide/users_guide libraries/Cabal/doc/Cabal utils/haddock/doc/haddock; do \
        /usr/bin/install -c -m 755 -d "/opt/haskell-platform-2011.4.0.0/share/doc/ghc/html/`basename $i`"; \
        /usr/bin/install -c -m 644  $i/* "/opt/haskell-platform-2011.4.0.0/share/doc/ghc/html/`basename $i`"; \
    done



[prompt]:~/Software/ghc-7.0.4$ cd ..
[prompt]:~/Software$ cd haskell-platform-2011.4.0.0


[prompt]:~/Software/haskell-platform-2011.4.0.0$ sudo ./configure --prefix=/opt/haskell-platform-2011.4.0.0 --with-ghc=/opt/haskell-platform-2011.4.0.0/bin/ghc --with-ghc-pkg=/opt/haskell-platform-2011.4.0.0/bin/ghc-pkg --with-hsc2hs=/opt/haskell-platform-2011.4.0.0/bin/hsc2hs
**************************************************
*
*     Haskell Platform Source Installer
*
*     For the Haskell Platform 2011.4.0.0 and GHC 7.0.4
*
**************************************************
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking version of ghc... 7.0.4
checking version of ghc-pkg matches... yes
checking ghc actually works... [1 of 1] Compiling Main             ( conftest.hs, conftest.o )
yes
checking the ghc core packages are all installed... yes

... ... ...

configure: creating ./config.status
config.status: creating scripts/config
**************************************************
* Configuration completed successfully.          
*                                                
*   Install prefix: /opt/haskell-platform-2011.4.0.0
*     Haskell packages will be registered into   
*     the global ghc package database            
*                                                
*   If you wish to change these settings then    
*   use --prefix= and/or --enable-user-install   
*                                                
* Now do "make" followed by "sudo make install"  
**************************************************

[prompt]:~/Software/haskell-platform-2011.4.0.0$ sudo make install
scripts/build.sh
**************************************************
Scanning system for any installed Haskell Platform components...

Found:None.

New packages to install: None! All done.

**************************************************
Building transformers-0.2.2.0
"/opt/haskell-platform-2011.4.0.0/bin/ghc" "--make" "Setup" "-o" "Setup" "-package" "Cabal-1.10.2.0"
[1 of 1] Compiling Main             ( Setup.hs, Setup.o )
Linking Setup ...
"./Setup" "configure" "--package-db=../../packages/package.conf.inplace" "--prefix=/opt/haskell-platform-2011.4.0.0" "--with-compiler=/opt/haskell-platform-2011.4.0.0/bin/ghc" "--with-hc-pkg=/opt/haskell-platform-2011.4.0.0/bin/ghc-pkg" "--with-hsc2hs=/
opt/haskell-platform-2011.4.0.0/bin/hsc2hs" "--enable-library-profiling" "--ghc-pkg-option=--package-conf=../../packages/package.conf.inplace"

... ... ...

*******************************************************
* Installation completed successfully.           
*
* Programs installed into:                       
*   /opt/haskell-platform-2011.4.0.0/bin
*
* Now do "cabal update" to initialize the package list                         
*
* Additional packages may be found at http://hackage.haskell.org
* or via "cabal list <pattern>"
*
* Use "cabal install <foo>" to install additional packages
*
*******************************************************

[prompt]:~/Software/haskell-platform-2011.4.0.0$ cabal update
Downloading the latest package list from hackage.haskell.org

============

CHANGES

In .bashrc:
# Path to Haskell ghc
PATH=$PATH:/opt/haskell-platform-2011.4.0.0/bin


In .emacs.el
(setq haskell-program-name "/opt/haskell-platform-2011.4.0.0/bin/ghci")

SLIME: there is no package with name "ASDF"

The known bug with

Welcome to GNU CLISP 2.49 (2010-07-07) <http://clisp.cons.org/>

Copyright (c) Bruno Haible, Michael Stoll 1992, 1993
Copyright (c) Bruno Haible, Marcus Daniels 1994-1997
Copyright (c) Bruno Haible, Pierpaolo Bernardi, Sam Steingold 1998
Copyright (c) Bruno Haible, Sam Steingold 1999-2000
Copyright (c) Sam Steingold, Bruno Haible 2001-2010

Type :h and hit Enter for context help.

[1]> 
;; Loading file /usr/share/common-lisp/source/slime/swank-loader.lisp ...
*** - READ de
       #<INPUT BUFFERED FILE-STREAM CHARACTER
         #P"/usr/share/common-lisp/source/slime/swank-loader.lisp" @143>
      : there is no package with name "ASDF"

The following restarts are available:
ABORT          :R1      Abort main loop
Break 1 SWANK-LOADER[2]>  
 
seems not yet fixed (2012-01-05). 
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=640815
The solution proposed there worked for me:
 
Ok I realized that I had to manually setup ASDF in my ~/.clisprc:

  (load #P"/usr/share/common-lisp/source/cl-asdf/asdf.lisp")

Or, for SBCL, in my ~/.sbclrc

  (require 'asdf)

Mentionning this fact in the README.Debian would be useful for CL newbies