Index: Portfile
===================================================================
--- Portfile	(revision 153494)
+++ Portfile	(working copy)
@@ -8,8 +8,8 @@
 # Do not update GHC separate from Haskell Platform.
 # When updating GHC, make sure to revbump all Haskell ports.
 # Also make sure to update the version in the Haskell PortGroup.
-version             7.8.3
-revision            4
+version             8.0.1
+revision            0
 categories          lang haskell
 maintainers         cal openmaintainer
 license             BSD
@@ -34,30 +34,29 @@
 distname        ${name}-${version}-src
 worksrcdir      ${name}-${version}
 
-use_bzip2       yes
+use_xz          yes
 
 distfiles       ${name}-${version}-src${extract.suffix} \
                 ${name}-${version}-testsuite${extract.suffix}
 
-checksums       ghc-7.8.3-src.tar.bz2 \
-                rmd160  464d31d924a8c1e23e94b3cae810c4e41dad4b75 \
-                sha256  2358826f8424bf571dcc313bd882422fe108a340d6e37db4339ff6d5d6ac3f37 \
-                ghc-7.8.3-testsuite.tar.bz2 \
-                rmd160  abc39b71e2f3926b80c681428c447f39599d7d83 \
-                sha256  9cfef874adf5b895701ae52e507f07049a64246af120ac15200e7bf612521122
+checksums       ghc-8.0.1-src.tar.xz \
+                rmd160  3ad5728492a7dd874de320fe0a3936fcd7681693 \
+                sha256  90fb20cd8712e3c0fbeb2eac8dab6894404c21569746655b9b12ca9684c7d1d2 \
+                ghc-8.0.1-testsuite.tar.xz \
+                rmd160  20e03e566d0842dfcd12f48fa0cc86c6d5a3caff \
+                sha256  bc57163656ece462ef61072559d491b72c5cdd694f3c39b80ac0f6b9a3dc8151
 
 depends_build   port:ghc-bootstrap \
                 port:libxslt
 
-depends_lib     port:gmp           \
-                port:ncurses       \
-                port:libiconv      \
-                port:llvm-3.5       \
+depends_lib     port:gmp \
+                port:ncurses \
+                port:libiconv \
+                port:llvm-3.7 \
                 port:libffi
 
-patchfiles      patch-configure-workaround-bsdsed-incompatibility.diff \
-                patch-configure-disable-docs.diff \
-                patch-unix_lib_osx_sandbox_compatibility.diff
+patchfiles      patch-configure-link-ghc-pwd-against-system-libiconv.diff \
+                buildpath-abi-stability.patch
 
 livecheck.type  none
 test.run        yes
@@ -78,7 +77,7 @@
                 macports-clang-3.3
 
 set bootstraproot ${prefix}/share/ghc-bootstrap
-set llvmPrefix  ${prefix}/libexec/llvm-3.5
+set llvmPrefix  ${prefix}/libexec/llvm-3.7
 configure.args  --with-ghc=${bootstraproot}/bin/ghc \
                 --with-iconv-includes=${prefix}/include \
                 --with-iconv-libraries=${prefix}/lib \
@@ -91,6 +90,16 @@
                 --with-llc=${llvmPrefix}/bin/llc \
                 --with-opt=${llvmPrefix}/bin/opt
 
+# See https://ghc.haskell.org/trac/ghc/ticket/11744
+pre-configure {
+    try {
+        set nmclassic [exec -- xcrun --find nm-classic]
+        if {$nmclassic ne ""} {
+            configure.args-append   --with-nm=${nmclassic}
+        }
+    } catch {*} {}
+}
+
 # OK so because the bootstrap binary has been prebuilt for libraries in
 # /usr/lib we search these in addition to MacPorts' paths to prevent link
 # errors. GHC _should_ actually compile itself in stage2 using paths from the
@@ -98,8 +107,10 @@
 compiler.cpath /usr/include
 compiler.library_path /usr/lib
 
