#! /bin/sh -e
# DP: Add D options and specs for the gcc driver.
dir=
if [ $# -eq 3 -a "$2" = '-d' ]; then
pdir="-d $3"
dir="$3/"
elif [ $# -ne 1 ]; then
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
fi
case "$1" in
-patch)
patch $pdir -f --no-backup-if-mismatch -p0 < $0
;;
-unpatch)
patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
;;
*)
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
esac
exit 0
diff -urN gcc.orig/d/lang.opt gcc/d/lang.opt
--- gcc.orig/d/lang.opt 1970-01-01 01:00:00.000000000 +0100
+++ gcc/d/lang.opt 2007-03-04 16:29:47.000000000 +0100
@@ -0,0 +1,160 @@
+; GDC -- D front-end for GCC
+; Copyright (C) 2004 David Friedman
+;
+; This program 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 of the License, or
+; (at your option) any later version.
+;
+; This program 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 this program; if not, write to the Free Software
+; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+; This is used in GCC 3.4+
+
+Language
+D
+
+I
+D Joined Separate
+-I
Add to the end of the main include path.
+
+J
+D Joined Separate
+-J Add to the end of the string import path.
+
+fdeprecated
+D
+Allow use of deprecated features
+
+fassert
+D
+Generate runtime code for assert()'s
+
+frelease
+D
+Compile release version
+
+funittest
+D
+Compile in unittest code
+
+fversion=
+D Joined RejectNegative
+-fversion= Compile in version code >= or identified by
+
+fdebug=
+D Joined RejectNegative
+-fdebug,-fdebug=,-fdebug= Compile in debug code, code <= level, or code identified by ident
+
+fdebug
+D
+Compile in debug code
+
+fdebug-c
+D
+With -g, generate C debug information for debugger compatibility
+
+fd-verbose
+D
+Print information about D language processing to stdout
+
+fd-version=1
+D RejectNegative
+Compile as D language version 1
+
+femit-templates=
+D Joined RejectNegative
+-femit-templates=[normal|private|all|none|auto] Control template emission
+
+femit-templates
+D
+-femit-templates Emit templates code and data even if the linker cannot merge multiple copies
+
+nostdinc
+D
+Do not search standard system include directories
+
+fonly=
+D Joined RejectNegative
+Process all modules specified on the command line, but only generate code for the module specified by the argument.
+
+fod=
+D Joined RejectNegative
+-fod= Specify the object output directory. Note: this is actually a driver option; the backend ignores it.
+
+fop
+D
+Specify that the source file's parent directories should be appended to the object output directory. Note: this is actually a driver option; the backend ignores it.
+
+fintfc
+Generate D interface files
+
+fintfc-dir=
+D Joined RejectNegative
+-fintfc-dir= Write D interface files to directory
+
+fintfc-file=
+D Joined RejectNegative
+-fintfc-file= Write D interface file to
+
+fdoc
+D
+Generate documentation
+
+fdoc-dir=
+D Joined RejectNegative
+-fdoc-dir= Write documentation file to docdir directory
+
+fdoc-file=
+D Joined RejectNegative
+-fdoc-file= Write documentation file to filename
+
+fdoc-inc=
+D Joined RejectNegative
+-fdoc-inc= Include a Ddoc macro file
+
+fmultilib-dir=
+D Joined RejectNegative
+-fmultilib-dir= Select header multilib subdirectory
+
+Wsign-compare
+D
+Warn about signed-unsigned comparisons
+
+fdump-source
+D RejectNegative
+Dump decoded UTF-8 text and source from HTML
+
+fbuiltin
+D
+Recognize built-in functions
+
+funsigned-char
+D
+Make \"char\" unsigned by default (silently ignored in D)
+
+fsigned-char
+D
+Make \"char\" signed by default (silently ignored in D)
+
+iprefix
+D Joined Separate
+-iprefix Specify as a prefix for next two options
+
+isysroot
+D Joined Separate
+-isysroot Set to be the system root directory
+
+isystem
+D Joined Separate
+-isystem Add to the start of the system include path
+
+Wall
+D
+Enable most warning messages
diff -urN gcc.orig/d/lang-specs.h gcc/d/lang-specs.h
--- gcc.orig/d/lang-specs.h 1970-01-01 01:00:00.000000000 +0100
+++ gcc/d/lang-specs.h 2007-03-04 16:36:44.000000000 +0100
@@ -0,0 +1,53 @@
+/* GDC -- D front-end for GCC
+ Copyright (C) 2004 David Friedman
+
+ This program 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 of the License, or
+ (at your option) any later version.
+
+ This program 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 this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef D_D_SPEC
+#define D_D_SPEC 0
+#endif
+
+/* %{!M} probably doesn't make sense because we would need
+ to do that -- -MD and -MMD doesn't sound like a plan for D.... */
+
+/* %(d_options) ? */
+
+#if GCC_SPEC_FORMAT_4
+#define D_D_SPEC_REST 0, 1, 0
+#else
+#define D_D_SPEC_REST 0
+#endif
+
+#if D_DRIVER_ONLY
+{".html", "@d", D_D_SPEC_REST },
+{".HTML", "@d", D_D_SPEC_REST },
+{".htm", "@d", D_D_SPEC_REST },
+{".HTM", "@d", D_D_SPEC_REST },
+{".xhtml", "@d", D_D_SPEC_REST },
+{".XHTML", "@d", D_D_SPEC_REST },
+{".d", "@d", D_D_SPEC_REST },
+{".D", "@d", D_D_SPEC_REST },
+{"@d",
+ "%{!E:cc1d %i %:d-all-sources() %(cc1_options) %I %N %{nostdinc*} %{+e*} %{I*} %{J*}\
+ %{M} %{MM} %{!fsyntax-only:%(invoke_as)}}", D_D_SPEC_REST },
+#else
+{".d", "@d", D_D_SPEC_REST },
+{".D", "@d", D_D_SPEC_REST },
+{"@d",
+ "%{!E:cc1d %i %(cc1_options) %I %N %{nostdinc*} %{+e*} %{I*} %{J*}\
+ %{M} %{MM} %{!fsyntax-only:%(invoke_as)}}", D_D_SPEC_REST },
+#endif
+