~angelsl/ubuntu/wily/gcc-5/mips-cross

« back to all changes in this revision

Viewing changes to debian/patches/g++-multiarch-incdir.diff

  • Committer: angelsl
  • Date: 2015-10-30 03:30:35 UTC
  • Revision ID: angelsl-20151030033035-rmug41zm8hyjgisg
Original import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# DP: Use /usr/include/<multiarch>/c++/4.x as the include directory
 
2
# DP: for host dependent c++ header files.
 
3
 
 
4
Index: b/src/libstdc++-v3/include/Makefile.am
 
5
===================================================================
 
6
--- a/src/libstdc++-v3/include/Makefile.am
 
7
+++ b/src/libstdc++-v3/include/Makefile.am
 
8
@@ -873,7 +873,7 @@ endif
 
9
 
 
10
 host_srcdir = ${glibcxx_srcdir}/$(OS_INC_SRCDIR)
 
11
 host_builddir = ./${host_alias}/bits
 
12
-host_installdir = ${gxx_include_dir}/${host_alias}$(MULTISUBDIR)/bits
 
13
+host_installdir = $(if $(shell $(CC) -print-multiarch),/usr/include/$(shell $(filter-out -m%,$(CC)) -print-multiarch)/c++/$(notdir ${gxx_include_dir})$(MULTISUBDIR)/bits,${gxx_include_dir}/${default_host_alias}$(MULTISUBDIR)/bits)
 
14
 host_headers = \
 
15
        ${host_srcdir}/ctype_base.h \
 
16
        ${host_srcdir}/ctype_inline.h \
 
17
Index: b/src/libstdc++-v3/include/Makefile.in
 
18
===================================================================
 
19
--- a/src/libstdc++-v3/include/Makefile.in
 
20
+++ b/src/libstdc++-v3/include/Makefile.in
 
21
@@ -1154,7 +1154,7 @@ profile_impl_headers = \
 
22
 @GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE@c_compatibility_headers_extra = ${c_compatibility_headers}
 
23
 host_srcdir = ${glibcxx_srcdir}/$(OS_INC_SRCDIR)
 
24
 host_builddir = ./${host_alias}/bits
 
25
-host_installdir = ${gxx_include_dir}/${host_alias}$(MULTISUBDIR)/bits
 
26
+host_installdir = $(if $(shell $(CC) -print-multiarch),/usr/include/$(shell $(filter-out -m%,$(CC)) -print-multiarch)/c++/$(notdir ${gxx_include_dir})$(MULTISUBDIR)/bits,${gxx_include_dir}/${default_host_alias}$(MULTISUBDIR)/bits)
 
27
 host_headers = \
 
28
        ${host_srcdir}/ctype_base.h \
 
29
        ${host_srcdir}/ctype_inline.h \
 
30
Index: b/src/gcc/Makefile.in
 
31
===================================================================
 
32
--- a/src/gcc/Makefile.in
 
33
+++ b/src/gcc/Makefile.in
 
34
@@ -1119,6 +1119,7 @@ FLAGS_TO_PASS = \
 
35
        "prefix=$(prefix)" \
 
36
        "local_prefix=$(local_prefix)" \
 
37
        "gxx_include_dir=$(gcc_gxx_include_dir)" \
 
38
+       "gxx_tool_include_dir=$(gcc_gxx_tool_include_dir)" \
 
39
        "build_tooldir=$(build_tooldir)" \
 
40
        "gcc_tooldir=$(gcc_tooldir)" \
 
41
        "bindir=$(bindir)" \
 
42
@@ -1596,6 +1597,14 @@ ifneq ($(xmake_file),)
 
43
 include $(xmake_file)
 
44
 endif
 
45
 
 
46
+# Directory in which the compiler finds target-dependent g++ includes.
 
47
+ifneq ($(call if_multiarch,non-empty),)
 
