summaryrefslogtreecommitdiff
path: root/lang/gcc45
diff options
context:
space:
mode:
authorwiz <wiz@pkgsrc.org>2011-05-14 20:19:46 +0000
committerwiz <wiz@pkgsrc.org>2011-05-14 20:19:46 +0000
commit5b2edaa90db52bff8cb68d8f79b003ee1e30957f (patch)
treefb42701e63203a34f516c019c0557d4fb1d22204 /lang/gcc45
parentf0cc2c6d307d02f06d5f50eade8fd967109fae7d (diff)
downloadpkgsrc-5b2edaa90db52bff8cb68d8f79b003ee1e30957f.tar.gz
Initial import of gcc45-4.5.2 from pkgsrc-wip.
Packaged by Marko Schütz, improved by Kai-Uwe Eckhardt. This is the gcc 4.5 compiler suite. This package has a test target. For testing (only), this package requires devel/dejagnu and devel/autogen.
Diffstat (limited to 'lang/gcc45')
-rw-r--r--lang/gcc45/DESCR4
-rw-r--r--lang/gcc45/MESSAGE17
-rw-r--r--lang/gcc45/Makefile189
-rw-r--r--lang/gcc45/buildlink3.mk63
-rw-r--r--lang/gcc45/distinfo14
-rw-r--r--lang/gcc45/files/dragonfly-spec.h215
-rw-r--r--lang/gcc45/files/dragonfly.h97
-rw-r--r--lang/gcc45/files/hello.f5
-rw-r--r--lang/gcc45/files/hello.m6
-rw-r--r--lang/gcc45/files/i386-dragonfly.h148
-rw-r--r--lang/gcc45/files/i386-dragonfly64.h54
-rw-r--r--lang/gcc45/options.mk21
-rw-r--r--lang/gcc45/patches/patch-aa73
-rw-r--r--lang/gcc45/patches/patch-ab24
-rw-r--r--lang/gcc45/patches/patch-ad13
-rw-r--r--lang/gcc45/patches/patch-af16
-rw-r--r--lang/gcc45/patches/patch-ag29
-rw-r--r--lang/gcc45/patches/patch-ah22
-rw-r--r--lang/gcc45/patches/patch-ai13
-rw-r--r--lang/gcc45/patches/patch-aj40
-rw-r--r--lang/gcc45/patches/patch-ak16
-rw-r--r--lang/gcc45/preconfigure.mk11
22 files changed, 1090 insertions, 0 deletions
diff --git a/lang/gcc45/DESCR b/lang/gcc45/DESCR
new file mode 100644
index 00000000000..8cd67ea231b
--- /dev/null
+++ b/lang/gcc45/DESCR
@@ -0,0 +1,4 @@
+This is the gcc 4.5 compiler suite.
+
+This package has a test target. For testing (only), this
+package requires devel/dejagnu and devel/autogen.
diff --git a/lang/gcc45/MESSAGE b/lang/gcc45/MESSAGE
new file mode 100644
index 00000000000..82fd730ea70
--- /dev/null
+++ b/lang/gcc45/MESSAGE
@@ -0,0 +1,17 @@
+===========================================================================
+$NetBSD: MESSAGE,v 1.1.1.1 2011/05/14 20:19:46 wiz Exp $
+
+${PKGNAME} has been installed in ${LOCALBASE}/gcc45
+
+To use this compiler in pkgsrc:
+
+ 1) In your "pre-configure" target:
+
+ .include "../../lang/gcc45/preconfigure.mk"
+
+ 2) .include "../../lang/gcc45/buildlink3.mk"
+
+The "preconfigure.mk" makefile fragment will override the compiler tools
+selected by ../../mk/compiler.mk to use gcc version 4.5.x.
+
+===========================================================================
diff --git a/lang/gcc45/Makefile b/lang/gcc45/Makefile
new file mode 100644
index 00000000000..8aebc481215
--- /dev/null
+++ b/lang/gcc45/Makefile
@@ -0,0 +1,189 @@
+# $NetBSD: Makefile,v 1.1.1.1 2011/05/14 20:19:46 wiz Exp $
+
+DISTNAME= gcc-${GCC_VERSION}
+PKGNAME= gcc45-${GCC_VERSION}
+CATEGORIES= lang
+MASTER_SITES= ${MASTER_SITE_GNU:=gcc/gcc-${GCC_VERSION}/}
+EXTRACT_SUFX= .tar.bz2
+
+MAINTAINER= MarkoSchuetz@web.de
+HOMEPAGE= http://gcc.gnu.org/
+COMMENT= GNU Compiler Collection 4.5
+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
+
+GCC_VERSION= 4.5.2
+
+GCC_SUBPREFIX= gcc45
+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+= --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}
+.if !(${OPSYS} == "Linux")
+CONFIGURE_ARGS+= --with-ld=${PREFIX}/bin/gnu-ld
+CONFIGURE_ARGS+= --with-libelf=${PREFIX}
+.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 "../../mk/bsd.pkg.mk"
diff --git a/lang/gcc45/buildlink3.mk b/lang/gcc45/buildlink3.mk
new file mode 100644
index 00000000000..04fd3aced81
--- /dev/null
+++ b/lang/gcc45/buildlink3.mk
@@ -0,0 +1,63 @@
+# $NetBSD: buildlink3.mk,v 1.1.1.1 2011/05/14 20:19:46 wiz Exp $
+
+BUILDLINK_TREE+= gcc45
+
+.if !defined(GCC45_BUILDLINK3_MK)
+GCC45_BUILDLINK3_MK:=
+
+FIND_PREFIX:= BUILDLINK_PREFIX.gcc45=gcc45
+.include "../../mk/find-prefix.mk"
+
+_GCC45_SUBDIR= gcc45
+_GCC45_PREFIX= ${BUILDLINK_PREFIX.gcc45}/${_GCC45_SUBDIR}
+
+BUILDLINK_API_DEPENDS.gcc45+= gcc45>=${_GCC_REQD}
+BUILDLINK_ABI_DEPENDS.gcc45?= gcc45>=4.5.0
+BUILDLINK_PKGSRCDIR.gcc45?= ../../lang/gcc45
+
+.if exists(${_GCC45_PREFIX}/bin/gcc)
+
+# logic for detecting the ADA compiler (not yet supported)
+#gcc45_GNAT1!=${_GCC45_PREFIX}/bin/gcc -print-prog-name=gnat1
+#. if exists(${gcc45_GNAT1})
+#CONFIGURE_ENV+= ADAC=${_GCC45_PREFIX}/bin/gcc
+#MAKE_ENV+= ADAC=${_GCC45_PREFIX}/bin/gcc
+#. endif
+
+# add libraries
+BUILDLINK_LIBDIRS.gcc45+= ${_GCC45_SUBDIR}/lib
+
+# find the gcc architecture
+gcc45_GCC_ARCHDIR!= ${DIRNAME} `${_GCC45_PREFIX}/bin/gcc --print-libgcc-file-name`
+
+# add the architecture dep libraries
+. if empty(gcc45_GCC_ARCHDIR:M*not_found*)
+BUILDLINK_LIBDIRS.gcc45+= ${gcc45_GCC_ARCHDIR:S/^${BUILDLINK_PREFIX.gcc45}\///}/
+
+# add the ada libraries (not yet supported)
+#. if exists(${gcc45_GNAT1})
+#BUILDLINK_LIBDIRS.gcc45+= ${gcc45_GCC_ARCHDIR:S/^${BUILDLINK_PREFIX.gcc45}\///}/adalib
+#. endif
+
+# add the header files
+BUILDLINK_INCDIRS.gcc45+= ${_GCC45_SUBDIR}/include ${gcc45_GCC_ARCHDIR:S/^${BUILDLINK_PREFIX.gcc45}\///}/include
+. endif
+.endif
+
+BUILDLINK_FILES_CMD.gcc45= \
+ (cd ${BUILDLINK_PREFIX.gcc45} && \
+ ${FIND} ${_GCC45_SUBDIR}/bin ${_GCC45_SUBDIR}/libexec ${_GCC45_SUBDIR}/lib \( -type f -o -type l \) -print)
+BUILDLINK_FNAME_TRANSFORM.gcc45= -e s:buildlink:buildlink/gcc45:
+
+# Packages that link against shared libraries need a full dependency.
+.if defined(_USE_GCC_SHLIB)
+BUILDLINK_DEPMETHOD.gcc45+= full
+.else
+BUILDLINK_DEPMETHOD.gcc45?= build
+.endif
+
+.include "../../mk/pthread.buildlink3.mk"
+.include "../../devel/gettext-lib/buildlink3.mk"
+.endif # GCC45_BUILDLINK3_MK
+
+BUILDLINK_TREE+= -gcc45
diff --git a/lang/gcc45/distinfo b/lang/gcc45/distinfo
new file mode 100644
index 00000000000..31fe8101a15
--- /dev/null
+++ b/lang/gcc45/distinfo
@@ -0,0 +1,14 @@
+$NetBSD: distinfo,v 1.1.1.1 2011/05/14 20:19:47 wiz Exp $
+
+SHA1 (gcc-4.5.2.tar.bz2) = ad5c440526c98fd17a74eab80c031af6b64d9c90
+RMD160 (gcc-4.5.2.tar.bz2) = e1e9f590f5cf5f7029f1941328529a22919ee609
+Size (gcc-4.5.2.tar.bz2) = 66328720 bytes
+SHA1 (patch-aa) = c488dc25e038d97c737c8c72437660598d9e15d3
+SHA1 (patch-ab) = 61bc2ebf150c6e471917e145d74e7795dc162194
+SHA1 (patch-ad) = 55b5303b494dbef323bd59464c7c14863f81c6e3
+SHA1 (patch-af) = 54fb9fb3438eb7c646b9d51b6b0cf3ded27d4989
+SHA1 (patch-ag) = b58f8b82fcf17c60eb2700bc54d6625ca45e542b
+SHA1 (patch-ah) = a963394b0434b82494b7510d4b2705f77acfb668
+SHA1 (patch-ai) = af9eb0b2b8c0c41aa5dce367666c49f40aa3f1ba
+SHA1 (patch-aj) = 7935c4c44b3942097129fdda2336de1ea0c83215
+SHA1 (patch-ak) = 3d8a859ba436a4b204bb99f59cd5331d695aa811
diff --git a/lang/gcc45/files/dragonfly-spec.h b/lang/gcc45/files/dragonfly-spec.h
new file mode 100644
index 00000000000..ace9e19c4ff
--- /dev/null
+++ b/lang/gcc45/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/gcc45/files/dragonfly.h b/lang/gcc45/files/dragonfly.h
new file mode 100644
index 00000000000..6274620d9fa
--- /dev/null
+++ b/lang/gcc45/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/gcc45/files/hello.f b/lang/gcc45/files/hello.f
new file mode 100644
index 00000000000..4b34eeda655
--- /dev/null
+++ b/lang/gcc45/files/hello.f
@@ -0,0 +1,5 @@
+
+ PROGRAM hello
+ print*, 'Hello, World!'
+ END
+
diff --git a/lang/gcc45/files/hello.m b/lang/gcc45/files/hello.m
new file mode 100644
index 00000000000..c25ba5ad4a0
--- /dev/null
+++ b/lang/gcc45/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/gcc45/files/i386-dragonfly.h b/lang/gcc45/files/i386-dragonfly.h
new file mode 100644
index 00000000000..78b7e0c1d5a
--- /dev/null
+++ b/lang/gcc45/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/gcc45/files/i386-dragonfly64.h b/lang/gcc45/files/i386-dragonfly64.h
new file mode 100644
index 00000000000..f423653982f
--- /dev/null
+++ b/lang/gcc45/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/gcc45/options.mk b/lang/gcc45/options.mk
new file mode 100644
index 00000000000..a530b871096
--- /dev/null
+++ b/lang/gcc45/options.mk
@@ -0,0 +1,21 @@
+# $NetBSD: options.mk,v 1.1.1.1 2011/05/14 20:19:47 wiz Exp $
+
+PKG_OPTIONS_VAR= PKG_OPTIONS.gcc45
+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/gcc45/patches/patch-aa b/lang/gcc45/patches/patch-aa
new file mode 100644
index 00000000000..39ac5bf1fc6
--- /dev/null
+++ b/lang/gcc45/patches/patch-aa
@@ -0,0 +1,73 @@
+$NetBSD: patch-aa,v 1.1.1.1 2011/05/14 20:19:47 wiz Exp $
+
+--- gcc/config.gcc.orig 2010-10-09 09:35:53.000000000 +0000
++++ gcc/config.gcc
+@@ -499,6 +499,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_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
+ gas=yes
+@@ -572,6 +599,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"
+@@ -1117,17 +1145,23 @@ 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"
+ ;;
+ 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"
+ 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"
+ tmake_file="${tmake_file} i386/t-crtstuff"
+ ;;
+ i[34567]86-*-openbsd2.*|i[34567]86-*openbsd3.[0123])
diff --git a/lang/gcc45/patches/patch-ab b/lang/gcc45/patches/patch-ab
new file mode 100644
index 00000000000..a1a46c9dcf8
--- /dev/null
+++ b/lang/gcc45/patches/patch-ab
@@ -0,0 +1,24 @@
+$NetBSD: patch-ab,v 1.1.1.1 2011/05/14 20:19:47 wiz Exp $
+
+--- libgcc/config.host.orig 2010-04-01 23:02:18.000000000 -0400
++++ libgcc/config.host
+@@ -156,6 +156,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"
+ ;;
+@@ -282,6 +284,10 @@ i[34567]86-*-freebsd*)
+ ;;
+ x86_64-*-freebsd*)
+ ;;
++i[34567]86-*-dragonfly*)
++ ;;
++x86_64-*-dragonfly*)
++ ;;
+ i[34567]86-*-netbsdelf*)
+ ;;
+ i[34567]86-*-netbsd*)
diff --git a/lang/gcc45/patches/patch-ad b/lang/gcc45/patches/patch-ad
new file mode 100644
index 00000000000..47e8e5fec08
--- /dev/null
+++ b/lang/gcc45/patches/patch-ad
@@ -0,0 +1,13 @@
+$NetBSD: patch-ad,v 1.1.1.1 2011/05/14 20:19:47 wiz Exp $
+
+--- configure.orig 2010-04-02 13:35:47.000000000 -0400
++++ configure
+@@ -5395,7 +5395,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/gcc45/patches/patch-af b/lang/gcc45/patches/patch-af
new file mode 100644
index 00000000000..e3e4f0bd26e
--- /dev/null
+++ b/lang/gcc45/patches/patch-af
@@ -0,0 +1,16 @@
+$NetBSD: patch-af,v 1.1.1.1 2011/05/14 20:19:47 wiz Exp $
+
+Avoid a reference to the wrapped make in the pkgsrc work directory from showing up
+in an installed file. See ${WRKDIR}/gcc-4.4.1/libjava/contrib/aotcompile.py.in
+
+--- libjava/configure.orig 2010-04-02 14:18:06.000000000 -0400
++++ libjava/configure
+@@ -24517,7 +24517,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/gcc45/patches/patch-ag b/lang/gcc45/patches/patch-ag
new file mode 100644
index 00000000000..0f1a5c1b92f
--- /dev/null
+++ b/lang/gcc45/patches/patch-ag
@@ -0,0 +1,29 @@
+$NetBSD: patch-ag,v 1.1.1.1 2011/05/14 20:19:47 wiz 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 09:17:54.000000000 -0400
++++ 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/gcc45/patches/patch-ah b/lang/gcc45/patches/patch-ah
new file mode 100644
index 00000000000..fbf9318029d
--- /dev/null
+++ b/lang/gcc45/patches/patch-ah
@@ -0,0 +1,22 @@
+$NetBSD: patch-ah,v 1.1.1.1 2011/05/14 20:19:47 wiz Exp $
+
+--- gcc/fortran/f95-lang.c.orig 2010-06-15 14:17:16.000000000 +0200
++++ gcc/fortran/f95-lang.c
+@@ -794,10 +794,17 @@
+
+ gfc_define_builtin ("__builtin_cabsl", func_clongdouble_longdouble,
+ BUILT_IN_CABSL, "cabsl", true);
++#if defined(__NetBSD__)
++ gfc_define_builtin ("__builtin_cabs", func_cdouble_double,
++ BUILT_IN_CABS, "__c99_cabs", true);
++ gfc_define_builtin ("__builtin_cabsf", func_cfloat_float,
++ BUILT_IN_CABSF, "__c99_cabsf", true);
++#else
+ gfc_define_builtin ("__builtin_cabs", func_cdouble_double,
+ BUILT_IN_CABS, "cabs", true);
+ gfc_define_builtin ("__builtin_cabsf", func_cfloat_float,
+ BUILT_IN_CABSF, "cabsf", true);
++#endif
+
+ gfc_define_builtin ("__builtin_copysignl", mfunc_longdouble[1],
+ BUILT_IN_COPYSIGNL, "copysignl", true);
diff --git a/lang/gcc45/patches/patch-ai b/lang/gcc45/patches/patch-ai
new file mode 100644
index 00000000000..87bccfd6452
--- /dev/null
+++ b/lang/gcc45/patches/patch-ai
@@ -0,0 +1,13 @@
+$NetBSD: patch-ai,v 1.1.1.1 2011/05/14 20:19:47 wiz Exp $
+
+--- libgfortran/intrinsics/c99_functions.c.orig 2011-02-23 18:44:34.000000000 +0100
++++ libgfortran/intrinsics/c99_functions.c
+@@ -601,7 +601,7 @@
+ if (x > DBL_MAX || x < -DBL_MAX)
+ {
+ #ifdef HAVE_NEXTAFTERL
+- static long double prechalf = nexafterl (0.5L, LDBL_MAX);
++ long double prechalf = nextafterl (0.5L, LDBL_MAX);
+ #else
+ static long double prechalf = 0.5L;
+ #endif
diff --git a/lang/gcc45/patches/patch-aj b/lang/gcc45/patches/patch-aj
new file mode 100644
index 00000000000..46040c37433
--- /dev/null
+++ b/lang/gcc45/patches/patch-aj
@@ -0,0 +1,40 @@
+$NetBSD: patch-aj,v 1.1.1.1 2011/05/14 20:19:47 wiz Exp $
+
+--- libstdc++-v3/config/os/bsd/netbsd/ctype_base.h.orig 2011-02-23 18:48:42.000000000 +0100
++++ libstdc++-v3/config/os/bsd/netbsd/ctype_base.h
+@@ -30,6 +30,7 @@
+ // Full details can be found from the CVS files at:
+ // anoncvs@anoncvs.netbsd.org:/cvsroot/basesrc/include/ctype.h
+ // See www.netbsd.org for details of access.
++#include <sys/param.h>
+
+ _GLIBCXX_BEGIN_NAMESPACE(std)
+
+@@ -42,6 +43,7 @@
+ // NB: Offsets into ctype<char>::_M_table force a particular size
+ // on the mask type. Because of this, we don't use an enum.
+ typedef unsigned char mask;
++#if __NetBSD_Version__ < 599004100
+ static const mask upper = _U;
+ static const mask lower = _L;
+ static const mask alpha = _U | _L;
+@@ -53,6 +55,19 @@
+ static const mask cntrl = _C;
+ static const mask punct = _P;
+ static const mask alnum = _U | _L | _N;
++#else
++ static const mask upper = _CTYPE_U;
++ static const mask lower = _CTYPE_L;
++ static const mask alpha = _CTYPE_U | _CTYPE_L;
++ static const mask digit = _CTYPE_N;
++ static const mask xdigit = _CTYPE_N | _CTYPE_X;
++ static const mask space = _CTYPE_S;
++ static const mask print = _CTYPE_P | _CTYPE_U | _CTYPE_L | _CTYPE_N | _CTYPE_B;
++ static const mask graph = _CTYPE_P | _CTYPE_U | _CTYPE_L | _CTYPE_N;
++ static const mask cntrl = _CTYPE_C;
++ static const mask punct = _CTYPE_P;
++ static const mask alnum = _CTYPE_U | _CTYPE_L | _CTYPE_N;
++#endif
+ };
+
+ _GLIBCXX_END_NAMESPACE
diff --git a/lang/gcc45/patches/patch-ak b/lang/gcc45/patches/patch-ak
new file mode 100644
index 00000000000..e808c167412
--- /dev/null
+++ b/lang/gcc45/patches/patch-ak
@@ -0,0 +1,16 @@
+$NetBSD: patch-ak,v 1.1.1.1 2011/05/14 20:19:47 wiz Exp $
+
+--- gcc/ginclude/stddef.h.orig 2011-03-03 15:35:00.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/gcc45/preconfigure.mk b/lang/gcc45/preconfigure.mk
new file mode 100644
index 00000000000..a229c00d1c8
--- /dev/null
+++ b/lang/gcc45/preconfigure.mk
@@ -0,0 +1,11 @@
+# $NetBSD: preconfigure.mk,v 1.1.1.1 2011/05/14 20:19:47 wiz Exp $
+ # Create compiler driver scripts in ${WRKDIR}.
+ (${TEST} -d ${WRKDIR}/.gcc/bin || ${MKDIR} ${WRKDIR}/.gcc/bin)
+ (cd ${BUILDLINK_PREFIX.gcc45}/bin && bin_files=`${LS} *` && \
+ cd ${WRKDIR}/.gcc/bin && \
+ for _target_ in $${bin_files} ; do \
+ ${ECHO} '#!${TOOLS_SHELL}' > $${_target_} && \
+ ${ECHO_N} "exec ${BUILDLINK_PREFIX.gcc45}/bin/$${_target_}" >> $${_target_} && \
+ ${ECHO} ' "$$@"' >> $${_target_} && \
+ ${CHMOD} +x $${_target_}; \
+ done )