Commits

Mitsuhiro Nakamura  committed 7dd7c7f

add lang/ghc-bootstrap and lang/ghc

Patches in lang/ghc are adopted from homebrew:
https://github.com/mxcl/homebrew/blob/master/Library/Formula/ghc.rb

  • Participants
  • Parent commits 0c01619

Comments (0)

Files changed (6)

File lang/ghc-bootstrap/Portfile

+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+# $Id: Portfile 110612 2013-09-02 23:16:22Z jeremyhu@macports.org $
+
+PortSystem          1.0
+
+name                ghc-bootstrap
+set canonicalname   ghc
+version             7.6.3
+categories          lang haskell
+maintainers         gmail.com:kitchen.andy cal openmaintainer
+license             BSD
+platforms           darwin
+supported_archs     i386 x86_64
+universal_variant   no
+installs_libs       no
+
+description         The Glorious Glasgow Haskell Compilation System
+long_description    \
+                    This is a package that installs a binary \
+                    bootstrap ghc compiler.
+
+homepage            http://haskell.org/${canonicalname}
+master_sites        ${homepage}/dist/${version}/
+distname            ${canonicalname}-${version}-${build_arch}-apple-darwin
+worksrcdir          ${canonicalname}-${version}
+use_bzip2           yes
+
+checksums           ${canonicalname}-${version}-i386-apple-darwin${extract.suffix} \
+                        rmd160  aca3ff527969cfaf1e4ebcbf304dd49e264b0ad7 \
+                        sha256  b212acd6ef99df87a4a6f2fb68b1de35071527889743bbd69b9c9ab2d301b178 \
+                    ${canonicalname}-${version}-x86_64-apple-darwin${extract.suffix} \
+                        rmd160  2ed57694bcf505e13fa69a7c84a83cb49040ea0c \
+                        sha256  f7a35bea69b6cae798c5f603471a53b43c4cc5feeeeb71733815db6e0a280945
+
+configure.pre_args  --prefix=${prefix}/share/ghc-bootstrap
+
+pre-configure {
+    # OK so because this binary has been prebuilt for libraries
+    # in /usr/lib we search these before macports stuff so (hopefully)
+    # weird things don't happen
+    configure.ldflags  -L/usr/lib
+    configure.cppflags -I/usr/include
+}
+
+build {}
+
+post-destroot {
+    # Delete dylibs; they aren't used by the bootstrap ghc and are incorrectly
+    # linked against /usr/local, causing rev-upgrade to complain.
+    # This problem might only be reproducible in i386; the x86_64 version
+    # apparently doesn't ship and dylibs.
+    fs-traverse f ${destroot}${prefix} {
+        if {[file isfile ${f}]} {
+            if {[file extension ${f}] == ".dylib"} {
+                delete ${f}
+            }
+        }
+    }
+}
+
+# TODO don't install documentation
+
+livecheck.type      none

File lang/ghc/Portfile