-build.args      VERBOSE=1
-destroot.args   VERBOSE=1
+pre-configure {
+    file mkdir ${worksrcpath}/build
+    file copy -force ${filespath}/build.mk ${worksrcpath}/build/build.mk
+}
 
 pre-activate {
     set obsoletes [list]
Index: files/build.mk
===================================================================
--- files/build.mk	(nonexistent)
+++ files/build.mk	(working copy)
@@ -0,0 +1,339 @@
+# -----------------------------------------------------------------------------
+# MacPorts GHC build configuration
+#
+# Uncomment one of the following BuildFlavour settings to get the desired
+# overall build type.
+
+# Disable building the documentation, we want to avoid the dependency
+BUILD_DOCBOOK_HTML = NO
+BUILD_DOCBOOK_PS   = NO
+BUILD_DOCBOOK_PDF  = NO
+
+# -------- Build profiles -----------------------------------------------------
+# Uncomment one of these to select a build profile below:
+
+# Full build with max optimisation and everything enabled (very slow build)
+#BuildFlavour = perf
+
+# As above but build GHC using the LLVM backend
+#BuildFlavour = perf-llvm
+
+# Perf build configured for a cross-compiler
+#BuildFlavour = perf-cross
+
+# Fast build with optimised libraries, no profiling (RECOMMENDED):
+BuildFlavour = quick
+
+# Fast build with optimised libraries, no profiling, with LLVM:
+#BuildFlavour = quick-llvm
+
+# Fast build configured for a cross compiler
+#BuildFlavour  = quick-cross
+
+# Even faster build.  NOT RECOMMENDED: the libraries will be
+# completely unoptimised, so any code built with this compiler
+# (including stage2) will run very slowly:
+#BuildFlavour = quickest
+
+# Profile the stage2 compiler:
+#BuildFlavour = prof
+
+# A development build, working on the stage 1 compiler:
+#BuildFlavour = devel1
+
+# A development build, working on the stage 2 compiler:
+#BuildFlavour = devel2
+
+# A build with max optimisation that still builds the stage2 compiler
+# quickly. Compiled code will be the same as with "perf". Programs
+# will compile more slowly.
+#BuildFlavour = bench
+
+# As above but build GHC using the LLVM backend
+#BuildFlavour = bench-llvm
+
+# Bench build configured for a cross-compiler
+#BuildFlavour = bench-cross
+
+# Use the same settings as validate.
+#BuildFlavour = validate
+
+ifneq "$(BuildFlavour)" ""
+include mk/flavours/$(BuildFlavour).mk
+endif
+
+# -------- Miscellaneous variables --------------------------------------------
+
+# Set to V = 0 to get prettier build output.
+# Please use V=1 (the default) when reporting GHC bugs.
+V = 0
+
+# Should all enabled warnings (see mk/warnings.mk) be turned into errors while
+# building stage 2?
+#WERROR=-Werror
+
+# After stage 1 and the libraries have been built, you can uncomment this line:
+#stage=2
+
+# Then stage 1 will not be touched by the build system, until
+# you comment the line again.  This is a useful trick for when you're
+# working on stage 2 and want to freeze stage 1 and the libraries for
+# a while.
+
+# Build the "extra" packages (see ./packages). This enables more tests. See:
+# https://ghc.haskell.org/trac/ghc/wiki/Building/RunningTests/Running#AdditionalPackages
+#BUILD_EXTRA_PKGS=YES
+
+# Uncomment the following line to enable building DPH
+#BUILD_DPH=YES
+
+# Uncomment the following to force `integer-gmp` to use the in-tree GMP 5.0.4
+# (other sometimes useful configure-options: `--with-gmp-{includes,libraries}`)
+#libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-intree-gmp
+
+GhcLibWays = $(if $(filter $(DYNAMIC_GHC_PROGRAMS),YES),v dyn,v)
+
+# Only use -fasm by default on platforms that support it.
+GhcFAsm = $(if $(filter $(GhcWithNativeCodeGen),YES),-fasm,)
+
+# ----------- A Performance/Distribution build --------------------------------
+
+ifeq "$(BuildFlavour)" "perf"
+
+# perf matches the default settings, repeated here for comparison:
+
+SRC_HC_OPTS     = -O -H64m
+GhcStage1HcOpts = -O $(GhcFAsm)
+GhcStage2HcOpts = -O2 $(GhcFAsm)
+GhcHcOpts       = -Rghc-timing
+GhcLibHcOpts    = -O2
+GhcLibWays     += p
+
+ifeq "$(PlatformSupportsSharedLibs)" "YES"
+GhcLibWays += dyn
+endif
+
+endif
+
+# ---------------- Perf build using LLVM --------------------------------------
+
+ifeq "$(BuildFlavour)" "perf-llvm"
+
+SRC_HC_OPTS     = -O -H64m -fllvm
+GhcStage1HcOpts = -O -fllvm
+GhcStage2HcOpts = -O2 -fllvm
+GhcHcOpts       = -Rghc-timing
+GhcLibHcOpts    = -O2
+GhcLibWays     += p
+
+endif
+
+# ------- A Perf build configured for cross-compilation ----------------------
+
+ifeq "$(BuildFlavour)" "perf-cross"
+
+SRC_HC_OPTS     = -O -H64m -fllvm
+GhcStage1HcOpts = -O2
+GhcStage2HcOpts = -O2 -fllvm
+GhcHcOpts       = -Rghc-timing
+GhcLibHcOpts    = -O2
+GhcLibWays     += p
+INTEGER_LIBRARY    = integer-simple
+Stage1Only         = YES
+
+HADDOCK_DOCS       = NO
+BUILD_DOCBOOK_HTML = NO
+BUILD_DOCBOOK_PS   = NO
+BUILD_DOCBOOK_PDF  = NO
+
+DYNAMIC_BY_DEFAULT   = NO
+DYNAMIC_GHC_PROGRAMS = NO
+
+endif
+
+# -------- A Fast build -------------------------------------------------------
+
+ifeq "$(BuildFlavour)" "quickest"
+
+SRC_HC_OPTS        = -H64m -O0 $(GhcFAsm)
+GhcStage1HcOpts    = -O $(GhcFAsm)
+GhcStage2HcOpts    = -O0 $(GhcFAsm)
+GhcLibHcOpts       = -O0 $(GhcFAsm)
+SplitObjs          = NO
+HADDOCK_DOCS       = NO
+BUILD_DOCBOOK_HTML = NO
+BUILD_DOCBOOK_PS   = NO
+BUILD_DOCBOOK_PDF  = NO
+
+endif
+
+# -------- A Fast build with optimised libs -----------------------------------
+
+ifeq "$(BuildFlavour)" "quick"
+
+SRC_HC_OPTS        = -H64m -O0 $(GhcFAsm)
+GhcStage1HcOpts    = -O $(GhcFAsm)
+GhcStage2HcOpts    = -O0 $(GhcFAsm)
+GhcLibHcOpts       = -O $(GhcFAsm)
+SplitObjs          = NO
+HADDOCK_DOCS       = NO
+BUILD_DOCBOOK_HTML = NO
+BUILD_DOCBOOK_PS   = NO
+BUILD_DOCBOOK_PDF  = NO
+
+endif
+
+# -------- A Fast build with optimised libs using LLVM ------------------------
+
+ifeq "$(BuildFlavour)" "quick-llvm"
+
+SRC_HC_OPTS        = -H64m -O0 -fllvm
+GhcStage1HcOpts    = -O -fllvm
+GhcStage2HcOpts    = -O0 -fllvm
+GhcLibHcOpts       = -O -fllvm
+SplitObjs          = NO
+HADDOCK_DOCS       = NO
+BUILD_DOCBOOK_HTML = NO
+BUILD_DOCBOOK_PS   = NO
+BUILD_DOCBOOK_PDF  = NO
+
+endif
+
+# -------- A Fast build configured for cross-compilation ----------------------
+
+ifeq "$(BuildFlavour)" "quick-cross"
+
+SRC_HC_OPTS        = -H64m -O0
+GhcStage1HcOpts    = -O
+GhcStage2HcOpts    = -O0 -fllvm
+GhcLibHcOpts       = -O -fllvm
+SplitObjs          = NO
+HADDOCK_DOCS       = NO
+BUILD_DOCBOOK_HTML = NO
+BUILD_DOCBOOK_PS   = NO
+BUILD_DOCBOOK_PDF  = NO
+INTEGER_LIBRARY    = integer-simple
+Stage1Only         = YES
+
+DYNAMIC_BY_DEFAULT   = NO
+DYNAMIC_GHC_PROGRAMS = NO
+
+endif
+
+# -------- Profile the stage2 compiler ----------------------------------------
+
+ifeq "$(BuildFlavour)" "prof"
+
+SRC_HC_OPTS        = -H64m -O0 $(GhcFAsm)
+GhcStage1HcOpts    = -O $(GhcFAsm)
+GhcStage2HcOpts    = -O $(GhcFAsm)
+GhcLibHcOpts       = -O $(GhcFAsm)
+
+GhcLibWays         += p
+GhcProfiled        = YES
+
+SplitObjs          = NO
+HADDOCK_DOCS       = NO
+BUILD_DOCBOOK_HTML = NO
+BUILD_DOCBOOK_PS   = NO
+BUILD_DOCBOOK_PDF  = NO
+
+endif
+
+# -------- A Development build (stage 1) --------------------------------------
+
+ifeq "$(BuildFlavour)" "devel1"
+
+SRC_HC_OPTS        = -H64m -O $(GhcFAsm)
+GhcLibHcOpts       = -O -dcore-lint
+GhcStage1HcOpts    = -Rghc-timing -O0 -DDEBUG
+GhcStage2HcOpts    = -Rghc-timing -O $(GhcFAsm)
+SplitObjs          = NO
+HADDOCK_DOCS       = NO
+BUILD_DOCBOOK_HTML = NO
+BUILD_DOCBOOK_PS   = NO
+BUILD_DOCBOOK_PDF  = NO
+LAX_DEPENDENCIES   = YES
+
+endif
+
+# -------- A Development build (stage 2) --------------------------------------
+
+ifeq "$(BuildFlavour)" "devel2"
+
+SRC_HC_OPTS        = -H64m -O $(GhcFAsm)
+GhcLibHcOpts       = -O -dcore-lint
+GhcStage1HcOpts    = -Rghc-timing -O $(GhcFAsm)
+GhcStage2HcOpts    = -Rghc-timing -O0 -DDEBUG
+SplitObjs          = NO
+HADDOCK_DOCS       = NO
+BUILD_DOCBOOK_HTML = NO
+BUILD_DOCBOOK_PS   = NO
+BUILD_DOCBOOK_PDF  = NO
+LAX_DEPENDENCIES   = YES
+
+endif
+
+# -------- A bench build with optimised libs -----------------------------------
+
+ifeq "$(BuildFlavour)" "bench"
+
+SRC_HC_OPTS        = -O -H64m
+GhcStage1HcOpts    = -O $(GhcFAsm)
+GhcStage2HcOpts    = -O0 $(GhcFAsm)
+GhcLibHcOpts       = -O2 $(GhcFAsm)
+SplitObjs          = NO
+HADDOCK_DOCS       = NO
+BUILD_DOCBOOK_HTML = NO
+BUILD_DOCBOOK_PS   = NO
+BUILD_DOCBOOK_PDF  = NO
+
+endif
+
+# ---------------- Bench build using LLVM --------------------------------------
+
+ifeq "$(BuildFlavour)" "bench-llvm"
+
+SRC_HC_OPTS        = -O -H64m
+GhcStage1HcOpts    = -O -fllvm
+GhcStage2HcOpts    = -O0 -fllvm
+GhcLibHcOpts       = -O2 -fllvm
+SplitObjs          = NO
+HADDOCK_DOCS       = NO
+BUILD_DOCBOOK_HTML = NO
+BUILD_DOCBOOK_PS   = NO
+BUILD_DOCBOOK_PDF  = NO
+
+endif
+
+# ------- A Bench build configured for cross-compilation ----------------------
+
+ifeq "$(BuildFlavour)" "bench-cross"
+
+SRC_HC_OPTS        = -O -H64m
+GhcStage1HcOpts    = -O $(GhcFAsm)
+GhcStage2HcOpts    = -O0 $(GhcFAsm)
+GhcLibHcOpts       = -O2 $(GhcFAsm)
+SplitObjs          = NO
+INTEGER_LIBRARY    = integer-simple
+Stage1Only         = YES
+HADDOCK_DOCS       = NO
+BUILD_DOCBOOK_HTML = NO
+BUILD_DOCBOOK_PS   = NO
+BUILD_DOCBOOK_PDF  = NO
+
+DYNAMIC_BY_DEFAULT   = NO
+DYNAMIC_GHC_PROGRAMS = NO
+
+endif
+
+# -----------------------------------------------------------------------------
+# Other settings that might be useful
+
+# NoFib settings
+NoFibWays =
+STRIP_CMD = :
+
+# ghc-pwd needs to link against /usr/lib/libiconv.dylib explicitly, because
+# ghc-bootstrap's base library .a archive expects it
+utils/ghc-pwd_EXTRA_LIBRARIES += "/usr/lib/libiconv.dylib"
Index: files/buildpath-abi-stability.patch
===================================================================
--- files/buildpath-abi-stability.patch	(nonexistent)
+++ files/buildpath-abi-stability.patch	(working copy)
@@ -0,0 +1,35 @@
+Avoid leaking build path into ABI hashes
+
+GHC's build path leaks into the ABI hashes it generates by default. This
+causes problems because it means that recompiling GHC in a different path
+also requires recompiling all Haskell packages. Obviously, this is
+undesirable for a distribution.
+
+This patch originates from Debian's Joachim Breitner. See
+http://bugs.debian.org/785282 for the Debian bug report. It has been
+submitted upstream in https://ghc.haskell.org/trac/ghc/ticket/10424.
+
+Upstream-Status: Submitted [https://ghc.haskell.org/trac/ghc/ticket/10424]
+Index: ./compiler/iface/MkIface.hs
+===================================================================
+--- ./compiler/iface/MkIface.hs	2015-05-17 20:34:02.808643844 +0200
++++ ./compiler/iface/MkIface.hs	2015-05-17 20:34:02.804643799 +0200
+@@ -611,7 +611,7 @@
+    iface_hash <- computeFingerprint putNameLiterally
+                       (mod_hash,
+                        ann_fn (mkVarOcc "module"),  -- See mkIfaceAnnCache
+-                       mi_usages iface0,
++                       usages,
+                        sorted_deps,
+                        mi_hpc iface0)
+ 
+@@ -644,6 +644,9 @@
+     (non_orph_fis,   orph_fis)   = mkOrphMap ifFamInstOrph (mi_fam_insts iface0)
+     fix_fn = mi_fix_fn iface0
+     ann_fn = mkIfaceAnnCache (mi_anns iface0)
++    -- Do not allow filenames to affect the interface
++    usages = [ case u of UsageFile _ fp -> UsageFile "" fp; _ -> u | u <- mi_usages iface0 ]
++
+ 
+ getOrphanHashes :: HscEnv -> [Module] -> IO [Fingerprint]
+ getOrphanHashes hsc_env mods = do
Index: files/patch-configure-disable-docs.diff
===================================================================
--- files/patch-configure-disable-docs.diff	(revision 153494)
+++ files/patch-configure-disable-docs.diff	(nonexistent)
@@ -1,12 +0,0 @@
---- configure.orig	2014-09-17 23:12:43.000000000 +0200
-+++ configure	2014-09-17 23:13:29.000000000 +0200
-@@ -11943,6 +11943,9 @@
-     BUILD_DOCBOOK_PS=YES
-     BUILD_DOCBOOK_PDF=YES
- fi
-+BUILD_DOCBOOK_HTML=NO
-+BUILD_DOCBOOK_PS=NO
-+BUILD_DOCBOOK_PDF=NO
- 
- 
- 
Index: files/patch-configure-link-ghc-pwd-against-system-libiconv.diff
===================================================================
--- files/patch-configure-link-ghc-pwd-against-system-libiconv.diff	(nonexistent)
+++ files/patch-configure-link-ghc-pwd-against-system-libiconv.diff	(working copy)
@@ -0,0 +1,20 @@
+Fix initial build of ghc-pwd due to missing libiconv
+
+ghc-pwd fails to build because it is built using ghc-bootstrap, which ships
+libHSbase-$version.a, which references symbols from libiconv (and actually the
+system libiconv, because the MacPorts use uses _libiconv as symbol names, but
+the archive uses _iconv). Fix this by explicitly linking against the system
+libiconv for this initial build of ghc-pwd.
+
+Upstream-Status: Inappropriate (/usr/lib/libiconv.dylib is system-specific; a generic solution would be needed)
+--- configure.orig	2016-05-20 23:40:29.000000000 +0200
++++ configure	2016-05-20 23:41:06.000000000 +0200
+@@ -4149,7 +4149,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=`perl -e 'foreach (@ARGV) { print "-optl$_ " }' -- $LDFLAGS`
++                GHC_LDFLAGS=`perl -e 'foreach (@ARGV) { print "-optl$_ " }' -- $LDFLAGS /usr/lib/libiconv.dylib`
+         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: files/patch-configure-workaround-bsdsed-incompatibility.diff
===================================================================
--- files/patch-configure-workaround-bsdsed-incompatibility.diff	(revision 153494)
+++ files/patch-configure-workaround-bsdsed-incompatibility.diff	(nonexistent)
@@ -1,11 +0,0 @@
---- 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: files/patch-unix_lib_osx_sandbox_compatibility.diff
===================================================================
--- files/patch-unix_lib_osx_sandbox_compatibility.diff	(revision 153494)
+++ files/patch-unix_lib_osx_sandbox_compatibility.diff	(nonexistent)
@@ -1,28 +0,0 @@
---- libraries/unix/System/Posix/Files.hsc.orig	2014-09-21 17:58:47.000000000 +0200
-+++ libraries/unix/System/Posix/Files.hsc	2014-09-21 17:59:31.000000000 +0200
-@@ -152,7 +152,8 @@
-     if (r == 0)
-         then return True
-         else do err <- getErrno
--                if (err == eACCES || err == eROFS || err == eTXTBSY)
-+                if (err == eACCES || err == eROFS || err == eTXTBSY ||
-+                    err == ePERM)
-                    then return False
-                    else throwErrnoPath "fileAccess" name
- 
---- libraries/unix/System/Posix/Files/ByteString.hsc.orig	2014-09-21 17:58:54.000000000 +0200
-+++ libraries/unix/System/Posix/Files/ByteString.hsc	2014-09-21 18:02:27.000000000 +0200
-@@ -158,9 +158,10 @@
-     if (r == 0)
- 	then return True
- 	else do err <- getErrno
--	        if (err == eACCES)
--		   then return False
--		   else throwErrnoPath "fileAccess" name
-+                if (err == eACCES || err == eROFS || err == eTXTBSY ||
-+                    err == ePERM)
-+                   then return False
-+                   else throwErrnoPath "fileAccess" name
- 
- 
- -- | @getFileStatus path@ calls gets the @FileStatus@ information (user ID,
