summaryrefslogtreecommitdiff
path: root/lang
diff options
context:
space:
mode:
authorsbd <sbd>2012-04-16 04:27:18 +0000
committersbd <sbd>2012-04-16 04:27:18 +0000
commit7e7bbecaae783ada87dd19957b33a4a2e304ddf1 (patch)
treec6cda586d1a3b224de8dcfd4c59092e2bc489b19 /lang
parent2a6e9df0b8b3c7a0e87e19ded082cf8af86c43a5 (diff)
downloadpkgsrc-7e7bbecaae783ada87dd19957b33a4a2e304ddf1.tar.gz
Import gcc-4.7.0 and lang/gcc47
GCC 4.7.0 is a major release, containing substantial new functionality not available in GCC 4.6.x or previous GCC releases. GCC 4.7 features support for software transactional memory on selected architectures. The C++ compiler supports a bigger subset of the new ISO C++11 standard such as support for atomics and the C++11 memory model, non-static data member initializers, user-defined literals, alias-declarations, delegating constructors, explicit override and extended friend syntax. The C compiler adds support for more features from the new ISO C11 standard. GCC now supports version 3.1 of the OpenMP specification for C, C++ and Fortran. The link-time optimization (LTO) framework has seen improvements with regards to scalability, stability and resource needs. Inlining and interprocedural constant propagation have been improved. GCC 4.7 now supports various new GNU extensions to the DWARF debugging information format, like entry value and call site information, a typed DWARF stack and a more compact macro representation. Extending the widest support for hardware architectures in the industry, GCC 4.7 gains support for Adapteva's Epiphany processor, National Semiconductor's CR16, and TI's C6X as well as Tilera's TILE-Gx and TILEPro families of processors. The x86 family support has been extended by the Intel Haswell and AMD Piledriver architectures. ARM has gained support for the Cortex-A7 family. See http://gcc.gnu.org/gcc-4.7/changes.html for more information about changes in GCC 4.7.
Diffstat (limited to 'lang')
-rw-r--r--lang/gcc47/DESCR3
-rw-r--r--lang/gcc47/Makefile119
-rw-r--r--lang/gcc47/PLIST.java42
-rw-r--r--lang/gcc47/distinfo18
-rw-r--r--lang/gcc47/files/values.c64
-rw-r--r--lang/gcc47/options.mk163
-rw-r--r--lang/gcc47/patches/patch-gcc_Makefile.in17
-rw-r--r--lang/gcc47/patches/patch-gcc_config.gcc31
-rw-r--r--lang/gcc47/patches/patch-gcc_config_netbsd-stdint.h63
-rw-r--r--lang/gcc47/patches/patch-gcc_fortran_f95-lang.c25
-rw-r--r--lang/gcc47/patches/patch-gcc_gcc.c19
-rw-r--r--lang/gcc47/patches/patch-gcc_ginclude_stddef.h19
-rw-r--r--lang/gcc47/patches/patch-libgfortran_configure15
-rw-r--r--lang/gcc47/patches/patch-libgo_Makefile.in17
-rw-r--r--lang/gcc47/patches/patch-libjava_configure17
-rw-r--r--lang/gcc47/patches/patch-libjava_contrib_rebuild-gcj-db.in29
-rw-r--r--lang/gcc47/version.mk2
17 files changed, 663 insertions, 0 deletions
diff --git a/lang/gcc47/DESCR b/lang/gcc47/DESCR
new file mode 100644
index 00000000000..0262b0919e3
--- /dev/null
+++ b/lang/gcc47/DESCR
@@ -0,0 +1,3 @@
+The GNU Compiler Collection (GCC) includes front ends for C, C++, Objective-C,
+Fortran, Java, and Go, as well as libraries for these languages (libstdc++,
+libgcj,...).
diff --git a/lang/gcc47/Makefile b/lang/gcc47/Makefile
new file mode 100644
index 00000000000..630294bf317
--- /dev/null
+++ b/lang/gcc47/Makefile
@@ -0,0 +1,119 @@
+# $NetBSD: Makefile,v 1.1.1.1 2012/04/16 04:27:18 sbd Exp $
+
+GCC_PKGNAME= gcc47
+.include "version.mk"
+
+DISTNAME= gcc-${GCC_DIST_VERSION}
+PKGNAME= ${GCC_PKGNAME}-${GCC_DIST_VERSION}
+CATEGORIES= lang
+MASTER_SITES= ${MASTER_SITE_GNU:=gcc/gcc-${GCC_DIST_VERSION}/}
+EXTRACT_SUFX= .tar.bz2
+
+MAINTAINER= sbd@NetBSD.org
+HOMEPAGE= http://gcc.gnu.org/
+COMMENT= The GNU Compiler Collection (GCC) - 4.7 Release Series
+LICENSE= gnu-gpl-v2 AND gnu-gpl-v3 AND gnu-lgpl-v2 AND gnu-lgpl-v3
+
+DISTFILES= ${DEFAULT_DISTFILES}
+EXTRACT_ONLY= ${DEFAULT_DISTFILES}
+
+NOT_FOR_PLATFORM= Interix-*-* DragonFly-*-*
+
+USE_TOOLS+= gmake makeinfo sed:run
+
+PKG_DESTDIR_SUPPORT= user-destdir
+
+GNU_CONFIGURE= yes
+## Build outside ${WRKSRC}
+OBJDIR= ../build
+CONFIGURE_DIRS= ${OBJDIR}
+CONFIGURE_SCRIPT= ../${DISTNAME}/configure
+GCC_SUBPREFIX= ${GCC_PKGNAME}
+GCC_PREFIX= ${PREFIX}/${GCC_SUBPREFIX}
+GNU_CONFIGURE_PREFIX= ${GCC_PREFIX}
+INFO_FILES= yes
+
+UNLIMIT_RESOURCES+= datasize
+UNLIMIT_RESOURCES+= stacksize
+
+.include "../../mk/bsd.prefs.mk"
+
+LANGS= c
+
+## The Library rpath to use in end programs.
+LDFLAGS_FOR_TARGET= ${LDFLAGS:M${COMPILER_RPATH_FLAG}*:N*/usr/lib*}
+
+## The "-static-libstdc++ -static-libgcc" flags are normally added to the
+## boot-ldflags by configure but because we are supply the boot-ldflags
+## we mash supply them.
+BOOT_LDFLAGS= -static-libstdc++ -static-libgcc ${LDFLAGS_FOR_TARGET}
+
+## For target librarys and libjava programs.
+CONFIGURE_ENV+= LDFLAGS_FOR_TARGET=${LDFLAGS_FOR_TARGET:Q}
+
+CONFIGURE_ARGS+= --enable-languages=${LANGS:Q}
+CONFIGURE_ARGS+= --enable-shared
+CONFIGURE_ARGS+= --enable-long-long
+CONFIGURE_ARGS+= --with-local-prefix=${GCC_PREFIX:Q}
+CONFIGURE_ARGS+= --enable-libssp
+CONFIGURE_ARGS+= --enable-threads=posix
+CONFIGURE_ARGS+= --with-boot-ldflags=${BOOT_LDFLAGS:Q}
+.if ${OPSYS} == "NetBSD"
+CONFIGURE_ARGS+= --with-gnu-ld --with-ld=/usr/bin/ld
+CONFIGURE_ARGS+= --with-gnu-as --with-as=/usr/bin/as
+MAKE_ENV+= ac_cv_func_clock_gettime=yes
+.endif
+
+.include "options.mk"
+
+# ${WRKSRC}/fixincludes/ looks for sed and compiles the path to sed into
+# a binary so we need to make sure we give it the installed sed and not
+# the tool wrapped one.
+MAKE_ENV+= ac_cv_path_SED=${TOOLS_SED}
+MAKE_ENV+= lt_cv_path_SED=${TOOLS_SED}
+
+# Determine whether to use binutils
+.if ${OPSYS} == "SunOS"
+CONFIGURE_ENV+= OBJDUMP=/usr/sfw/bin/gobjdump
+CONFIGURE_ARGS+= --without-gnu-ld --with-ld=/usr/ccs/bin/ld
+. if !exists(/usr/sfw/bin/gas)
+CONFIGURE_ARGS+= --without-gnu-as --with-as=/usr/ccs/bin/as
+. else
+CONFIGURE_ARGS+= --with-gnu-as --with-as=/usr/sfw/bin/gas
+. endif
+.endif
+
+pre-configure:
+ ${RUN} cd ${WRKSRC} && ${MKDIR} ${OBJDIR}
+
+TEST_TARGET= -k check || ${TRUE}
+pre-test:
+ ${RUN} \
+ if runtest --version >/dev/null 2>/dev/null ; then \
+ : ; \
+ else \
+ ${ECHO} "ERROR: Please install devel/dejagnu in order to run the test suite." ; \
+ exit 1 ; \
+ fi
+post-test:
+ ${RUN} cd ${WRKSRC} && cd ${OBJDIR} && \
+ ${SHELL} ${WRKSRC}/contrib/test_summary >${WRKDIR}/test_summary.log
+ @${INFO_MSG} "Test summary are available in ${WRKDIR}/test_summary.log"
+
+post-install:
+ ${TEST} -f ${DESTDIR}${GCC_PREFIX}/bin/cc || \
+ ( cd ${DESTDIR}${GCC_PREFIX}/bin ; ${LN} -f gcc cc )
+.if !empty(PKG_OPTIONS:Mgcc-java)
+ ${RM} -f ${DESTDIR}${JAVA_HOME}/bin/javadoc
+ ${RM} -f ${DESTDIR}${JAVA_HOME}/jre/lib/${JAVA_ARCH}/libjawt.so
+.endif
+.if !empty(MACHINE_PLATFORM:MSunOS-*-*86*) && ${OS_VERSION} != "5.11"
+ ${SH} files/values.c ${DESTDIR}${GCC_PREFIX}/bin/gcc -m32 || ${TRUE}
+ ${SH} files/values.c ${DESTDIR}${GCC_PREFIX}/bin/gcc -m64 || ${TRUE}
+.endif
+
+GENERATE_PLIST+= \
+ cd ${DESTDIR}${PREFIX} && \
+ ${FIND} ${GCC_SUBPREFIX} \( -type f -o -type l \) -print | ${SORT} ;
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/lang/gcc47/PLIST.java b/lang/gcc47/PLIST.java
new file mode 100644
index 00000000000..9dde13a2463
--- /dev/null
+++ b/lang/gcc47/PLIST.java
@@ -0,0 +1,42 @@
+@comment $NetBSD: PLIST.java,v 1.1.1.1 2012/04/16 04:27:18 sbd Exp $
+bin/${JAVA_NAME}-appletviewer
+bin/${JAVA_NAME}-jar
+bin/${JAVA_NAME}-jarsigner
+bin/${JAVA_NAME}-java
+bin/${JAVA_NAME}-javah
+bin/${JAVA_NAME}-keytool
+bin/${JAVA_NAME}-native2ascii
+bin/${JAVA_NAME}-orbd
+bin/${JAVA_NAME}-rmic
+bin/${JAVA_NAME}-rmid
+bin/${JAVA_NAME}-rmiregistry
+bin/${JAVA_NAME}-serialver
+bin/${JAVA_NAME}-tnameserv
+java/${JAVA_NAME}/bin/appletviewer
+java/${JAVA_NAME}/bin/jar
+java/${JAVA_NAME}/bin/jarsigner
+java/${JAVA_NAME}/bin/java
+java/${JAVA_NAME}/bin/javah
+java/${JAVA_NAME}/bin/keytool
+java/${JAVA_NAME}/bin/native2ascii
+java/${JAVA_NAME}/bin/orbd
+java/${JAVA_NAME}/bin/rmic
+java/${JAVA_NAME}/bin/rmid
+java/${JAVA_NAME}/bin/rmiregistry
+java/${JAVA_NAME}/bin/serialver
+java/${JAVA_NAME}/bin/tnameserv
+java/${JAVA_NAME}/include/jawt.h
+java/${JAVA_NAME}/include/jni.h
+java/${JAVA_NAME}/include/${LOWER_OPSYS}/jawt_md.h
+java/${JAVA_NAME}/include/${LOWER_OPSYS}/jni_md.h
+java/${JAVA_NAME}/jre/bin/java
+java/${JAVA_NAME}/jre/bin/keytool
+java/${JAVA_NAME}/jre/bin/orbd
+java/${JAVA_NAME}/jre/bin/rmid
+java/${JAVA_NAME}/jre/bin/rmiregistry
+java/${JAVA_NAME}/jre/bin/tnameserv
+java/${JAVA_NAME}/jre/lib/${JAVA_ARCH}/client/libjvm.so
+java/${JAVA_NAME}/jre/lib/${JAVA_ARCH}/server/libjvm.so
+java/${JAVA_NAME}/jre/lib/rt.jar
+java/${JAVA_NAME}/jre/lib/security/java.security
+java/${JAVA_NAME}/lib/tools.jar
diff --git a/lang/gcc47/distinfo b/lang/gcc47/distinfo
new file mode 100644
index 00000000000..34faecefe33
--- /dev/null
+++ b/lang/gcc47/distinfo
@@ -0,0 +1,18 @@
+$NetBSD: distinfo,v 1.1.1.1 2012/04/16 04:27:18 sbd Exp $
+
+SHA1 (ecj-4.5.jar) = 58c1d79c64c8cd718550f32a932ccfde8d1e6449
+RMD160 (ecj-4.5.jar) = d3f4da657f086b6423f74e93f001132f4855368a
+Size (ecj-4.5.jar) = 1470676 bytes
+SHA1 (gcc-4.7.0.tar.bz2) = 03b8241477a9f8a34f6efe7273d92b9b6dd9fe82
+RMD160 (gcc-4.7.0.tar.bz2) = 4ed660b281cdb9bcf98f5c2cf2da105c71db5be4
+Size (gcc-4.7.0.tar.bz2) = 82518546 bytes
+SHA1 (patch-gcc_Makefile.in) = 2372899a37259c89281e6bd1223e39df9b53a7e3
+SHA1 (patch-gcc_config.gcc) = eeec5e63f000905c03186c4ccbac07e0cbe8a6b2
+SHA1 (patch-gcc_config_netbsd-stdint.h) = 025fc883101a187e84ed4c0772406720d645d550
+SHA1 (patch-gcc_fortran_f95-lang.c) = 06470dbee79f8c762675d3060a870b7dd9ba38f8
+SHA1 (patch-gcc_gcc.c) = 67a74bf3a5fc4cc9d9b3c7b79807fe11e2b002b3
+SHA1 (patch-gcc_ginclude_stddef.h) = 635e3e7579e9395fa017ac38e8b768d98937a80e
+SHA1 (patch-libgfortran_configure) = b3bbc7d9201073a1bed0b7e10141465bab52c8be
+SHA1 (patch-libgo_Makefile.in) = c06e3f0deb9f906d2c158262cffdc3fb7af95602
+SHA1 (patch-libjava_configure) = 48ea2baffe87e09dda8133d286bd9b1bfe4c3f8a
+SHA1 (patch-libjava_contrib_rebuild-gcj-db.in) = bb01d738fc7db05046ae37e8ade32574de1d8297
diff --git a/lang/gcc47/files/values.c b/lang/gcc47/files/values.c
new file mode 100644
index 00000000000..27657094580
--- /dev/null
+++ b/lang/gcc47/files/values.c
@@ -0,0 +1,64 @@
+#if 0 /* $NetBSD: values.c,v 1.1.1.1 2012/04/16 04:27:18 sbd Exp $ */
+#
+# This is Solaris x86 specific GCC run-time environment patch, which
+# makes it possible to reliably deploy .init snippets. Trouble is that
+# Solaris linker erroneously pads .init segment with zeros [instead of
+# nops], which is bound to SEGV early upon program start-up. This bug
+# was recognized by GCC team [it is mentioned in source code], but
+# workaround apparently and obviously erroneously slipped away in some
+# newer GCC release. This patch compensates for this mishap by dropping
+# modified values-X*.o into GCC installation tree. Object modules in
+# question are normally provided by Sun and linked prior crtbegin.o.
+# Modified versions are additionally crafted with custom .init segment,
+# which does some magic:-)
+# <appro@fy.chalmers.se>
+set -e
+gcc=gcc
+if [[ "x$1" = x*gcc ]]; then
+ gcc=$1; shift
+fi
+gcc_dir=`${gcc} "$@" -print-libgcc-file-name`
+gcc_dir=${gcc_dir%/*} #*/
+set -x
+${gcc} "$@" -c -o $gcc_dir/values-Xa.o -DXa $0
+${gcc} "$@" -c -o $gcc_dir/values-Xc.o -DXc $0
+${gcc} "$@" -c -o $gcc_dir/values-Xt.o -DXt $0
+exit
+#endif
+
+#include <math.h>
+
+#if defined(Xa)
+const enum version _lib_version = ansi_1;
+#elif defined(Xc)
+const enum version _lib_version = strict_ansi;
+#elif defined(Xt)
+const enum version _lib_version = c_issue_4;
+#else
+#error "compile by issuing 'ksh -f values.c [gcc] [-m64]'"
+#endif
+
+#if defined(__x86_64__)
+asm("\n"
+".section .init\n"
+".align 1\n"
+" leaq 1f(%rip),%rax\n"
+"1: cmpl $0,2f-1b(%rax)\n"
+" jne 2f\n"
+" jmp 2f+5\n"
+" .skip 9\n" /* pad up to 0x1b bytes */
+"2:\n"
+);
+#else
+asm("\n"
+".section .init\n"
+".align 1\n"
+" call 1f\n"
+"1: popl %eax\n"
+" cmpl $0,2f-1b(%eax)\n"
+" jne 2f\n"
+" jmp 2f+5\n"
+" .skip 10\n" /* pad up to 0x1b bytes */
+"2:\n"
+);
+#endif
diff --git a/lang/gcc47/options.mk b/lang/gcc47/options.mk
new file mode 100644
index 00000000000..706809a3735
--- /dev/null
+++ b/lang/gcc47/options.mk
@@ -0,0 +1,163 @@
+# $NetBSD: options.mk,v 1.1.1.1 2012/04/16 04:27:18 sbd Exp $
+
+PKG_OPTIONS_VAR= PKG_OPTIONS.${GCC_PKGNAME}
+PKG_SUPPORTED_OPTIONS= nls gcc-inplace-math gcc-c++ gcc-fortran gcc-java \
+ gcc-go gcc-objc gcc-objc++
+PKG_SUGGESTED_OPTIONS= gcc-c++ gcc-fortran gcc-go gcc-objc gcc-objc++
+
+.if ${OPSYS} == "NetBSD" || ${OPSYS} == "Linux"
+PKG_SUGGESTED_OPTIONS+= nls gcc-java
+.elif ${OPSYS} == "SunOS"
+PKG_SUGGESTED_OPTIONS+= gcc-inplace-math
+.else
+PKG_SUGGESTED_OPTIONS+= gcc-java
+.endif
+
+###
+### Determine if multilib is avalible.
+###
+.if !empty(MACHINE_PLATFORM:MLinux-*-x86_64) && \
+ exists(/usr/include/gnu/stubs-64.h) && \
+ !exists(/usr/include/gnu/stubs-32.h)
+MULTILIB_SUPPORTED=No
+.endif
+.if empty(MULTILIB_SUPPORTED:M[Nn][Oo])
+PKG_SUPPORTED_OPTIONS+= gcc-multilib
+PKG_SUGGESTED_OPTIONS+= gcc-multilib
+.endif
+
+.include "../../mk/bsd.options.mk"
+
+###
+### Native Language Support
+###
+.if !empty(PKG_OPTIONS:Mnls)
+USE_TOOLS+= msgfmt
+CONFIGURE_ARGS+= --enable-nls
+CONFIGURE_ARGS+= --with-libiconv-prefix=${BUILDLINK_PREFIX.iconv}
+MAKE_ENV+= ICONVPREFIX=${BUILDLINK_PREFIX.iconv}
+.include "../../converters/libiconv/buildlink3.mk"
+.include "../../devel/gettext-lib/buildlink3.mk"
+.else
+CONFIGURE_ARGS+= --disable-nls
+.endif
+
+###
+### Multilib Support
+###
+.if empty(PKG_OPTIONS:Mgcc-multilib)
+CONFIGURE_ARGS+= --disable-multilib
+.endif
+
+###
+### Build math libraries in place
+###
+.if !empty(PKG_OPTIONS:Mgcc-inplace-math)
+. include "../../devel/gmp/inplace.mk"
+. include "../../math/mpcomplex/inplace.mk"
+. include "../../math/mpfr/inplace.mk"
+.else
+CONFIGURE_ARGS+= --with-gmp=${BUILDLINK_PREFIX.gmp}
+CONFIGURE_ARGS+= --with-mpc=${BUILDLINK_PREFIX.mpcomplex}
+CONFIGURE_ARGS+= --with-mpfr=${BUILDLINK_PREFIX.mpfr}
+LIBS.SunOS+= -lgmp
+. include "../../devel/gmp/buildlink3.mk"
+. include "../../math/mpcomplex/buildlink3.mk"
+. include "../../math/mpfr/buildlink3.mk"
+.endif
+
+###
+### Optional languages
+### Ada could be added although there is a bootstrapping issue. See
+### ../gcc34-ada for guidance
+###
+
+.if !empty(PKG_OPTIONS:Mgcc-objc++)
+. if empty(PKG_OPTIONS:Mgcc-c++)
+PKG_OPTIONS+= gcc-c++
+. endif
+LANGS+= obj-c++
+.endif
+
+.if !empty(PKG_OPTIONS:Mgcc-objc)
+LANGS+= objc
+.endif
+
+.if !empty(PKG_OPTIONS:Mgcc-java)
+. if empty(PKG_OPTIONS:Mgcc-c++)
+PKG_OPTIONS+= gcc-c++
+. endif
+
+LANGS+= java
+
+# Add the Eclipse Java compiler for to parse `.java' source files.
+ECJ_JAR= ecj-4.5.jar
+SITES.${ECJ_JAR}= ftp://sourceware.org/pub/java/
+DISTFILES+= ${ECJ_JAR}
+CONFIGURE_ARGS+= --with-ecj-jar=${DISTDIR:Q}/${ECJ_JAR:Q}
+
+JAVA_NAME= ${GCC_PKGNAME}
+JAVA_HOME= ${PREFIX}/java/${JAVA_NAME}
+JAVA_WRAPPERS= appletviewer jar jarsigner java javah keytool \
+ native2ascii orbd rmic rmid rmiregistry serialver \
+ tnameserv
+
+JAVA_ARCH= ${MACHINE_ARCH:S/x86_64/amd64/}
+
+PLIST_SRC+= PLIST.java
+PLIST_SUBST+= JAVA_NAME=${JAVA_NAME:Q}
+PLIST_SUBST+= JAVA_ARCH=${JAVA_ARCH:Q}
+
+# Create a JPackage compatible SDK environment.
+CONFIGURE_ARGS+= --enable-java-home
+CONFIGURE_ARGS+= --with-os-directory=${LOWER_OPSYS:Q}
+CONFIGURE_ARGS+= --with-arch-directory=${JAVA_ARCH:Q}
+CONFIGURE_ARGS+= --with-jvm-root-dir=${JAVA_HOME:Q}
+CONFIGURE_ARGS+= --with-java-home=${JAVA_HOME:Q}
+
+REPLACE_PYTHON= libjava/contrib/aot-compile.in
+
+USE_TOOLS+= unzip zip:run gmake:run
+CONFIGURE_ARGS+= --with-system-zlib
+
+# libjava/contrib/aotcompile.py.in stores the path to a 'make' program so
+# we need to make sure we give it the installed 'make' and not the tool
+# wrapped one.
+CONFIGURE_ENV+= PKGSRC_MAKE=${TOOLS_PATH.gmake}
+MAKE_ENV+= PKGSRC_MAKE=${TOOLS_PATH.gmake}
+
+# fastjar-0.93 from pkgsrc/archivers/fastjar seems to trigger a build
+# failure (seen on NetBSD-5.0/i386) when building java. So in case
+# the fastjar package is installed, make sure the configure script
+# doesn't pick it up.
+CONFIGURE_ENV+= JAR=no
+MAKE_ENV+= JAR=no
+MAKE_ENV+= ac_cv_prog_JAR=no
+
+.include "../../devel/zlib/buildlink3.mk"
+.include "../../lang/python/application.mk"
+.include "../../mk/dlopen.buildlink3.mk"
+.include "../../mk/java-env.mk"
+.endif
+
+.if !empty(PKG_OPTIONS:Mgcc-go)
+LANGS+= go
+.endif
+
+.if !empty(PKG_OPTIONS:Mgcc-java) || !empty(PKG_OPTIONS:Mgcc-go)
+.include "../../mk/pthread.buildlink3.mk"
+.endif
+
+.if !empty(PKG_OPTIONS:Mgcc-fortran)
+LANGS+= fortran
+.endif
+
+.if !empty(PKG_OPTIONS:Mgcc-c++)
+LANGS+= c++
+USE_TOOLS+= perl
+CONFIGURE_ARGS+= --enable-__cxa_atexit
+CONFIGURE_ARGS+= --with-gxx-include-dir=${GCC_PREFIX}/include/c++/
+.else
+CONFIGURE_ARGS+= --disable-build-with-cxx
+CONFIGURE_ARGS+= --disable-build-poststage1-with-cxx
+.endif
diff --git a/lang/gcc47/patches/patch-gcc_Makefile.in b/lang/gcc47/patches/patch-gcc_Makefile.in
new file mode 100644
index 00000000000..2b45bf5df04
--- /dev/null
+++ b/lang/gcc47/patches/patch-gcc_Makefile.in
@@ -0,0 +1,17 @@
+$NetBSD: patch-gcc_Makefile.in,v 1.1.1.1 2012/04/16 04:27:18 sbd Exp $
+
+Add gcc libdir to a programs rpath so that _this gcc's_ support librarys
+are found.
+
+NOTE: the %M spec string is added by patch-gcc_gcc.c
+
+--- gcc/Makefile.in.orig 2012-03-07 10:59:56.000000000 +0000
++++ gcc/Makefile.in
+@@ -2074,6 +2074,7 @@ prefix.o: prefix.c $(CONFIG_H) $(SYSTEM_
+ # Language-independent files.
+
+ DRIVER_DEFINES = \
++ -DLINK_LIBGCC_SPEC="\"%D $(LINKER_RPATH_FLAG)$(libdir)/%M \"" \
+ -DSTANDARD_STARTFILE_PREFIX=\"$(unlibsubdir)/\" \
+ -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc/\" \
+ -DSTANDARD_LIBEXEC_PREFIX=\"$(libexecdir)/gcc/\" \
diff --git a/lang/gcc47/patches/patch-gcc_config.gcc b/lang/gcc47/patches/patch-gcc_config.gcc
new file mode 100644
index 00000000000..7c45bd452cf
--- /dev/null
+++ b/lang/gcc47/patches/patch-gcc_config.gcc
@@ -0,0 +1,31 @@
+$NetBSD: patch-gcc_config.gcc,v 1.1.1.1 2012/04/16 04:27:18 sbd Exp $
+
+* Add t-crtstuff to tmake_file on NetBSD.
+* Add netbsd-stdint.h to tm_file on NetBSD.
+* wrap the system stdint.h on NetBSD.
+
+--- gcc/config.gcc.orig 2012-03-05 10:43:22.000000000 +0000
++++ gcc/config.gcc
+@@ -644,6 +644,7 @@ case ${target} in
+ esac
+ ;;
+ *-*-netbsd*)
++ use_gcc_stdint=wrap
+ tmake_file="t-slibgcc"
+ gas=yes
+ gnu_ld=yes
+@@ -1203,11 +1204,12 @@ x86_64-*-freebsd*)
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/x86-64.h i386/freebsd.h i386/freebsd64.h"
+ ;;
+ i[34567]86-*-netbsdelf*)
+- tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/netbsd-elf.h"
++ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/netbsd-elf.h netbsd-stdint.h"
+ extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
++ tmake_file="${tmake_file} i386/t-crtstuff"
+ ;;
+ x86_64-*-netbsd*)
+- tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/x86-64.h i386/netbsd64.h"
++ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/x86-64.h i386/netbsd64.h netbsd-stdint.h"
+ extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
+ ;;
+ i[34567]86-*-openbsd2.*|i[34567]86-*openbsd3.[0123])
diff --git a/lang/gcc47/patches/patch-gcc_config_netbsd-stdint.h b/lang/gcc47/patches/patch-gcc_config_netbsd-stdint.h
new file mode 100644
index 00000000000..b8894a83486
--- /dev/null
+++ b/lang/gcc47/patches/patch-gcc_config_netbsd-stdint.h
@@ -0,0 +1,63 @@
+$NetBSD: patch-gcc_config_netbsd-stdint.h,v 1.1.1.1 2012/04/16 04:27:18 sbd Exp $
+
+Copy gcc/config/freebsd-stdint.h to gcc/config/netbsd-stdint.h.
+
+--- gcc/config/netbsd-stdint.h.orig 2012-04-02 09:19:19.577200540 +0000
++++ gcc/config/netbsd-stdint.h
+@@ -0,0 +1,56 @@
++/* Definitions for <stdint.h> types for NetBSD systems.
++ Copyright (C) 2009 Free Software Foundation, Inc.
++ Contributed by Gerald Pfeifer <gerald@pfeifer.com>.
++
++This file is part of GCC.
++
++GCC is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 3, or (at your option)
++any later version.
++
++GCC is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++GNU General Public License for more details.
++
++Under Section 7 of GPL version 3, you are granted additional
++permissions described in the GCC Runtime Library Exception, version
++3.1, as published by the Free Software Foundation.
++
++You should have received a copy of the GNU General Public License and
++a copy of the GCC Runtime Library Exception along with this program;
++see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
++<http://www.gnu.org/licenses/>. */
++
++#define SIG_ATOMIC_TYPE "int"
++
++#define INT8_TYPE "signed char"
++#define INT16_TYPE "short int"
++#define INT32_TYPE "int"
++#define INT64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
++#define UINT8_TYPE "unsigned char"
++#define UINT16_TYPE "short unsigned int"
++#define UINT32_TYPE "unsigned int"
++#define UINT64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
++
++#define INT_LEAST8_TYPE "signed char"
++#define INT_LEAST16_TYPE "short int"
++#define INT_LEAST32_TYPE "int"
++#define INT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
++#define UINT_LEAST8_TYPE "unsigned char"
++#define UINT_LEAST16_TYPE "short unsigned int"
++#define UINT_LEAST32_TYPE "unsigned int"
++#define UINT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
++
++#define INT_FAST8_TYPE "int"
++#define INT_FAST16_TYPE "int"
++#define INT_FAST32_TYPE "int"
++#define INT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
++#define UINT_FAST8_TYPE "unsigned int"
++#define UINT_FAST16_TYPE "unsigned int"
++#define UINT_FAST32_TYPE "unsigned int"
++#define UINT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
++
++#define INTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int")
++#define UINTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int")
diff --git a/lang/gcc47/patches/patch-gcc_fortran_f95-lang.c b/lang/gcc47/patches/patch-gcc_fortran_f95-lang.c
new file mode 100644
index 00000000000..885b77da71e
--- /dev/null
+++ b/lang/gcc47/patches/patch-gcc_fortran_f95-lang.c
@@ -0,0 +1,25 @@
+$NetBSD: patch-gcc_fortran_f95-lang.c,v 1.1.1.1 2012/04/16 04:27:18 sbd Exp $
+
+No NetBSD the 'cabs' and 'cabsf' functions are are __RENAME so that
+thay have '__c99_' prefixes.
+
+--- gcc/fortran/f95-lang.c.orig 2012-01-17 14:34:37.000000000 +0000
++++ gcc/fortran/f95-lang.c
+@@ -819,10 +819,17 @@ gfc_init_builtin_functions (void)
+
+ gfc_define_builtin ("__builtin_cabsl", func_clongdouble_longdouble,
+ BUILT_IN_CABSL, "cabsl", ATTR_CONST_NOTHROW_LEAF_LIST);
++#if defined(__NetBSD__)
++ gfc_define_builtin ("__builtin_cabs", func_cdouble_double,
++ BUILT_IN_CABS, "__c99_cabs", ATTR_CONST_NOTHROW_LEAF_LIST);
++ gfc_define_builtin ("__builtin_cabsf", func_cfloat_float,
++ BUILT_IN_CABSF, "__c99_cabsf", ATTR_CONST_NOTHROW_LEAF_LIST);
++#else
+ gfc_define_builtin ("__builtin_cabs", func_cdouble_double,
+ BUILT_IN_CABS, "cabs", ATTR_CONST_NOTHROW_LEAF_LIST);
+ gfc_define_builtin ("__builtin_cabsf", func_cfloat_float,
+ BUILT_IN_CABSF, "cabsf", ATTR_CONST_NOTHROW_LEAF_LIST);
++#endif
+
+ gfc_define_builtin ("__builtin_copysignl", mfunc_longdouble[1],
+ BUILT_IN_COPYSIGNL, "copysignl",
diff --git a/lang/gcc47/patches/patch-gcc_gcc.c b/lang/gcc47/patches/patch-gcc_gcc.c
new file mode 100644
index 00000000000..2ea6c4e0bad
--- /dev/null
+++ b/lang/gcc47/patches/patch-gcc_gcc.c
@@ -0,0 +1,19 @@
+$NetBSD: patch-gcc_gcc.c,v 1.1.1.1 2012/04/16 04:27:18 sbd Exp $
+
+Add %M spec string.
+
+Submitted to GCC: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53002
+
+--- gcc/gcc.c.orig 2012-02-28 17:31:38.000000000 +0000
++++ gcc/gcc.c
+@@ -5115,6 +5115,10 @@ do_spec_1 (const char *spec, int inswitc
+ return value;
+ break;
+
++ case 'M':
++ obstack_grow (&obstack, multilib_os_dir, strlen (multilib_os_dir));
++ break;
++
+ case 'G':
+ value = do_spec_1 (libgcc_spec, 0, NULL);
+ if (value != 0)
diff --git a/lang/gcc47/patches/patch-gcc_ginclude_stddef.h b/lang/gcc47/patches/patch-gcc_ginclude_stddef.h
new file mode 100644
index 00000000000..ebcb6643ff7
--- /dev/null
+++ b/lang/gcc47/patches/patch-gcc_ginclude_stddef.h
@@ -0,0 +1,19 @@
+$NetBSD: patch-gcc_ginclude_stddef.h,v 1.1.1.1 2012/04/16 04:27:18 sbd Exp $
+
+Fix build on NetBSD i386/amd64 after the ansi.h header include protection
+name change.
+
+--- gcc/ginclude/stddef.h.orig 2012-02-12 01:06:04.000000000 +0000
++++ gcc/ginclude/stddef.h
+@@ -53,6 +53,11 @@ see the files COPYING3 and COPYING.RUNTI
+ one less case to deal with in the following. */
+ #if defined (__BSD_NET2__) || defined (____386BSD____) || (defined (__FreeBSD__) && (__FreeBSD__ < 5)) || defined(__NetBSD__)
+ #include <machine/ansi.h>
++#if !defined(_MACHINE_ANSI_H_)
++#if defined(_I386_ANSI_H_) || defined(_X86_64_ANSI_H_)
++#define _MACHINE_ANSI_H_
++#endif
++#endif
+ #endif
+ /* On FreeBSD 5, machine/ansi.h does not exist anymore... */
+ #if defined (__FreeBSD__) && (__FreeBSD__ >= 5)
diff --git a/lang/gcc47/patches/patch-libgfortran_configure b/lang/gcc47/patches/patch-libgfortran_configure
new file mode 100644
index 00000000000..2b3dc5bc8b8
--- /dev/null
+++ b/lang/gcc47/patches/patch-libgfortran_configure
@@ -0,0 +1,15 @@
+$NetBSD: patch-libgfortran_configure,v 1.1.1.1 2012/04/16 04:27:18 sbd Exp $
+
+"#pragma weak" shouldn't be used on NetBSD.
+
+--- libgfortran/configure.orig 2012-03-22 07:37:39.000000000 +0000
++++ libgfortran/configure
+@@ -25564,7 +25564,7 @@ $as_echo "#define SUPPORTS_WEAK 1" >>con
+
+ fi
+ case "$host" in
+- *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* | alpha*-dec-osf* )
++ *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* | alpha*-dec-osf* | *-*-netbsd* )
+
+ $as_echo "#define GTHREAD_USE_WEAK 0" >>confdefs.h
+
diff --git a/lang/gcc47/patches/patch-libgo_Makefile.in b/lang/gcc47/patches/patch-libgo_Makefile.in
new file mode 100644
index 00000000000..b54f1f3715d
--- /dev/null
+++ b/lang/gcc47/patches/patch-libgo_Makefile.in
@@ -0,0 +1,17 @@
+$NetBSD: patch-libgo_Makefile.in,v 1.1.1.1 2012/04/16 04:27:18 sbd Exp $
+
+proc.c will not compile with inline-functions (implied by -O3)
+so add -fno-inline-functions to it's cflags.
+
+
+--- libgo/Makefile.in.orig 2012-03-10 19:03:09.000000000 +0000
++++ libgo/Makefile.in
+@@ -3028,7 +3028,7 @@ msize.lo: runtime/msize.c
+ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o msize.lo `test -f 'runtime/msize.c' || echo '$(srcdir)/'`runtime/msize.c
+
+ proc.lo: runtime/proc.c
+-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT proc.lo -MD -MP -MF $(DEPDIR)/proc.Tpo -c -o proc.lo `test -f 'runtime/proc.c' || echo '$(srcdir)/'`runtime/proc.c
++@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) -fno-inline-functions $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT proc.lo -MD -MP -MF $(DEPDIR)/proc.Tpo -c -o proc.lo `test -f 'runtime/proc.c' || echo '$(srcdir)/'`runtime/proc.c
+ @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/proc.Tpo $(DEPDIR)/proc.Plo
+ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/proc.c' object='proc.lo' libtool=yes @AMDEPBACKSLASH@
+ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
diff --git a/lang/gcc47/patches/patch-libjava_configure b/lang/gcc47/patches/patch-libjava_configure
new file mode 100644
index 00000000000..29f1f2314de
--- /dev/null
+++ b/lang/gcc47/patches/patch-libjava_configure
@@ -0,0 +1,17 @@
+$NetBSD: patch-libjava_configure,v 1.1.1.1 2012/04/16 04:27:18 sbd Exp $
+
+Avoid a reference to the wrapped make in the pkgsrc work directory from
+showing up in an installed file.
+See: libjava/contrib/aotcompile.py.in
+
+--- libjava/configure.orig 2012-03-22 07:37:39.000000000 +0000
++++ libjava/configure
+@@ -24692,7 +24692,7 @@ $as_echo "Python modules dir: ${python_m
+
+
+ # needed for aot-compile-rpm
+-MAKE=`which make`
++MAKE=${PKGSRC_MAKE}
+
+
+ # Check whether --enable-aot-compile-rpm was given.
diff --git a/lang/gcc47/patches/patch-libjava_contrib_rebuild-gcj-db.in b/lang/gcc47/patches/patch-libjava_contrib_rebuild-gcj-db.in
new file mode 100644
index 00000000000..bd3f5c067a7
--- /dev/null
+++ b/lang/gcc47/patches/patch-libjava_contrib_rebuild-gcj-db.in
@@ -0,0 +1,29 @@
+$NetBSD: patch-libjava_contrib_rebuild-gcj-db.in,v 1.1.1.1 2012/04/16 04:27:18 sbd Exp $
+
+No need to use bash for this small script.
+
+Also -print0 is not portable to solaris and perhaps others.
+
+--- libjava/contrib/rebuild-gcj-db.in.orig 2008-07-02 13:17:54.000000000 +0000
++++ libjava/contrib/rebuild-gcj-db.in
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/bin/sh
+ # rebuild-gcj-db
+
+ ## Copyright (C) 2000, 2002, 2003, 2008 Free Software Foundation
+@@ -16,12 +16,12 @@ for i in `@prefix@/bin/gcc --print-multi
+ base=@prefix@/lib/$dirname
+ dbLocation=`@prefix@/bin/gcj-dbtool -p $base`
+ libdir=$base/gcj
+- if ! test -d $libdir; then
++ if test ! -d $libdir; then
+ # No shared libraries here.
+ continue
+ fi
+ dirname $dbLocation | xargs mkdir -p
+ @prefix@/bin/gcj-dbtool -n $dbLocation 64
+- find $libdir -follow -name '*.db' -print0 | \
++ find $libdir -follow -name '*.db' -print | @AWK@ '{printf("%s%c", $1, 0);}'|\
+ @prefix@/bin/gcj-dbtool -0 -m $dbLocation $dbLocation
+ done
diff --git a/lang/gcc47/version.mk b/lang/gcc47/version.mk
new file mode 100644
index 00000000000..ed294353c4c
--- /dev/null
+++ b/lang/gcc47/version.mk
@@ -0,0 +1,2 @@
+# $NetBSD: version.mk,v 1.1.1.1 2012/04/16 04:27:18 sbd Exp $
+GCC_DIST_VERSION:= 4.7.0