+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+# $Id: Portfile 111081 2013-09-14 11:51:40Z cal@macports.org $
+
+PortSystem          1.0
+
+name                ghc
+set canonicalname   ghc
+# Do not update GHC separate from Haskell Platform.
+# When updating GHC, make sure to revbump all Haskell ports.
+version             7.6.3
+revision            3
+categories          lang haskell
+maintainers         gmail.com:kitchen.andy cal openmaintainer
+license             BSD
+platforms           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}/
+distname        ${canonicalname}-${version}-src
+worksrcdir      ${canonicalname}-${version}
+
+use_bzip2       yes
+
+distfiles       ${canonicalname}-${version}-src${extract.suffix} \
+                ${canonicalname}-${version}-testsuite${extract.suffix}
+
+checksums       ghc-7.6.3-src.tar.bz2 \
+                rmd160  82a673ed38b7cf9a59afeb01057625fc761a822b \
+                sha256  bd43823d31f6b5d0b2ca7b74151a8f98336ab0800be85f45bb591c9c26aac998 \
+                ghc-7.6.3-testsuite.tar.bz2 \
+                rmd160  e1d7536b1b0799a6c069eb89be41ceb56692b68d \
+                sha256  870d8f50a1b569b0f93d0c7c6b80225280841988f1d779aafe847bcf02d76256
+
+depends_build   port:ghc-bootstrap \
+                port:libxslt
+
+depends_lib     port:gmp           \
+                port:ncurses       \
+                port:libiconv
+
+patchfiles      patch-configure-disable-docbook-ps-and-pdf.diff \
+                patch-includes-HsFFI.h.diff \
+                patch-rts-RtsProbes.d.diff \
+                patch-utils-mkdirhier-mkdirhier.sh.diff
+
+
+livecheck.type  none
+test.run        yes
+use_parallel_build no
+
+# -- BEGIN gcc variants
+
+variant gcc43 conflicts gcc44 gcc45 gcc46 gcc47 gcc48 gcc49 description {Compile with gcc 4.3} {
+    configure.compiler      macports-gcc-4.3
+    configure.args-append   --with-gcc=${configure.cc}
+}
+
+variant gcc44 conflicts gcc43 gcc45 gcc46 gcc47 gcc48 gcc49 description {Compile with gcc 4.4} {
+    configure.compiler      macports-gcc-4.4
+    configure.args-append   --with-gcc=${configure.cc}
+}
+
+variant gcc45 conflicts gcc43 gcc44 gcc46 gcc47 gcc48 gcc49 description {Compile with gcc 4.5} {
+    configure.compiler      macports-gcc-4.5
+    configure.args-append   --with-gcc=${configure.cc}
+}
+
+variant gcc46 conflicts gcc43 gcc44 gcc45 gcc47 gcc48 gcc49 description {Compile with gcc 4.6} {
+    configure.compiler      macports-gcc-4.6
+    configure.args-append   --with-gcc=${configure.cc}
+}
+
+variant gcc47 conflicts gcc43 gcc44 gcc45 gcc46 gcc48 gcc49 description {Compile with gcc 4.7} {
+    configure.compiler      macports-gcc-4.7
+    configure.args-append   --with-gcc=${configure.cc}
+}
+
+variant gcc48 conflicts gcc43 gcc44 gcc45 gcc46 gcc47 gcc49 description {Compile with gcc 4.8} {
+    configure.compiler      macports-gcc-4.8
+    configure.args-append   --with-gcc=${configure.cc}
+}
+
+variant gcc49 conflicts gcc43 gcc44 gcc45 gcc46 gcc47 gcc48 description {Compile with gcc 4.9} {
+    configure.compiler      macports-gcc-4.9
+    configure.args-append   --with-gcc=${configure.cc}
+}
+
+if {![variant_isset gcc43] && ![variant_isset gcc44] &&
+    ![variant_isset gcc45] && ![variant_isset gcc46] &&
+    ![variant_isset gcc47] && ![variant_isset gcc49]} {
+    default_variants +gcc48
+}
+
+# -- END gcc variants
+
+set bootstraproot ${prefix}/share/ghc-bootstrap
+configure.args  --with-ghc=${bootstraproot}/bin/ghc     \
+                --with-iconv-includes=${prefix}/include \
+                --with-iconv-libraries=${prefix}/lib    \
+                --with-gmp-includes=${prefix}/include   \
+                --with-gmp-libraries=${prefix}/lib
+
+# OK so because the bootstrap binary has been prebuilt for libraries
+# in /usr/lib we search these before macports stuff to prevent
+# link errors, ghc _should_ actually compile itself in stage2
+# using paths from the command line arguments
+compiler.cpath /usr/include
+compiler.library_path /usr/lib
+
+post-destroot {
+    set prefixlib ${prefix}/lib/${worksrcdir}
+    set destlib   ${destroot}/${prefixlib}
+    set libver    ${canonicalname}${version}
+
+    variable libs [ list                               \
+                    libHSrts-${libver}.dylib           \
+                    libHSrts_debug-${libver}.dylib     \
+                    libHSrts_thr-${libver}.dylib       \
+                    libHSrts_thr_debug-${libver}.dylib ]
+
+    system "install_name_tool -id ${prefixlib}/libffi.dylib ${destlib}/libffi.dylib"
+
+    foreach lib $libs {
+      regexp -line {[^[:space:]]*/libffi.*\.dylib} [exec otool -L ${destlib}/${lib}] oldlib
+      system "install_name_tool -change ${oldlib} ${prefixlib}/libffi.dylib ${destlib}/$lib"
+    }
+}
+
+pre-activate {
+    # Legacy port deactivation hack added 2012-12-08
+    if {![catch {set platform_ghc_installed [lindex [registry_active hs-platform-ghc] 0]}]} {
+        # hs-platform-ghc is installed and active
+        # force deactivation
+        registry_deactivate_composite hs-platform-ghc "" [list ports_nodepcheck 1]
+    }
+    # Legacy port deactivation hack added 2013-08-11, hs-process is provided by base
+    if {![catch {set hs_process_installed [lindex [registry_active hs-process] 0]}]} {
+        # hs-process is installed and active
+        # force deactivation
+        registry_deactivate_composite hs-process "" [list ports_nodepcheck 1]
+    }
+    # Legacy port deactivation hack added 2013-08-14, hs-template-haskell is provided by base
+    if {![catch {set hs_template_haskell_installed [lindex [registry_active hs-template-haskell] 0]}]} {
+        # hs-template-haskell is installed and active
+        # force deactivation
+        registry_deactivate_composite hs-template-haskell "" [list ports_nodepcheck 1]
+    }
+}
+
+post-activate {
+    catch {system "${prefix}/bin/ghc-pkg -v recache"}
+}

