--- a/lang/gcc7/Portfile	2017-04-23 13:35:37.000000000 +0200
+++ b/lang/gcc7/Portfile	2017-05-19 13:40:32.000000000 +0200
@@ -5,36 +5,37 @@
 PortGroup compiler_blacklist_versions 1.0
 
 name                gcc7
-subport             libgcc-devel {}
+subport             libgcc {}
 
-epoch               1
-version             7-20170420
+epoch               2
+version             7.1.0
 platforms           darwin
 categories          lang
 maintainers         nomaintainer
 # an exception in the license allows dependents to not be GPL
 license             {GPL-3+ Permissive}
-description         The GNU compiler collection, prerelease BETA
+description         The GNU compiler collection
 long_description    The GNU compiler collection, including front ends for \
-                    C, C++, Objective-C, Objective-C++, and Fortran. \
-                    This is a prerelease BETA version!
+                    C, C++, Objective-C, Objective-C++, and Fortran.
 
 homepage            http://gcc.gnu.org/
-master_sites        ftp://ftp.funet.fi/pub/mirrors/sources.redhat.com/pub/gcc/snapshots/${version}/ \
-                    ftp://gcc.gnu.org/pub/gcc/snapshots/${version}/ \
-                    http://gcc.skazkaforyou.com/snapshots/${version}/
+master_sites        ftp://ftp.funet.fi/pub/mirrors/sources.redhat.com/pub/gcc/releases/gcc-${version}/ \
+                    ftp://ftp.gwdg.de/pub/linux/gcc/releases/gcc-${version}/ \
+                    ftp://gcc.ftp.nluug.nl/mirror/languages/gcc/releases/gcc-${version}/ \
+                    ftp://gcc.gnu.org/pub/gcc/releases/gcc-${version}/ \
+                    gnu:gcc/gcc-${version}
 
 distname            gcc-${version}
 use_bzip2           yes
 
-checksums           rmd160  58ab8c87a1f78ec12135741844362089f0401e28 \
-                    sha256  93d6e4b559c8191cb91dd49586a0020f0e239a119ccb7d329ff4d03e123c196a
+checksums           rmd160  a228dc45a09eda91b1a201d234f9013b3009b461 \
+                    sha256  8a8136c235f64c6fef69cac0d73a46a1a09bb250776a050aec8f9fc880bebc17
 
 depends_lib         port:cctools \
                     port:gmp \
                     path:lib/pkgconfig/isl.pc:isl \
                     port:ld64 \
-                    port:libgcc-devel \
+                    path:lib/libgcc/libgcc_s.1.dylib:libgcc \
                     port:libiconv \
                     port:libmpc \
                     port:mpfr
@@ -49,6 +50,10 @@
 
     # see https://gcc.gnu.org/ml/gcc-patches/2012-05/msg00672.html
     patchfiles-append         patch-float128.diff
+    # cause `as` to be invoked with the -q option so that it
+    # invokes the clang integrated assembler (instead of the obsolete GNU as)
+    # `man as` claims that this is the default but clearly that is not true everywhere.
+    patchfiles-append         patch-default-clang-assembler.diff
 }
 
 configure.dir       ${workpath}/build
@@ -131,8 +136,15 @@
 
 destroot.target     install install-info-host
 
-if {${subport} eq "libgcc-devel"} {
-    conflicts       libgcc
+set standardLibs    {libgcc_ext.10.4.dylib libgcc_ext.10.5.dylib \
+    libgcc_s.1.dylib libgfortran.4.dylib libquadmath.0.dylib \
+    libstdc++.6.dylib libobjc-gnu.4.dylib libgomp.1.dylib \
+    libitm.1.dylib libssp.0.dylib libasan.0.dylib libatomic.1.dylib}
+
+if {${subport} eq "libgcc"} {
+    conflicts       libgcc-devel
+    long_description-append \
+                    This port installs the standard runtime libraries, including libstdc++.
 
     # http://trac.macports.org/ticket/35770
     # http://trac.macports.org/ticket/38814
@@ -146,7 +158,7 @@
     # version should continue to provide a subport for that and older gcc
     # versions.
 
-    depends_lib-delete port:libgcc-devel
+    depends_lib-delete path:lib/libgcc/libgcc_s.1.dylib:libgcc
 
     configure.args-delete --libdir=${prefix}/lib/${name}
     configure.args-append --libdir=${prefix}/lib/libgcc
@@ -166,9 +178,8 @@
         # Note that we really don't want to include libgcc_ext.10.[45].dylib here, but install_name_tool
         # doesn't know how to change the id of stubs, and it's easier than recreating them for each
         # gcc port.
-        set dylibs {libgcc_ext.10.4.dylib libgcc_ext.10.5.dylib libgcc_s.1.dylib libgfortran.4.dylib libquadmath.0.dylib libstdc++.6.dylib libobjc-gnu.4.dylib libgomp.1.dylib libitm.1.dylib libssp.0.dylib libasan.0.dylib libatomic.1.dylib}
 
-        foreach dylib ${dylibs} {
+        foreach dylib ${standardLibs} {
             # Different OS versions (eg: Leopard) or architectures (eg: PPC) don't produce all the dylibs
             # https://trac.macports.org/ticket/40098
             # https://trac.macports.org/ticket/40100
@@ -208,7 +219,9 @@
         # For binary compatibility with binaries that linked against the old libstdcxx port
         ln -s libgcc/libstdc++.6.dylib ${destroot}${prefix}/lib/libstdc++.6.dylib
     }
+
 } else {
+
 depends_run-append         port:gcc_select
 
 post-destroot {
@@ -221,7 +234,7 @@
         file rename ${file} ${newfile}
     }
 
-    foreach dylib {libgcc_ext.10.4.dylib libgcc_ext.10.5.dylib libgcc_s.1.dylib libgfortran.3.dylib libquadmath.0.dylib libstdc++.6.dylib libobjc-gnu.4.dylib libgomp.1.dylib libitm.1.dylib libssp.0.dylib libasan.0.dylib libatomic.1.dylib} {
+    foreach dylib ${standardLibs} {
         # Different OS versions (eg: Leopard) or architectures (eg: PPC) don't produce all the dylibs
         # https://trac.macports.org/ticket/40098
         # https://trac.macports.org/ticket/40100
@@ -274,5 +287,5 @@
 configure.universal_args
 
 livecheck.type      regex
-livecheck.url       ftp://gcc.gnu.org/pub/gcc/snapshots/
-livecheck.regex     LATEST-${major} -> (${major}-\[0-9\]+)
+livecheck.url       http://ftp.gnu.org/gnu/gcc/
+livecheck.regex     gcc-(${major}\\.\[0-9.\]+)/
