Installation Guide to the Feldspar Compiler

Document Sample
Installation Guide to the Feldspar Compiler Powered By Docstoc
					      Installation Guide to the Feldspar Compiler


                                March 16, 2010


1       Quick Installation
1.1     Prerequisites
To start the installation of Feldspar, the following dependencies have to be met.
See section 2 for detailed installation instructions of the Haskell environment.

    • GHC 6.10.* (http://haskell.org/ghc/)
    • Cabal for Haskell (http://haskell.org/haskellwiki/Cabal-Install)
    • The following extra cabal packages:

         – haskell-src-exts (>= 1.1.4) (for feldspar-compiler)
         – hint (>= 0.3.1.0) (for feldspar-compiler)
         – mtl (>= 1.1) (for feldspar-language)
         – QuickCheck (>= 1.2 && < 2) (for feldspar-language)
         – happy (>= 1.17) (for haskell-src-exts)

1.2     Installing Feldspar Packages
1.2.1    Minimal Installation
    • Download and unpack the feldspar-language and feldspar-compiler
      packages from the Sourceforge page: http://feldspar.sourceforge.net/
    • First enter the language and then the compiler subdirectories and issue
      the following command in each of them:
$ cabal i n s t a l l

    • Note that on Windows systems administrator privileges are required for
      this installation. Another option is installing Feldspar for only the current
      user with the --user flag. But in this case one of the following lines has
      to be added to the Path environment variable depending on configuration:
         – C:\Users\%USERNAME%\AppData\Roaming\cabal\bin
         – C:\Documents and Settings\%USERNAME%\Application Data\
             cabal\bin


                                         1
1.2.2     Minimal Installation from Hackage
    • Issue the following commands:
$ c a b a l i n s t a l l f e l d s p a r −l a n g u a g e
$ c a b a l i n s t a l l f e l d s p a r −c o m p i l e r

    • Note that on Windows systems administrator privileges are required for
      this installation. Another option is installing Feldspar for only the current
      user with the --user flag. But in this case one of the following lines has
      to be added to the Path environment variable depending on configuration:
          – C:\Users\%USERNAME%\AppData\Roaming\cabal\bin
          – C:\Documents and Settings\%USERNAME%\Application Data\
              cabal\bin

1.2.3     Installation with Documentation
    • First install the latest version of Haddock and Hscolour. (We need these
      packages to generate the documentation and the linked colourized source
      code.)
$ c a b a l i n s t a l l haddock − 2 . 5 . 0 h s c o l o u r

    • Download and unpack feldspar-language and feldspar-compiler pack-
      ages from the Sourceforge page: http://feldspar.sourceforge.net/
    • First enter the language directory and issue the following commands:
$ cabal i n s t a l l
$ c a b a l haddock −−h y p e r l i n k −s o u r c e
$ cabal i n s t a l l

    • Enter the compiler directory and install it using the following command:
$ cabal i n s t a l l

    • The generated documentation might be found at the following locations
      (depending on the actual configuration):
          – ~/.cabal/share/doc/feldspar-language-0.2
          – C:\Program Files\Haskell\doc\feldspar-language-0.2
          – C:\Users\%USERNAME%\AppData\Roaming\cabal\doc\
              feldspar-language-0.2
          – C:\Documents and Settings\%USERNAME%\Application Data\
              cabal\doc\feldspar-language-0.2
    • Note that on Windows systems administrator privileges are required for
      this installation. Another option is installing Feldspar for only the current
      user: Issue the cabal configure and cabal install commands with the
      --user flag and add one of the following lines to the Path environment
      variable depending on configuration:


                                                  2
         – C:\Users\%USERNAME%\AppData\Roaming\cabal\bin
         – C:\Documents and Settings\%USERNAME%\Application Data\
             cabal\bin
      Administrator privileges are required for installing Haddock and Hscolour.
      If they are not installed, issue the cabal haddock command without the
      --hyperlink-source flag.


2     Installing Haskell Environment
In order to install Feldspar as described in the previous section, it requires
Haskell and all the related tools. This section gives detailed description of
installing this environment under specific systems.

2.1    Windows 7, Windows XP
    • Download and install the Haskell Platform from the page
      http://hackage.haskell.org/platform/

    • Update the Cabal package list:
> c a b a l update


2.2    Ubuntu 9.10
    • Install GHC, some other packages to build cabal-install, and Happy
      for haskell-src-exts installation:
$ apt−g e t i n s t a l l ghc6
$ apt−g e t i n s t a l l l i b g h c 6 −http−dev l i b g h c 6 −z l i b −dev
$ apt−g e t i n s t a l l happy

    • Download the cabal-install tarball (not the Cabal library!) from
      http://www.haskell.org/cabal/download.html, unpack it and enter the newly
      created directory.
    • Run the script bootstrap.sh

    • Add the prefix ~/.cabal/bin to the PATH environment variable:
$ echo ’PATH=˜/. c a b a l / b i n : $PATH’ >> ˜ / . b a s h r c

    • Update the Cabal package list:
$ c a b a l update




                                          3
2.3      Fedora 11
    • Install GHC, cabal-install and Happy for haskell-src-exts installa-
      tion:
$ su
$ yum i n s t a l l ghc c a b a l − i n s t a l l happy
$ exit

    • Add the prefix ~/.cabal/bin to the PATH environment variable:
$ echo ’PATH=˜/. c a b a l / b i n : $PATH’ >> ˜ / . b a s h r c

    • Update the Cabal package list:
$ c a b a l update


2.4      openSUSE 11.2
    • In order to install GHC, add a new repository:
$   URL=h t t p : / / download . o p e n s u s e . o r g / r e p o s i t o r i e s
$   DIR=d e v e l : / l a n g u a g e s : / h a s k e l l / openSUSE 11 . 2
$   sudo zypper a r $URL/$DIR/ d e v e l : l a n g u a g e s : h a s k e l l . r e p o
$   sudo zypper r e f

    • Install GHC, GCC, zlib to build cabal-install and Happy for haskell-
      src-exts installation:
$ sudo zypper i n ghc g c c ghc−z l i b −d e v e l happy

    • Download the cabal-install tarball (not the Cabal library!) from
      http://www.haskell.org/cabal/download.html, unpack it and enter the newly
      created directory.

    • Run the script bootstrap.sh
    • Add the prefix ~/.cabal/bin to the PATH environment variable:
$ echo ’PATH=˜/. c a b a l / b i n : $PATH’ >> ˜ / . b a s h r c

    • Update the Cabal package list:
$ c a b a l update




                                            4
2.5     Installation on Generic Linux without Haskell Plat-
        form
Installing GHC
    • The GHC binary installer requires the following packages. Please make
      sure that they are installed:
          – binutils
          – coreutils
          – gcc
          – perl
          – sed
    • Download the appropriate GHC binary package from the ”Binary Pack-
      ages” section from the ”Current Stable Release” section from
      http://haskell.org/ghc/download.html

    • Unpack the archive and enter the newly created directory.
    • Use the following commands to install the package:
$ ./ configure
$ sudo make i n s t a l l


Installing cabal-install
    • To build cabal-install it requires the following packages. Please make
      sure that the gmp and zlib development packages are installed. For ex-
      ample:
          – libgmp3-dev or gmp-devel
          – zlib1g-dev or zlib-devel
    • Download the cabal-install tarball (not the Cabal library!) from
      http://www.haskell.org/cabal/download.html
    • Unpack the archive and enter the newly created directory.
    • Run the script bootstrap.sh:
$ . / b o o t s t r a p . sh

    • Add the prefix ~/.cabal/bin to the PATH environment variable:
$ echo ’PATH=˜/. c a b a l / b i n : $PATH’ >> ˜ / . b a s h r c

    • Update the Cabal package list:
$ c a b a l update




                                        5
Installing the Happy Cabal package
   • Use the following command:
$ c a b a l i n s t a l l happy


2.6    Installation on Generic Linux with Haskell Platform
Installing GHC
   • Download the GHC binary package from the ”Current Stable Release”
     section from http://haskell.org/ghc/download.html
   • Unpack the archive and enter the newly created directory.
   • Use the following commands to install the package:
$ ./ configure
$ sudo make i n s t a l l


Installing Haskell Platform
   • Haskell Platform depends on the following packages. Please make sure
     that the freeglut and libedit development packages are installed. For
     example:
         – freeglut3-dev
         – libedit-dev

   • Download the Haskell Platform sources from
     http://hackage.haskell.org/platform/.
   • Unpack the archive and enter the newly created directory.
   • As of March 2010, Haskell Platform version 2009.2.0.2, the sources will not
     build due to an erroneous install script in the source distribution package.
     The file scripts/install.sh needs to be fixed manually to proceed with
     the installation.1
         – Add the following lines to the beginning of the file (right below
           #!/bin/sh).
is pkg installed () {
  PKG VER=$1
  g r e p ” $ {PKG VER} ” i n s t a l l e d . p a c k a g e s > / dev / n u l l 2>&1
}

         – Locate the following part near the end of the file:
  1 Solution   taken from http://trac.haskell.org/haskell-platform/ticket/84




                                               6
# A c t u a l l y do s o m e t h i n g !
cd p a c k a g e s
f o r pkg i n ‘ cat p l a t f o r m . packages ‘ ; do
    cd ” $ { pkg } ” | | d i e ”The d i r e c t o r y f o r t h e ” \
                                   ” component ${PKG} i s m i s s i n g ”
    echo ” I n s t a l l i n g $ { pkg } . . . ”
    i n s t a l l p k g $ { pkg }
    cd . .
done

         – Replace it with the following lines:
# A c t u a l l y do s o m e t h i n g !
cd p a c k a g e s
f o r pkg i n ‘ cat p l a t f o r m . packages ‘ ; do
    i f i s p k g i n s t a l l e d ” ${ pkg } ” ; then
       echo ” P l a t f o r m package ${ pkg } i s a l r e a d y ” \
                 ” i n s t a l l e d . Skipping . . . ”
    else
       cd ” ${ pkg }” | | d i e ”The d i r e c t o r y f o r t h e ” \
                                         ” component $ {PKG} i s m i s s i n g ”
       echo ” I n s t a l l i n g ${ pkg } . . . ”
       i n s t a l l p k g $ { pkg }
       cd . .
    fi
done

    • Build the sources and install the package using the following commands:
$ ./ configure
$ make
$ sudo make i n s t a l l

    • Update the Cabal package list:
$ c a b a l update




                                           7