Merge lp:~peter-pearse/ubuntu/natty/python2.6/prop004 into lp:ubuntu/natty/python2.6
- Natty (11.04)
- prop004
- Merge into natty
Status: | Needs review |
---|---|
Proposed branch: | lp:~peter-pearse/ubuntu/natty/python2.6/prop004 |
Merge into: | lp:ubuntu/natty/python2.6 |
Diff against target: |
663 lines (+447/-16) 4 files modified
debian/changelog (+15/-0) debian/patches/cross.diff (+299/-0) debian/patches/series.in (+1/-0) debian/rules (+132/-16) |
To merge this branch: | bzr merge lp:~peter-pearse/ubuntu/natty/python2.6/prop004 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Steve Langasek | Needs Information | ||
Review via email: mp+55501@code.launchpad.net |
Commit message
Description of the change
Fix PIC problem by using the correct config files during installation.
Note that multiarch paths are used and this results in the omission of the following extensions:-
dbm
_sqlite3
_bsddb.
Peter Pearse (peter-pearse) wrote : | # |
No need to set -fPIC now that the make install gets the correct config files.
It was needed when the static python binary was being built & installed using the dynamic libpython
The following part of the patch ensures the static python is built with the static library or vice versa,
622 ifeq ($(with_
623 - $(MAKE) -C $(buildd_static) install prefix=
624 + ifneq ($(DEB_
625 + @echo "Build python should use the new pyconfig.h"
626 + cp $(buildd_
627 + cp $(buildd_
628 + endif
629 + $(MAKE) -C $(buildd_static) install prefix=
630 else
631 - $(MAKE) -C $(buildd_shared) install prefix=
632 + ifneq ($(DEB_
633 + @echo "Build python should use the new pyconfig.h"
634 + cp $(buildd_
635 + cp $(buildd_
636 + endif
637 + $(MAKE) -C $(buildd_shared) install prefix=
638 endif
Unmerged revisions
- 68. By Peter Pearse
-
* configure.in - Set buggygetaddrinfo for cross builds.
* Add py_cv_has_zd_printf for cross builds.
* Makefile.pre.in - Use BUILDPYTHON where applicable for cross builds.
* setup.py - For cross builds, pass cross toolchain info in python
environment.
* Use multiarch paths where applicable.
* debian/rules - Build a build host python for use during a crossbuild.
* Adjust the configuration files & make environment
accordingl y.
* Modules/Setup.dist - Drop system paths for zlib.
Preview Diff
1 | === modified file 'debian/changelog' |
2 | --- debian/changelog 2011-03-25 17:45:24 +0000 |
3 | +++ debian/changelog 2011-03-30 10:21:06 +0000 |
4 | @@ -1,3 +1,18 @@ |
5 | +python2.6 (2.6.6-6ubuntu8) natty; urgency=low |
6 | + |
7 | + * configure.in - Set buggygetaddrinfo for cross builds. |
8 | + * Add py_cv_has_zd_printf for cross builds. |
9 | + * Makefile.pre.in - Use BUILDPYTHON where applicable for cross builds. |
10 | + * setup.py - For cross builds, pass cross toolchain info in python |
11 | + environment. |
12 | + * Use multiarch paths where applicable. |
13 | + * debian/rules - Build a build host python for use during a crossbuild. |
14 | + * Adjust the configuration files & make environment |
15 | + accordingly. |
16 | + * Modules/Setup.dist - Drop system paths for zlib. |
17 | + |
18 | + -- Peter Pearse <peter.pearse@linaro.org> Wed, 30 Mar 2011 10:12:04 +0000 |
19 | + |
20 | python2.6 (2.6.6-6ubuntu7) natty; urgency=low |
21 | |
22 | * Search libraries in multiarch directories too. LP: #738213. |
23 | |
24 | === added file 'debian/patches/cross.diff' |
25 | --- debian/patches/cross.diff 1970-01-01 00:00:00 +0000 |
26 | +++ debian/patches/cross.diff 2011-03-30 10:21:06 +0000 |
27 | @@ -0,0 +1,299 @@ |
28 | +Index: python2.6/configure.in |
29 | +=================================================================== |
30 | +--- python2.6.orig/configure.in 2011-03-30 10:01:20.000000000 +0000 |
31 | ++++ python2.6/configure.in 2011-03-30 10:01:20.000000000 +0000 |
32 | +@@ -3018,8 +3018,8 @@ |
33 | + buggygetaddrinfo=no, |
34 | + AC_MSG_RESULT(buggy) |
35 | + buggygetaddrinfo=yes, |
36 | +-AC_MSG_RESULT(buggy) |
37 | +-buggygetaddrinfo=yes)], [ |
38 | ++AC_MSG_RESULT(cross) |
39 | ++buggygetaddrinfo=no)], [ |
40 | + AC_MSG_RESULT(no) |
41 | + buggygetaddrinfo=yes |
42 | + ]) |
43 | +@@ -3873,7 +3873,7 @@ |
44 | + AC_MSG_RESULT(no) |
45 | + fi |
46 | + |
47 | +-AC_MSG_CHECKING(for %zd printf() format support) |
48 | ++AC_CACHE_CHECK([for %zd printf() format support], [py_cv_has_zd_printf], [dnl |
49 | + AC_TRY_RUN([#include <stdio.h> |
50 | + #include <stddef.h> |
51 | + #include <string.h> |
52 | +@@ -3907,10 +3907,13 @@ |
53 | + return 1; |
54 | + |
55 | + return 0; |
56 | +-}], |
57 | +-[AC_MSG_RESULT(yes) |
58 | +- AC_DEFINE(PY_FORMAT_SIZE_T, "z", [Define to printf format modifier for Py_ssize_t])], |
59 | +- AC_MSG_RESULT(no)) |
60 | ++}], [py_cv_has_zd_printf="yes"], |
61 | ++ [py_cv_has_zd_printf="no"], |
62 | ++ [py_cv_has_zd_printf="cross -- assuming yes"] |
63 | ++)]) |
64 | ++if test "$py_cv_has_zd_printf" != "no" ; then |
65 | ++ AC_DEFINE(PY_FORMAT_SIZE_T, "z", [Define to printf format modifier for Py_ssize_t]) |
66 | ++fi |
67 | + |
68 | + AC_CHECK_TYPE(socklen_t,, |
69 | + AC_DEFINE(socklen_t,int, |
70 | +Index: python2.6/Makefile.pre.in |
71 | +=================================================================== |
72 | +--- python2.6.orig/Makefile.pre.in 2011-03-30 10:01:20.000000000 +0000 |
73 | ++++ python2.6/Makefile.pre.in 2011-03-30 10:01:20.000000000 +0000 |
74 | +@@ -207,6 +207,8 @@ |
75 | + ########################################################################## |
76 | + # Parser |
77 | + PGEN= Parser/pgen$(EXE) |
78 | ++# Allow override for cross build |
79 | ++BUILDPGEN= $(PGEN) |
80 | + |
81 | + POBJS= \ |
82 | + Parser/acceler.o \ |
83 | +@@ -354,7 +356,7 @@ |
84 | + |
85 | + # Default target |
86 | + all: build_all |
87 | +-build_all: $(BUILDPYTHON) oldsharedmods sharedmods gdbhooks |
88 | ++build_all: $(BUILDPYTHON) $(PYTHON) oldsharedmods sharedmods gdbhooks |
89 | + |
90 | + # Compile a binary with gcc profile guided optimization. |
91 | + profile-opt: |
92 | +@@ -371,7 +373,7 @@ |
93 | + build_all_generate_profile: |
94 | + $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-generate" LIBS="$(LIBS) -lgcov" |
95 | + |
96 | +-run_profile_task: |
97 | ++run_profile_task: $(BUILDPYTHON) $(PYTHON) |
98 | + -./$(BUILDPYTHON) $(PROFILE_TASK) |
99 | + |
100 | + build_all_use_profile: |
101 | +@@ -386,17 +388,17 @@ |
102 | + |
103 | + |
104 | + # Build the interpreter |
105 | +-$(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY) |
106 | ++$(PYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY) |
107 | + $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \ |
108 | + Modules/python.o \ |
109 | +- $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) |
110 | ++ $(LDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) |
111 | + |
112 | +-platform: $(BUILDPYTHON) |
113 | ++platform: $(BUILDPYTHON) $(PYTHON) |
114 | + $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform |
115 | + |
116 | + |
117 | + # Build the shared modules |
118 | +-sharedmods: $(BUILDPYTHON) |
119 | ++sharedmods: $(BUILDPYTHON) $(PYTHON) |
120 | + @case $$MAKEFLAGS in \ |
121 | + *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \ |
122 | + *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \ |
123 | +@@ -434,10 +436,10 @@ |
124 | + # |
125 | + # Distributors are likely to want to install this somewhere else e.g. relative |
126 | + # to the stripped DWARF data for the shared library. |
127 | +-gdbhooks: $(BUILDPYTHON)-gdb.py |
128 | ++gdbhooks: $(PYTHON)-gdb.py |
129 | + |
130 | +-$(BUILDPYTHON)-gdb.py: Tools/gdb/libpython.py |
131 | +- $(INSTALL_SCRIPT) $< $(BUILDPYTHON)-gdb.py |
132 | ++$(PYTHON)-gdb.py: Tools/gdb/libpython.py |
133 | ++ $(INSTALL_SCRIPT) $< $(PYTHON)-gdb.py |
134 | + |
135 | + # This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary |
136 | + # minimal framework (not including the Lib directory and such) in the current |
137 | +@@ -528,10 +530,9 @@ |
138 | + Modules/python.o: $(srcdir)/Modules/python.c |
139 | + $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c |
140 | + |
141 | +- |
142 | +-$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT) |
143 | +- -@$(INSTALL) -d Include |
144 | +- -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) |
145 | ++$(GRAMMAR_H) $(GRAMMAR_C): $(BUILDPGEN) $(PGEN) $(GRAMMAR_INPUT) |
146 | ++ -@$(INSTALL) -d Include |
147 | ++ -$(BUILDPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) |
148 | + |
149 | + $(PGEN): $(PGENOBJS) |
150 | + $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN) |
151 | +@@ -780,7 +781,7 @@ |
152 | + |
153 | + # Install the interpreter with $(VERSION) affixed |
154 | + # This goes into $(exec_prefix) |
155 | +-altbininstall: $(BUILDPYTHON) |
156 | ++altbininstall: $(BUILDPYTHON) $(PYTHON) |
157 | + @for i in $(BINDIR) $(LIBDIR); \ |
158 | + do \ |
159 | + if test ! -d $(DESTDIR)$$i; then \ |
160 | +@@ -789,7 +790,7 @@ |
161 | + else true; \ |
162 | + fi; \ |
163 | + done |
164 | +- $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE) |
165 | ++ $(INSTALL_PROGRAM) $(PYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE) |
166 | + if test -f $(LDLIBRARY); then \ |
167 | + if test -n "$(DLLLIBRARY)" ; then \ |
168 | + $(INSTALL_SHARED) $(DLLLIBRARY) $(DESTDIR)$(BINDIR); \ |
169 | +@@ -1014,7 +1015,7 @@ |
170 | + |
171 | + # Install the dynamically loadable modules |
172 | + # This goes into $(exec_prefix) |
173 | +-sharedinstall: |
174 | ++sharedinstall: $(BUILDPYTHON) |
175 | + $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \ |
176 | + --prefix=$(prefix) \ |
177 | + --install-scripts=$(BINDIR) \ |
178 | +@@ -1039,7 +1040,7 @@ |
179 | + |
180 | + frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib |
181 | + |
182 | +-frameworkinstallstructure: $(LDLIBRARY) |
183 | ++frameworkinstallstructure: $(BUILDPYTHON) $(LDLIBRARY) |
184 | + @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \ |
185 | + echo Not configured with --enable-framework; \ |
186 | + exit 1; \ |
187 | +@@ -1094,7 +1095,7 @@ |
188 | + cd Mac && $(MAKE) installextras DESTDIR="$(DESTDIR)" |
189 | + |
190 | + # This installs a few of the useful scripts in Tools/scripts |
191 | +-scriptsinstall: |
192 | ++scriptsinstall: $(BUILDPYTHON) |
193 | + SRCDIR=$(srcdir) $(RUNSHARED) \ |
194 | + ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \ |
195 | + --prefix=$(prefix) \ |
196 | +@@ -1110,14 +1111,14 @@ |
197 | + config.status: $(srcdir)/configure |
198 | + $(SHELL) $(srcdir)/configure $(CONFIG_ARGS) |
199 | + |
200 | +-.PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre |
201 | ++.PRECIOUS: config.status $(PYTHON) Makefile Makefile.pre |
202 | + |
203 | + # Some make's put the object file in the current directory |
204 | + .c.o: |
205 | + $(CC) -c $(PY_CFLAGS) -o $@ $< |
206 | + |
207 | + # Run reindent on the library |
208 | +-reindent: |
209 | ++reindent: $(BUILDPYTHON) |
210 | + ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib |
211 | + |
212 | + # Rerun configure with the same options as it was run last time, |
213 | +@@ -1162,7 +1163,7 @@ |
214 | + find . -name '*.gc??' -exec rm -f {} ';' |
215 | + |
216 | + clobber: clean profile-removal |
217 | +- -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \ |
218 | ++ -rm -f $(PYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \ |
219 | + tags TAGS \ |
220 | + config.cache config.log pyconfig.h Modules/config.c |
221 | + -rm -rf build platform |
222 | +@@ -1215,7 +1216,7 @@ |
223 | + -o -print |
224 | + |
225 | + # Perform some verification checks on any modified files. |
226 | +-patchcheck: |
227 | ++patchcheck: $(BUILDPYTHON) |
228 | + $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py |
229 | + |
230 | + # Dependencies |
231 | +Index: python2.6/Modules/Setup.dist |
232 | +=================================================================== |
233 | +--- python2.6.orig/Modules/Setup.dist 2011-03-30 10:01:20.000000000 +0000 |
234 | ++++ python2.6/Modules/Setup.dist 2011-03-30 10:01:20.000000000 +0000 |
235 | +@@ -458,7 +458,9 @@ |
236 | + # Andrew Kuchling's zlib module. |
237 | + # This require zlib 1.1.3 (or later). |
238 | + # See http://www.gzip.org/zlib/ |
239 | +-#zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz |
240 | ++# Well behaved toolchains should not require -L$(exec_prefix)/lib or -I$(prefix)/include |
241 | ++# - using them breaks cross builds |
242 | ++#zlib zlibmodule.c -lz |
243 | + |
244 | + # Interface to the Expat XML parser |
245 | + # |
246 | +Index: python2.6/setup.py |
247 | +=================================================================== |
248 | +--- python2.6.orig/setup.py 2011-03-30 10:01:20.000000000 +0000 |
249 | ++++ python2.6/setup.py 2011-03-30 10:05:34.000000000 +0000 |
250 | +@@ -235,6 +235,23 @@ |
251 | + # When you run "make CC=altcc" or something similar, you really want |
252 | + # those environment variables passed into the setup.py phase. Here's |
253 | + # a small set of useful ones. |
254 | ++ |
255 | ++ # Change the environment for cross compiling |
256 | ++ # - may want to use environment variables for settings? |
257 | ++ if os.environ.get('CROSS_COMPILE'): |
258 | ++ host_gnu_type=os.environ.get('CROSS_COMPILE') |
259 | ++ os.environ["CC"] = host_gnu_type + '-gcc' |
260 | ++ os.environ["CXX"] = host_gnu_type + '-g++' |
261 | ++ os.environ["LDSHARED"] = host_gnu_type + '-gcc -shared' |
262 | ++ os.environ["CPP"] = host_gnu_type + '-cpp' |
263 | ++ # Add in the multiarch locations here. |
264 | ++ os.environ["LDFLAGS"] = '-L/usr/lib/' + host_gnu_type |
265 | ++ os.environ["CFLAGS"] = '-I/usr/include/' + host_gnu_type |
266 | ++ # Use -D markers to detect if/where used |
267 | ++ os.environ["CPPFLAGS"] = '-DCROSSCPPFLAGS' |
268 | ++ os.environ["BASECFLAGS"] = '-DCROSSBASECFLAGS' |
269 | ++ os.environ["OPT"] = '-DCROSSOPT' |
270 | ++ |
271 | + compiler = os.environ.get('CC') |
272 | + args = {} |
273 | + # unfortunately, distutils doesn't let us provide separate C and C++ |
274 | +@@ -313,6 +330,13 @@ |
275 | + self.announce('WARNING: skipping import check for Cygwin-based "%s"' |
276 | + % ext.name) |
277 | + return |
278 | ++ |
279 | ++ # Cant import cross built modules |
280 | ++ if os.environ.get('CROSS_COMPILE'): |
281 | ++ self.announce('WARNING: skipping import check for %s, cross built for %s' |
282 | ++ % (ext.name, os.environ.get('CROSS_COMPILE'))) |
283 | ++ return |
284 | ++ |
285 | + ext_filename = os.path.join( |
286 | + self.build_lib, |
287 | + self.get_ext_filename(self.get_ext_fullname(ext.name))) |
288 | +@@ -394,11 +418,13 @@ |
289 | + for directory in reversed(options.dirs): |
290 | + add_dir_to_list(dir_list, directory) |
291 | + |
292 | +- if os.path.normpath(sys.prefix) != '/usr': |
293 | +- add_dir_to_list(self.compiler.library_dirs, |
294 | +- sysconfig.get_config_var("LIBDIR")) |
295 | +- add_dir_to_list(self.compiler.include_dirs, |
296 | +- sysconfig.get_config_var("INCLUDEDIR")) |
297 | ++ # Don't add the system path for cross builds |
298 | ++ if os.environ.get('CROSS_COMPILE') is None: |
299 | ++ if os.path.normpath(sys.prefix) != '/usr': |
300 | ++ add_dir_to_list(self.compiler.library_dirs, |
301 | ++ sysconfig.get_config_var("LIBDIR")) |
302 | ++ add_dir_to_list(self.compiler.include_dirs, |
303 | ++ sysconfig.get_config_var("INCLUDEDIR")) |
304 | + |
305 | + try: |
306 | + have_unicode = unicode |
307 | +@@ -416,6 +442,7 @@ |
308 | + ] |
309 | + inc_dirs = self.compiler.include_dirs + ['/usr/include'] |
310 | + inc_dirs.append(os.path.join('/usr/include', gnu_triplet)) |
311 | ++ |
312 | + exts = [] |
313 | + missing = [] |
314 | + |
315 | +@@ -1841,6 +1868,11 @@ |
316 | + mkpath(ffi_builddir) |
317 | + config_args = [] |
318 | + |
319 | ++ if os.environ.get('CROSS_COMPILE'): |
320 | ++ host_gnu_type = os.environ.get('CROSS_COMPILE') |
321 | ++ print "Configuring _ctypes module for cross building %s" % (host_gnu_type) |
322 | ++ config_args = [ '--host ' + host_gnu_type] |
323 | ++ |
324 | + # Pass empty CFLAGS because we'll just append the resulting |
325 | + # CFLAGS to Python's; -g or -O2 is to be avoided. |
326 | + cmd = "cd %s && env CFLAGS='' '%s/configure' %s" \ |
327 | |
328 | === modified file 'debian/patches/series.in' |
329 | --- debian/patches/series.in 2010-10-12 12:53:47 +0000 |
330 | +++ debian/patches/series.in 2011-03-30 10:21:06 +0000 |
331 | @@ -60,3 +60,4 @@ |
332 | link-system-expat.diff |
333 | plat-gnukfreebsd.diff |
334 | issue7356.diff |
335 | +cross.diff |
336 | |
337 | === modified file 'debian/rules' |
338 | --- debian/rules 2011-02-23 23:41:57 +0000 |
339 | +++ debian/rules 2011-03-30 10:21:06 +0000 |
340 | @@ -10,6 +10,8 @@ |
341 | |
342 | DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) |
343 | DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS) |
344 | +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) |
345 | +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) |
346 | |
347 | changelog_values := $(shell dpkg-parsechangelog \ |
348 | | awk '/^(Version|Source):/ {print $$2}') |
349 | @@ -25,6 +27,10 @@ |
350 | ifneq (,$(findstring nobench, $(DEB_BUILD_OPTIONS))) |
351 | WITHOUT_BENCH := yes |
352 | endif |
353 | +ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) |
354 | + WITHOUT_BENCH := yes |
355 | + WITHOUT_CHECK := yes |
356 | +endif |
357 | ifeq ($(on_buildd),yes) |
358 | ifneq (,$(findstring $(DEB_HOST_ARCH), hppa mips mipsel s390)) |
359 | WITHOUT_CHECK := yes |
360 | @@ -92,7 +98,17 @@ |
361 | endif |
362 | with_fpectl = yes |
363 | |
364 | -CC = gcc |
365 | +ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) |
366 | + CC = gcc |
367 | + CROSS = |
368 | +else |
369 | + CC = $(DEB_HOST_GNU_TYPE)-gcc |
370 | + # Note that make runs the binaries as ./$(app), |
371 | + # - so they must not be absolutely pathed |
372 | + CROSS = BUILDPYTHON=../build-cross/python \ |
373 | + BUILDPGEN=../build-cross/Parser/pgen \ |
374 | + CROSS_COMPILE=$(DEB_HOST_GNU_TYPE) |
375 | +endif |
376 | |
377 | # on alpha, use -O2 only, use -mieee |
378 | ifeq ($(DEB_HOST_ARCH),alpha) |
379 | @@ -102,8 +118,17 @@ |
380 | ifeq ($(DEB_HOST_ARCH),m68k) |
381 | OPTSETTINGS = OPT="-fwrapv -g -O2 -Wall -Wstrict-prototypes" |
382 | endif |
383 | +# For armel static objects which will be linked into shared modules |
384 | +# must be built as PIC |
385 | +# Note use of CONFIG_CFLAGS to allow CFLAGS entries to be defined elsewhere |
386 | +ifeq ($(DEB_HOST_ARCH),armel) |
387 | +# CONFIG_EXTRAS_STATIC = CFLAGS="-fPIC $(CONFIG_CFLAGS)" |
388 | +endif |
389 | |
390 | PWD := $(shell pwd) |
391 | +ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) |
392 | + buildd_cross := $(CURDIR)/build-cross |
393 | +endif |
394 | buildd_static := $(CURDIR)/build-static |
395 | buildd_shared := $(CURDIR)/build-shared |
396 | buildd_debug := $(CURDIR)/build-debug |
397 | @@ -167,30 +192,30 @@ |
398 | |
399 | stamps/stamp-build-static: stamps/stamp-configure-static |
400 | dh_testdir |
401 | - $(MAKE) $(NJOBS) -C $(buildd_static) \ |
402 | + $(MAKE) $(NJOBS) -C $(buildd_static) $(CROSS) \ |
403 | PROFILE_TASK='$(PROFILE_TASK)' $(make_build_target) |
404 | touch stamps/stamp-build-static |
405 | |
406 | stamps/stamp-build-shared: stamps/stamp-configure-shared |
407 | dh_testdir |
408 | - $(MAKE) $(NJOBS) -C $(buildd_shared) |
409 | + $(MAKE) $(NJOBS) -C $(buildd_shared) $(CROSS) |
410 | # : # build the shared library |
411 | -# $(MAKE) $(NJOBS) -C $(buildd_shared) \ |
412 | +# $(MAKE) $(NJOBS) -C $(buildd_shared) $(CROSS) \ |
413 | # libpython$(VER).so |
414 | : # build a static library with PIC objects |
415 | - $(MAKE) $(NJOBS) -C $(buildd_shared) \ |
416 | + $(MAKE) $(NJOBS) -C $(buildd_shared) $(CROSS) \ |
417 | LIBRARY=libpython$(VER)-pic.a libpython$(VER)-pic.a |
418 | touch stamps/stamp-build-shared |
419 | |
420 | stamps/stamp-build-debug: stamps/stamp-configure-debug |
421 | dh_testdir |
422 | - $(MAKE) $(NJOBS) -C $(buildd_debug) |
423 | + $(MAKE) $(NJOBS) -C $(buildd_debug) $(CROSS) |
424 | touch stamps/stamp-build-debug |
425 | |
426 | stamps/stamp-build-shared-debug: stamps/stamp-configure-shared-debug |
427 | dh_testdir |
428 | : # build the shared debug library |
429 | - $(MAKE) $(NJOBS) -C $(buildd_shdebug) \ |
430 | + $(MAKE) $(NJOBS) -C $(buildd_shdebug) $(CROSS) \ |
431 | libpython$(VER)_d.so |
432 | touch stamps/stamp-build-shared-debug |
433 | |
434 | @@ -206,11 +231,53 @@ |
435 | common_configure_args += --with-system-ffi |
436 | endif |
437 | |
438 | +ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) |
439 | + common_configure_args += \ |
440 | + --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) |
441 | +endif |
442 | + |
443 | ifeq ($(with_fpectl),yes) |
444 | common_configure_args += \ |
445 | --with-fpectl |
446 | endif |
447 | |
448 | +ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) |
449 | + |
450 | +# Build build host binary for use during the build |
451 | +# - various files will be accessed from the build-cross |
452 | +# directory and must be copied in after variants are configured. |
453 | +stamps/stamp-configure-cross: stamps/stamp-patch |
454 | + rm -rf $(buildd_cross) |
455 | + mkdir -p $(buildd_cross) |
456 | + cd $(buildd_cross) && \ |
457 | + CC=gcc CONFIG_SITE= $(OPTSETTINGS) \ |
458 | + ../configure --build $(DEB_BUILD_GNU_TYPE) $(CONFIG_EXTRAS_STATIC) |
459 | + egrep \ |
460 | + "^#($$(awk '$$2 ~ /^extension$$/ {print $$1}' debian/PVER-minimal.README.Debian.in | tr '\012' '|')XX)" \ |
461 | + Modules/Setup.dist \ |
462 | + | sed -e 's/^#//' -e 's/-Wl,-Bdynamic//;s/-Wl,-Bstatic//' \ |
463 | + >> $(buildd_cross)/Modules/Setup.local |
464 | + cd $(buildd_cross) && \ |
465 | + ../Modules/makesetup -c ../Modules/config.c.in -s Modules \ |
466 | + Modules/Setup.config Modules/Setup.local Modules/Setup |
467 | + mv $(buildd_cross)/config.c $(buildd_cross)/Modules/ |
468 | + @echo "Each build should use it's own pyconfig.h & Makefile variables" |
469 | + cp $(buildd_cross)/pyconfig.h $(buildd_cross)/pyconfig.h.cross |
470 | + cp $(buildd_cross)/Makefile $(buildd_cross)/Makefile.cross |
471 | + touch stamps/stamp-configure-cross |
472 | + |
473 | +stamps/stamp-build-cross: stamps/stamp-configure-cross |
474 | + dh_testdir |
475 | + $(MAKE) $(NJOBS) -C $(buildd_cross) python Parser/pgen |
476 | + touch stamps/stamp-build-cross |
477 | + |
478 | +stamps/stamp-configure-shared: stamps/stamp-build-cross |
479 | +stamps/stamp-configure-static: stamps/stamp-build-cross |
480 | +stamps/stamp-configure-debug: stamps/stamp-build-cross |
481 | +stamps/stamp-configure-shared-debug: stamps/stamp-build-cross |
482 | + |
483 | +endif |
484 | + |
485 | stamps/stamp-configure-shared: stamps/stamp-patch |
486 | rm -rf $(buildd_shared) |
487 | mkdir -p $(buildd_shared) |
488 | @@ -229,6 +296,12 @@ |
489 | Modules/Setup.config Modules/Setup.local Modules/Setup |
490 | mv $(buildd_shared)/config.c $(buildd_shared)/Modules/ |
491 | |
492 | +ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) |
493 | + @echo "Build python should use the new pyconfig.h & Makefile " |
494 | + cp $(buildd_shared)/pyconfig.h $(buildd_cross)/pyconfig.h |
495 | + cp $(buildd_shared)/Makefile $(buildd_cross)/Makefile |
496 | +endif |
497 | + |
498 | touch stamps/stamp-configure-shared |
499 | |
500 | stamps/stamp-configure-static: stamps/stamp-patch |
501 | @@ -237,7 +310,7 @@ |
502 | cd $(buildd_static) && \ |
503 | CC="$(CC)" $(OPTSETTINGS) \ |
504 | ../configure \ |
505 | - $(common_configure_args) |
506 | + $(common_configure_args) $(CONFIG_EXTRAS_STATIC) |
507 | egrep \ |
508 | "^#($$(awk '$$2 ~ /^extension$$/ {print $$1}' debian/PVER-minimal.README.Debian.in | tr '\012' '|')XX)" \ |
509 | Modules/Setup.dist | sed 's/^#//' \ |
510 | @@ -245,7 +318,6 @@ |
511 | cd $(buildd_static) && \ |
512 | ../Modules/makesetup -c ../Modules/config.c.in -s Modules \ |
513 | Modules/Setup.config Modules/Setup.local Modules/Setup |
514 | - |
515 | : # apply workaround for missing os.fsync |
516 | sed 's/HAVE_SYNC/HAVE_FSYNC/g' $(buildd_static)/pyconfig.h \ |
517 | > $(buildd_static)/pyconfig.h.new |
518 | @@ -253,6 +325,12 @@ |
519 | mv -f $(buildd_static)/pyconfig.h.new $(buildd_static)/pyconfig.h |
520 | mv $(buildd_static)/config.c $(buildd_static)/Modules/ |
521 | |
522 | +ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) |
523 | + @echo "Build python should use the new pyconfig.h" |
524 | + cp $(buildd_static)/pyconfig.h $(buildd_cross)/pyconfig.h |
525 | + cp $(buildd_static)/Makefile $(buildd_cross)/Makefile |
526 | +endif |
527 | + |
528 | touch stamps/stamp-configure-static |
529 | |
530 | stamps/stamp-configure-debug: stamps/stamp-patch |
531 | @@ -278,6 +356,12 @@ |
532 | touch -r $(buildd_debug)/pyconfig.h $(buildd_debug)/pyconfig.h.new |
533 | mv -f $(buildd_debug)/pyconfig.h.new $(buildd_debug)/pyconfig.h |
534 | |
535 | +ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) |
536 | + @echo "Build python should use the new pyconfig.h" |
537 | + cp $(buildd_debug)/pyconfig.h $(buildd_cross)/pyconfig.h |
538 | + cp $(buildd_debug)/Makefile $(buildd_cross)/Makefile |
539 | +endif |
540 | + |
541 | touch stamps/stamp-configure-debug |
542 | |
543 | stamps/stamp-configure-shared-debug: stamps/stamp-patch |
544 | @@ -305,9 +389,16 @@ |
545 | touch -r $(buildd_shdebug)/pyconfig.h $(buildd_shdebug)/pyconfig.h.new |
546 | mv -f $(buildd_shdebug)/pyconfig.h.new $(buildd_shdebug)/pyconfig.h |
547 | |
548 | +ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) |
549 | + @echo "Build python should use the new pyconfig.h" |
550 | + cp $(buildd_shdebug)/pyconfig.h $(buildd_cross)/pyconfig.h |
551 | + cp $(buildd_shdebug)/Makefile $(buildd_cross)/Makefile |
552 | +endif |
553 | + |
554 | touch stamps/stamp-configure-shared-debug |
555 | |
556 | stamps/stamp-mincheck: stamps/stamp-build-static debian/PVER-minimal.README.Debian.in |
557 | +ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) |
558 | for m in $(MIN_MODS) $(MIN_PACKAGES) $(MIN_EXTS) $(MIN_BUILTINS); do \ |
559 | echo "import $$m"; \ |
560 | done > $(buildd_static)/minmods.py |
561 | @@ -321,6 +412,9 @@ |
562 | else true; fi |
563 | cd $(buildd_static) && ./python ../debian/mincheck.py \ |
564 | minmods.py mindeps.txt |
565 | +else |
566 | + @echo "No mincheck for cross build" |
567 | +endif |
568 | touch stamps/stamp-mincheck |
569 | |
570 | TEST_RESOURCES = all |
571 | @@ -412,6 +506,7 @@ |
572 | touch stamps/stamp-check |
573 | |
574 | stamps/stamp-pystone: |
575 | +ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) |
576 | @echo "BEGIN pystone static" |
577 | cd $(buildd_static) && ./python ../Lib/test/pystone.py |
578 | cd $(buildd_static) && ./python ../Lib/test/pystone.py |
579 | @@ -426,6 +521,9 @@ |
580 | cd $(buildd_debug) && ./python ../Lib/test/pystone.py |
581 | cd $(buildd_debug) && ./python ../Lib/test/pystone.py |
582 | @echo "END pystone debug" |
583 | +else |
584 | + @echo "No pystone for cross build" |
585 | +endif |
586 | touch stamps/stamp-pystone |
587 | |
588 | #ifeq (,$(filter $(DEB_HOST_ARCH), arm armel avr32 hppa mips mipsel m68k)) |
589 | @@ -487,7 +585,7 @@ |
590 | |
591 | stamps/stamp-doc-html: |
592 | dh_testdir |
593 | - $(MAKE) -C Doc html |
594 | + $(MAKE) -C Doc html $(CROSS) |
595 | touch stamps/stamp-doc-html |
596 | |
597 | build-doc: stamps/stamp-patch stamps/stamp-build-doc |
598 | @@ -518,14 +616,17 @@ |
599 | clean: control-file |
600 | dh_testdir |
601 | dh_testroot |
602 | - $(MAKE) -f debian/rules unpatch |
603 | + $(MAKE) -f debian/rules unpatch $(CROSS) |
604 | rm -rf stamps .pc |
605 | rm -f debian/test_results |
606 | |
607 | - $(MAKE) -C Doc clean |
608 | - sed 's/^@/#/' Makefile.pre.in | $(MAKE) -f - srcdir=. distclean |
609 | + $(MAKE) -C Doc clean $(CROSS) |
610 | + sed 's/^@/#/' Makefile.pre.in | $(MAKE) -f - srcdir=. distclean $(CROSS) |
611 | rm -rf Lib/test/db_home |
612 | rm -rf $(buildd_static) $(buildd_shared) $(buildd_debug) $(buildd_shdebug) |
613 | +ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) |
614 | + rm -rf $(buildd_cross) |
615 | +endif |
616 | find -name '*.py[co]' | xargs -r rm -f |
617 | rm -f Lib/lib2to3/*.pickle |
618 | rm -rf locales |
619 | @@ -568,9 +669,19 @@ |
620 | : # their packages' directories. |
621 | install -d $(d)/usr |
622 | ifeq ($(with_interp),static) |
623 | - $(MAKE) -C $(buildd_static) install prefix=$(CURDIR)/$(d)/usr |
624 | + ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) |
625 | + @echo "Build python should use the new pyconfig.h" |
626 | + cp $(buildd_static)/pyconfig.h $(buildd_cross)/pyconfig.h |
627 | + cp $(buildd_static)/Makefile $(buildd_cross)/Makefile |
628 | + endif |
629 | + $(MAKE) -C $(buildd_static) install prefix=$(CURDIR)/$(d)/usr $(CROSS) |
630 | else |
631 | - $(MAKE) -C $(buildd_shared) install prefix=$(CURDIR)/$(d)/usr |
632 | + ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) |
633 | + @echo "Build python should use the new pyconfig.h" |
634 | + cp $(buildd_shared)/pyconfig.h $(buildd_cross)/pyconfig.h |
635 | + cp $(buildd_shared)/Makefile $(buildd_cross)/Makefile |
636 | + endif |
637 | + $(MAKE) -C $(buildd_shared) install prefix=$(CURDIR)/$(d)/usr $(CROSS) |
638 | endif |
639 | -find $(d)/usr/lib/python$(VER) -name '*_failed*.so' |
640 | find $(d)/usr/lib/python$(VER) -name '*_failed*.so' | xargs -r rm -f |
641 | @@ -806,8 +917,13 @@ |
642 | |
643 | : # generate binfmt file |
644 | mkdir -p $(d_min)/usr/share/binfmts |
645 | +ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) |
646 | $(buildd_static)/python debian/mkbinfmt.py $(PVER) \ |
647 | > $(d_min)/usr/share/binfmts/$(PVER) |
648 | +else |
649 | + $(buildd_cross)/python debian/mkbinfmt.py $(PVER) \ |
650 | + > $(d_min)/usr/share/binfmts/$(PVER) |
651 | +endif |
652 | |
653 | : # desktop entry |
654 | mkdir -p $(d_base)/usr/share/applications |
655 | @@ -823,7 +939,7 @@ |
656 | |
657 | : # install debug package |
658 | rm -rf $(d)-dbg |
659 | - $(MAKE) -C $(buildd_debug) install DESTDIR=$(CURDIR)/$(d)-dbg |
660 | + $(MAKE) -C $(buildd_debug) install DESTDIR=$(CURDIR)/$(d)-dbg $(CROSS) |
661 | dh_installdirs -p$(p_dbg) \ |
662 | usr/bin \ |
663 | usr/share/man/man1 \ |
Still trying to wrap my brain around what this fPIC change in debian/rules is supposed to do, given that this should already be the upstream default. In my tests, setting -fPIC doesn't appear to have any effect, these extensions fail to be built /either way/. I see this in the build log no matter which way I slice it:
Failed to find the necessary bits to build these modules:
_bsddb _sqlite3 bsddb185
dbm dl gdbm
imageop sunaudiodev zlib
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
And those modules seem to mostly fail to build anyway due to problems finding headers. I guess I'm missing something here?