Ghc version 6.10.4 - How to Download and Install on Mac OS X
Saturday the 21st of November, 2009

    version 6.10.4

      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.4 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 57375 2009-09-10 08:16:41Z ryandesign macports.org $

      PortSystem 1.0

      Name: ghc
      set canonicalname ghc
      Version: 6.10.4
      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/${canonicalname}
      Master Sites: ${homepage}/dist/${version}/

      use_bzip2 yes

      distfiles ${canonicalname}-${version}-src.tar.bz2 ${canonicalname}-${version}-src-extralibs.tar.bz2 testsuite-${version}.tar.bz2

      Checksums: ${canonicalname}-${version}-src.tar.bz2 md5 167687fa582ef6702aaac24e139ec982 sha1 0566858b409066d98da70de5adb9a7030d0df5dc rmd160 5f83baf2549f1f4bea140c6a80728c2a76f60ab6 ${canonicalname}-${version}-src-extralibs.tar.bz2 md5 37ce285617d7cebabc3cf6805bdbca25 sha1 b08b26070f2965122662d035c602536ae9aafbb8 rmd160 78e6dba88a253095c79f94c5356918402810bd01 testsuite-${version}.tar.bz2 md5 1973d7c1a24afbc58cebc7c574ebb56f sha1 cfb327686398fba2c12a5cd1fdad56faa4fbf3c6 rmd160 8952dda913a6363f60d3c4ad2d18ec6abcf33425
      # 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-compiler-ghc.cabal.in.diff patch-compiler-Makefile.diff patch-compiler-Makefile.local.diff patch-ghc-Makefile.diff patch-libraries-Makefile.diff patch-libraries-cabal-bin.hs.diff patch-libraries-terminfo-configure.ac.diff patch-mk-cabal.mk.diff patch-mk-target.mk.diff patch-utils-genapply-Makefile.diff patch-utils-genprimopcode-Makefile.diff

      depends_build port:autoconf
      depends_lib port:gmp port:ncursesw port:libiconv

      Variant: cabal_configure_debug description {Add verbose debugging to cabal configure commands} {
      patchfiles-append patch-compiler-Makefile-debug.diff patch-ghc-Makefile-debug.diff patch-libraries-Makefile-debug.diff patch-mk-cabal.mk-debug.diff

      patchfiles-delete patch-compiler-Makefile.diff patch-ghc-Makefile.diff patch-libraries-Makefile.diff patch-mk-cabal.mk.diff
      }

      # 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 ${canonicalname}-${version}

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


      platform darwin 10 {
      pre-fetch {
      return -code error "${canonicalname} is not yet supported on Mac OS X 10.6.x (SnowLeopard)"
      }
      }


      platform darwin 8 powerpc {
      global ghc_bootversion
      set ghc_bootversion 6.10.1

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

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

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

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

      pre-fetch {
      set minimum_xcodeversion 2.5
      set current_xcodeversion [exec defaults read /Developer/Applications/Xcode.app/Contents/Info CFBundleShortVersionString]
      if {[rpm-vercomp ${current_xcodeversion} ${minimum_xcodeversion}] < 0} {
      ui_msg "On Mac OS X ${macosx_version}, ${name} ${version} requires Xcode ${minimum_xcodeversion} but you have Xcode ${current_xcodeversion}."
      return -code error "incompatible Xcode version"
      }
      }
      }


      platform darwin 8 i386 {
      global ghc_bootversion
      set ghc_bootversion 6.6

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

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

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

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

      pre-fetch {
      set minimum_xcodeversion 2.5
      set current_xcodeversion [exec defaults read /Developer/Applications/Xcode.app/Contents/Info CFBundleShortVersionString]
      if {[rpm-vercomp ${current_xcodeversion} ${minimum_xcodeversion}] < 0} {
      ui_msg "On Mac OS X ${macosx_version}, ${name} ${version} requires Xcode ${minimum_xcodeversion} but you have Xcode ${current_xcodeversion}."
      return -code error "incompatible Xcode version"
      }
      }
      }


      platform darwin 9 powerpc {
      global ghc_bootversion
      set ghc_bootversion 6.10.1

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

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

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

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

      pre-fetch {
      set minimum_xcodeversion 3.1.2
      set current_xcodeversion [exec defaults read /Developer/Applications/Xcode.app/Contents/Info CFBundleShortVersionString]
      if {[rpm-vercomp ${current_xcodeversion} ${minimum_xcodeversion}] < 0} {
      ui_msg "On Mac OS X ${macosx_version}, ${name} ${version} requires Xcode ${minimum_xcodeversion} but you have Xcode ${current_xcodeversion}."
      return -code error "incompatible Xcode version"
      }
      }
      }


      platform darwin 9 i386 {
      global ghc_bootversion
      set ghc_bootversion 6.8.2

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

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

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

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

      pre-fetch {
      set minimum_xcodeversion 3.1
      set current_xcodeversion [exec defaults read /Developer/Applications/Xcode.app/Contents/Info CFBundleShortVersionString]
      if {[rpm-vercomp ${current_xcodeversion} ${minimum_xcodeversion}] < 0} {
      ui_msg "On Mac OS X ${macosx_version}, ${name} ${version} requires Xcode ${minimum_xcodeversion} but you have Xcode ${current_xcodeversion}."
      return -code error "incompatible Xcode version"
      }
      }
      }


      post-extract {
      system "tar jxf ${distpath}/testsuite-${version}.tar.bz2 -C ${worksrcpath}"
      }


      post-patch {
      reinplace "s|XXPATH_TO_GCCXX|${configure.cc}|g" ${worksrcpath}/ghc/Makefile
      reinplace "s|XXPATH_TO_GCCXX|${configure.cc}|g" ${worksrcpath}/compiler/Makefile
      reinplace "s|XXPATH_TO_GCCXX|${configure.cc}|g" ${worksrcpath}/compiler/Makefile.local
      reinplace "s|XXPATH_TO_GCCXX|${configure.cc}|g" ${worksrcpath}/libraries/Makefile
      reinplace "s|XXPATH_TO_GCCXX|${configure.cc}|g" ${worksrcpath}/libraries/cabal-bin.hs
      reinplace "s|XXPATH_TO_GCCXX|${configure.cc}|g" ${worksrcpath}/aclocal.m4
      reinplace "s|XXPATH_TO_GCCXX|${configure.cc}|g" ${worksrcpath}/mk/cabal.mk
      reinplace "s|XXPATH_TO_GCCXX|${configure.cc}|g" ${worksrcpath}/mk/target.mk
      reinplace "s|XXPATH_TO_GCCXX|${configure.cc}|g" ${worksrcpath}/utils/genapply/Makefile
      reinplace "s|XXPATH_TO_GCCXX|${configure.cc}|g" ${worksrcpath}/utils/genprimopcode/Makefile

      reinplace "s|XXPATH_TO_HSC2HSXX|${workpath}/ghc-bootstrap/bin/hsc2hs|" ${worksrcpath}/libraries/Makefile

      reinplace "s|XXMACPORTS_PREFIXXX|${prefix}|" ${worksrcpath}/compiler/ghc.cabal.in

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

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

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

      if {"/opt/local" != ${prefix}} {
      reinplace "s|-L/opt/local|-L${prefix}|" ${workpath}/${canonicalname}-bootstrap/bin/ghc
      reinplace "s|-I/opt/local|-I${prefix}|" ${workpath}/${canonicalname}-bootstrap/bin/ghc
      reinplace "s|/opt/local|${prefix}|g" ${workpath}/${canonicalname}-bootstrap/lib/ghc-${ghc_bootversion}/ghc-asm ${workpath}/${canonicalname}-bootstrap/lib/ghc-${ghc_bootversion}/ghc-split }
      }


      pre-configure {
      system "${prefix}/bin/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"
      puts $cfg "EXTRA_CABAL_CONFIGURE_FLAGS += --extra-include-dirs=${prefix}/include"
      puts $cfg "EXTRA_CABAL_CONFIGURE_FLAGS += --extra-lib-dirs=${prefix}/lib"
      if {[variant_isset cabal_configure_debug]} then {
      puts $cfg "EXTRA_CABAL_CONFIGURE_FLAGS += --verbose=3"
      }
      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/${canonicalname}-${version} --with-gmp-includes=${prefix}/include --with-gmp-libraries=${prefix}/lib --with-ghc='${workpath}/${canonicalname}-bootstrap/bin/ghc' --with-gcc=${configure.cc}

      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 exists at least in MP 1.600.
      destroot {
      system "cd ${worksrcpath} && ${destroot.cmd} ${destroot.target}"
      }

      # Note that we catch the results of the tests, since usually at least
      # one of the tests unexpectedly fails.

      set testlog ${canonicalname}-${version}-tests.log

      test {
      set testpath ${worksrcpath}/testsuite-${version}
      catch {system "cd ${testpath} && make stage=2 2>&1 | tee ${workpath}/${testlog}"}
      }


      post-destroot {
      reinplace s|${destroot}${prefix}|${prefix}|g ${destroot}${prefix}/bin/ghc
      reinplace s|${destroot}${prefix}|${prefix}|g ${destroot}${prefix}/bin/ghc-${version}
      reinplace s|${destroot}${prefix}|${prefix}|g ${destroot}${prefix}/bin/ghci
      reinplace s|${destroot}${prefix}|${prefix}|g ${destroot}${prefix}/bin/ghci-${version}
      reinplace s|${destroot}${prefix}|${prefix}|g ${destroot}${prefix}/bin/ghc-pkg
      reinplace s|${destroot}${prefix}|${prefix}|g ${destroot}${prefix}/bin/ghc-pkg-${version}
      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/${canonicalname}-${version}/package.conf

      file rename ${destroot}${prefix}/lib/${canonicalname}-${version}/libffi.a ${destroot}${prefix}/lib/${canonicalname}-${version}/libHsLocalFfi.a
      reinplace s|"ffi"|"HsLocalFfi"| ${destroot}${prefix}/lib/${canonicalname}-${version}/package.conf

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

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

      if {[file exists ${workpath}/${testlog}]} {
      set testsavepath ${prefix}/share/${canonicalname}-${version}/tests
      file mkdir ${destroot}${testsavepath}
      file rename ${workpath}/${testlog} ${destroot}${testsavepath}/${testlog}
      ui_msg "Test results are saved in ${testsavepath}"
      }
      }

      livecheck.type regex
      livecheck.url ${homepage}
      livecheck.regex "GHC (\[0-9\\.\]+) Released"


    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.