Ghc version 6.10.1 - How to Download and Install on Mac OS X
Saturday the 4th of July, 2009

    version 6.10.1

      View the most recent changes for the ghc port at: ghc.darwinports.com/diff
      Scroll down toward the bottom of the page to get installation instructions for ghc.
      The raw portfile for ghc 6.10.1 is located here:
      http://ghc.darwinports.com/dports/lang/ghc/Portfile
      Find related portfiles with the unique DarwinPorts.com search feature.
      Check for any related Fink projects here: pdb.finkproject.org/pdb/package.php/ghc


      The ghc Portfile 42399 2008-11-20 21:02:31Z gwright macports.org $

      PortSystem 1.0

      Name: ghc
      Version: 6.10.1
      Revision: 8
      Category: lang haskell
      Maintainers: gwright
      Platform: darwin
      Description: The Glorious Glasgow Haskell Compilation System
      Long Description: The Glasgow Haskell Compiler is a robust, fully-featured, optimising compiler and interactive environment for Haskell 98, GHC compiles Haskell to either native code or C. It implements numerous experimental language extensions to Haskell 98, for example: concurrency, a foreign language interface, multi-parameter type classes, scoped type variables, existential and universal quantification, unboxed types, exceptions, weak pointers, and so on. GHC comes with a generational garbage collector, and a space and time profiler.

      Homepage: http://haskell.org/${name}
      #master_sites ${homepage}/dist/${version}/
      Master Sites: ${homepage}/dist/stable/dist/

      use_bzip2 yes

      distfiles ${name}-${version}-src.tar.bz2 ${name}-${version}-src-extralibs.tar.bz2

      Checksums: ${name}-${version}-src.tar.bz2 md5 54c676a632b3d73cf526b06347522c32 sha1 5b3759d6a1177f0cc8f754673b52bfd31923280f rmd160 4768e7246edd494367232e3af030ffed77990c10 ${name}-${version}-src-extralibs.tar.bz2 md5 4ff4590f1002ae1ff608874da8643c67 sha1 279072813e265bb143c7e612d5900bb324c72f6c rmd160 34fe542788284c1e2167a955c3219e7e539eff4e

      # ghc does not support a universal build:
      universal_variant no

      # On (at least) i386/Tiger, the file compiler/ghc.cabal.in needs to be
      # patched so it can find the GMP library.
      #
      Patch Files: patch-configure.ac.diff patch-aclocal.m4.diff patch-libraries-Makefile.diff patch-compiler-ghc.cabal.in.diff

      post-patch {
      reinplace "s|XXPATH_TO_HSC2HSXX|${workpath}/ghc-bootstrap/bin/hsc2hs|" ${worksrcpath}/libraries/Makefile
      reinplace "s|XXPATH_TO_GMP_LIBRARYXX|${prefix}/lib|" ${worksrcpath}/compiler/ghc.cabal.in
      }

      depends_lib port:libedit port:gmp

      # Yes, it some situations (-fvia-C) we really need perl
      # to _run_ ghc, since the mangler (an assembly to assembly transformation)
      # is a perl script. That's why it called the "Evil Mangler".
      #
      # Not only that, but since correctly handling whitespace is critical,
      # only perl 5.8 is known to work reliably.
      #
      depends_lib-append port:perl5.8
      configure.env-append PerlCmd=${prefix}/bin/perl5.8

      worksrcdir ${name}-${version}

      platform darwin 6 {
      pre-fetch {
      return -code error "${name} is not supported on Mac OS X 10.2.x (Jaguar)"
      }
      }


      platform darwin 7 {
      pre-fetch {
      return -code error "${name} is not supported on Mac OS X 10.3.x (Panther)"
      }
      }


      platform darwin 8 powerpc {
      global ghc_bootversion
      set ghc_bootversion 6.10.1

      master_sites-append ${homepage}/dist/${ghc_bootversion}/:bootstrap

      distfiles-append ${name}-${ghc_bootversion}-darwin-ppc-tiger-bootstrap.tar.bz2:bootstrap

      checksums-append ${name}-${ghc_bootversion}-darwin-ppc-tiger-bootstrap.tar.bz2 md5 511f4bec375b51aaa82de999529916ae sha1 cb6974a680168246c6e13a92818b39c559d7a2b4 rmd160 be60cfffc0ed223fb39ce2fe40ad501486564f0e

      extract.only ${name}-${version}-src.tar.bz2 ${name}-${version}-src-extralibs.tar.bz2 ${name}-${ghc_bootversion}-darwin-ppc-tiger-bootstrap.tar.bz2
      }


      platform darwin 8 i386 {
      global ghc_bootversion
      set ghc_bootversion 6.6

      master_sites-append ${homepage}/dist/${ghc_bootversion}/:bootstrap

      distfiles-append ${name}-${ghc_bootversion}-darwin-i386-tiger-bootstrap-rev1.tar.bz2:bootstrap

      checksums-append ${name}-${ghc_bootversion}-darwin-i386-tiger-bootstrap-rev1.tar.bz2 md5 f01663cecefd50b5f1e1f524f49cd6df

      extract.only ${name}-${version}-src.tar.bz2 ${name}-${version}-src-extralibs.tar.bz2 ${name}-${ghc_bootversion}-darwin-i386-tiger-bootstrap-rev1.tar.bz2
      }


      platform darwin 9 powerpc {
      global ghc_bootversion
      set ghc_bootversion 6.10.1

      master_sites-append ${homepage}/dist/${ghc_bootversion}/:bootstrap

      distfiles-append ${name}-${ghc_bootversion}-darwin-ppc-leopard-bootstrap.tar.bz2:bootstrap

      checksums-append ${name}-${ghc_bootversion}-darwin-ppc-leopard-bootstrap.tar.bz2 md5 511f4bec375b51aaa82de999529916ae sha1 cb6974a680168246c6e13a92818b39c559d7a2b4 rmd160 be60cfffc0ed223fb39ce2fe40ad501486564f0e

      extract.only ${name}-${version}-src.tar.bz2 ${name}-${version}-src-extralibs.tar.bz2 ${name}-${ghc_bootversion}-darwin-ppc-leopard-bootstrap.tar.bz2
      }


      platform darwin 9 i386 {
      global ghc_bootversion
      set ghc_bootversion 6.8.2

      master_sites-append ${homepage}/dist/${ghc_bootversion}/:bootstrap

      distfiles-append ${name}-${ghc_bootversion}-darwin-i386-leopard-bootstrap.tar.bz2:bootstrap

      checksums-append ${name}-${ghc_bootversion}-darwin-i386-leopard-bootstrap.tar.bz2 md5 f263cedef8bcbaa7e9014b3e06923583

      extract.only ${name}-${version}-src.tar.bz2 ${name}-${version}-src-extralibs.tar.bz2 ${name}-${ghc_bootversion}-darwin-i386-leopard-bootstrap.tar.bz2
      }


      post-patch {
      reinplace "s|/opt/local/lib/ghc-${ghc_bootversion}|${workpath}/ghc-bootstrap/lib/ghc-${ghc_bootversion}|g" ${workpath}/ghc-bootstrap/lib/ghc-${ghc_bootversion}/package.conf

      reinplace "s|GHCBIN=/opt/local|GHCBIN=${workpath}/${name}-bootstrap|" ${workpath}/${name}-bootstrap/bin/ghc

      reinplace "s|TOPDIROPT=-B/opt/local|TOPDIROPT=-B${workpath}/${name}-bootstrap|" ${workpath}/${name}-bootstrap/bin/ghc

      reinplace "s|-L/opt/local|-L${prefix}|" ${workpath}/${name}-bootstrap/bin/ghc

      reinplace "s|-I/opt/local|-I${prefix}|" ${workpath}/${name}-bootstrap/bin/ghc

      reinplace "s|/opt/local|${prefix}|" ${workpath}/${name}-bootstrap/lib/ghc-${ghc_bootversion}/ghc-asm

      reinplace "s|/opt/local|${prefix}|" ${workpath}/${name}-bootstrap/lib/ghc-${ghc_bootversion}/ghc-split

      }


      pre-configure {
      system "autoreconf ${worksrcpath}"

      set cfg [open "${workpath}/ghc-bootstrap/bin/ghc-pkg" w]
      puts $cfg "#!/bin/sh"
      puts $cfg "GHCPKGBIN=${workpath}/ghc-bootstrap/lib/ghc-${ghc_bootversion}/ghc-pkg.bin"
      puts $cfg "PKGCONF=${workpath}/ghc-bootstrap/lib/ghc-${ghc_bootversion}/package.conf"
      puts $cfg "exec \$GHCPKGBIN --global-conf \$PKGCONF \${1+\"\$ \"}"
      close $cfg

      system "chmod +x ${workpath}/ghc-bootstrap/bin/ghc-pkg"

      set cfg [open "${workpath}/ghc-bootstrap/bin/hsc2hs" w]
      puts $cfg "#!/bin/sh"
      puts $cfg "HSC2HSBIN=${workpath}/ghc-bootstrap/lib/ghc-${ghc_bootversion}/hsc2hs-bin"
      if {${ghc_bootversion} eq "6.10.1"} {
      puts $cfg "tflag=\"--template=${workpath}/ghc-bootstrap/lib/ghc-${ghc_bootversion}/hsc2hs-0.67/template-hsc.h\""
      } else {
      puts $cfg "tflag=\"--template=${workpath}/ghc-bootstrap/lib/ghc-${ghc_bootversion}/template-hsc.h\""
      }
      puts $cfg "for arg do"
      puts $cfg " case \"\$arg\" in"
      puts $cfg " -c*) HSC2HS_EXTRA=;;"
      puts $cfg " --cc=*) HSC2HS_EXTRA=;;"
      puts $cfg " -t*) tflag=;;"
      puts $cfg " --template=*) tflag=;;"
      puts $cfg " --) break;;"
      puts $cfg " esac"
      puts $cfg "done"
      puts $cfg "exec \$HSC2HSBIN \$tflag \$HSC2HS_EXTRA -I${prefix}/include --lflag=\"-L${prefix}/lib\" \${1+\"\$ \"}"
      close $cfg

      system "chmod +x ${workpath}/ghc-bootstrap/bin/hsc2hs"

      set cfg [open "${worksrcpath}/mk/build.mk" w]
      puts $cfg "#"
      puts $cfg "# Local configuration overrides for MacPorts"
      puts $cfg "#"
      puts $cfg "SRC_HC_OPTS += -I${prefix}/include -L${prefix}/lib"
      puts $cfg "EXTRA_HSC2HS_OPTS += -I${prefix}/include --lflag=\"-L${prefix}/lib\""
      puts $cfg "EXTRA_LD_OPTS += -L${prefix}/lib"
      close $cfg
      }

      #bugs GHC does not support DESTDIR. Instead, we install # everything into ${destroot}${prefix}, and then fix up # the five scripts which actually have the installation # path hard coded. # # The odd "ac_cv_lib_elf_nlist" environment variable # is required to avoid including the wrong nlist.h # header if libelf is installed on the system.

      configure.ldflags-append "-L/usr/lib"
      configure.cflags-append "-I${prefix}/include"
      configure.env-append DYLD_FALLBACK_LIBRARY_PATH=${prefix}/lib ac_cv_lib_elf_nlist=no

      configure.args --prefix=${destroot}${prefix} --datadir=${destroot}${prefix}/share/${name}-${version} --with-gmp-includes=${prefix}/include --with-gmp-libraries=${prefix}/lib --with-ghc='${workpath}/${name}-bootstrap/bin/ghc'

      Variant: no_opengl description {omit OpenGL support} {
      configure.args-append --disable-opengl
      configure.args-append --disable-glut
      }

      # The OpenAL variant does not work yet (see http://hackage.haskell.org/trac/ghc/ticket/2067)
      #variant openal description {include OpenAL support} {
      # configure.args-append --enable-openal
      # configure.args-append --enable-alut
      #}

      build {
      system "cd ${worksrcpath} && env DYLD_FALLBACK_LIBRARY_PATH=${prefix}/lib ${build.cmd}"
      }

      # This should not be necessary, but it seems to work around a bug
      # that exist at least in MP 1.600.
      destroot {
      system "cd ${worksrcpath} && ${destroot.cmd} ${destroot.target}"
      }

      post-destroot {
      reinplace s|${destroot}${prefix}|${prefix}|g ${destroot}${prefix}/bin/ghc
      reinplace s|${destroot}${prefix}|${prefix}|g ${destroot}${prefix}/bin/ghci
      reinplace s|${destroot}${prefix}|${prefix}|g ${destroot}${prefix}/bin/ghc-pkg
      reinplace s|${destroot}${prefix}|${prefix}|g ${destroot}${prefix}/bin/haddock
      reinplace s|${destroot}${prefix}|${prefix}|g ${destroot}${prefix}/bin/hsc2hs
      reinplace s|${destroot}${prefix}|${prefix}|g ${destroot}${prefix}/bin/runghc

      reinplace "s|\\\$ \"\}|\\\$ \"\} -L${prefix}/lib -I${prefix}/include |" ${destroot}${prefix}/bin/ghc
      reinplace s|${destroot}${prefix}|${prefix}|g ${destroot}${prefix}/lib/${name}-${version}/package.conf

      file rename ${destroot}${prefix}/bin/haddock ${destroot}${prefix}/bin/haddock-${name}

      system "ranlib ${destroot}${prefix}/lib/ghc-${version}/*.a"
      }

    If you haven't already installed Darwin Ports, you can find easy instructions for doing so at the main Darwin Ports page.

    Once Darwin Ports has been installed, in a terminal window and while online, type the following and hit return:


      %  cd /opt/local/bin/portslocation/dports/ghc
      % sudo port install ghc
      Password:
    You will then be prompted for your root password, which you should enter. You may have to wait for a few minutes while the software is retrieved from the network and installed for you. Y ou should see something that looks similar to:

      ---> Fetching ghc
      ---> Verifying checksum for ghc
      ---> Extracting ghc
      ---> Configuring ghc
      ---> Building ghc with target all
      ---> Staging ghc into destroot
      ---> Installing ghc
    - Make sure that you do not close the terminal window while Darwin Ports is working. Once the software has been installed, you can find further information about using ghc with these commands:
      %  man ghc
      % apropos ghc
      % which ghc
      % locate ghc

     Where to find more information:

    Darwin Ports



    Lightbox this page.