--- Portfile.orig	2013-04-11 18:43:16.000000000 -0400
+++ Portfile	2013-04-12 10:15:24.000000000 -0400
@@ -5,44 +5,54 @@
 PortGroup compiler_blacklist_versions 1.0
 
 name                gcc48
-subport             libstdcxx-devel {}
+subport             libstdcxx {}
+epoch               1
 
-# Remove the revision in libstdcxx-devel when bumping
-version             4.8-20130404
-revision            1
+version             4.8.0
 platforms           darwin
 categories          lang
 maintainers         mww openmaintainer
 # 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++, Fortran and Java. \
-                    This is a prerelease BETA version!
+                    C, C++, Objective-C, Objective-C++, Fortran and Java.
 
 homepage            http://gcc.gnu.org/
-master_sites        http://gcc.petsads.us/snapshots/${version} \
-                    ftp://ftp.gwdg.de/pub/linux/gcc/snapshots/${version}/ \
-                    ftp://ftp.funet.fi/pub/mirrors/sources.redhat.com/pub/gcc/snapshots/${version}/ \
-                    ftp://gcc.gnu.org/pub/gcc/snapshots/${version}/ \
-                    http://mirrors-us.seosue.com/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}/:gcc \
+                    ftp://ftp.gwdg.de/pub/linux/gcc/releases/gcc-${version}/:gcc \
+                    ftp://gcc.ftp.nluug.nl/mirror/languages/gcc/releases/gcc-${version}/:gcc \
+                    ftp://gcc.gnu.org/pub/gcc/releases/gcc-${version}/:gcc \
+                    gnu:gcc/gcc-${version}:gcc \
+                    ftp://sourceware.org/pub/java/:ecj \
+                    http://mirrors.kernel.org/sources.redhat.com/java/:ecj \
+                    http://www.mirrorservice.org/sites/sources.redhat.com/pub/java/:ecj \
+                    http://ftp-stud.fht-esslingen.de/pub/Mirrors/sourceware.org/java/:ecj
 
 distname            gcc-${version}
 
-checksums           rmd160  b5ac698129f3be6c4a6e6424b71ee51041ce9bb9 \
-                    sha256  428088223bec4ab6b832196ac84da1ae25ac72bf26403b49851a20a19d4d915e
+set ecj             ecj-4.5.jar
 
-supported_archs     i386 x86_64
+checksums           gcc-${version}.tar.bz2 \
+                    rmd160  0000f2af2aa4daa32108ba4725938833684f6937 \
+                    sha256  b037fe5132b71ecad2ea7141ec92292b5d32427bf90fd90cde432b1d5abacc2c \
+                    ${ecj} \
+                    rmd160  d3f4da657f086b6423f74e93f001132f4855368a \
+                    sha256  98fd128f1d374d9e42fd9d4836bdd249c6d511ebc6c0df17fbc1b9df96c3d781
 
 use_bzip2           yes
 
+distfiles           [suffix ${distname}]:gcc ${ecj}:ecj
+
+extract.only        [suffix ${distname}]
+
 depends_lib         port:gmp port:mpfr port:libiconv port:libmpc port:ppl port:cloog
-depends_run         port:gcc_select port:ld64 port:cctools port:libstdcxx-devel
+depends_run         port:gcc_select port:ld64 port:cctools path:lib/libstdc\\\\+\\\\+.6.dylib:libstdcxx
 
 depends_skip_archcheck-append gcc_select ld64 cctools
 license_noconflict  gmp mpfr ppl libmpc
 
+patchfiles          skip-libffi-install.patch
 patch.dir           ${workpath}/gcc-${version}
 
 set major           4.8
@@ -51,6 +61,7 @@
 
 post-extract {
     file mkdir ${worksrcpath}
+    copy ${distpath}/${ecj} ${workpath}/${distname}/ecj.jar
 }
 
 platform darwin {
@@ -58,12 +69,13 @@
 }
 
 configure.cmd       ../gcc-${version}/configure
