Index: ghc/Portfile
===================================================================
--- ghc/Portfile	(revision 125437)
+++ ghc/Portfile	(working copy)
@@ -5,11 +5,9 @@
 PortGroup           active_variants 1.1
 
 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            4
+version             7.8.3
 categories          lang haskell
 maintainers         gmail.com:kitchen.andy cal openmaintainer
 license             BSD
@@ -29,97 +27,48 @@
         GHC comes with a generational garbage collector,    \
         and a space and time profiler.
 
-homepage        http://haskell.org/${canonicalname}
+homepage        http://haskell.org/${name}
 master_sites    ${homepage}/dist/${version}/
-distname        ${canonicalname}-${version}-src
-worksrcdir      ${canonicalname}-${version}
+distname        ${name}-${version}-src
+worksrcdir      ${name}-${version}
 
 use_bzip2       yes
 
-distfiles       ${canonicalname}-${version}-src${extract.suffix} \
-                ${canonicalname}-${version}-testsuite${extract.suffix}
+distfiles       ${name}-${version}-src${extract.suffix} \
+                ${name}-${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
+checksums       ghc-7.8.3-src.tar.bz2 \
+                rmd160  464d31d924a8c1e23e94b3cae810c4e41dad4b75 \
+                sha256  2358826f8424bf571dcc313bd882422fe108a340d6e37db4339ff6d5d6ac3f37 \
+                ghc-7.8.3-testsuite.tar.bz2 \
+                rmd160  abc39b71e2f3926b80c681428c447f39599d7d83 \
+                sha256  9cfef874adf5b895701ae52e507f07049a64246af120ac15200e7bf612521122
 
 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-utils__mkdirhier__mkdirhier.sh.diff \
-                patch-includes_HsFFI.h.diff
+                port:libiconv      \
+                port:llvm-3.5
 
+patchfiles      patch-configure-workaround-bsdsed-incompatibility.diff \
+                patch-configure-disable-docs.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}
-    require_active_variants ghc-bootstrap gcc43
-}
-
-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}
-    require_active_variants ghc-bootstrap gcc44
-}
-
-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}
-    require_active_variants ghc-bootstrap gcc45
-}
-
-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}
-    require_active_variants ghc-bootstrap gcc46
-}
-
-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}
-    require_active_variants ghc-bootstrap gcc47
-}
-
-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}
-    require_active_variants ghc-bootstrap gcc48
-}
-
-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}
-    require_active_variants ghc-bootstrap gcc49
-}
-
-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
+set llvmPrefix  ${prefix}/libexec/llvm-3.5
 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
+                --with-gmp-libraries=${prefix}/lib      \
+                --with-gcc="${configure.cc}"            \
+                --with-llc=${llvmPrefix}/bin/llc        \
+                --with-opt=${llvmPrefix}/bin/opt
+
 
 # OK so because the bootstrap binary has been prebuilt for libraries
 # in /usr/lib we search these before macports stuff to prevent
@@ -128,10 +77,13 @@
 compiler.cpath /usr/include
 compiler.library_path /usr/lib
 
