summaryrefslogtreecommitdiff
path: root/lang/gcc46
diff options
context:
space:
mode:
authorwiz <wiz@pkgsrc.org>2011-05-15 00:09:55 +0000
committerwiz <wiz@pkgsrc.org>2011-05-15 00:09:55 +0000
commitaf495c007eb8efe6d675e1c2460a12283bdc2084 (patch)
treecf65601753d3b050233c4ae4e31c976c4375df78 /lang/gcc46
parent676529627d00933c4180daa9f876a4712a3c347a (diff)
downloadpkgsrc-af495c007eb8efe6d675e1c2460a12283bdc2084.tar.gz
Initial import of gcc46-4.6.0, packaged for wip by Kai-Uwe Eckhardt.
This is the gcc 4.6 compiler suite. This package has a test target. For testing (only), this package requires devel/dejagnu and devel/autogen.
Diffstat (limited to 'lang/gcc46')
-rw-r--r--lang/gcc46/DESCR4
-rw-r--r--lang/gcc46/MESSAGE17
-rw-r--r--lang/gcc46/Makefile198
-rw-r--r--lang/gcc46/TODO3
-rw-r--r--lang/gcc46/buildlink3.mk63
-rw-r--r--lang/gcc46/distinfo13
-rw-r--r--lang/gcc46/files/dragonfly-spec.h215
-rw-r--r--lang/gcc46/files/dragonfly.h97
-rw-r--r--lang/gcc46/files/hello.f5
-rw-r--r--lang/gcc46/files/hello.m6
-rw-r--r--lang/gcc46/files/i386-dragonfly.h148
-rw-r--r--lang/gcc46/files/i386-dragonfly64.h54
-rw-r--r--lang/gcc46/options.mk21
-rw-r--r--lang/gcc46/patches/patch-aa75
-rw-r--r--lang/gcc46/patches/patch-ab24
-rw-r--r--lang/gcc46/patches/patch-ad13
-rw-r--r--lang/gcc46/patches/patch-af13
-rw-r--r--lang/gcc46/patches/patch-ag25
-rw-r--r--lang/gcc46/patches/patch-ah22
-rw-r--r--lang/gcc46/patches/patch-ak16
-rw-r--r--lang/gcc46/patches/patch-al13
-rw-r--r--lang/gcc46/preconfigure.mk11
22 files changed, 1056 insertions, 0 deletions
diff --git a/lang/gcc46/DESCR b/lang/gcc46/DESCR
new file mode 100644
index 00000000000..a1532b61067
--- /dev/null
+++ b/lang/gcc46/DESCR
@@ -0,0 +1,4 @@
+This is the gcc 4.6 compiler suite.
+
+This package has a test target. For testing (only), this
+package requires devel/dejagnu and devel/autogen.
diff --git a/lang/gcc46/MESSAGE b/lang/gcc46/MESSAGE
new file mode 100644
index 00000000000..b552183aac1
--- /dev/null
+++ b/lang/gcc46/MESSAGE
@@ -0,0 +1,17 @@
+===========================================================================
+$NetBSD: MESSAGE,v 1.1.1.1 2011/05/15 00:09:55 wiz Exp $
+
+${PKGNAME} has been installed in ${LOCALBASE}/gcc46
+
+To use this compiler in pkgsrc:
+
+ 1) In your "pre-configure" target:
+
+ .include "../../lang/gcc46/preconfigure.mk"
+
+ 2) .include "../../lang/gcc46/buildlink3.mk"
+
+The "preconfigure.mk" makefile fragment will override the compiler tools
+selected by ../../mk/compiler.mk to use gcc version 4.6.
+
+===========================================================================
diff --git a/lang/gcc46/Makefile b/lang/gcc46/Makefile
new file mode 100644
index 00000000000..ff141db1288
--- /dev/null
+++ b/lang/gcc46/Makefile
@@ -0,0 +1,198 @@
+# $NetBSD: Makefile,v 1.1.1.1 2011/05/15 00:09:55 wiz Exp $
+
+DISTNAME= gcc-${GCC_VERSION}
+PKGNAME= gcc46-${GCC_VERSION}
+CATEGORIES= lang
+MASTER_SITES= ${MASTER_SITE_GNU:=gcc/gcc-${GCC_VERSION}/}
+EXTRACT_SUFX= .tar.bz2
+
+MAINTAINER= kuehro@gmx.de
+HOMEPAGE= http://gcc.gnu.org/
+COMMENT= GNU Compiler Collection 4.6
+LICENSE= gnu-gpl-v2 AND gnu-gpl-v3 AND gnu-lgpl-v2 AND gnu-lgpl-v3
+
+PKG_DESTDIR_SUPPORT= user-destdir
+
+USE_TOOLS+= awk:run bash:run perl chmod \
+ gmake:run makeinfo msgfmt bison flex gm4 \
+ sed:run unzip
+
+DEPENDS+= zip-[0-9]*:../../archivers/zip
+DEPENDS+= libiconv-[0-9]*:../../converters/libiconv
+
+GCC_VERSION= 4.6.0
+
+GCC_SUBPREFIX= gcc46
+GCC_PREFIX= ${PREFIX}/${GCC_SUBPREFIX}
+FILES_SUBST+= PKGNAME=${PKGNAME}
+MESSAGE_SUBST+= GCC_PREFIX=${GCC_PREFIX}
+
+
+# To avoid GNU surprises
+CONFIG_SHELL= ${TOOLS_PATH.bash}
+
+NOT_FOR_PLATFORM= Interix-*-*
+UNLIMIT_RESOURCES+= datasize
+UNLIMIT_RESOURCES+= stacksize
+
+.include "../../mk/bsd.prefs.mk"
+.include "options.mk"
+
+# Determine whether to use binutils
+
+# REPLACE_AWK+= gcc/testsuite/gcc.test-framework/test-framework.awk \
+# gcc/mkmap-symver.awk \
+# gcc/optc-gen.awk \
+# gcc/mkmap-flat.awk \
+# gcc/opt-gather.awk \
+# gcc/opth-gen.awk \
+# gcc/opt-functions.awk
+
+REPLACE_BASH+= contrib/dg-cmp-results.sh
+REPLACE_BASH+= contrib/reghunt/bin/gcc-svn-patchlist
+REPLACE_BASH+= contrib/reghunt/bin/gcc-svn-update
+REPLACE_BASH+= contrib/reghunt/bin/gcc-svn-update-fix
+REPLACE_BASH+= contrib/reghunt/bin/reg-hunt
+REPLACE_BASH+= contrib/reghunt/bin/reg-test
+REPLACE_BASH+= contrib/reghunt/date_based/reg_periodic
+REPLACE_BASH+= contrib/reghunt/date_based/reg_search
+REPLACE_BASH+= gcc/dbgcnt.def
+REPLACE_BASH+= gcc/testsuite/gcc.test-framework/gen_directive_tests
+REPLACE_BASH+= libstdc++-v3/scripts/run_doxygen
+
+# Optional languages - change as required
+# Ada could be added although there is a bootstrapping issue. See
+# ../gcc34-ada for guidance
+BUILD_DEFS+= BUILD_CXX BUILD_FORTRAN BUILD_JAVA BUILD_OBJC
+BUILD_CXX?= YES
+BUILD_FORTRAN?= YES
+BUILD_JAVA?= NO
+BUILD_OBJC?= YES
+
+LANGS= c
+
+#.if !empty(BUILD_CXX:M[aA][dD][aA])
+#LANGS+= ada
+#.endif
+
+.if !empty(BUILD_CXX:M[Yy][Ee][Ss])
+LANGS+= c++
+.endif
+
+.if !empty(BUILD_FORTRAN:M[Yy][Ee][Ss])
+LANGS+= fortran
+.endif
+
+.if !empty(BUILD_JAVA:M[Yy][Ee][Ss])
+LANGS+= java
+.endif
+
+.if !empty(BUILD_OBJC:M[Yy][Ee][Ss])
+LANGS+= objc
+.endif
+
+
+CONFIGURE_ARGS+= --prefix=${GCC_PREFIX:Q}
+CONFIGURE_ARGS+= --enable-languages=${LANGS:Q}
+CONFIGURE_ARGS+= --with-system-zlib
+CONFIGURE_ARGS+= --disable-nls
+CONFIGURE_ARGS+= --enable-shared
+CONFIGURE_ARGS+= --enable-__cxa_atexit
+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-gmp=${BUILDLINK_PREFIX.gmp}
+CONFIGURE_ARGS+= --with-mpfr=${BUILDLINK_PREFIX.mpfr}
+CONFIGURE_ARGS+= --with-libiconv-prefix=${PREFIX}
+CONFIGURE_ARGS+= --with-gxx-include-dir=${GCC_PREFIX}/include/c++/
+.if ${OPSYS} == "NetBSD"
+CONFIGURE_ARGS+= --with-ld=${PREFIX}/bin/gnu-ld
+CONFIGURE_ARGS+= --with-libelf=${PREFIX}
+MAKE_ENV+= ac_cv_func_clock_gettime=yes
+.endif
+.if ${OPSYS} == "Linux"
+CONFIGURE_ARGS+= --disable-libquadmath --disable-libquadmath-support
+.endif
+
+CONFIGURE_ENV+= CONFIG_SHELL=${CONFIG_SHELL}
+
+# ${WRKSRC}/gcc-4.4.1/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
+
+MAKE_ENV+= ICONVPREFIX=${BUILDLINK_PREFIX.iconv}
+MAKE_ENV+= SHELL=${CONFIG_SHELL}
+MAKE_ENV+= ac_cv_path_ac_cv_prog_chmod=${TOOLS_CHMOD}
+
+# ${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}
+
+CPPFLAGS+= -I${BUILDLINK_DIR}/include
+CFLAGS+= -I${BUILDLINK_DIR}/include
+
+
+# Somone should fix this so it will match the NetBSD system compiler
+#.if ${OPSYS} == "NetBSD"
+#GCC_PLATFORM= ${LOWER_ARCH}--${LOWER_OPSYS}${APPEND_ELF}
+#CONFIGURE_ARGS+= --host=${GCC_PLATFORM:Q}
+#MAKE_ENV+= AR=/usr/bin/ar
+#.endif # NetBSD
+
+LIBS.SunOS+= -lgmp
+
+pre-configure:
+.if ${OPSYS} == "DragonFly"
+ ${CP} ${FILESDIR}/dragonfly.h ${WRKSRC}/gcc/config/dragonfly.h
+ ${CP} ${FILESDIR}/dragonfly-spec.h ${WRKSRC}/gcc/config/dragonfly-spec.h
+ ${CP} ${FILESDIR}/i386-dragonfly.h ${WRKSRC}/gcc/config/i386/dragonfly.h
+ ${CP} ${FILESDIR}/i386-dragonfly64.h ${WRKSRC}/gcc/config/i386/dragonfly64.h
+.endif
+
+.if ${OPSYS} == "NetBSD"
+ ${CP} ${WRKSRC}/gcc/config/freebsd-stdint.h ${WRKSRC}/gcc/config/netbsd-stdint.h
+.endif
+
+do-configure:
+ ${MKDIR} ${WRKDIR}/obj
+ cd ${WRKDIR}/obj; ${SETENV} ${CONFIGURE_ENV} ${CONFIG_SHELL} ${WRKSRC}/configure ${CONFIGURE_ARGS}
+
+do-build:
+ (${_ULIMIT_CMD} cd ${WRKDIR}/obj && ${SETENV} ${MAKE_ENV} ${GMAKE} -j${MAKE_JOBS:U1:Q} )
+
+do-test:
+#.if (${MACHINE_GNU_ARCH} == "x86_64")
+# (cd ${FILESDIR} && ${CP} netbsd64macro.dfs ${WRKSRC}/gcc/testsuite/ada/acats/support/macro.dfs)
+#.endif
+ (cd ${WRKDIR}/obj && ${GMAKE} -k check)
+
+do-install:
+ (cd ${WRKDIR}/obj && ${SETENV} ${MAKE_ENV} ${GMAKE} install DESTDIR=${DESTDIR} \
+ && ${TEST} -f ${DESTDIR}${GCC_PREFIX}/bin/cc || ${LN} -f ${DESTDIR}${GCC_PREFIX}/bin/gcc ${DESTDIR}${GCC_PREFIX}/bin/cc)
+
+GENERATE_PLIST+= \
+ cd ${DESTDIR}${PREFIX} && ${FIND} ${GCC_SUBPREFIX} \( -type f -o -type l \) -print \
+ | ${SORT} ;
+
+.include "../../devel/gmp/buildlink3.mk"
+.include "../../math/mpcomplex/buildlink3.mk"
+.include "../../devel/zlib/buildlink3.mk"
+.include "../../math/mpfr/buildlink3.mk"
+.include "../../devel/binutils/buildlink3.mk"
+.include "../../devel/libelf/buildlink3.mk"
+.include "../../converters/libiconv/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/lang/gcc46/TODO b/lang/gcc46/TODO
new file mode 100644
index 00000000000..a14b0107acc
--- /dev/null
+++ b/lang/gcc46/TODO
@@ -0,0 +1,3 @@
+
+* TODO make java target work
+* TODO Make it work on Dragonfly
diff --git a/lang/gcc46/buildlink3.mk b/lang/gcc46/buildlink3.mk
new file mode 100644
index 00000000000..10097e8d450
--- /dev/null
+++ b/lang/gcc46/buildlink3.mk
@@ -0,0 +1,63 @@
+# $NetBSD: buildlink3.mk,v 1.1.1.1 2011/05/15 00:09:55 wiz Exp $
+
+BUILDLINK_TREE+= gcc46
+
+.if !defined(GCC46_BUILDLINK3_MK)
+GCC46_BUILDLINK3_MK:=
+
+FIND_PREFIX:= BUILDLINK_PREFIX.gcc46=gcc46
+.include "../../mk/find-prefix.mk"
+
+_GCC46_SUBDIR= gcc46
+_GCC46_PREFIX= ${BUILDLINK_PREFIX.gcc46}/${_GCC46_SUBDIR}
+
+BUILDLINK_API_DEPENDS.gcc46+= gcc46>=${_GCC_REQD}
+BUILDLINK_ABI_DEPENDS.gcc46?= gcc46>=4.6.0
+BUILDLINK_PKGSRCDIR.gcc46?= ../../lang/gcc46
+
+.if exists(${_GCC46_PREFIX}/bin/gcc)
+
+# logic for detecting the ADA compiler (not yet supported)
+#gcc46_GNAT1!=${_GCC46_PREFIX}/bin/gcc -print-prog-name=gnat1
+#. if exists(${gcc46_GNAT1})
+#CONFIGURE_ENV+= ADAC=${_GCC46_PREFIX}/bin/gcc
+#MAKE_ENV+= ADAC=${_GCC46_PREFIX}/bin/gcc
+#. endif
+
+# add libraries
+BUILDLINK_LIBDIRS.gcc46+= ${_GCC46_SUBDIR}/lib
+
+# find the gcc architecture
+gcc46_GCC_ARCHDIR!= ${DIRNAME} `${_GCC46_PREFIX}/bin/gcc --print-libgcc-file-name`
+
+# add the architecture dep libraries
+. if empty(gcc46_GCC_ARCHDIR:M*not_found*)
+BUILDLINK_LIBDIRS.gcc46+= ${gcc46_GCC_ARCHDIR:S/^${BUILDLINK_PREFIX.gcc46}\///}/
+
+# add the ada libraries (not yet supported)
+#. if exists(${gcc46_GNAT1})
+#BUILDLINK_LIBDIRS.gcc46+= ${gcc46_GCC_ARCHDIR:S/^${BUILDLINK_PREFIX.gcc46}\///}/adalib
+#. endif
+
+# add the header files
+BUILDLINK_INCDIRS.gcc46+= ${_GCC46_SUBDIR}/include ${gcc46_GCC_ARCHDIR:S/^${BUILDLINK_PREFIX.gcc46}\///}/include
+. endif
+.endif
+
+BUILDLINK_FILES_CMD.gcc46= \
+ (cd ${BUILDLINK_PREFIX.gcc46} && \
+ ${FIND} ${_GCC46_SUBDIR}/bin ${_GCC46_SUBDIR}/libexec ${_GCC46_SUBDIR}/lib \( -type f -o -type l \) -print)
+BUILDLINK_FNAME_TRANSFORM.gcc46= -e s:buildlink:buildlink/gcc46:
+
+# Packages that link against shared libraries need a full dependency.
+.if defined(_USE_GCC_SHLIB)
+BUILDLINK_DEPMETHOD.gcc46+= full
+.else
+BUILDLINK_DEPMETHOD.gcc46?= build
+.endif
+
+.include "../../mk/pthread.buildlink3.mk"
+.include "../../devel/gettext-lib/buildlink3.mk"
+.endif # GCC46_BUILDLINK3_MK
+
+BUILDLINK_TREE+= -gcc46
diff --git a/lang/gcc46/distinfo b/lang/gcc46/distinfo
new file mode 100644
index 00000000000..06dc28aa32c
--- /dev/null
+++ b/lang/gcc46/distinfo
@@ -0,0 +1,13 @@
+$NetBSD: distinfo,v 1.1.1.1 2011/05/15 00:09:56 wiz Exp $
+
+SHA1 (gcc-4.6.0.tar.bz2) = dcbb5ce724c4bf87b9ec93473d16b71e9ebac483
+RMD160 (gcc-4.6.0.tar.bz2) = b4069838c882d70320a54c25517fa84ba2e7db8d
+Size (gcc-4.6.0.tar.bz2) = 71579535 bytes
+SHA1 (patch-aa) = 801b340bb24586c84b09f53161a7aced141ab9d9
+SHA1 (patch-ab) = f69d2db611aee1d31b7872bbf59d2b651413b3d3
+SHA1 (patch-ad) = 42894f37b20f85e601b941a8fea99d2af3f8b6c7
+SHA1 (patch-af) = fb06bce10adc88d3f6829f41a91f4612a72434fd
+SHA1 (patch-ag) = 4b82b06880bdccc3f967c8633e957fef4509dbc1
+SHA1 (patch-ah) = 7bddb8424dfcbce3e0cf1d856f851d827b66303c
+SHA1 (patch-ak) = 3038525af107b6c5ecf91ecb4aa8120c9881fe29
+SHA1 (patch-al) = 96b2a39c91af219227b202f1c3ce182f3bbdf502
diff --git a/lang/gcc46/files/dragonfly-spec.h b/lang/gcc46/files/dragonfly-spec.h
new file mode 100644
index 00000000000..ace9e19c4ff
--- /dev/null
+++ b/lang/gcc46/files/dragonfly-spec.h
@@ -0,0 +1,215 @@
+/* $DragonFly: src/gnu/usr.bin/cc41/cc_prep/config/dragonfly-spec.h,v 1.5 2008/07/24 21:45:10 corecode Exp $ */
+
+/* Base configuration file for all DragonFly targets.
+ Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+
+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 2, 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.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+/* Common DragonFly configuration.
+ All DragonFly architectures should include this file, which will specify
+ their commonalities.
+
+ Adapted from gcc/config/freebsd-spec.h by
+ Joerg Sonnenberger <joerg@bec.de>
+
+ Adapted from gcc/config/freebsd.h by
+ David O'Brien <obrien@FreeBSD.org>
+ Loren J. Rittle <ljrittle@acm.org>. */
+
+
+/* This defines which switch letters take arguments. On DragonFly, most of
+ the normal cases (defined in gcc.c) apply, and we also have -h* and
+ -z* options (for the linker) (coming from SVR4).
+ We also have -R (alias --rpath), no -z, --soname (-h), --assert etc. */
+
+#define DFBSD_SWITCH_TAKES_ARG(CHAR) \
+ (DEFAULT_SWITCH_TAKES_ARG (CHAR) \
+ || (CHAR) == 'h' \
+ || (CHAR) == 'z' /* ignored by ld */ \
+ || (CHAR) == 'R')
+
+/* This defines which multi-letter switches take arguments. */
+
+#define DFBSD_WORD_SWITCH_TAKES_ARG(STR) \
+ (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \
+ || !strcmp ((STR), "rpath") || !strcmp ((STR), "rpath-link") \
+ || !strcmp ((STR), "soname") || !strcmp ((STR), "defsym") \
+ || !strcmp ((STR), "assert") || !strcmp ((STR), "dynamic-linker"))
+
+#define DFBSD_TARGET_OS_CPP_BUILTINS() \
+ do \
+ { \
+ if (DFBSD_MAJOR == 3) \
+ builtin_define ("__DragonFly__=3"); \
+ else if (DFBSD_MAJOR == 2) \
+ builtin_define ("__DragonFly__=2"); \
+ else if (DFBSD_MAJOR == 1) \
+ builtin_define ("__DragonFly__=1"); \
+ else \
+ builtin_define ("__DragonFly__"); \
+ builtin_define ("__DragonFly_cc_version=100001"); \
+ builtin_define_std ("unix"); \
+ builtin_define ("__KPRINTF_ATTRIBUTE__"); \
+ builtin_assert ("system=unix"); \
+ builtin_assert ("system=bsd"); \
+ builtin_assert ("system=DragonFly"); \
+ DFBSD_TARGET_CPU_CPP_BUILTINS(); \
+ } \
+ while (0)
+
+/* Define the default DragonFly-specific per-CPU hook code. */
+#define DFBSD_TARGET_CPU_CPP_BUILTINS() do {} while (0)
+
+/* Provide a CPP_SPEC appropriate for DragonFly. We just deal with the GCC
+ option `-posix', and PIC issues. */
+
+#define DFBSD_CPP_SPEC " \
+ %(cpp_cpu) \
+ %{fPIC|fpic|fPIE|fpie:-D__PIC__ -D__pic__} \
+ %{posix:-D_POSIX_SOURCE}"
+
+/* Provide a STARTFILE_SPEC appropriate for DragonFly. Here we add
+ the magical crtbegin.o file (see crtstuff.c) which provides part
+ of the support for getting C++ file-scope static object constructed
+ before entering `main'. */
+
+#define DFBSD_STARTFILE_SPEC \
+ "%{!shared: \
+ %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
+ %{!p:%{profile:gcrt1.o%s} \
+ %{!profile:crt1.o%s}}}} \
+ crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
+
+/* Provide a ENDFILE_SPEC appropriate for DragonFly. Here we tack on
+ the magical crtend.o file (see crtstuff.c) which provides part of
+ the support for getting C++ file-scope static object constructed
+ before entering `main', followed by a normal "finalizer" file,
+ `crtn.o'. */
+
+#define DFBSD_ENDFILE_SPEC \
+ "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
+
+/* Provide a LIB_SPEC appropriate for DragonFly as configured and as
+ required by the user-land thread model. Select the appropriate libc,
+ depending on whether we're doing profiling or need threads support.
+ Make it a hard error if -pthread is provided on the command line and gcc
+ was configured with --disable-threads (this will help avoid bug
+ reports from users complaining about threading when they
+ misconfigured the gcc bootstrap but are later consulting DragonFly
+ manual pages that refer to the mythical -pthread option). */
+
+/* Provide a LIB_SPEC appropriate for DragonFly. Just select the appropriate
+ libc, depending on whether we're doing profiling or need threads support.
+ (simular to the default, except no -lg, and no -p). */
+
+#ifdef DFBSD_NO_THREADS
+#define DFBSD_LIB_SPEC " \
+ %{pthread: %eThe -pthread option is only supported on DragonFly when gcc \
+is built with the --enable-threads configure-time option.} \
+ %{!nostdlib{!nostartfiles{!nolibc: -lc}}} \
+ }"
+#else
+#define DFBSD_LIB_SPEC " \
+ %{pthread:-lpthread} \
+ %{!nostdlib: %{!nostartfiles: %{!nolibc: -lc}}} \
+ "
+#endif
+
+#define DFBSD_DYNAMIC_LINKER "/usr/libexec/ld-elf.so.2"
+
+#if 0
+#define LINK_LIBGCC_SPEC ""
+#define LIBGCC_SPEC "%{shared: -lgcc_pic} %{!shared: -lgcc}"
+
+#define PRE_LIB_SPEC " \
+ %{pg: -L"PREFIX2"/lib/gcc41/profiling \
+ %{!static: -rpath /usr/lib/gcc41/profiling \
+ -rpath-link "PREFIX2"/lib/gcc41/profiling}} \
+ %{g: -L"PREFIX2"/lib/gcc41/debug \
+ %{!static: -rpath /usr/lib/gcc41/debug \
+ -rpath-link "PREFIX2"/lib/gcc41/debug}} \
+ -L"PREFIX2"/lib/gcc41 \
+ %{!static: -rpath /usr/lib/gcc41 -rpath-link "PREFIX2"/lib/gcc41} \
+ %{pg: -L"PREFIX2"/lib/profiling \
+ %{!static: -rpath /usr/lib/profiling \
+ -rpath-link "PREFIX2"/lib/profiling}} \
+ %{g: -L"PREFIX2"/lib/debug \
+ %{!static: -rpath /usr/lib/debug -rpath-link "PREFIX2"/lib/debug}} \
+ %{!static: -rpath /usr/lib -rpath-link "PREFIX2"/lib} \
+ "
+
+#define DFBSD_LINK_COMMAND_SPEC "\
+%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
+ %(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\
+ %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
+ %{static:} %{L*} %(link_libgcc) %o \
+ %{fprofile-arcs|fprofile-generate: -lgcov}\
+ %{!nostdlib:%{!nodefaultlibs:%(pre_lib)}}\
+ %{!nostdlib:%{!nodefaultlibs:%(link_gcc_c_sequence)}}\
+ %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}"
+
+#ifndef PREFIX2
+#define PREFIX2 "/usr"
+#endif
+
+#ifndef STANDARD_STARTFILE_PREFIX_1
+#define STANDARD_STARTFILE_PREFIX_1 PREFIX2"/lib/gcc41/"
+#endif
+#ifndef STANDARD_EXEC_PREFIX
+#define STANDARD_EXEC_PREFIX PREFIX2"/libexec/gcc41/"
+#endif
+#ifndef STANDARD_STARTFILE_PREFIX
+#define STANDARD_STARTFILE_PREFIX PREFIX2"/lib/"
+#endif
+#ifndef TOOLDIR_BASE_PREFIX
+#define TOOLDIR_BASE_PREFIX PREFIX2"/libexec/gcc41"
+#endif
+#ifndef STANDARD_BINDIR_PREFIX
+#define STANDARD_BINDIR_PREFIX PREFIX2"/libexec/gcc41"
+#endif
+#ifndef STANDARD_LIBEXEC_PREFIX
+#define STANDARD_LIBEXEC_PREFIX PREFIX2"/libexec/gcc41"
+#endif
+
+#ifndef GPLUSPLUS_INCLUDE_DIR
+#define GPLUSPLUS_INCLUDE_DIR PREFIX2"/include/c++"
+#endif
+#ifndef GPLUSPLUS_TOOL_INCLUDE_DIR
+#define GPLUSPLUS_TOOL_INCLUDE_DIR PREFIX2"/include/c++/4.1"
+#endif
+#ifndef GPLUSPLUS_BACKWARD_INCLUDE_DIR
+#define GPLUSPLUS_BACKWARD_INCLUDE_DIR PREFIX2"/include/c++/4.1/backward"
+#endif
+#ifndef GCC_LOCAL_INCLUDE_DIR
+#define GCC_LOCAL_INCLUDE_DIR PREFIX2"/libdata/gcc41"
+#endif
+#ifndef GCC_INCLUDE_DIR
+#define GCC_INCLUDE_DIR PREFIX2"/include"
+#endif
+
+#undef INCLUDE_DEFAULTS
+#define INCLUDE_DEFAULTS \
+ { \
+ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 }, \
+ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, 0 }, \
+ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, 0 }, \
+ { GCC_INCLUDE_DIR, "GCC", 0, 0 }, \
+ { GCC_LOCAL_INCLUDE_DIR, "GCC", 0, 0 }, \
+ { NULL, NULL, 0, 0 } \
+ }
+#endif
diff --git a/lang/gcc46/files/dragonfly.h b/lang/gcc46/files/dragonfly.h
new file mode 100644
index 00000000000..6274620d9fa
--- /dev/null
+++ b/lang/gcc46/files/dragonfly.h
@@ -0,0 +1,97 @@
+/* $DragonFly: src/gnu/usr.bin/cc41/cc_prep/config/dragonfly.h,v 1.2 2008/05/19 10:46:39 corecode Exp $ */
+
+/* Base configuration file for all DragonFly targets.
+ Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+
+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 2, 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.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+/* Common DragonFly configuration.
+ All DragonFly architectures should include this file, which will specify
+ their commonalities.
+
+ Adapted from gcc/config/freebsd.h by
+ Joerg Sonnenberger <joerg@bec.de>
+
+ Adapted from gcc/config/i386/freebsd-elf.h by
+ David O'Brien <obrien@FreeBSD.org>.
+ Further work by David O'Brien <obrien@FreeBSD.org> and
+ Loren J. Rittle <ljrittle@acm.org>. */
+
+
+/* This defines which switch letters take arguments. On DragonFly, most of
+ the normal cases (defined in gcc.c) apply, and we also have -h* and
+ -z* options (for the linker) (coming from SVR4).
+ We also have -R (alias --rpath), no -z, --soname (-h), --assert etc. */
+
+#undef SWITCH_TAKES_ARG
+#define SWITCH_TAKES_ARG(CHAR) (DFBSD_SWITCH_TAKES_ARG(CHAR))
+
+#undef WORD_SWITCH_TAKES_ARG
+#define WORD_SWITCH_TAKES_ARG(STR) (DFBSD_WORD_SWITCH_TAKES_ARG(STR))
+
+#undef TARGET_OS_CPP_BUILTINS
+#define TARGET_OS_CPP_BUILTINS() DFBSD_TARGET_OS_CPP_BUILTINS()
+
+#undef CPP_SPEC
+#define CPP_SPEC DFBSD_CPP_SPEC
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC DFBSD_STARTFILE_SPEC
+
+#undef ENDFILE_SPEC
+#define ENDFILE_SPEC DFBSD_ENDFILE_SPEC
+
+#undef LIB_SPEC
+#define LIB_SPEC DFBSD_LIB_SPEC
+
+#if 0
+#undef LINK_COMMAND_SPEC
+#define LINK_COMMAND_SPEC DFBSD_LINK_COMMAND_SPEC
+#endif
+
+/************************[ Target stuff ]***********************************/
+
+/* All DragonFly Architectures support the ELF object file format. */
+#undef OBJECT_FORMAT_ELF
+#define OBJECT_FORMAT_ELF
+
+/* Don't assume anything about the header files. */
+#undef NO_IMPLICIT_EXTERN_C
+#define NO_IMPLICIT_EXTERN_C 1
+
+/* Make gcc agree with DragonFly's standard headers (<machine/stdint.h>, etc...) */
+
+#undef WCHAR_TYPE
+#define WCHAR_TYPE "int"
+
+#define MATH_LIBRARY_PROFILE "-lm_p"
+
+/* Code generation parameters. */
+
+/* Use periods rather than dollar signs in special g++ assembler names.
+ This ensures the configuration knows our system correctly so we can link
+ with libraries compiled with the native cc. */
+#undef NO_DOLLAR_IN_LABEL
+
+/* Define this so we can compile MS code for use with WINE. */
+#define HANDLE_PRAGMA_PACK_PUSH_POP
+
+/* Used by libgcc2.c. We support file locking with fcntl / F_SETLKW.
+ This enables the test coverage code to use file locking when exiting a
+ program, which avoids race conditions if the program has forked. */
+#define TARGET_POSIX_IO
diff --git a/lang/gcc46/files/hello.f b/lang/gcc46/files/hello.f
new file mode 100644
index 00000000000..4b34eeda655
--- /dev/null
+++ b/lang/gcc46/files/hello.f
@@ -0,0 +1,5 @@
+
+ PROGRAM hello
+ print*, 'Hello, World!'
+ END
+
diff --git a/lang/gcc46/files/hello.m b/lang/gcc46/files/hello.m
new file mode 100644
index 00000000000..c25ba5ad4a0
--- /dev/null
+++ b/lang/gcc46/files/hello.m
@@ -0,0 +1,6 @@
+#import <stdio.h>
+
+int main( int argc, const char *argv[] ) {
+ printf( "hello world\n" );
+ return 0;
+}
diff --git a/lang/gcc46/files/i386-dragonfly.h b/lang/gcc46/files/i386-dragonfly.h
new file mode 100644
index 00000000000..78b7e0c1d5a
--- /dev/null
+++ b/lang/gcc46/files/i386-dragonfly.h
@@ -0,0 +1,148 @@
+/* $DragonFly: src/gnu/usr.bin/cc41/cc_prep/config/i386/dragonfly.h,v 1.1 2006/09/27 12:10:34 corecode Exp $ */
+
+/* Definitions for Intel 386 running DragonFly with ELF format
+
+ Copyright (C) 1996, 2000, 2002 Free Software Foundation, Inc.
+ Contributed by Eric Youngdale.
+ Modified for stabs-in-ELF by H.J. Lu.
+ Adapted from GNU/Linux version by John Polstra.
+ Continued development by David O'Brien <obrien@freebsd.org>
+ Adapted from the FreeBSD version.
+
+ Changes:
+ - remove support for changing the dynamic linker
+
+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 2, 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.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+
+#define TARGET_VERSION fprintf (stderr, " (i386 DragonFly/ELF)");
+
+/* Override the default comment-starter of "/". */
+#undef ASM_COMMENT_START
+#define ASM_COMMENT_START "#"
+
+#undef ASM_APP_ON
+#define ASM_APP_ON "#APP\n"
+
+#undef ASM_APP_OFF
+#define ASM_APP_OFF "#NO_APP\n"
+
+#undef DBX_REGISTER_NUMBER
+#define DBX_REGISTER_NUMBER(n) \
+ (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n])
+
+#undef NO_PROFILE_COUNTERS
+#define NO_PROFILE_COUNTERS 1
+
+/* Tell final.c that we don't need a label passed to mcount. */
+
+#undef MCOUNT_NAME
+#define MCOUNT_NAME ".mcount"
+
+/* Make gcc agree with <machine/ansi.h>. */
+
+#undef SIZE_TYPE
+#define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int")
+
+#undef PTRDIFF_TYPE
+#define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int")
+
+#undef WCHAR_TYPE_SIZE
+#define WCHAR_TYPE_SIZE (TARGET_64BIT ? 32 : BITS_PER_WORD)
+
+#undef SUBTARGET_EXTRA_SPECS /* i386.h bogusly defines it. */
+#define SUBTARGET_EXTRA_SPECS \
+ { "dfbsd_dynamic_linker", DFBSD_DYNAMIC_LINKER }
+
+/* Provide a STARTFILE_SPEC appropriate for DragonFly. Here we add
+ the magical crtbegin.o file (see crtstuff.c) which provides part
+ of the support for getting C++ file-scope static object constructed
+ before entering `main'. */
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC \
+ "%{!shared: \
+ %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
+ %{!p:%{profile:gcrt1.o%s} \
+ %{!profile:crt1.o%s}}}} \
+ crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
+
+/* Provide a ENDFILE_SPEC appropriate for DragonFly. Here we tack on
+ the magical crtend.o file (see crtstuff.c) which provides part of
+ the support for getting C++ file-scope static object constructed
+ before entering `main', followed by a normal "finalizer" file,
+ `crtn.o'. */
+
+#undef ENDFILE_SPEC
+#define ENDFILE_SPEC \
+ "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
+
+/* Provide a LINK_SPEC appropriate for DragonFly. Here we provide support
+ for the special GCC options -static and -shared, which allow us to
+ link things in one of these three modes by applying the appropriate
+ combinations of options at link-time. We like to support here for
+ as many of the other GNU linker options as possible. But I don't
+ have the time to search for those flags. I am sure how to add
+ support for -soname shared_object_name. H.J.
+
+ I took out %{v:%{!V:-V}}. It is too much :-(. They can use
+ -Wl,-V.
+
+ When the -shared link option is used a final link is not being
+ done. */
+
+#undef LINK_SPEC
+#define LINK_SPEC "\
+ %{p:%nconsider using `-pg' instead of `-p' with gprof(1)} \
+ %{v:-V} \
+ %{assert*} %{R*} %{rpath*} %{defsym*} \
+ %{shared:-Bshareable %{h*} %{soname*}} \
+ %{!shared: \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+ %{!dynamic-linker:-dynamic-linker %(dfbsd_dynamic_linker) }} \
+ %{static:-Bstatic}} \
+ %{symbolic:-Bsymbolic}"
+
+/* A C statement to output to the stdio stream FILE an assembler
+ command to advance the location counter to a multiple of 1<<LOG
+ bytes if it is within MAX_SKIP bytes.
+
+ This is used to align code labels according to Intel recommendations. */
+
+#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
+#undef ASM_OUTPUT_MAX_SKIP_ALIGN
+#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP) \
+ if ((LOG) != 0) { \
+ if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
+ else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
+ }
+#endif
+
+/* Don't default to pcc-struct-return, we want to retain compatibility with
+ older gcc versions AND pcc-struct-return is nonreentrant.
+ (even though the SVR4 ABI for the i386 says that records and unions are
+ returned in memory). */
+
+#undef DEFAULT_PCC_STRUCT_RETURN
+#define DEFAULT_PCC_STRUCT_RETURN 0
+
+/* DragonFly sets the rounding precision of the FPU to 53 bits. Let the
+ compiler get the contents of <float.h> and std::numeric_limits correct. */
+#undef TARGET_96_ROUND_53_LONG_DOUBLE
+#define TARGET_96_ROUND_53_LONG_DOUBLE (!TARGET_64BIT)
diff --git a/lang/gcc46/files/i386-dragonfly64.h b/lang/gcc46/files/i386-dragonfly64.h
new file mode 100644
index 00000000000..f423653982f
--- /dev/null
+++ b/lang/gcc46/files/i386-dragonfly64.h
@@ -0,0 +1,54 @@
+/* $DragonFly: src/gnu/usr.bin/cc41/cc_prep/config/i386/dragonfly64.h,v 1.1 2007/01/15 17:53:16 corecode Exp $ */
+
+/* Definitions for AMD x86-64 running DragonFly with ELF format
+ Copyright (C) 2002 Free Software Foundation, Inc.
+ Contributed by David O'Brien <obrien@FreeBSD.org>
+ Adapted from the FreeBSD version.
+
+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 2, 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.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+/* $FreeBSD: src/contrib/gcc/config/i386/freebsd64.h,v 1.9 2004/07/28 04:44:23 kan Exp $ */
+
+
+#undef TARGET_VERSION
+#define TARGET_VERSION fprintf (stderr, " (x86-64 DragonFly/ELF)");
+
+/* Tell final.c that we don't need a label passed to mcount. */
+
+#define SUBTARGET_EXTRA_SPECS \
+ { "dfbsd_dynamic_linker", DFBSD_DYNAMIC_LINKER }
+
+#undef MCOUNT_NAME
+#define MCOUNT_NAME ".mcount"
+
+/* Provide a LINK_SPEC appropriate for the DragonFly/x86-64 ELF target.
+ This is a copy of LINK_SPEC from <i386/dragonfly.h> tweaked for
+ the x86-64 target.
+ XXX We don't support two arch userland yet */
+
+#undef LINK_SPEC
+#define LINK_SPEC "\
+ %{v:-V} \
+ %{assert*} %{R*} %{rpath*} %{defsym*} \
+ %{shared:-Bshareable %{h*} %{soname*}} \
+ %{!shared: \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+ %{!dynamic-linker:-dynamic-linker %(dfbsd_dynamic_linker) }} \
+ %{static:-Bstatic}} \
+ %{symbolic:-Bsymbolic}"
diff --git a/lang/gcc46/options.mk b/lang/gcc46/options.mk
new file mode 100644
index 00000000000..f2c92d8381c
--- /dev/null
+++ b/lang/gcc46/options.mk
@@ -0,0 +1,21 @@
+# $NetBSD: options.mk,v 1.1.1.1 2011/05/15 00:09:56 wiz Exp $
+
+PKG_OPTIONS_VAR= PKG_OPTIONS.gcc46
+PKG_SUPPORTED_OPTIONS= nls
+PKG_SUGGESTED_OPTIONS=
+.if ${OPSYS} == "NetBSD"
+PKG_SUGGESTED_OPTIONS+= nls
+.endif
+
+.include "../../mk/bsd.options.mk"
+
+###
+### Native Language Support
+###
+.if !empty(PKG_OPTIONS:Mnls)
+CONFIGURE_ARGS+= --enable-nls
+.include "../../converters/libiconv/buildlink3.mk"
+.include "../../devel/gettext-lib/buildlink3.mk"
+.else
+CONFIGURE_ARGS+= --disable-nls
+.endif
diff --git a/lang/gcc46/patches/patch-aa b/lang/gcc46/patches/patch-aa
new file mode 100644
index 00000000000..580ccf0be4b
--- /dev/null
+++ b/lang/gcc46/patches/patch-aa
@@ -0,0 +1,75 @@
+$NetBSD: patch-aa,v 1.1.1.1 2011/05/15 00:09:56 wiz Exp $
+
+--- gcc/config.gcc.orig 2011-03-14 06:05:29.000000000 +0000
++++ gcc/config.gcc
+@@ -560,6 +560,33 @@ case ${target} in
+ # need_64bit_hwint=yes # system compiler has this for all arch!
+ use_gcc_stdint=wrap
+ ;;
++*-*-dragonfly*)
++ gas=yes
++ gnu_ld=yes
++ extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
++ case ${target} in
++ *-*-dragonfly1 | *-*-dragonfly[1].*)
++ tm_defines="${tm_defines} DFBSD_MAJOR=1" ;;
++ *-*-dragonfly2 | *-*-dragonfly[2].*)
++ tm_defines="${tm_defines} DFBSD_MAJOR=2" ;;
++ *-*-dragonfly3 | *-*-dragonfly[3].*)
++ tm_defines="${tm_defines} DFBSD_MAJOR=3" ;;
++ *-*-dragonfly4 | *-*-dragonfly[4].*)
++ tm_defines="${tm_defines} DFBSD_MAJOR=4" ;;
++ *)
++ echo 'Please update *-*-dragonfly* in gcc/config.gcc'
++ exit 1
++ ;;
++ esac
++ tmake_file="t-slibgcc-elf-ver t-dragonfly"
++ case ${enable_threads} in
++ "" | yes | posix)
++ thread_file='posix'
++ tmake_file="${tmake_file} t-dragonfly-thread"
++ ;;
++ esac
++ dfbsd_tm_file="${dfbsd_tm_file} dragonfly-spec.h dragonfly.h"
++ ;;
+ *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu)
+ extra_options="$extra_options gnu-user.opt"
+ extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
+@@ -654,6 +681,7 @@ case ${target} in
+ default_use_cxa_atexit=yes
+ ;;
+ esac
++ use_gcc_stdint=wrap
+ ;;
+ *-*-openbsd*)
+ tmake_file="t-libc-ok t-openbsd t-libgcc-pic"
+@@ -1217,19 +1245,25 @@ 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"
+ tmake_file="${tmake_file} i386/t-crtstuff"
+ ;;
++x86_64-*-dragonfly*)
++ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${dfbsd_tm_file} i386/x86-64.h i386/dragonfly.h i386/dragonfly64.h"
++ ;;
++i[34567]86-*-dragonfly*)
++ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${dfbsd_tm_file} i386/dragonfly.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"
+ ;;
+ i[34567]86-*-netbsd*)
+- tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/gstabs.h netbsd.h netbsd-aout.h i386/netbsd.h"
++ tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/gstabs.h netbsd.h netbsd-aout.h i386/netbsd.h netbsd-stdint.h"
+ extra_options="${extra_options} netbsd.opt"
+ tmake_file="${tmake_file} t-netbsd"
+ extra_parts=""
+ use_collect2=yes
+ ;;
+ 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"
+ tmake_file="${tmake_file} i386/t-crtstuff"
+ ;;
diff --git a/lang/gcc46/patches/patch-ab b/lang/gcc46/patches/patch-ab
new file mode 100644
index 00000000000..3a20d5a56d2
--- /dev/null
+++ b/lang/gcc46/patches/patch-ab
@@ -0,0 +1,24 @@
+$NetBSD: patch-ab,v 1.1.1.1 2011/05/15 00:09:56 wiz Exp $
+
+--- libgcc/config.host.orig 2011-03-14 06:06:23.000000000 +0000
++++ libgcc/config.host
+@@ -159,6 +159,8 @@ case ${host} in
+ # machine-specific sections may refine and add to this
+ # configuration.
+ ;;
++*-*-dragonfly*)
++ ;;
+ *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu*)
+ extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
+ ;;
+@@ -287,6 +289,10 @@ i[34567]86-*-freebsd*)
+ x86_64-*-freebsd*)
+ tmake_file="${tmake_file} i386/t-freebsd"
+ ;;
++i[34567]86-*-dragonfly*)
++ ;;
++x86_64-*-dragonfly*)
++ ;;
+ i[34567]86-*-netbsdelf*)
+ ;;
+ i[34567]86-*-netbsd*)
diff --git a/lang/gcc46/patches/patch-ad b/lang/gcc46/patches/patch-ad
new file mode 100644
index 00000000000..8557b470448
--- /dev/null
+++ b/lang/gcc46/patches/patch-ad
@@ -0,0 +1,13 @@
+$NetBSD: patch-ad,v 1.1.1.1 2011/05/15 00:09:56 wiz Exp $
+
+--- configure.orig 2011-03-16 18:27:36.000000000 +0000
++++ configure
+@@ -5275,7 +5275,7 @@ fi
+
+
+ if test "x$with_mpfr" != x; then
+- gmplibs="-L$with_mpfr/lib $gmplibs"
++ gmplibs="-L$with_mpfr/lib -Wl,-R${PREFIX}/lib $gmplibs"
+ gmpinc="-I$with_mpfr/include $gmpinc"
+ fi
+ if test "x$with_mpfr_include" != x; then
diff --git a/lang/gcc46/patches/patch-af b/lang/gcc46/patches/patch-af
new file mode 100644
index 00000000000..bf47055c653
--- /dev/null
+++ b/lang/gcc46/patches/patch-af
@@ -0,0 +1,13 @@
+$NetBSD: patch-af,v 1.1.1.1 2011/05/15 00:09:56 wiz Exp $
+
+--- libjava/configure.orig 2011-03-25 17:07:00.000000000 +0000
++++ libjava/configure
+@@ -24653,7 +24653,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/gcc46/patches/patch-ag b/lang/gcc46/patches/patch-ag
new file mode 100644
index 00000000000..4e46c1c9a13
--- /dev/null
+++ b/lang/gcc46/patches/patch-ag
@@ -0,0 +1,25 @@
+$NetBSD: patch-ag,v 1.1.1.1 2011/05/15 00:09:56 wiz Exp $
+
+--- 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/gcc46/patches/patch-ah b/lang/gcc46/patches/patch-ah
new file mode 100644
index 00000000000..2fa72c7d215
--- /dev/null
+++ b/lang/gcc46/patches/patch-ah
@@ -0,0 +1,22 @@
+$NetBSD: patch-ah,v 1.1.1.1 2011/05/15 00:09:56 wiz Exp $
+
+--- gcc/fortran/f95-lang.c.orig 2011-02-24 09:53:26.000000000 +0000
++++ gcc/fortran/f95-lang.c
+@@ -824,10 +824,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/gcc46/patches/patch-ak b/lang/gcc46/patches/patch-ak
new file mode 100644
index 00000000000..4e4c173ec20
--- /dev/null
+++ b/lang/gcc46/patches/patch-ak
@@ -0,0 +1,16 @@
+$NetBSD: patch-ak,v 1.1.1.1 2011/05/15 00:09:56 wiz Exp $
+
+--- gcc/ginclude/stddef.h.orig 2011-01-29 22:15:52.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/gcc46/patches/patch-al b/lang/gcc46/patches/patch-al
new file mode 100644
index 00000000000..25a8ca3ac8b
--- /dev/null
+++ b/lang/gcc46/patches/patch-al
@@ -0,0 +1,13 @@
+$NetBSD: patch-al,v 1.1.1.1 2011/05/15 00:09:56 wiz Exp $
+
+--- libgfortran/configure.orig 2011-04-13 10:23:06.659661693 +0000
++++ libgfortran/configure
+@@ -25687,7 +25687,7 @@ $as_echo "#define SUPPORTS_WEAK 1" >>con
+
+ fi
+ case "$host" in
+- *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* )
++ *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* | *-*-netbsd*)
+
+ $as_echo "#define GTHREAD_USE_WEAK 0" >>confdefs.h
+
diff --git a/lang/gcc46/preconfigure.mk b/lang/gcc46/preconfigure.mk
new file mode 100644
index 00000000000..455862f5630
--- /dev/null
+++ b/lang/gcc46/preconfigure.mk
@@ -0,0 +1,11 @@
+# $NetBSD: preconfigure.mk,v 1.1.1.1 2011/05/15 00:09:56 wiz Exp $
+ # Create compiler driver scripts in ${WRKDIR}.
+ (${TEST} -d ${WRKDIR}/.gcc/bin || ${MKDIR} ${WRKDIR}/.gcc/bin)
+ (cd ${BUILDLINK_PREFIX.gcc46}/bin && bin_files=`${LS} *` && \
+ cd ${WRKDIR}/.gcc/bin && \
+ for _target_ in $${bin_files} ; do \
+ ${ECHO} '#!${TOOLS_SHELL}' > $${_target_} && \
+ ${ECHO_N} "exec ${BUILDLINK_PREFIX.gcc46}/bin/$${_target_}" >> $${_target_} && \
+ ${ECHO} ' "$$@"' >> $${_target_} && \
+ ${CHMOD} +x $${_target_}; \
+ done )