summaryrefslogtreecommitdiffstats
path: root/meta/packages/gcc/gcc-4.3.1/debian/multiarch-include.dpatch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages/gcc/gcc-4.3.1/debian/multiarch-include.dpatch')
-rw-r--r--meta/packages/gcc/gcc-4.3.1/debian/multiarch-include.dpatch138
1 files changed, 138 insertions, 0 deletions
diff --git a/meta/packages/gcc/gcc-4.3.1/debian/multiarch-include.dpatch b/meta/packages/gcc/gcc-4.3.1/debian/multiarch-include.dpatch
new file mode 100644
index 0000000000..2580444e7d
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.1/debian/multiarch-include.dpatch
@@ -0,0 +1,138 @@
1#! /bin/sh -e
2
3# DP: biarch-include.dpatch
4# DP:
5# DP: Adds biarch include directories
6# DP: /usr/local/include/<arch>-linux-gnu
7# DP: /usr/include/<arch>-linux-gnu
8# DP: to the system include paths, depending on 32/64 bit mode.
9
10dir=
11if [ $# -eq 3 -a "$2" = '-d' ]; then
12 pdir="-d $3"
13 dir="$3/"
14elif [ $# -ne 1 ]; then
15 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
16 exit 1
17fi
18case "$1" in
19 -patch)
20 patch $pdir -f --no-backup-if-mismatch -p0 < $0
21 ;;
22 -unpatch)
23 patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
24 ;;
25 *)
26 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
27 exit 1
28esac
29exit 0
30
31Index: gcc/cppdefault.c
32===================================================================
33--- gcc/cppdefault.c (revision 112832)
34+++ gcc/cppdefault.c (working copy)
35@@ -60,6 +60,7 @@
36 #endif
37 #ifdef LOCAL_INCLUDE_DIR
38 /* /usr/local/include comes before the fixincluded header files. */
39+ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },
40 { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
41 #endif
42 #ifdef PREFIX_INCLUDE_DIR
43@@ -83,6 +84,7 @@
44 #endif
45 #ifdef STANDARD_INCLUDE_DIR
46 /* /usr/include comes dead last. */
47+ { STANDARD_INCLUDE_DIR, STANDARD_INCLUDE_COMPONENT, 0, 0, 1, 2 },
48 { STANDARD_INCLUDE_DIR, STANDARD_INCLUDE_COMPONENT, 0, 0, 1, 0 },
49 #endif
50 { 0, 0, 0, 0, 0, 0 }
51Index: gcc/c-incpath.c
52===================================================================
53--- gcc/c-incpath.c (revision 112832)
54+++ gcc/c-incpath.c (working copy)
55@@ -30,6 +30,7 @@
56 #include "intl.h"
57 #include "c-incpath.h"
58 #include "cppdefault.h"
59+#include "errors.h"
60
61 /* Windows does not natively support inodes, and neither does MSDOS.
62 Cygwin's emulation can generate non-unique inodes, so don't use it.
63@@ -121,6 +121,31 @@
64 }
65 }
66
67+struct multiarch_mapping
68+{
69+ const char *const multilib;
70+ const char *const multiarch;
71+};
72+
73+const struct multiarch_mapping multiarch_mappings[]
74+= {
75+#include "multiarch.inc"
76+ { 0, 0 }
77+};
78+
79+static const char*
80+multilib_to_multiarch (const char *imultilib)
81+{
82+ const struct multiarch_mapping *p;
83+
84+ for (p = multiarch_mappings; p->multiarch; p++)
85+ {
86+ if (!strcmp(p->multilib, imultilib ? imultilib : ""))
87+ return p->multiarch;
88+ }
89+ internal_error("no multiarch mapping for multilib (%s)\n", imultilib);
90+}
91+
92 /* Append the standard include chain defined in cppdefault.c. */
93 static void
94 add_standard_paths (const char *sysroot, const char *iprefix,
95@@ -128,6 +153,7 @@
96 {
97 const struct default_include *p;
98 size_t len;
99+ const char *multiarch;
100
101 if (iprefix && (len = cpp_GCC_INCLUDE_DIR_len) != 0)
102 {
103@@ -146,8 +172,15 @@
104 if (!strncmp (p->fname, cpp_GCC_INCLUDE_DIR, len))
105 {
106 char *str = concat (iprefix, p->fname + len, NULL);
107- if (p->multilib && imultilib)
108+ if (p->multilib == 1 && imultilib)
109 str = concat (str, dir_separator_str, imultilib, NULL);
110+ if (p->multilib == 2)
111+ {
112+ multiarch = multilib_to_multiarch (imultilib);
113+ if (!multiarch)
114+ continue;
115+ str = concat (str, dir_separator_str, multiarch, NULL);
116+ }
117 add_path (str, SYSTEM, p->cxx_aware, false);
118 }
119 }
120@@ -166,9 +199,17 @@
121 else
122 str = update_path (p->fname, p->component);
123
124- if (p->multilib && imultilib)
125+ if (p->multilib == 1 && imultilib)
126 str = concat (str, dir_separator_str, imultilib, NULL);
127
128+ if (p->multilib == 2)
129+ {
130+ multiarch = multilib_to_multiarch (imultilib);
131+ if (!multiarch)
132+ continue;
133+ str = concat (str, dir_separator_str, multiarch, NULL);
134+ }
135+
136 add_path (str, SYSTEM, p->cxx_aware, false);
137 }
138 }