-configure.args      --enable-languages=c,c++,objc,obj-c++,fortran,java \
+configure.args      --enable-languages=c,c++,objc,obj-c++,lto,fortran,java \
                     --libdir=${prefix}/lib/${name} \
                     --includedir=${prefix}/include/${name} \
                     --infodir=${prefix}/share/info \
                     --mandir=${prefix}/share/man \
                     --datarootdir=${prefix}/share/gcc-${major} \
+                    --with-libiconv-prefix=${prefix} \
                     --with-local-prefix=${prefix} \
                     --with-system-zlib \
                     --disable-nls \
@@ -78,7 +90,6 @@
                     --enable-stage1-checking \
                     --disable-multilib \
                     --enable-lto \
-                    --enable-libstdcxx-time \
                     --with-as=${prefix}/bin/as \
                     --with-ld=${prefix}/bin/ld \
                     --with-ar=${prefix}/bin/ar \
@@ -110,29 +121,25 @@
 
 destroot.target     install install-info-host
 
-if {${subport} == "libstdcxx-devel"} {
-    conflicts       libstdcxx
-
-    patchfiles-append  force-static-gcc.patch
+if {${subport} == "libstdcxx"} {
+    conflicts       libstdcxx-devel
 
-    depends_run-delete port:${subport}
+    depends_run-delete path:lib/libstdc\\\\+\\\\+.6.dylib:libstdcxx
 
     configure.args-delete --libdir=${prefix}/lib/${name}
 
     configure.args-delete --enable-languages=c,c++,objc,obj-c++,lto,fortran,java
-    configure.args-append --enable-languages=c++
+    configure.args-append --enable-languages=c,c++
 
     # http://trac.macports.org/ticket/36116
     compiler.blacklist-append {clang < 425}
 
-    configure.args-append --disable-bootstrap
-    build.target        all
+    build.target 
 
     destroot.target     install-target-libstdc++-v3
 
     post-destroot {
         eval file delete [glob ${destroot}${prefix}/lib/*{a,py}]
-        eval file delete [glob ${destroot}${prefix}/lib/libgcc*]
         file delete -force ${destroot}${prefix}/lib/gcc
         file delete -force ${destroot}${prefix}/share/gcc-${major}
         file delete -force ${destroot}${prefix}/include/${name}
@@ -179,8 +186,14 @@
 
     # http://trac.macports.org/ticket/35770
     eval delete [glob ${destroot}${prefix}/lib/${name}/libstdc++*]
+    eval delete [glob ${destroot}${prefix}/lib/${name}/libgcc*dylib]
 
     ln -s ${prefix}/lib/libstdc++.6.dylib ${destroot}${prefix}/lib/${name}/libstdc++.dylib
+    ln -s ${prefix}/lib/libgcc_ext.10.4.dylib ${destroot}${prefix}/lib/${name}/libgcc_ext.10.4.dylib
+    ln -s ${prefix}/lib/libgcc_ext.10.5.dylib ${destroot}${prefix}/lib/${name}/libgcc_ext.10.5.dylib
+    ln -s ${prefix}/lib/libgcc_s.1.dylib ${destroot}${prefix}/lib/${name}/libgcc_s.1.dylib
+    ln -s ${prefix}/lib/libgcc_s.1.dylib ${destroot}${prefix}/lib/${name}/libgcc_s_ppc64.1.dylib
+    ln -s ${prefix}/lib/libgcc_s.1.dylib ${destroot}${prefix}/lib/${name}/libgcc_s_x86_64.1.dylib
 
     # This symlink is provided as a transition aide and will be removed
     # with a future revision of this port.
@@ -215,5 +228,5 @@
 configure.universal_args
 
 livecheck.type      regex
-livecheck.url       ftp://gcc.gnu.org/pub/gcc/snapshots/
-livecheck.regex     LATEST-4.8 -> (4.8-\[0-9\]+)
+livecheck.url       http://gcc.gnu.org/gcc-4.8/
+livecheck.regex     GCC (4\\.8\\.\[0-9\])
