Index: files/patch-sl-compiler-main-DynFlags.hs.diff
===================================================================
--- files/patch-sl-compiler-main-DynFlags.hs.diff	(revision 0)
+++ files/patch-sl-compiler-main-DynFlags.hs.diff	(revision 0)
@@ -0,0 +1,25 @@
+--- compiler/main/DynFlags.hs.orig	2010-02-09 15:39:50.000000000 -0500
++++ compiler/main/DynFlags.hs	2010-02-09 15:49:29.000000000 -0500
+@@ -2115,10 +2115,20 @@
+       -- -fomit-frame-pointer : *must* in .hc files; because we're stealing
+       --   the fp (%ebp) for our register maps.
+         =  let n_regs = stolen_x86_regs _dflags
+-               sta = opt_Static
+            in
+-                    ( [ if sta then "-DDONT_WANT_WIN32_DLL_SUPPORT" else ""
++                    (
++#if darwin_TARGET_OS
++                      -- By default, gcc on OS X will generate SSE
++                      -- instructions, which need things 16-byte aligned,
++                      -- but we don't 16-byte align things. Thus drop
++                      -- back to generic i686 compatibility. Trac #2983.
++                      --
++                      -- Since Snow Leopard (10.6), gcc defaults to x86_64.
++                      ["-march=i686", "-m32"],
++#else
++                      [ if sta then "-DDONT_WANT_WIN32_DLL_SUPPORT" else ""
+                       ],
++#endif
+                       [ "-fno-defer-pop",
+                         "-fomit-frame-pointer",
+                         -- we want -fno-builtin, because when gcc inlines
Index: files/patch-sl-compiler-main-DriverPipeline.hs.diff
===================================================================
--- files/patch-sl-compiler-main-DriverPipeline.hs.diff	(revision 0)
+++ files/patch-sl-compiler-main-DriverPipeline.hs.diff	(revision 0)
@@ -0,0 +1,16 @@
+--- ./compiler/main/DriverPipeline.hs.bak	2010-02-09 02:26:27.000000000 -0500
++++ ./compiler/main/DriverPipeline.hs	2010-02-09 02:26:54.000000000 -0500
+@@ -988,13 +988,6 @@
+         -- This is a temporary hack.
+                        ++ ["-mcpu=v9"]
+ #endif
+-#if defined(darwin_TARGET_OS) && defined(i386_TARGET_ARCH)
+-                          -- By default, gcc on OS X will generate SSE
+-                          -- instructions, which need things 16-byte aligned,
+-                          -- but we don't 16-byte align things. Thus drop
+-                          -- back to generic i686 compatibility. Trac #2983.
+-                       ++ ["-march=i686"]
+-#endif
+ 		       ++ (if hcc && mangle
+ 		  	     then md_regd_c_flags
+ 		  	     else [])
Index: Portfile
===================================================================
--- Portfile	(revision 63396)
+++ Portfile	(working copy)
@@ -1,6 +1,7 @@
 # $Id$
 
 PortSystem 1.0
+PortGroup  archcheck 1.0
 
 name		ghc
 set canonicalname	ghc
@@ -68,6 +69,9 @@
 depends_lib	port:gmp	\
 		port:ncursesw	\
 		port:libiconv
+archcheck.files lib/libgmp.dylib \
+		lib/libncursesw.dylib \
+		lib/libiconv.dylib
 
 variant cabal_configure_debug description {Add verbose debugging to cabal configure commands} {
 	patchfiles-append	patch-compiler-Makefile-debug.diff	\
@@ -100,13 +104,6 @@
 }
 
 
-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
@@ -211,6 +208,58 @@
 }
 
 
+platform darwin 10 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"
+        		}
+		}
+
+
+		# GHC is not 64-bit friendly yet
+		configure.build_arch i386
+		patchfiles-append patch-sl-compiler-main-DriverPipeline.hs.diff \
+			patch-sl-compiler-main-DynFlags.hs.diff
+
+		pre-configure {
+			# fix up the bootstrap ghc to use 32-bit gcc
+			reinplace "s|-I|-optc-m32 -opta-m32 -optl-m32 -I|g" \
+				${workpath}/ghc-bootstrap/bin/ghc
+			reinplace "s|--lflag=\"|--cflag=\"-m32\" --lflag=\"-m32 |g" \
+				${workpath}/ghc-bootstrap/bin/hsc2hs
+		
+			# make the build use 32-bit gcc
+			reinplace "s|--lflag=\"|--cflag=\"-arch i386\" --lflag=\"-arch i386 |g" \
+				${worksrcpath}/mk/build.mk
+			set cfg [open "${worksrcpath}/mk/build.mk" a]
+            	puts $cfg "CC_OPTS += -m32"
+				puts $cfg "EXTRA_CABAL_CONFIGURE_FLAGS += --ld-options=\"-arch i386 \" --gcc-options=\"-arch i386 \""
+			close $cfg
+			reinplace "s|\$\(CABAL\) configure|\$\(CABAL\) configure  \$\(EXTRA_CABAL_CONFIGURE_FLAGS\)|g" \
+				${worksrcpath}/libraries/Makefile
+
+			# make the intermediate and final ghc use 32-bit gcc
+			reinplace "s|executablename|executablename -optc-m32 -opta-m32 -optl-m32|g" \
+				${worksrcpath}/ghc/ghc.wrapper
+		}
+}
 post-extract {
      system "tar jxf ${distpath}/testsuite-${version}.tar.bz2 -C ${worksrcpath}" 
 }