File lang/ghc/files/patch-configure-disable-docbook-ps-and-pdf.diff

+--- configure.orig	2013-04-19 00:47:00.000000000 +0200
++++ configure	2013-06-05 21:52:52.000000000 +0200
+@@ -10983,6 +10983,8 @@
+     BUILD_DOCBOOK_PS=YES
+     BUILD_DOCBOOK_PDF=YES
+ fi
++BUILD_DOCBOOK_PS=NO
++BUILD_DOCBOOK_PDF=NO
+ 
+ 
+ 

File lang/ghc/files/patch-includes-HsFFI.h.diff

+--- includes/HsFFI.h.orig	2013-11-05 23:53:51.000000000 +0900
++++ includes/HsFFI.h	2013-11-05 23:54:04.000000000 +0900
+@@ -21,7 +21,7 @@
+ #include "stg/Types.h"
+ 
+ /* get limits for integral types */
+-#ifdef HAVE_STDINT_H
++#if defined HAVE_STDINT_H && !defined USE_INTTYPES_H_FOR_RTS_PROBES_D
+ /* ISO C 99 says:
+  * "C++ implementations should define these macros only when
+  * __STDC_LIMIT_MACROS is defined before <stdint.h> is included."

File lang/ghc/files/patch-rts-RtsProbes.d.diff

+--- rts/RtsProbes.d.orig	2013-11-05 23:54:47.000000000 +0900
++++ rts/RtsProbes.d	2013-11-05 23:55:06.000000000 +0900
+@@ -6,6 +6,12 @@
+  *
+  * ---------------------------------------------------------------------------*/
+ 
++#ifdef __APPLE__ && __MACH__
++# if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9
++# define USE_INTTYPES_H_FOR_RTS_PROBES_D
++# endif
++#endif
++
+ #include "HsFFI.h"
+ #include "rts/EventLogFormat.h"
+ 

File lang/ghc/files/patch-utils-mkdirhier-mkdirhier.sh.diff

+--- utils/mkdirhier/mkdirhier.sh.orig	2013-11-05 23:55:37.000000000 +0900
++++ utils/mkdirhier/mkdirhier.sh	2013-11-05 23:55:43.000000000 +0900
+@@ -1,4 +1,4 @@
+ #!/bin/sh
+ 
+-mkdir -p ${1+"$@"}
++mkdir -p ${1+"./$@"}
+