48
+  gcc_gxx_tool_include_dir = $(libsubdir)/$(libsubdir_to_prefix)include/$(MULTIARCH_DIRNAME)/c++/$(BASEVER_c)
 
49
+else
 
50
+  gcc_gxx_tool_include_dir = $(gcc_gxx_include_dir)/$(target_noncanonical)
 
51
+endif
 
52
+
 
53
+
 
54
 # all-tree.def includes all the tree.def files.
 
55
 all-tree.def: s-alltree; @true
 
56
 s-alltree: Makefile
 
57
@@ -2595,7 +2604,7 @@ PREPROCESSOR_DEFINES = \
 
58
   -DFIXED_INCLUDE_DIR=\"$(libsubdir)/include-fixed\" \
 
59
   -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
 
60
   -DGPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT=$(gcc_gxx_include_dir_add_sysroot) \
 
61
-  -DGPLUSPLUS_TOOL_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/$(target_noncanonical)\" \
 
62
+  -DGPLUSPLUS_TOOL_INCLUDE_DIR=\"$(gcc_gxx_tool_include_dir)\" \
 
63
   -DGPLUSPLUS_BACKWARD_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/backward\" \
 
64
   -DLOCAL_INCLUDE_DIR=\"$(local_includedir)\" \
 
65
   -DCROSS_INCLUDE_DIR=\"$(CROSS_SYSTEM_HEADER_DIR)\" \
 
66
Index: b/src/gcc/cppdefault.c
 
67
===================================================================
 
68
--- a/src/gcc/cppdefault.c
 
69
+++ b/src/gcc/cppdefault.c
 
70
@@ -49,6 +49,8 @@ const struct default_include cpp_include
 
71
     /* Pick up GNU C++ target-dependent include files.  */
 
72
     { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1,
 
73
       GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 },
 
74
+    { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1,
 
75
+      GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 2 },
 
76
 #endif
 
77
 #ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
 
78
     /* Pick up GNU C++ backward and deprecated include files.  */
 
79
Index: b/src/gcc/incpath.c
 
80
===================================================================
 
81
--- a/src/gcc/incpath.c
 
82
+++ b/src/gcc/incpath.c
 
83
@@ -160,6 +160,18 @@ add_standard_paths (const char *sysroot,
 
84
                        }
 
85
                      str = reconcat (str, str, dir_separator_str,
 
86
                                      imultiarch, NULL);
 
87
+                     if (p->cplusplus)
 
88
+                       {
 
89
+                         char *suffix = strstr (str, "/c++/");
 
90
+                         *suffix++ = '\0';
 
91
+                         suffix = xstrdup (suffix);
 
92
+                         str = reconcat (str, str, dir_separator_str,
 
93
+                                         imultiarch,
 
94
+                                         dir_separator_str, suffix, NULL);
 
95
+                       }
 
96
+                     else
 
97
+                       str = reconcat (str, str, dir_separator_str,
 
98
+                                       imultiarch, NULL);
 
99
                    }
 
100
                  add_path (str, SYSTEM, p->cxx_aware, false);
 
101
                }
 
102
@@ -224,7 +236,16 @@ add_standard_paths (const char *sysroot,
 
103
                  free (str);
 
104
                  continue;
 
105
                }
 
106
-             str = reconcat (str, str, dir_separator_str, imultiarch, NULL);
 
107
+             if (p->cplusplus)
 
108
+               {
 
109
+                 char *suffix = strstr (str, "/c++/");
 
110
+                 *suffix++ = '\0';
 
111
+                 suffix = xstrdup (suffix);
 
112
+                 str = reconcat (str, str, dir_separator_str, imultiarch,
 
113
+                                 dir_separator_str, suffix, NULL);
 
114
+               }
 
115
+             else
 
116
+               str = reconcat (str, str, dir_separator_str, imultiarch, NULL);
 
117
            }
 
118
 
 
119
          add_path (str, SYSTEM, p->cxx_aware, false);