summaryrefslogtreecommitdiff
path: root/debian/patches/gdc-cross-build.diff
blob: 582e0707887b3aedbd2223c943e16737355b5d05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# DP: Fix cross building gdc

--- a/src/gcc/d/Make-lang.in
+++ b/src/gcc/d/Make-lang.in
@@ -51,7 +51,6 @@ d-warn = $(filter-out -pedantic -Woverlo
 # Also filter out warnings for missing format attributes in the D Frontend.
 DMD_WARN_CXXFLAGS = $(filter-out -Wmissing-format-attribute, $(WARN_CXXFLAGS))
 DMD_COMPILE = $(subst $(WARN_CXXFLAGS), $(DMD_WARN_CXXFLAGS), $(COMPILE))
-DMDGEN_COMPILE = $(subst $(COMPILER), $(COMPILER_FOR_BUILD), $(DMD_COMPILE))
 
 # D Frontend object files.
 D_FRONTEND_OBJS = \
@@ -335,6 +334,15 @@ d/id.h: d/id.c
 d/impcnvtab.c: d/impcnvgen$(build_exeext)
 	cd d && ./impcnvgen$(build_exeext)
 
+# Compile the generator programs.
 d/%.dmdgen.o: $(srcdir)/d/dmd/%.c
-	$(DMDGEN_COMPILE) $(D_INCLUDES) $<
-	$(POSTCOMPILE)
+	$(COMPILER_FOR_BUILD) -c $(BUILD_COMPILERFLAGS) $(D_INCLUDES) \
+		$(BUILD_CPPFLAGS) -o $@ $<
+
+# Header dependencies for the generator programs.
+D_SYSTEM_H = d/dmd/root/dsystem.h d/d-system.h
+
+d/idgen.dmdgen.o: d/dmd/idgen.c $(D_SYSTEM_H) $(BCONFIG_H) $(SYSTEM_H)
+
+d/impcnvgen.dmdgen.o: d/dmd/impcnvgen.c d/dmd/mtype.h $(D_SYSTEM_H) \
+       $(BCONFIG_H) $(SYSTEM_H)
--- a/src/gcc/d/d-system.h
+++ b/src/gcc/d/d-system.h
@@ -19,7 +19,11 @@
 #ifndef GCC_D_SYSTEM_H
 #define GCC_D_SYSTEM_H
 
+#ifdef GENERATOR_FILE
+#include "bconfig.h"
+#else
 #include "config.h"
+#endif
 #include "system.h"
 
 /* Used by the dmd front-end to determine if we have POSIX-style IO.  */