+build.args      VERBOSE=1
+destroot.args   VERBOSE=1
+
 post-destroot {
     set prefixlib ${prefix}/lib/${worksrcdir}
     set destlib   ${destroot}/${prefixlib}
-    set libver    ${canonicalname}${version}
+    set libver    ${name}${version}
 
     variable libs [ list                               \
                     libHSrts-${libver}.dylib           \
@@ -173,7 +125,7 @@
     # delete old ${prefix}/lib/ghc-${version} directories
     foreach fullpath [glob -directory ${prefix}/lib ghc-*] {
         if {$fullpath ne $libprefix} {
-            ui_debug "Cleaning up remnant GHC library directory ${fullpath}"
+            ui_info "Cleaning up remnant GHC library directory ${fullpath}"
             delete $fullpath
         }
     }
@@ -202,7 +154,7 @@
     fs-traverse file $packageconfd {
         foreach pattern $deletefiles {
             if {[string match $pattern $file]} {
-                ui_debug "Removing remnant package registration file ${file}" 
+                ui_info "Removing remnant package registration file ${file}"
                 delete $file
             }
         }
Index: ghc/files/patch-configure-workaround-bsdsed-incompatibility.diff
===================================================================
--- ghc/files/patch-configure-workaround-bsdsed-incompatibility.diff	(revision 0)
+++ ghc/files/patch-configure-workaround-bsdsed-incompatibility.diff	(working copy)
@@ -0,0 +1,11 @@
+--- configure.orig	2014-09-17 22:40:16.000000000 +0200
++++ configure	2014-09-17 22:40:40.000000000 +0200
+@@ -4075,7 +4075,7 @@
+ $as_echo "$as_me: Building in-tree ghc-pwd" >&6;}
+                 rm -rf utils/ghc-pwd/dist-boot
+     mkdir  utils/ghc-pwd/dist-boot
+-                GHC_LDFLAGS=`echo $LDFLAGS | sed 's/\(^\| \)\([^ ]\)/\1-optl\2/g'`
++                GHC_LDFLAGS= # this breaks our build with BSD sed, and we don't need the LDFLAGS here
+         if ! "$WithGhc" $GHC_LDFLAGS -v0 -no-user-$GHC_PACKAGE_DB_FLAG -hidir utils/ghc-pwd/dist-boot -odir utils/ghc-pwd/dist-boot -stubdir utils/ghc-pwd/dist-boot --make utils/ghc-pwd/Main.hs -o utils/ghc-pwd/dist-boot/ghc-pwd
+     then
+         as_fn_error $? "Building ghc-pwd failed" "$LINENO" 5
Index: ghc-bootstrap/Portfile
===================================================================
--- ghc-bootstrap/Portfile	(revision 125437)
+++ ghc-bootstrap/Portfile	(working copy)
@@ -5,8 +5,8 @@
 
 name                ghc-bootstrap
 set canonicalname   ghc
-version             7.0.4
-revision            1
+# Note: 7.6.3 doesn't have a i386 darwin version at http://www.haskell.org/ghc/dist/7.6.3
+version             7.6.2
 categories          lang haskell
 maintainers         gmail.com:kitchen.andy cal openmaintainer
 license             BSD
@@ -27,51 +27,19 @@
 use_bzip2           yes
 
 checksums           ${canonicalname}-${version}-i386-apple-darwin${extract.suffix} \
-                        rmd160  ed4cb136a30455e57ca4526d89b019fe4ce638f3 \
-                        sha256  c316fcd59166f1075675d7365b06cca973aec6623254a4a7fb28e74c352c4462 \
+                        rmd160  232b3aa4ed9e2ff09d520f4ae02fa572a671178a \
+                        sha256  c1da502fa7d99f3d87370c65d705a7e8ee4c900fdb62df6f71696c5432047059 \
                     ${canonicalname}-${version}-x86_64-apple-darwin${extract.suffix} \
-                        rmd160  14f4c6a044eaa3d04f1645324f9255eebff9a49d \
-                        sha256  74580b919b5205007901d15da88635e4b2dcc887086fb16d238eeb7011a255d4
+                        rmd160  b0870a4a292fae7248f9b0be485affa4a5a76a2d \
+                        sha256  eb0dd19bd5a6eede332d58de219437b9c2b186c72a1fc0c60fa1095b0c2d2789
 
-# -- BEGIN gcc variants
-
-variant gcc43 conflicts gcc44 gcc45 gcc46 gcc47 gcc48 gcc49 description {Compile with gcc 4.3} {
-    configure.compiler      macports-gcc-4.3
-}
-
-variant gcc44 conflicts gcc43 gcc45 gcc46 gcc47 gcc48 gcc49 description {Compile with gcc 4.4} {
-    configure.compiler      macports-gcc-4.4
-}
-
-variant gcc45 conflicts gcc43 gcc44 gcc46 gcc47 gcc48 gcc49 description {Compile with gcc 4.5} {
-    configure.compiler      macports-gcc-4.5
-}
-
-variant gcc46 conflicts gcc43 gcc44 gcc45 gcc47 gcc48 gcc49 description {Compile with gcc 4.6} {
-    configure.compiler      macports-gcc-4.6
-}
-
-variant gcc47 conflicts gcc43 gcc44 gcc45 gcc46 gcc48 gcc49 description {Compile with gcc 4.7} {
-    configure.compiler      macports-gcc-4.7
-}
-
-variant gcc48 conflicts gcc43 gcc44 gcc45 gcc46 gcc47 gcc49 description {Compile with gcc 4.8} {
-    configure.compiler      macports-gcc-4.8
-}
-
-variant gcc49 conflicts gcc43 gcc44 gcc45 gcc46 gcc47 gcc48 description {Compile with gcc 4.9} {
-    configure.compiler      macports-gcc-4.9
-}
-
-if {![variant_isset gcc43] && ![variant_isset gcc44] &&
-    ![variant_isset gcc45] && ![variant_isset gcc46] &&
-    ![variant_isset gcc47] && ![variant_isset gcc49]} {
-    default_variants +gcc48
+post-extract {
+    # Copy clang-wrapper for re-inplace during configure
+    xinstall -m 644 ${filespath}/clang-wrapper ${workpath}/clang-wrapper
 }
 
-# -- END gcc variants
-
 configure.pre_args  --prefix=${prefix}/share/ghc-bootstrap
+configure.args      --with-gcc=${configure.cc}
 
 pre-configure {
     # OK so because this binary has been prebuilt for libraries
@@ -79,24 +47,34 @@
     # weird things don't happen
     configure.ldflags  -L/usr/lib
     configure.cppflags -I/usr/include
+
+    # patch clang-wrapper and make sure it is used by patching settings.in
+    reinplace "s#@clang@#${configure.cc}#g" ${workpath}/clang-wrapper
+    reinplace "s#@SettingsCCompilerCommand@#${prefix}/share/ghc-bootstrap/libexec/clang-wrapper#g" ${worksrcpath}/settings.in
 }
 
 build {}
 
 post-destroot {
+    # install clang-wrapper to libexec
+    xinstall -d -m 755 ${destroot}${prefix}/share/ghc-bootstrap/libexec
+    xinstall -m 755 ${workpath}/clang-wrapper ${destroot}${prefix}/share/ghc-bootstrap/libexec
+
     # 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 any dylibs.
+    # 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 any dylibs.
+
+    # We also delete all the .html files, because we really don't need the
+    # documentation in a bootstrap port.
     fs-traverse f ${destroot}${prefix} {
         if {[file isfile ${f}]} {
-            if {[file extension ${f}] == ".dylib"} {
+            set ext [file extension ${f}]
+            if {${ext} eq ".dylib" || ${ext} eq ".html"} {
                 delete ${f}
             }
         }
     }
 }
 
-# TODO don't install documentation
-
 livecheck.type      none
Index: ghc-bootstrap/files/clang-wrapper
===================================================================
--- ghc-bootstrap/files/clang-wrapper	(revision 0)
+++ ghc-bootstrap/files/clang-wrapper	(working copy)
@@ -0,0 +1,73 @@
+#!/usr/bin/python
+# vim:ts=4:sts=4:sw=4:et:tw=120
+# Explicitly using /usr/bin/python, not /usr/bin/env python here.
+
+##########
+# README #
+##########
+# This script wraps clang for GHC. GHC won't compile with clang's preprocessor unless the flags
+#   -Wno-invalid-pp-token -Wno-unicode -Wno-trigraphs
+# are passed (in addition to -E -undef -traditional, which are already passed in by GHC). Furthermore, if a compilation
+# language is passed and it is C (i.e., -x c), it is replaced with -x assembler-with-cpp.
+#
+# There is a popular script fulfilling the same purpose on Github, but the script does not specify a license and can
+# thus not be re-distributed and used in MacPorts. To avoid the same problem with this script further down the road:
+#
+###########
+# LICENSE #
+###########
+#
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# Copyright (c) 2014, Clemens Lang <cal@macports.org>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
+#    disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
+#    disclaimer in the documentation and/or other materials provided with the distribution.
+#
+#    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+#    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+#    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+#    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+#    WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+#    USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import sys
+import os
+
+# To be reinplaced on installation, should hold the absolute path to clang
+__clang_path = '@clang@'
+
+# The set of flags to be added in preprocessor mode
+__clang_cpp_flags = ['-Wno-invalid-pp-token', '-Wno-unicode', '-Wno-trigraphs']
+
+def filterLanguageFlag(args):
+    lastArgWasLanguage = False
+    # Start at 1, because index 0 is the program basename, and we don't want to check that for -x
+    for idx in range(1, len(args)):
+        if lastArgWasLanguage and args[idx].lower() == 'c':
+            args[idx] = 'assembler-with-cpp'
+        lastArgWasLanguage = args[idx] == '-x'
+    return args
+
+# copy argv for modification
+args = sys.argv[:]
+
+# Don't check for -E, -undef, -traditional in sys.argv[0]
+# But check for the presence of all -E, -undef, and -traditional in the other flags
+if all(needle in sys.argv[1:] for needle in ['-E', '-undef', '-traditional']):
+    # We're in preprocessor mode, replace "-x c" with "-x assembler-with-cpp" and append __clang_cpp_flags
+    args = filterLanguageFlag(args)
+    args.extend(__clang_cpp_flags) 
+
+# Replace args[0] with the real path to clang and exec that instead
+args[0] = __clang_path
+#print >> sys.stderr, "Executing: %s" % repr(args)
+os.execv(args[0], args)
