Ticket #20132: lang-ghc.diff

File lang-ghc.diff, 5.6 KB (added by ecronin (Eric Cronin), 14 years ago)

partial update to fix Snow Leopard compat

  • files/patch-sl-compiler-main-DynFlags.hs.diff

     
     1--- compiler/main/DynFlags.hs.orig      2010-02-09 15:39:50.000000000 -0500
     2+++ compiler/main/DynFlags.hs   2010-02-09 15:49:29.000000000 -0500
     3@@ -2115,10 +2115,20 @@
     4       -- -fomit-frame-pointer : *must* in .hc files; because we're stealing
     5       --   the fp (%ebp) for our register maps.
     6         =  let n_regs = stolen_x86_regs _dflags
     7-               sta = opt_Static
     8            in
     9-                    ( [ if sta then "-DDONT_WANT_WIN32_DLL_SUPPORT" else ""
     10+                    (
     11+#if darwin_TARGET_OS
     12+                      -- By default, gcc on OS X will generate SSE
     13+                      -- instructions, which need things 16-byte aligned,
     14+                      -- but we don't 16-byte align things. Thus drop
     15+                      -- back to generic i686 compatibility. Trac #2983.
     16+                      --
     17+                      -- Since Snow Leopard (10.6), gcc defaults to x86_64.
     18+                      ["-march=i686", "-m32"],
     19+#else
     20+                      [ if sta then "-DDONT_WANT_WIN32_DLL_SUPPORT" else ""
     21                       ],
     22+#endif
     23                       [ "-fno-defer-pop",
     24                         "-fomit-frame-pointer",
     25                         -- we want -fno-builtin, because when gcc inlines
  • files/patch-sl-compiler-main-DriverPipeline.hs.diff

     
     1--- ./compiler/main/DriverPipeline.hs.bak       2010-02-09 02:26:27.000000000 -0500
     2+++ ./compiler/main/DriverPipeline.hs   2010-02-09 02:26:54.000000000 -0500
     3@@ -988,13 +988,6 @@
     4         -- This is a temporary hack.
     5                        ++ ["-mcpu=v9"]
     6 #endif
     7-#if defined(darwin_TARGET_OS) && defined(i386_TARGET_ARCH)
     8-                          -- By default, gcc on OS X will generate SSE
     9-                          -- instructions, which need things 16-byte aligned,
     10-                          -- but we don't 16-byte align things. Thus drop
     11-                          -- back to generic i686 compatibility. Trac #2983.
     12-                       ++ ["-march=i686"]
     13-#endif
     14                       ++ (if hcc && mangle
     15                             then md_regd_c_flags
     16                             else [])
  • Portfile

     
    11# $Id$
    22
    33PortSystem 1.0
     4PortGroup  archcheck 1.0
    45
    56name            ghc
    67set canonicalname       ghc
     
    6869depends_lib     port:gmp        \
    6970                port:ncursesw   \
    7071                port:libiconv
     72archcheck.files lib/libgmp.dylib \
     73                lib/libncursesw.dylib \
     74                lib/libiconv.dylib
    7175
    7276variant cabal_configure_debug description {Add verbose debugging to cabal configure commands} {
    7377        patchfiles-append       patch-compiler-Makefile-debug.diff      \
     
    100104}
    101105
    102106
    103 platform darwin 10 {
    104                 pre-fetch {
    105                         return -code error "${canonicalname} is not yet supported on Mac OS X 10.6.x (SnowLeopard)"
    106                 }
    107 }
    108 
    109 
    110107platform darwin 8 powerpc {
    111108                global ghc_bootversion
    112109                set ghc_bootversion     6.10.1
     
    211208}
    212209
    213210
     211platform darwin 10 i386 {
     212                global ghc_bootversion
     213                set ghc_bootversion     6.8.2
     214
     215                master_sites-append     ${homepage}/dist/${ghc_bootversion}/:bootstrap
     216
     217                distfiles-append        ${canonicalname}-${ghc_bootversion}-darwin-i386-leopard-bootstrap.tar.bz2:bootstrap
     218
     219                checksums-append        ${canonicalname}-${ghc_bootversion}-darwin-i386-leopard-bootstrap.tar.bz2 md5 f263cedef8bcbaa7e9014b3e06923583
     220
     221                extract.only            ${canonicalname}-${version}-src.tar.bz2 \
     222                                        ${canonicalname}-${version}-src-extralibs.tar.bz2 \
     223                                        ${canonicalname}-${ghc_bootversion}-darwin-i386-leopard-bootstrap.tar.bz2
     224
     225                pre-fetch {
     226                        set minimum_xcodeversion 3.1
     227
     228                        set current_xcodeversion [exec defaults read /Developer/Applications/Xcode.app/Contents/Info CFBundleShortVersionString]
     229                        if {[rpm-vercomp ${current_xcodeversion} ${minimum_xcodeversion}] < 0} {
     230                                ui_msg "On Mac OS X ${macosx_version}, ${name} ${version} requires Xcode ${minimum_xcodeversion} but you have Xcode ${current_xcodeversion}."
     231                                return -code error "incompatible Xcode version"
     232                        }
     233                }
     234
     235
     236                # GHC is not 64-bit friendly yet
     237                configure.build_arch i386
     238                patchfiles-append patch-sl-compiler-main-DriverPipeline.hs.diff \
     239                        patch-sl-compiler-main-DynFlags.hs.diff
     240
     241                pre-configure {
     242                        # fix up the bootstrap ghc to use 32-bit gcc
     243                        reinplace "s|-I|-optc-m32 -opta-m32 -optl-m32 -I|g" \
     244                                ${workpath}/ghc-bootstrap/bin/ghc
     245                        reinplace "s|--lflag=\"|--cflag=\"-m32\" --lflag=\"-m32 |g" \
     246                                ${workpath}/ghc-bootstrap/bin/hsc2hs
     247               
     248                        # make the build use 32-bit gcc
     249                        reinplace "s|--lflag=\"|--cflag=\"-arch i386\" --lflag=\"-arch i386 |g" \
     250                                ${worksrcpath}/mk/build.mk
     251                        set cfg [open "${worksrcpath}/mk/build.mk" a]
     252                puts $cfg "CC_OPTS += -m32"
     253                                puts $cfg "EXTRA_CABAL_CONFIGURE_FLAGS += --ld-options=\"-arch i386 \" --gcc-options=\"-arch i386 \""
     254                        close $cfg
     255                        reinplace "s|\$\(CABAL\) configure|\$\(CABAL\) configure  \$\(EXTRA_CABAL_CONFIGURE_FLAGS\)|g" \
     256                                ${worksrcpath}/libraries/Makefile
     257
     258                        # make the intermediate and final ghc use 32-bit gcc
     259                        reinplace "s|executablename|executablename -optc-m32 -opta-m32 -optl-m32|g" \
     260                                ${worksrcpath}/ghc/ghc.wrapper
     261                }
     262}
    214263post-extract {
    215264     system "tar jxf ${distpath}/testsuite-${version}.tar.bz2 -C ${worksrcpath}"
    216265}