File: multiarch.diff

package info (click to toggle)
python2.7 2.7.16-2%2Bdeb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 78,524 kB
  • sloc: python: 469,695; ansic: 444,315; sh: 17,604; asm: 14,304; makefile: 4,899; objc: 761; exp: 499; cpp: 128; xml: 76
file content (166 lines) | stat: -rw-r--r-- 5,912 bytes parent folder | download
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
Index: b/Lib/sysconfig.py
===================================================================
--- a/Lib/sysconfig.py
+++ b/Lib/sysconfig.py
@@ -338,7 +338,7 @@ def get_makefile_filename():
     """Return the path of the Makefile."""
     if _PYTHON_BUILD:
         return os.path.join(_PROJECT_BASE, "Makefile")
-    return os.path.join(get_path('platstdlib').replace("/usr/local","/usr",1), "config" + (sys.pydebug and "_d" or ""), "Makefile")
+    return os.path.join(get_config_var('LIBPL'), "Makefile")
 
 # Issue #22199: retain undocumented private name for compatibility
 _get_makefile_filename = get_makefile_filename
@@ -537,6 +537,12 @@ def get_config_vars(*args):
         # the init-function.
         _CONFIG_VARS['userbase'] = _getuserbase()
 
+        multiarch = get_config_var('MULTIARCH')
+        if multiarch:
+            _CONFIG_VARS['multiarchsubdir'] = '/' + multiarch
+        else:
+            _CONFIG_VARS['multiarchsubdir'] = ''
+
         if 'srcdir' not in _CONFIG_VARS:
             _CONFIG_VARS['srcdir'] = _PROJECT_BASE
 
Index: b/Makefile.pre.in
===================================================================
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -101,6 +101,9 @@ MACHDEP=	@MACHDEP@
 # Multiarch directory (may be empty)
 MULTIARCH=	@MULTIARCH@
 
+# Multiarch directory (may be empty)
+MULTIARCH=	@MULTIARCH@
+
 # Install prefix for architecture-independent files
 prefix=		@prefix@
 
@@ -622,6 +625,10 @@ Makefile Modules/config.c: Makefile.pre
 	@mv config.c Modules
 	@echo "The Makefile was updated, you may need to re-run make."
 
+Python/dynload_shlib.o: $(srcdir)/Python/dynload_shlib.c Makefile
+	$(CC) -c $(PY_CORE_CFLAGS) \
+		$(if $(MULTIARCH),-DMULTIARCH='"$(MULTIARCH)"') \
+		-o $@ $(srcdir)/Python/dynload_shlib.c
 
 Modules/Setup: $(srcdir)/Modules/Setup.dist
 	@if test -f Modules/Setup; then \
@@ -1204,10 +1211,10 @@ inclinstall:
 
 # Install the library and miscellaneous stuff needed for extending/embedding
 # This goes into $(exec_prefix)$(DEBUG_EXT)
-LIBPL=		$(LIBP)/config$(DEBUG_EXT)
+LIBPL=		$(LIBP)/config-$(MULTIARCH)$(DEBUG_EXT)
 
 # pkgconfig directory
-LIBPC=		$(LIBDIR)/pkgconfig
+LIBPC=		$(LIBDIR)/$(MULTIARCH)/pkgconfig
 
 libainstall:	@DEF_MAKE_RULE@ python-config
 	@for i in $(LIBDIR) $(LIBP) $(LIBPL) $(LIBPC); \
@@ -1487,6 +1494,11 @@ patchcheck:
 
 Python/thread.o: @THREADHEADERS@
 
+Python/sysmodule.o: $(srcdir)/Python/sysmodule.c Makefile
+	$(CC) -c $(PY_CORE_CFLAGS) \
+		-DMULTIARCH='"$(MULTIARCH)"' \
+		-o $@ $(srcdir)/Python/sysmodule.c
+
 # Declare targets that aren't real files
 .PHONY: all build_all sharedmods check-clean-src oldsharedmods test quicktest memtest
 .PHONY: install altinstall oldsharedinstall bininstall altbininstall
Index: b/Python/dynload_shlib.c
===================================================================
--- a/Python/dynload_shlib.c
+++ b/Python/dynload_shlib.c
@@ -49,6 +49,12 @@ const struct filedescr _PyImport_DynLoad
 #ifdef Py_DEBUG
     {"_d.so", "rb", C_EXTENSION},
     {"module_d.so", "rb", C_EXTENSION},
+# ifdef MULTIARCH
+    {"." MULTIARCH "_d.so", "rb", C_EXTENSION},
+# endif
+#endif
+#ifdef MULTIARCH
+    {"." MULTIARCH ".so", "rb", C_EXTENSION},
 #endif
     {".so", "rb", C_EXTENSION},
     {"module.so", "rb", C_EXTENSION},
Index: b/configure.ac
===================================================================
--- a/configure.ac
+++ b/configure.ac
@@ -511,8 +511,16 @@ then
 fi
 AC_MSG_RESULT($MACHDEP)
 
+MULTIARCH=$($CC --print-multiarch 2>/dev/null)
+AC_SUBST(MULTIARCH)
+
+
 AC_SUBST(PLATDIR)
-PLATDIR=plat-$MACHDEP
+if test -n "$MULTIARCH"; then
+  PLATDIR=plat-$MULTIARCH
+else
+  PLATDIR=plat-$MACHDEP
+fi
 
 # And add extra plat-mac for darwin
 AC_SUBST(EXTRAPLATDIR)
Index: b/Lib/distutils/sysconfig.py
===================================================================
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -74,8 +74,6 @@ def get_python_inc(plat_specific=0, pref
     If 'prefix' is supplied, use it instead of sys.prefix or
     sys.exec_prefix -- i.e., ignore 'plat_specific'.
     """
-    if prefix is None:
-        prefix = plat_specific and EXEC_PREFIX or PREFIX
 
     if os.name == "posix":
         if python_build:
@@ -90,7 +88,14 @@ def get_python_inc(plat_specific=0, pref
                 # Include is located in the srcdir
                 inc_dir = os.path.join(srcdir, "Include")
             return inc_dir
-        return os.path.join(prefix, "include", "python" + get_python_version())+(sys.pydebug and "_d" or "")
+        else:
+            if not (prefix is None):
+                return os.path.join(prefix, "include",
+                                    "python" + get_python_version())+(sys.pydebug and "_d" or "")
+            if plat_specific:
+                return get_config_var('CONFINCLUDEPY')
+            else:
+                return get_config_var('INCLUDEPY')
     elif os.name == "nt":
         return os.path.join(prefix, "include")
     elif os.name == "os2":
@@ -263,7 +268,7 @@ def get_makefile_filename():
     if python_build:
         return os.path.join(project_base, "Makefile")
     lib_dir = get_python_lib(plat_specific=1, standard_lib=1)
-    return os.path.join(lib_dir, "config"+(sys.pydebug and "_d" or ""), "Makefile")
+    return os.path.join(get_config_var('LIBPL'), "Makefile")
 
 
 def parse_config_h(fp, g=None):
Index: b/Python/sysmodule.c
===================================================================
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -1453,6 +1453,8 @@ _PySys_Init(void)
                         PyFloat_GetInfo());
     SET_SYS_FROM_STRING("long_info",
                         PyLong_GetInfo());
+    SET_SYS_FROM_STRING("_multiarch",
+                        PyString_FromString(MULTIARCH));
 #ifdef Py_USING_UNICODE
     SET_SYS_FROM_STRING("maxunicode",
                         PyInt_FromLong(PyUnicode_GetMax()));