Debian Codegraph @

debian/rules

raw
1 #!/usr/bin/make -f
2
3 include /usr/share/dpkg/architecture.mk
4 include /usr/share/dpkg/pkg-info.mk
5
6 unexport LANG LC_ALL LC_CTYPE LC_COLLATE LC_TIME LC_NUMERIC LC_MESSAGES
7 unexport CFLAGS CXXFLAGS LDFLAGS CPPFLAGS
8
9 export SHELL = /bin/bash
10
11 # Uncomment this to turn on verbose mode.
12 #export DH_VERBOSE=1
13
14 ifeq ($(DEB_HOST_ARCH_OS),linux)
15 PLAT = linux
16 else ifeq ($(DEB_HOST_ARCH_OS),kfreebsd)
17 PLAT = gnukfreebsd10
18 else ifeq ($(DEB_HOST_ARCH_OS),hurd)
19 PLAT = gnu0
20 else
21 $(warning unhandled operating system name: $(DEB_HOST_ARCH_OS))
22 PLAT = unknown
23 endif
24
25 SPHINXOPTS := -D today='$(shell LC_ALL=C date -u +'%B %d, %Y' -d '@$(SOURCE_DATE_EPOCH)')'
26 SPHINXOPTS += -D html_last_updated_fmt='$(shell LC_ALL=C date -u +'%B %d, %Y' -d '@$(SOURCE_DATE_EPOCH)')'
27 export SPHINXOPTS
28
29 on_buildd := $(shell [ -f /CurrentlyBuilding -o "$$LOGNAME" = buildd -o "$$USER" = buildd ] && echo yes)
30
31 dh_compat2 := $(shell dpkg --compare-versions "$$(dpkg-query -f '$${Version}' -W debhelper)" lt 9.20150811ubuntu2 && echo DH_COMPAT=2)
32
33 ifneq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
34 WITHOUT_CHECK := yes
35 endif
36 WITHOUT_BENCH :=
37 ifneq (,$(findstring nobench, $(DEB_BUILD_OPTIONS)))
38 WITHOUT_BENCH := yes
39 endif
40 ifeq ($(on_buildd),yes)
41 ifneq (,$(filter $(DEB_HOST_ARCH), armel hppa mips mipsel mips64 mips64el riscv64 s390)$(filter $(DEB_HOST_ARCH_OS), hurd kfreebsd))
42 WITHOUT_CHECK := yes
43 endif
44 ifneq (,$(filter $(DEB_HOST_ARCH), armel hppa mips mipsel mips64 mips64el riscv64 s390)$(filter $(DEB_HOST_ARCH_OS), hurd kfreebsd))
45 WITHOUT_BENCH := yes
46 endif
47 endif
48 ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
49 WITHOUT_BENCH := yes
50 WITHOUT_CHECK := yes
51 endif
52
53 SPACE = $(EMPTY) $(EMPTY)
54 COMMA = ,
55 ifneq (,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS))))
56 NJOBS := -j $(subst parallel=,,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS))))
57 endif
58
59 distribution := $(shell lsb_release -is)
60 distrelease := $(shell lsb_release -cs)
61 derivative := $(shell \
62 if dpkg-vendor --derives-from Ubuntu; then echo Ubuntu; \
63 elif dpkg-vendor --derives-from Debian; then echo Debian; \
64 else echo Unknown; fi)
65
66 # we inject our own lto flags
67 DPKG_OPTIMIZE = optimize=-lto
68 dpkg_buildflags = DEB_BUILD_MAINT_OPTIONS="hardening=-pie $(DPKG_OPTIMIZE)" dpkg-buildflags
69 dpkg_pieflags = DEB_BUILD_MAINT_OPTIONS="hardening=-pie $(DPKG_OPTIMIZE)"dpkg-buildflags
70 ifeq (,$(filter $(distrelease),stretch buster bullseye trusty xenial bionic focal impish))
71 with_nopie := yes
72 dpkg_pieflags = DEB_BUILD_MAINT_OPTIONS="hardening=-pie $(DPKG_OPTIMIZE)" dpkg-buildflags
73 endif
74
75 # FIXME: remove sid when uploading to unstable, after bookworm is released
76 #ifneq (,$(filter $(distrelase), jessie stretch buster bullseye bookworm sid precise trusty xenial bionic focal groovy hirsute))
77 with_dbmmodule = yes
78 bd_dbm = libdb-dev
79 dbmliborder = bdb:gdbm
80 #else
81 # bd_dbm = libgdbm-compat-dev
82 # dbmliborder = gdbm:bdb
83 #endif
84
85 ifneq (,$(filter valgrind, $(shell dpkg-query --show -f '$${Depends}\n' valgrind-if-available)))
86 valgrind_configure_args = --with-valgrind
87 endif
88
89 VER=3.13
90 SVER=3.13.0~rc3
91 NVER=3.14
92 PVER=python$(VER)
93 EXT_VER=$(subst .,,$(VER))
94 PRIORITY=$(shell echo $(VER) | tr -d '.')0
95
96 PREVVER := $(shell awk '/^python/ && NR > 1 {print substr($$2,2,length($$2)-2); exit}' debian/changelog)
97
98 # default versions are built from the python-defaults source package
99 # keep the definition to adjust package priorities.
100 DEFAULT_VERSION = no
101 STATIC_PYTHON=yes
102
103 MIN_MODS := $(shell awk '/^ / && $$2 == "module" { print $$1 }' \
104 debian/PVER-minimal.README.Debian.in)
105 MIN_EXTS := $(shell awk '/^ / && $$2 ~ /^extension/ { print $$1 }' \
106 debian/PVER-minimal.README.Debian.in)
107 MIN_BUILTINS := $(shell awk '/^ / && $$2 == "builtin" { print $$1 }' \
108 debian/PVER-minimal.README.Debian.in)
109 MIN_PACKAGES := $(shell awk '/^ / && $$2 == "package" { print $$1 }' \
110 debian/PVER-minimal.README.Debian.in)
111 MIN_ENCODINGS := $(foreach i, \
112 $(filter-out \
113 big5% bz2% cp932.py cp949.py cp950.py euc_% \
114 gb% iso2022% johab.py shift_jis% , \
115 $(shell cd Lib/encodings && echo *.py)), \
116 encodings/$(i)) \
117 codecs.py stringprep.py
118
119 with_tk := yes
120 with_gdbm := yes
121 with_interp := static
122 #with_interp := shared
123
124 PY_INTERPRETER = /usr/bin/python$(VER)
125
126 ifeq ($(DEFAULT_VERSION),yes)
127 PY_PRIO = standard
128 #PYSTDDEP = , python (>= $(VER))
129 else
130 PY_PRIO = optional
131 endif
132 ifeq ($(distribution),Ubuntu)
133 PY_MINPRIO = required
134 PY_MINPRIO = optional
135 #with_udeb = yes
136 # test_ssl assumes that openssl is compiled with security level set to 1
137 # make it so, during the build
138 export OPENSSL_CONF = $(CURDIR)/debian/openssl.cnf
139 else
140 PY_MINPRIO = $(PY_PRIO)
141 endif
142 ifeq (,$(filter $(distrelease),lenny etch squeeze wheezy lucid maverick natty oneiric))
143 bd_qual = :any
144 endif
145 ifeq (,$(filter $(distrelease),lenny etch squeeze wheezy lucid maverick natty oneiric))
146 ma_filter = cat
147 else
148 ma_filter = grep -v '^Multi-Arch:'
149 endif
150 ifeq (,$(filter $(distrelease),lenny etch squeeze wheezy lucid maverick natty oneiric precise quantal raring saucy trusty))
151 bd_dpkgdev = dpkg-dev (>= 1.17.11),
152 endif
153
154 CC=$(DEB_HOST_GNU_TYPE)-gcc
155 CXX=$(DEB_HOST_GNU_TYPE)-g++
156 ifneq (,$(filter $(distrelease),bionic))
157 CC=$(DEB_HOST_GNU_TYPE)-gcc-8
158 CXX=$(DEB_HOST_GNU_TYPE)-g++-8
159 bd_gcc = g++-8,
160 endif
161
162 AR=$(DEB_HOST_GNU_TYPE)-ar
163 RANLIB=$(DEB_HOST_GNU_TYPE)-ranlib
164
165 # configure and dtrace consume these
166 export CC CXX
167
168 # These variables are needed for the ELF package metadata (set via LDFLAGS)
169 DEB_BUILD_OS_RELEASE_ID=$(shell . /usr/lib/os-release && echo $$ID)
170 export DEB_BUILD_OS_RELEASE_ID
171 export DEB_HOST_ARCH
172 export DEB_SOURCE
173 export DEB_VERSION
174
175 DPKG_CPPFLAGS= $(shell $(dpkg_buildflags) --get CPPFLAGS)
176 DPKG_CFLAGS := $(shell $(dpkg_buildflags) --get CFLAGS)
177 DPKG_CFLAGS := $(subst -fstack-protector-strong,-fstack-protector,$(DPKG_CFLAGS))
178 DPKG_LDFLAGS = $(shell $(dpkg_buildflags) --get LDFLAGS)
179 OPT_CFLAGS := $(filter-out -O%,$(DPKG_CFLAGS)) # default is -O3
180 DEBUG_CFLAGS := $(patsubst -O%,-Og,$(DPKG_CFLAGS))
181
182 DPKG_PIE_CPPFLAGS= $(shell $(dpkg_pieflags) --get CPPFLAGS)
183 DPKG_PIE_CFLAGS := $(shell $(dpkg_pieflags) --get CFLAGS)
184 DPKG_PIE_CFLAGS := $(subst -fstack-protector-strong,-fstack-protector,$(DPKG_PIE_CFLAGS))
185 DPKG_PIE_LDFLAGS = $(shell $(dpkg_pieflags) --get LDFLAGS)
186 OPT_PIE_CFLAGS := $(filter-out -O%,$(DPKG_PIE_CFLAGS)) # default is -O3
187
188 ifeq ($(DEB_HOST_ARCH),ia64)
189 DPKG_CPPFLAGS += -DWITH_PYMALLOC_RADIX_TREE=0
190 DPKG_PIE_CPPFLAGS += -DWITH_PYMALLOC_RADIX_TREE=0
191 endif
192
193 ifneq (,$(filter $(DEB_HOST_ARCH), ppc64 ppc64el))
194 OPT_CFLAGS += -fexceptions
195 OPT_PIE_CFLAGS += -fexceptions
196 DEBUG_CFLAGS += -fexceptions
197 endif
198
199 ifneq (,$(filter $(DEB_HOST_ARCH), m68k))
200 OPT_CFLAGS += $(filter-out -O%,$(DPKG_CFLAGS)) -O1
201 OPT_PIE_CFLAGS += $(filter-out -O%,$(DPKG_PIE_CFLAGS)) -O1
202 endif
203
204 ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
205 ifeq ($(DEB_HOST_ARCH_OS),linux)
206 ifneq (,$(findstring $(DEB_HOST_ARCH), amd64 armel armhf arm64 i386 powerpc ppc64 ppc64el s390x))
207 with_pgo := yes
208 endif
209 endif
210 endif
211
212 ifneq (,$(filter $(DEB_HOST_ARCH), amd64 armel armhf arm64 i386 powerpc ppc64 ppc64el s390x))
213 with_lto := yes
214 endif
215
216 ifneq (,$(findstring nopgo, $(DEB_BUILD_OPTIONS)))
217 with_pgo :=
218 endif
219
220 ifneq (,$(findstring nolto, $(DEB_BUILD_OPTIONS)))
221 with_lto :=
222 endif
223
224 ifneq (,$(findstring noopt, $(DEB_BUILD_OPTIONS)))
225 OPT_CFLAGS := $(filter-out -O%, $(OPT_CFLAGS)) -O0
226 with_pgo =
227 with_lto =
228 endif
229
230 BASE_LTO_CFLAGS = -g -fwrapv -O3
231 ifeq ($(with_lto),yes)
232 LTO_CFLAGS = $(BASE_LTO_CFLAGS) -flto -fuse-linker-plugin
233 with_fat_lto := $(shell dpkg --compare-versions $$($(CC) --version \
234 | sed -n '/^$(CC)/s,.* ,,p') ge 4.9 && echo yes)
235 ifeq ($(with_fat_lto),yes)
236 LTO_CFLAGS += -ffat-lto-objects
237 endif
238 OPT_CFLAGS += $(LTO_CFLAGS)
239 OPT_PIE_CFLAGS += $(LTO_CFLAGS)
240 AR=$(DEB_HOST_GNU_TYPE)-gcc-ar
241 RANLIB=$(DEB_HOST_GNU_TYPE)-gcc-ranlib
242 endif
243
244 sysconfig_substflags = \
245 $(if $(with_lto),$(foreach i,-flto=auto -flto -fuse-linker-plugin -ffat-lto-objects,-e 's/$(i)//g')) \
246 -e '/^OPT/s,-O3,-O2,' \
247 -e 's/-O3/-O2/g' \
248 -e 's/-fprofile-use *-fprofile-correction//g' \
249 -e "s/-specs=[^ '\"]*//g" \
250 -e "s/-fdebug-prefix-map=[^ '\"]*//g" \
251 -e "s/-ffile-prefix-map=[^ '\"]*//g" \
252 -e 's,^RUNSHARED *=.*,RUNSHARED=,' \
253 -e '/BLDLIBRARY/s/-L\. //'
254
255 ifeq ($(derivative),Ubuntu)
256 arch_substvars =
257 else ifeq ($(derivative),Debian)
258 arch_substvars = # '-Vpython38:Breaks=$(shell tr '\n' ' ' < debian/py38-breaks.$(derivative))'
259 endif
260
261 make_build_target = $(if $(filter yes, $(with_pgo)),profile-opt)
262
263 buildd_static := $(CURDIR)/build-static
264 buildd_nopie := $(CURDIR)/build-nopie
265 buildd_shared := $(CURDIR)/build-shared
266 buildd_debug := $(CURDIR)/build-debug
267 buildd_shdebug := $(CURDIR)/build-shdebug
268
269 d := debian/tmp
270 scriptdir = usr/share/lib/python$(VER)
271 scriptdir = usr/share/python$(VER)
272 scriptdir = usr/lib/python$(VER)
273
274 # package names and directories
275 p_base := $(PVER)
276 p_npie := $(PVER)-nopie
277 p_min := $(PVER)-minimal
278 p_lib := lib$(PVER)
279 p_gdbm := $(PVER)-gdbm
280 p_tk := $(PVER)-tk
281 p_dev := $(PVER)-dev
282 p_exam := $(PVER)-examples
283 p_idle := idle-$(PVER)
284 p_doc := $(PVER)-doc
285 p_dbg := $(PVER)-dbg
286 p_udeb := $(PVER)-udeb
287 p_venv := $(PVER)-venv
288 p_full := $(PVER)-full
289
290 p_lbase := lib$(PVER)-stdlib
291 p_lmin := lib$(PVER)-minimal
292 p_ldev := lib$(PVER)-dev
293 p_ldbg := lib$(PVER)-dbg
294 p_ltst := lib$(PVER)-testsuite
295
296 d_base := debian/$(p_base)
297 d_min := debian/$(p_min)
298 d_npie := debian/$(p_npie)
299 d_lib := debian/$(p_lib)
300 d_gdbm := debian/$(p_gdbm)
301 d_tk := debian/$(p_tk)
302 d_dev := debian/$(p_dev)
303 d_exam := debian/$(p_exam)
304 d_idle := debian/$(p_idle)
305 d_doc := debian/$(p_doc)
306 d_dbg := debian/$(p_dbg)
307 d_udeb := debian/$(p_udeb)
308 d_venv := debian/$(p_venv)
309 d_full := debian/$(p_full)
310
311 d_lbase := debian/$(p_lbase)
312 d_lmin := debian/$(p_lmin)
313 d_ldev := debian/$(p_ldev)
314 d_ldbg := debian/$(p_ldbg)
315 d_ltst := debian/$(p_ltst)
316
317 build-arch: stamps/stamp-build
318 build-indep: stamps/stamp-build-doc
319 build: build-arch
320 stamps/stamp-build: stamps/stamp-build-static \
321 $(if $(filter yes, $(with_nopie)),stamps/stamp-build-nopie) \
322 stamps/stamp-mincheck \
323 stamps/stamp-build-shared stamps/stamp-build-debug \
324 stamps/stamp-build-shared-debug \
325 stamps/stamp-check stamps/stamp-pybench
326 touch $@
327
328 PROFILE_EXCLUDES = test_compiler test_subprocess \
329 test_multiprocessing test_socket test_socketserver \
330 test_thread test_threaded_import test_threadedtempfile \
331 test_threading test_threading_local test_threadsignals \
332 test_concurrent_futures test_ctypes \
333 test_dbm_dumb test_dbm_ndbm test_pydoc test_sundry \
334 test_signal test_ioctl test_gdb test_ensurepip test_venv
335
336 # TODO: these hang/fail with new OpenSSL
337 PROFILE_EXCLUDES += \
338 test_asyncio test_ftplib test_httplib test_imaplib test_nntplib test_poplib test_ssl
339
340 # TODO: these fail in the profile build
341 PROFILE_EXCLUDES += \
342 test_cmd_line_script test_zipimport_support
343
344 # these take a long time to run ...
345 PROFILE_EXCLUDES += \
346 test_multiprocessing_fork test_multiprocessing_forkserver test_multiprocessing_spawn
347
348 # relying on external dependencies
349 PROFILE_EXCLUDES += test_cppext test_tools
350
351 # TODO: update profiled-build.diff to support --next
352 # --next=20
353 PROFILE_TASK = ../Lib/test/regrtest.py \
354 -s \
355 -j 1 -unone,decimal \
356 -x $(sort $(TEST_EXCLUDES) $(PROFILE_EXCLUDES))
357
358
359 run-profile-task:
360 $(MAKE) -C $(buildd_static) \
361 PROFILE_TASK='$(PROFILE_TASK)' run_profile_task
362
363
364 common_configure_args = \
365 --prefix=/usr \
366 --libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
367 --enable-ipv6 \
368 --enable-loadable-sqlite-extensions \
369 --with-dbmliborder=$(dbmliborder) \
370 --with-computed-gotos \
371 --without-ensurepip \
372 --with-system-expat \
373 $(if $(filter hurd, $(DEB_HOST_ARCH_OS)),,--with-dtrace) \
374 --with-ssl-default-suites=openssl \
375 --with-system-libmpdec=no \
376 --with-wheel-pkg-dir=/usr/share/python-wheels/ \
377 MKDIR_P="/bin/mkdir -p" \
378
379 # FIXME, only temporaray
380 #common_configure_args += \
381 # --without-builtin-hashlib-hashes
382
383 ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
384 common_configure_args += --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE)
385 common_configure_args += --with-build-python
386 config_site = ac_cv_file__dev_ptmx=yes ac_cv_file__dev_ptc=yes
387 ifeq (,$(filter $(DEB_HOST_ARCH),arm m68k))
388 ifeq ($(DEB_HOST_ARCH_ENDIAN),little)
389 config_site += ac_cv_little_endian_double=yes
390 else
391 config_site += ac_cv_big_endian_double=yes
392 endif
393 endif
394 endif
395
396 stamps/stamp-configure-shared: stamps/stamp-patch
397 rm -rf $(buildd_shared)
398 mkdir -p $(buildd_shared)
399 cd $(buildd_shared) && \
400 AR="$(AR)" RANLIB="$(RANLIB)" \
401 CFLAGS_NODIST="$(DPKG_CPPFLAGS) $(OPT_CFLAGS)" \
402 LDFLAGS_NODIST="$(DPKG_LDFLAGS) $(LTO_CFLAGS)" \
403 $(config_site) \
404 ../configure \
405 --enable-shared \
406 $(common_configure_args)
407
408 $(call __post_configure,$(buildd_shared))
409
410 @echo XXXXXXX pyconfig.h
411 -cat $(buildd_shared)/pyconfig.h
412
413 touch $@
414
415 stamps/stamp-build-static: stamps/stamp-configure-static
416 dh_testdir
417 $(MAKE) $(NJOBS) -C $(buildd_static) \
418 PROFILE_TASK='$(PROFILE_TASK)' $(make_build_target)
419
420 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
421 : # check that things are correctly built
422 ifneq (,$(filter $(DEB_HOST_ARCH_OS), linux))
423 cd $(buildd_static) && ./python -c 'from _multiprocessing import SemLock'
424 endif
425 cd $(buildd_static) && ./python -c 'import _decimal'
426 cd $(buildd_static) && ./python -c 'import math, cmath'
427 endif
428 touch $@
429
430 stamps/stamp-build-shared: stamps/stamp-configure-shared
431 dh_testdir
432 $(MAKE) $(NJOBS) -C $(buildd_shared)
433
434 : # build a static library with PIC objects
435 $(MAKE) $(NJOBS) -C $(buildd_shared) \
436 LIBRARY=libpython$(VER)-pic.a libpython$(VER)-pic.a
437 touch $@
438
439 stamps/stamp-configure-static: stamps/stamp-patch
440 rm -rf $(buildd_static)
441 mkdir -p $(buildd_static)
442 cd $(buildd_static) && \
443 AR="$(AR)" RANLIB="$(RANLIB)" \
444 CFLAGS_NODIST="$(DPKG_PIE_CPPFLAGS) $(OPT_PIE_CFLAGS)" \
445 LDFLAGS_NODIST="$(DPKG_PIE_LDFLAGS) $(LTO_CFLAGS)" \
446 $(config_site) \
447 ../configure \
448 $(common_configure_args)
449
450 $(call __post_configure,$(buildd_static))
451 touch $@
452
453 stamps/stamp-configure-nopie: stamps/stamp-patch
454 rm -rf $(buildd_nopie)
455 mkdir -p $(buildd_nopie)
456 cd $(buildd_nopie) && \
457 AR="$(AR)" RANLIB="$(RANLIB)" \
458 CFLAGS_NODIST="$(DPKG_CPPFLAGS) $(OPT_CFLAGS)" \
459 LDFLAGS_NODIST="$(DPKG_LDFLAGS) $(LTO_CFLAGS)" \
460 $(config_site) \
461 ../configure \
462 $(common_configure_args)
463
464 $(call __post_configure,$(buildd_nopie))
465 touch $@
466
467 stamps/stamp-build-nopie: stamps/stamp-configure-nopie
468 dh_testdir
469 $(MAKE) $(NJOBS) -C $(buildd_nopie) \
470 PROFILE_TASK='$(PROFILE_TASK)' $(make_build_target)
471
472 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
473 : # check that things are correctly built
474 ifneq (,$(filter $(DEB_HOST_ARCH_OS), linux))
475 cd $(buildd_nopie) && ./python -c 'from _multiprocessing import SemLock'
476 endif
477 cd $(buildd_nopie) && ./python -c 'import _decimal'
478 cd $(buildd_nopie) && ./python -c 'import math, cmath'
479 endif
480 touch $@
481
482 stamps/stamp-configure-debug: stamps/stamp-patch
483 rm -rf $(buildd_debug)
484 mkdir -p $(buildd_debug)
485 cd $(buildd_debug) && \
486 AR="$(AR)" RANLIB="$(RANLIB)" \
487 CFLAGS_NODIST="$(DPKG_CPPFLAGS) $(DEBUG_CFLAGS)" \
488 LDFLAGS_NODIST="$(DPKG_LDFLAGS)" \
489 $(config_site) \
490 ../configure \
491 $(common_configure_args) \
492 $(valgrind_configure_args) \
493 --with-pydebug
494
495 $(call __post_configure,$(buildd_debug))
496 touch $@
497
498 stamps/stamp-build-debug: stamps/stamp-configure-debug
499 dh_testdir
500 $(MAKE) $(NJOBS) -C $(buildd_debug)
501
502 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
503 cd $(buildd_static) && ./python -c 'import _decimal'
504 cd $(buildd_debug) && ./python -c 'import math, cmath'
505 endif
506 touch $@
507
508 stamps/stamp-configure-shared-debug: stamps/stamp-patch
509 rm -rf $(buildd_shdebug)
510 mkdir -p $(buildd_shdebug)
511 cd $(buildd_shdebug) && \
512 AR="$(AR)" RANLIB="$(RANLIB)" \
513 CFLAGS_NODIST="$(DPKG_CPPFLAGS) $(DEBUG_CFLAGS)" \
514 LDFLAGS_NODIST="$(DPKG_LDFLAGS)" \
515 $(config_site) \
516 ../configure \
517 $(common_configure_args) \
518 --enable-shared \
519 $(valgrind_configure_args) \
520 --with-pydebug
521
522 $(call __post_configure,$(buildd_shdebug))
523 touch $@
524
525 stamps/stamp-build-shared-debug: stamps/stamp-configure-shared-debug
526 dh_testdir
527 : # build the shared debug library
528 $(MAKE) $(NJOBS) -C $(buildd_shdebug)
529 touch $@
530
531
532 define __post_configure
533 egrep \
534 "^#($$(awk -v ORS='|' '$$2 ~ /^extension$$/ {print $$1}' debian/PVER-minimal.README.Debian.in)XX)" \
535 Modules/Setup \
536 | sed -e 's/^#//' -e 's/-Wl,-Bdynamic//;s/-Wl,-Bstatic//' \
537 >> $(1)/Modules/Setup.local
538
539 : # unconditionally run makesetup
540 cd $(1) && \
541 ../Modules/makesetup -c ../Modules/config.c.in -s Modules \
542 Modules/Setup.local Modules/Setup.bootstrap Modules/Setup.stdlib ../Modules/Setup
543 mv $(1)/config.c $(1)/Modules/
544
545 : # and fix the timestamps
546 $(MAKE) -C $(1) Makefile Modules/config.c
547
548 : # this second rule doesn't build with -fPIC, remove it.
549 sed '/^Modules\/_math.o: .*PY_STDMODULE_CFLAGS/d' $(1)/Makefile > $(1)/Makefile.fixed
550 touch -r $(1)/Makefile $(1)/Makefile.fixed
551 mv -f $(1)/Makefile.fixed $(1)/Makefile
552 endef
553
554 stamps/stamp-mincheck: stamps/stamp-build-static debian/PVER-minimal.README.Debian.in
555 ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
556 for m in $(MIN_MODS) $(MIN_PACKAGES) $(MIN_EXTS) $(MIN_BUILTINS); do \
557 echo "import $$m"; \
558 done > $(buildd_static)/minmods.py
559 cd $(buildd_static) && ./python -S ../debian/pymindeps.py minmods.py \
560 > mindeps.txt
561 -if [ -x /usr/bin/dot ]; then \
562 cd $(buildd_static) && ./python -S ../debian/depgraph.py \
563 < mindeps.txt > mindeps.dot; \
564 dot -Tpng -o mindeps.png mindeps.dot; \
565 else true; fi
566 cd $(buildd_static) && ./python -S ../debian/mincheck.py \
567 minmods.py mindeps.txt
568 endif
569 touch stamps/stamp-mincheck
570
571 TEST_DIR := $(shell [ -f debian/testdir ] || mktemp -d > debian/testdir; cat debian/testdir)
572
573 TEST_RESOURCES = all
574 ifeq ($(on_buildd),yes)
575 TEST_RESOURCES := $(TEST_RESOURCES),-network,-urlfetch
576 endif
577 TESTOPTS = -j 1 -w -u$(TEST_RESOURCES) --timeout=3600
578 TEST_EXCLUDES =
579 TEST_EXCLUDES += test_ensurepip test_venv
580 ifeq ($(on_buildd),yes)
581 TEST_EXCLUDES += test_tcl test_codecmaps_cn test_codecmaps_hk \
582 test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw \
583 test_normalization test_ossaudiodev
584 endif
585 ifeq (,$(wildcard /dev/dsp))
586 TEST_EXCLUDES += test_linuxaudiodev test_ossaudiodev
587 endif
588 ifneq (,$(filter $(DEB_HOST_ARCH), hppa))
589 TEST_EXCLUDES += test_fork1 test_multiprocessing test_socketserver test_threading test_wait3 test_wait4 test_gdb
590 endif
591 # hangs on Aarch64, see LP: #1264354
592 ifneq (,$(filter $(DEB_HOST_ARCH),arm64))
593 TEST_EXCLUDES += test_faulthandler
594 endif
595 ifneq (,$(filter $(DEB_HOST_ARCH), arm))
596 TEST_EXCLUDES += test_ctypes
597 endif
598 TEST_EXCLUDES += test_socket
599 ifneq (,$(filter $(DEB_HOST_ARCH), arm armel m68k))
600 ifeq ($(on_buildd),yes)
601 TEST_EXCLUDES += test_compiler
602 endif
603 endif
604 TEST_EXCLUDES += test_ttk_guionly
605 # https://buildd.debian.org/status/logs.php?pkg=python3.5&ver=3.5.1-1&arch=alpha&suite=sid
606 ifneq (,$(filter $(DEB_HOST_ARCH), alpha))
607 TEST_EXCLUDES += test_signal
608 endif
609 ifneq (,$(filter $(DEB_HOST_ARCH), sparc sparc64))
610 TEST_EXCLUDES += test_gdb
611 endif
612
613 ifneq (,$(filter $(DEB_HOST_ARCH), alpha armhf riscv64 sparc64))
614 TEST_EXCLUDES += test_concurrent_futures
615 endif
616
617 # fail/hang with new OpenSSL
618 TEST_EXCLUDES += test_asyncio test_ftplib test_httplib test_imaplib test_nntplib test_poplib test_ssl
619
620 # TODO: re-enable once fixed, see #708652
621 ifneq (,$(filter $(DEB_HOST_ARCH_OS), hurd))
622 TEST_EXCLUDES += test_asyncore test_curses test_exceptions \
623 test_faulthandler test_imaplib test_io test_logging test_mmap \
624 test_random test_signal test_socket test_socketserver test_ssl \
625 test_threading test_pydoc test_runpy test_telnetlib test_tk
626 endif
627
628 # TODO: re-enable once fixed, see #708653
629 ifneq (,$(filter $(DEB_HOST_ARCH_OS), kfreebsd))
630 TEST_EXCLUDES += test_io test_signal test_socket test_socketserver \
631 test_threading test_threadsignals test_threaded_import \
632 test_time test_pty test_curses
633 endif
634
635 # for debug builds only
636 TEST_EXCLUDES += test_gdb
637
638 ifneq (,$(TEST_EXCLUDES))
639 TESTOPTS += -x $(sort $(TEST_EXCLUDES))
640 endif
641
642 ifneq (,$(wildcard /usr/bin/localedef))
643 SET_LOCPATH = LOCPATH=$(CURDIR)/locales
644 endif
645
646 stamps/stamp-check:
647 ifeq ($(WITHOUT_CHECK),yes)
648 echo "check run disabled for this build" > $(buildd_static)/test_results
649 else
650 @echo ========== test environment ============
651 @env
652 @echo ========================================
653
654 ifeq (,$(findstring $(DEB_HOST_ARCH), alpha))
655 ( \
656 echo '#! /bin/sh'; \
657 echo 'set -x'; \
658 echo 'export $(SET_LOCPATH)'; \
659 echo '$(buildd_static)/python $(CURDIR)/debian/script.py test_results '\''make test TESTOPTS="$(filter-out test_gdb,$(TESTOPTS))"'\'; \
660 echo 'echo DONE'; \
661 ) > $(buildd_debug)/run_tests
662 chmod 755 $(buildd_debug)/run_tests
663 @echo "BEGIN test debug"
664 mkdir -p $(TEST_DIR)/debug/.local/lib/$(PVER)/site-packages
665 -cd $(buildd_debug) && HOME=$(TEST_DIR)/debug time xvfb-run -a -e xvfb-run.log ./run_tests
666 find $(TEST_DIR)/debug
667 rm -rf $(TEST_DIR)/debug
668 @echo "END test debug"
669 endif
670
671 ( \
672 echo '#! /bin/sh'; \
673 echo 'set -x'; \
674 echo 'export $(SET_LOCPATH)'; \
675 echo '$(buildd_static)/python $(CURDIR)/debian/script.py test_results '\''make test TESTOPTS="$(TESTOPTS)"'\'; \
676 echo 'echo DONE'; \
677 ) > $(buildd_static)/run_tests
678 chmod 755 $(buildd_static)/run_tests
679 @echo "BEGIN test static"
680 mkdir -p $(TEST_DIR)/static/.local/lib/$(PVER)/site-packages
681 -cd $(buildd_static) && HOME=$(TEST_DIR)/static time xvfb-run -a -e xvfb-run.log ./run_tests
682 find $(TEST_DIR)/static
683 rm -rf $(TEST_DIR)/static
684 @echo "END test static"
685
686 ( \
687 echo '#! /bin/sh'; \
688 echo 'set -x'; \
689 echo 'export $(SET_LOCPATH)'; \
690 echo '$(buildd_static)/python $(CURDIR)/debian/script.py test_results '\''make test TESTOPTS="$(TESTOPTS)"'\'; \
691 echo 'echo DONE'; \
692 ) > $(buildd_shared)/run_tests
693 chmod 755 $(buildd_shared)/run_tests
694 @echo "BEGIN test shared"
695 mkdir -p $(TEST_DIR)/shared/.local/lib/$(PVER)/site-packages
696 -cd $(buildd_shared) && HOME=$(TEST_DIR)/shared time xvfb-run -a -e xvfb-run.log ./run_tests
697 find $(TEST_DIR)/shared
698 rm -rf $(TEST_DIR)/shared
699 @echo "END test shared"
700 endif
701 cp -p $(buildd_static)/test_results debian/
702 touch stamps/stamp-check
703
704 stamps/stamp-pybench:
705 echo "pybench run disabled for this build" > $(buildd_static)/pybench.log
706
707 #ifeq (,$(filter $(DEB_HOST_ARCH), arm armel hppa mips mipsel mips64 mips64el m68k))
708 pybench_options = -C 2 -n 5 -w 4
709 #endif
710
711 stamps/stamp-pybenchx:
712 ifeq ($(WITHOUT_BENCH),yes)
713 echo "pybench run disabled for this build" > $(buildd_static)/pybench.log
714 else
715 @echo "BEGIN pybench static"
716 cd $(buildd_static) \
717 && time ./python ../Tools/pybench/pybench.py -f run1.pybench $(pybench_options)
718 cd $(buildd_static) \
719 && ./python ../Tools/pybench/pybench.py -f run2.pybench -c run1.pybench $(pybench_options)
720 @echo "END pybench static"
721 @echo "BEGIN pybench shared"
722 cd $(buildd_shared) \
723 && LD_LIBRARY_PATH=. ./python ../Tools/pybench/pybench.py -f run1.pybench $(pybench_options)
724 cd $(buildd_shared) \
725 && LD_LIBRARY_PATH=. ./python ../Tools/pybench/pybench.py -f run2.pybench -c run1.pybench $(pybench_options)
726 @echo "END pybench shared"
727 @echo "BEGIN shared/static comparision"
728 $(buildd_static)/python Tools/pybench/pybench.py \
729 -s $(buildd_static)/run2.pybench -c $(buildd_shared)/run2.pybench \
730 | tee $(buildd_static)/pybench.log
731 @echo "END shared/static comparision"
732 endif
733 touch stamps/stamp-pybench
734
735 minimal-test:
736 rm -rf mintest
737 mkdir -p mintest/lib mintest/dynlib mintest/testlib mintest/all-lib
738 cp -p $(buildd_static)/python mintest/
739 cp -p $(foreach i,$(MIN_MODS),Lib/$(i).py) \
740 mintest/lib/
741 cp -a $(foreach i,$(MIN_PACKAGES),Lib/$(i)) \
742 mintest/lib/
743 cp -p $(wildcard $(foreach i,$(MIN_EXTS),$(buildd_static)/build/lib*/$(i).*.so)) \
744 mintest/dynlib/
745 cp -p Lib/unittest.py mintest/lib/
746 cp -pr Lib/test mintest/lib/
747 cp -pr Lib mintest/all-lib
748 cp -p $(buildd_static)/build/lib*/*.so mintest/all-lib/
749 ( \
750 echo "import sys"; \
751 echo "sys.path = ["; \
752 echo " '$(CURDIR)/mintest/lib',"; \
753 echo " '$(CURDIR)/mintest/dynlib',"; \
754 echo "]"; \
755 cat Lib/test/regrtest.py; \
756 ) > mintest/lib/test/mintest.py
757 cd mintest && ./python -E -S lib/test/mintest.py \
758 -x test_codecencodings_cn test_codecencodings_hk \
759 test_codecencodings_jp test_codecencodings_kr \
760 test_codecencodings_tw test_codecs test_multibytecodec \
761
762 stamps/stamp-doc-html:
763 dh_testdir
764 $(MAKE) -C Doc html
765 @mkdir -p stamps
766 touch stamps/stamp-doc-html
767
768 stamps/stamp-doc-info:
769 dh_testdir
770 rm -rf Doc/build/texinfo
771 $(MAKE) -C Doc texinfo
772 # - Change name of info file (@setfilename) to include the version.
773 # - Change the directory entry to include the version and point to the
774 # correct filename.
775 # - Change image links (@image) to point to a subdirectory.
776 # - Remove trailing whitespace.
777 sed -e 's/^@setfilename .*/@setfilename $(PVER).info/' \
778 -e '/^@direntry/,/^@/s/^\*[^:]*: ([^)]*)/* Python $(VER): ($(PVER))/' \
779 -e 's,@image{,@image{$(PVER)/,g' \
780 -e 's/ *$$//' \
781 < Doc/build/texinfo/python.texi \
782 > Doc/build/texinfo/$(PVER).texi
783 rm -f Doc/build/texinfo/python.texi
784 # - Create a symbolic link so that makeinfo will be able to find the
785 # image files.
786 ln -s . Doc/build/texinfo/$(PVER)
787 $(MAKE) -C Doc/build/texinfo
788 @mkdir -p stamps
789 touch stamps/stamp-doc-info
790
791 build-doc: stamps/stamp-patch stamps/stamp-build-doc
792 stamps/stamp-build-doc: stamps/stamp-doc-html stamps/stamp-doc-info
793 @mkdir -p stamps
794 touch stamps/stamp-build-doc
795
796 control-file:
797 sed -e "s/@PVER@/$(PVER)/g" \
798 -e "s/@VER@/$(VER)/g" \
799 -e "s/@PYSTDDEP@/$(PYSTDDEP)/g" \
800 -e "s/@PRIO@/$(PY_PRIO)/g" \
801 -e "s/@MINPRIO@/$(PY_MINPRIO)/g" \
802 -e "s/@bd_qual@/$(bd_qual)/g" \
803 -e "s/@bd_gcc@/$(bd_gcc)/g" \
804 -e "s/@bd_dbm@/$(bd_dbm)/g" \
805 -e "s/@bd_dpkgdev@/$(bd_dpkgdev)/g" \
806 debian/control.in \
807 debian/control.stdlib \
808 $(if $(with_udeb),debian/control.udeb) \
809 | $(ma_filter) \
810 > debian/control.tmp
811 ifeq ($(distribution),Ubuntu)
812 ifneq (,$(findstring ubuntu, $(DEB_VERSION)))
813 m='Ubuntu Core Developers <[email protected]>'; \
814 sed -i "/^Maintainer:/s/\(.*\)/Maintainer: $$m\nXSBC-Original-\1/" \
815 debian/control.tmp
816 endif
817 endif
818 [ -e debian/control ] \
819 && cmp -s debian/control debian/control.tmp \
820 && rm -f debian/control.tmp && exit 0; \
821 mv debian/control.tmp debian/control
822
823
824
825 clean: control-file
826 dh_testdir
827 dh_testroot
828 rm -rf stamps
829 rm -f debian/test_results
830
831 $(MAKE) -C Doc clean
832 sed 's/^@/#/' Makefile.pre.in | $(MAKE) -f - srcdir=. distclean
833 rm -rf $(buildd_static) $(buildd_shared) $(buildd_debug) $(buildd_shdebug) $(buildd_nopie)
834 find -name '*.py[co]' | xargs -r rm -f
835 rm -f Lib/dist-packages
836 rm -rf locales
837 rm -rf $(d)-dbg
838 rm -f configure
839 rm -f netlify.toml
840 rm -rf $(TEST_DIR) debian/testdir
841
842 for f in debian/*.in; do \
843 f2=`echo $$f | sed "s,PVER,$(PVER),g;s/@VER@/$(VER)/g;s,\.in$$,,"`; \
844 if [ $$f2 != debian/control ] && [ $$f2 != debian/source.lintian-overrides ]; then \
845 rm -f $$f2; \
846 fi; \
847 done
848 rm -rf debian/__pycache__
849
850 dh_clean
851
852 stamps/stamp-control:
853 : # We have to prepare the various control files
854
855 for f in debian/*.in; do \
856 f2=`echo $$f | sed "s,PVER,$(PVER),g;s/@VER@/$(VER)/g;s,\.in$$,,"`; \
857 if [ $$f2 != debian/control ]; then \
858 sed -e "s/@PVER@/$(PVER)/g;s/@VER@/$(VER)/g;s/@SVER@/$(SVER)/g" \
859 -e "s/@PRIORITY@/$(PRIORITY)/g" \
860 -e "s,@SCRIPTDIR@,/$(scriptdir),g" \
861 -e "s,@INFO@,$(info_docs),g" \
862 -e "s,@HOST_QUAL@,:$(DEB_HOST_ARCH),g" \
863 <$$f >$$f2; \
864 fi; \
865 done
866
867 install: build-arch stamps/stamp-install
868 stamps/stamp-install: stamps/stamp-build control-file stamps/stamp-control
869 dh_testdir
870 dh_testroot
871 dh_prep
872 dh_installdirs
873
874 : # make install into tmp and subsequently move the files into
875 : # their packages' directories.
876 install -d $(d)/usr
877 install -d $(d)/$(scriptdir)/lib-dynload
878 ifeq ($(with_interp),static)
879 $(MAKE) -C $(buildd_static) install DESTDIR=$(CURDIR)/$(d)
880 ls -l $(d)/$(scriptdir)/_sysconfigdata*
881 sed $(sysconfig_substflags) \
882 $(buildd_shared)/$(shell cat $(buildd_shared)/pybuilddir.txt)/_sysconfigdata__$(PLAT)_$(DEB_HOST_MULTIARCH).py \
883 > $(d)/$(scriptdir)/_sysconfigdata__$(PLAT)_$(DEB_HOST_MULTIARCH).py
884 else
885 $(MAKE) -C $(buildd_shared) install DESTDIR=$(CURDIR)/$(d)
886 endif
887 mkdir -p $(d)/usr/include/$(DEB_HOST_MULTIARCH)/$(PVER)
888 mv $(d)/usr/include/$(PVER)/pyconfig.h \
889 $(d)/usr/include/$(DEB_HOST_MULTIARCH)/$(PVER)/.
890 rm -f $(d)/$(scriptdir)/lib-dynload/*.py
891 ls -l $(d)/$(scriptdir)/_sysconfigdata*
892 sed -i $(sysconfig_substflags) \
893 $(d)/$(scriptdir)/_sysconfigdata__$(PLAT)_$(DEB_HOST_MULTIARCH).py
894
895 -find $(d)/usr/lib/python$(VER) -name '*_failed*.so'
896 find $(d)/usr/lib/python$(VER) -name '*_failed*.so' | xargs -r rm -f
897
898 for i in $(d)/$(scriptdir)/lib-dynload/*.so; do \
899 case "$$i" in *$(DEB_HOST_MULTIARCH)*) continue; esac; \
900 b=$$(basename $$i .cpython-$(EXT_VER)m.so); \
901 d=$${b}.cpython-$(EXT_VER)m-$(DEB_HOST_MULTIARCH).so; \
902 mv $$i $(d)/$(scriptdir)/lib-dynload/$$d; \
903 done
904
905 mkdir -p $(d)/usr/lib/python3
906 mv $(d)/usr/lib/python$(VER)/site-packages \
907 $(d)/usr/lib/python3/dist-packages
908 rm -f $(d)/usr/lib/python3/dist-packages/README*
909
910 : # remove files, which are not packaged
911 rm -rf $(d)/usr/lib/python$(VER)/ctypes/macholib
912 rm -f $(d)/usr/share/man/man1/python3.1
913
914 if [ -d $(d)/$(scriptdir)/ensurepip/_bundled ]; then \
915 echo "don't ship the prebuilt ensurepip/_bundled wheels."; \
916 rm -rf $(d)/$(scriptdir)/ensurepip/_bundled; \
917 fi
918
919 : # cannot build it, zlib maintainer won't provide a mingw build
920 find $(d) -name 'wininst*.exe' | xargs -r rm -f
921
922 mkdir -p $(d)/usr/share/man/man1
923 cp -p Misc/python.man $(d)/usr/share/man/man1/python$(VER).1
924 cp -p debian/pydoc.1 $(d)/usr/share/man/man1/pydoc$(VER).1
925
926 : # Symlinks to /usr/bin for some tools
927 ln -sf ../lib/python$(VER)/pdb.py $(d)/usr/bin/pdb$(VER)
928 cp -p debian/pdb.1 $(d)/usr/share/man/man1/pdb$(VER).1
929
930 : # versioned install only
931 rm -f $(d)/usr/bin/{idle3,pydoc3,python3,python3-config}
932 rm -f $(d)/usr/lib/*/pkgconfig/python3.pc
933 rm -f $(d)/usr/lib/*/pkgconfig/python3-embed.pc
934
935 dh_installdirs -p$(p_lib) \
936 usr/lib/$(DEB_HOST_MULTIARCH) \
937 $(scriptdir)/config-$(VER)m-$(DEB_HOST_MULTIARCH) \
938 usr/share/doc
939 : # install the shared library
940 cp -p $(buildd_shared)/libpython$(VER).so.1.0 \
941 $(d_lib)/usr/lib/$(DEB_HOST_MULTIARCH)/
942 dh_link -p$(p_lib) \
943 /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER).so.1.0 \
944 /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER).so.1 \
945 /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER).so.1 \
946 /$(scriptdir)/config-$(VER)-$(DEB_HOST_MULTIARCH)/libpython$(VER).so \
947 /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER).so.1 \
948 /$(scriptdir)/config-$(VER)-$(DEB_HOST_MULTIARCH)/libpython$(VER).so
949
950 ln -sf $(p_base) $(d_lib)/usr/share/doc/$(p_lib)
951
952 ln -sf libpython$(VER).so.1 $(d)/usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER).so
953
954 ifeq ($(with_interp),shared)
955 : # install the statically linked runtime
956 install -m755 $(buildd_static)/python $(d)/usr/bin/python$(VER)-static
957 endif
958
959 cp -p Tools/i18n/pygettext.py $(d)/usr/bin/pygettext$(VER)
960 cp -p debian/pygettext.1 $(d)/usr/share/man/man1/pygettext$(VER).1
961
962 : # install the Makefile of the shared python build
963 sed $(sysconfig_substflags) \
964 $(buildd_shared)/Makefile \
965 > $(d)/$(scriptdir)/config-$(VER)-$(DEB_HOST_MULTIARCH)/Makefile
966
967 : # Move the minimal libraries into $(p_lmin).
968 dh_installdirs -p$(p_lmin) \
969 etc/$(PVER) \
970 usr/bin \
971 usr/share/man/man1 \
972 $(scriptdir)/lib-dynload
973 -cd $(d); for i in $(MIN_EXTS); do \
974 test -e $(scriptdir)/lib-dynload/$$i.*.so \
975 && echo $(scriptdir)/lib-dynload/$$i.*.so; \
976 done
977
978 $(dh_compat2) dh_movefiles -p$(p_lmin) --sourcedir=$(d) \
979 $(foreach i,$(MIN_MODS),$(scriptdir)/$(i).py) \
980 $(foreach i,$(MIN_PACKAGES),$(scriptdir)/$(i)) \
981 $(foreach i,$(MIN_ENCODINGS),$(scriptdir)/$(i)) \
982 $(scriptdir)/site.py \
983 $(scriptdir)/_sysconfigdata__$(PLAT)_$(DEB_HOST_MULTIARCH).py \
984 `cd $(d); for i in $(MIN_EXTS); do \
985 test -e $(scriptdir)/lib-dynload/$$i.*.so \
986 && echo $(scriptdir)/lib-dynload/$$i.*.so; \
987 done`
988 -ls -l $(d_lmin)/$(scriptdir)/lib-dynload/*.so
989
990 : # Move the binary into $(p_min).
991 dh_installdirs -p$(p_min) \
992 usr/bin \
993 usr/share/man/man1
994 $(dh_compat2) dh_movefiles -p$(p_min) --sourcedir=$(d) \
995 usr/bin/python$(VER) \
996 usr/share/man/man1/python$(VER).1
997
998 rv=0; \
999 for i in $(MIN_EXTS); do \
1000 if [ -f $(d)/$(scriptdir)/lib-dynload/$$i.so ]; then \
1001 echo >&2 "extension $$i not mentioned in Setup.dist"; \
1002 rv=1; \
1003 fi; \
1004 done; \
1005 exit $$rv;
1006
1007 : # Install sitecustomize.py
1008 cp -p debian/sitecustomize.py $(d_lmin)/etc/$(PVER)/
1009 dh_link -p$(p_lmin) \
1010 /etc/$(PVER)/sitecustomize.py /$(scriptdir)/sitecustomize.py
1011
1012 : # Move the static library and the header files into $(p_dev).
1013 # mv $(d)/usr/share/include/python$(VER)/* $(d)/usr/include/python$(VER)/.
1014 # rm -rf $(d)/usr/share/include
1015
1016 sed -i $(sysconfig_substflags) \
1017 $(d)/usr/bin/$(PVER)-config
1018 cp $(d)/usr/bin/$(PVER)-config $(d)/usr/bin/$(DEB_HOST_MULTIARCH)-$(PVER)-config
1019
1020 dh_installdirs -p$(p_ldev) \
1021 usr/bin \
1022 $(scriptdir) \
1023 usr/include \
1024 usr/share/man/man1
1025
1026 $(dh_compat2) dh_movefiles -p$(p_ldev) --sourcedir=$(d) \
1027 usr/bin/$(DEB_HOST_MULTIARCH)-$(PVER)*-config \
1028 usr/lib/python$(VER)/config-$(VER)-$(DEB_HOST_MULTIARCH) \
1029 usr/include \
1030 usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER).{a,so} \
1031 usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/python-$(VER)*.pc
1032
1033 sed 's/@subdir@/$(PVER)/;s/@header@/pyconfig.h/' \
1034 debian/multiarch.h.in > $(d_ldev)/usr/include/$(PVER)/pyconfig.h
1035
1036 sed -i \
1037 -e '/^Cflags:/s,$$, -I$${includedir}/$(DEB_HOST_MULTIARCH)/python$(VER),' \
1038 -e '/^libdir=/d;s/-L\$${libdir} *//' \
1039 $(d_ldev)/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/python-$(VER).pc
1040
1041 dh_link -p$(p_ldev) \
1042 /usr/lib/$(PVER)/config-$(VER)-$(DEB_HOST_MULTIARCH)/libpython$(VER).a \
1043 /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER).a
1044
1045 cp -p $(buildd_shared)/libpython$(VER)-pic.a \
1046 $(d_ldev)/usr/lib/python$(VER)/config-$(VER)-$(DEB_HOST_MULTIARCH)/
1047
1048 mkdir -p $(d_ldev)/usr/src/$(PVER)/{Grammar,Parser}
1049 cp -p Grammar/python.gram $(d_ldev)/usr/src/$(PVER)/Grammar/.
1050 cp -p Parser/Python.asdl $(d_ldev)/usr/src/$(PVER)/Parser/.
1051
1052 # FIXME
1053 # : # symlinks for the "old" include directory name
1054 # ln -sf python$(VER)m $(d_ldev)/usr/include/python$(VER)
1055
1056 dh_installdirs -p$(p_dev) \
1057 usr/share/doc/python$(VER) \
1058 usr/share/man/man1 \
1059 $(scriptdir) \
1060 $(scriptdir)/doc/html
1061 cp -p Misc/HISTORY Misc/README.valgrind \
1062 debian/README.maintainers \
1063 debian/test_results $(buildd_static)/pybench.log \
1064 $(d_dev)/usr/share/doc/python$(VER)/
1065
1066 $(dh_compat2) dh_movefiles -p$(p_dev) --sourcedir=$(d) \
1067 usr/bin/python$(VER)*-config
1068
1069 : # in $(p_ldev), prefix python-config with triplets
1070 cp -p debian/python3-config.1 \
1071 $(d_ldev)/usr/share/man/man1/$(DEB_HOST_MULTIARCH)-$(PVER)-config.1
1072 ifneq ($(DEB_HOST_MULTIARCH),$(DEB_HOST_GNU_TYPE))
1073 ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)-config \
1074 $(d_ldev)/usr/bin/$(DEB_HOST_GNU_TYPE)-$(PVER)-config
1075 ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)-config.1.gz \
1076 $(d_ldev)/usr/share/man/man1/$(DEB_HOST_GNU_TYPE)-$(PVER)-config.1.gz
1077 endif
1078
1079 ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)-config $(d_dev)/usr/bin/$(PVER)-config
1080 ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)-config.1.gz $(d_dev)/usr/share/man/man1/$(PVER)-config.1.gz
1081
1082 ifeq ($(with_gdbm),yes)
1083 : # Move the gdbm extension file into $(p_gdbm).
1084 dh_installdirs -p$(p_gdbm) \
1085 $(scriptdir) \
1086 usr/lib/python$(VER)/lib-dynload
1087 $(dh_compat2) dh_movefiles -p$(p_gdbm) --sourcedir=$(d) \
1088 usr/lib/python$(VER)/lib-dynload/_gdbm*.so
1089 endif
1090
1091 ifeq ($(with_tk),yes)
1092 : # Move the Tkinter extension files into $(p_tk).
1093 dh_installdirs -p$(p_tk) \
1094 $(scriptdir) \
1095 usr/lib/python$(VER)/lib-dynload
1096 $(dh_compat2) dh_movefiles -p$(p_tk) --sourcedir=$(d) \
1097 usr/lib/python$(VER)/tkinter \
1098 usr/lib/python$(VER)/lib-dynload/_tkinter*.so
1099 endif
1100
1101 : # The test framework into $(p_lbase)
1102 $(dh_compat2) dh_movefiles -p$(p_lbase) --sourcedir=$(d) \
1103 $(scriptdir)/test/{libregrtest,support} \
1104 $(scriptdir)/test/typinganndata \
1105 $(scriptdir)/test/{regrtest,test_support,__init__,__main__}.py
1106
1107 : # The complete testsuite into $(p_ltst)
1108 $(dh_compat2) dh_movefiles -p$(p_ltst) --sourcedir=$(d) \
1109 $(scriptdir)/test
1110 rm -f $(d_ltst)/$(scriptdir)/test/test_ctypes/test_macholib.py
1111
1112 : # fixed upstream ...
1113 chmod -x $(d_ltst)/$(scriptdir)/test/{test_dbm_gnu,test_dbm_ndbm}.py
1114
1115 : # Move the demos and tools into $(p_exam)'s doc directory
1116 dh_installdirs -p$(p_exam) \
1117 usr/share/doc/python$(VER)/examples
1118 $(dh_compat2) dh_movefiles -p$(p_exam) --sourcedir=$(d) \
1119 $(scriptdir)/turtledemo
1120
1121 cp -rp Tools/* $(d_exam)/usr/share/doc/python$(VER)/examples/
1122 rm -rf $(d_exam)/usr/share/doc/python$(VER)/examples/Tools/{buildbot,msi}
1123 : # XXX: We don't need rgb.txt, we'll use our own:
1124 rm -rf $(d_exam)/usr/share/doc/python$(VER)/examples/Tools/pynche/X
1125
1126 : # IDLE
1127 mv $(d)/usr/bin/idle$(VER) $(d)/usr/bin/idle-python$(VER)
1128 rm -f $(d)/usr/lib/python$(VER)/idlelib/idle.bat
1129 dh_installdirs -p$(p_idle) \
1130 usr/bin \
1131 usr/share/man/man1
1132 $(dh_compat2) dh_movefiles -p$(p_idle) --sourcedir=$(d) \
1133 usr/bin/idle-python$(VER) \
1134 usr/lib/python$(VER)/idlelib
1135 cp -p debian/idle-$(PVER).1 $(d_idle)/usr/share/man/man1/
1136
1137 : # Move the docs into $(p_base)'s /usr/share/doc/$(PVER) directory,
1138 : # all other packages only have a copyright file.
1139 dh_installdocs -p$(p_base) \
1140 README.rst Misc/NEWS Misc/ACKS debian/README.venv
1141 ln -sf NEWS.gz $(d_base)/usr/share/doc/$(p_base)/changelog.gz
1142 dh_installdocs --all \
1143 -N$(p_base) -N$(p_dev) -N$(p_dbg) -N$(p_lib) \
1144 debian/README.Debian
1145
1146 : # IDLE has its own changelogs, docs...
1147 dh_installchangelogs -p$(p_idle) Lib/idlelib/ChangeLog
1148 dh_installdocs -p$(p_idle) Lib/idlelib/{NEWS2x,News3,README,TODO,extend}.txt
1149
1150 mkdir -p $(d_idle)/usr/share/applications
1151 cp -p debian/idle.desktop \
1152 $(d_idle)/usr/share/applications/idle-$(PVER).desktop
1153
1154 : # those packages have own README.Debian's
1155 install -m 644 -p debian/README.$(p_base) \
1156 $(d_base)/usr/share/doc/$(PVER)/README.Debian
1157 install -m 644 -p debian/README.$(p_idle) \
1158 $(d_idle)/usr/share/doc/$(p_idle)/README.Debian
1159 ifeq ($(with_tk),yes)
1160 mkdir -p $(d_tk)/usr/share/doc/$(p_base) $(d_tk)/usr/share/doc/$(p_tk)
1161 cp -p debian/README.Tk $(d_tk)/usr/share/doc/$(p_base)/
1162 ln -sf ../$(p_base)/README.Tk $(d_tk)/usr/share/doc/$(p_tk)/README.Tk
1163 endif
1164
1165 : # pyvenv and ensurepip files into $(p_venv)
1166 dh_installdirs -p$(p_venv) \
1167 usr/lib/python$(VER)
1168 dh_movefiles -p$(p_venv) \
1169 usr/lib/python$(VER)/ensurepip
1170
1171 : # library files into $(p_lbase)
1172 dh_installdirs -p$(p_lbase) \
1173 usr/lib
1174 dh_movefiles -p$(p_lbase) \
1175 usr/lib/python$(VER)
1176
1177 # Mark the interpreter as being PEP668 EXTERNALLY-MANAGED
1178 install -m 644 debian/EXTERNALLY-MANAGED \
1179 $(d_lbase)/$(scriptdir)
1180
1181 : # The rest goes into $(p_base)
1182 mkdir -p $(d)/usr/lib/python3/dist-packages
1183 (cd $(d) && tar cf - .) | (cd $(d_base) && tar xpf -)
1184 rm -f $(d_base)/usr/bin/python
1185
1186 : # Replace all '#!' calls to python with $(PY_INTERPRETER)
1187 : # and make them executable
1188 for p in $(shell dh_listpackages); do \
1189 [ -d debian/$$p ] || continue; \
1190 for i in `find debian/$$p -type f ! -name '*.so'`; do \
1191 sed '1s,#!.*python[^ ]*\(.*\),#! $(PY_INTERPRETER)\1,' \
1192 $$i > $$i.temp; \
1193 if cmp --quiet $$i $$i.temp; then \
1194 rm -f $$i.temp; \
1195 else \
1196 if [ ! -x $$i ]; then \
1197 echo "fixed x file permissions: $$i"; \
1198 fi; \
1199 mv -f $$i.temp $$i; \
1200 chmod 755 $$i; \
1201 echo "fixed interpreter: $$i"; \
1202 fi; \
1203 done; \
1204 done
1205
1206 : # Install menu icon
1207 dh_installdirs -p$(p_base) usr/share/pixmaps
1208 cp -p debian/pylogo.xpm $(d_base)/usr/share/pixmaps/$(PVER).xpm
1209
1210 : # generate binfmt file
1211 mkdir -p $(d_min)/usr/share/binfmts
1212 mkdir -p $(d_min)/usr/lib/binfmt.d
1213 ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
1214 $(buildd_static)/python debian/mkbinfmt.py $(PVER) \
1215 > $(d_min)/usr/share/binfmts/$(PVER)
1216 $(buildd_static)/python debian/mkbinfmtconf.py $(PVER) \
1217 > $(d_min)/usr/lib/binfmt.d/$(PVER).conf
1218 else
1219 $(PVER) debian/mkbinfmt.py $(PVER) > $(d_min)/usr/share/binfmts/$(PVER)
1220 $(PVER) debian/mkbinfmtconf.py $(PVER) > $(d_min)/usr/lib/binfmt.d/$(PVER).conf
1221 endif
1222
1223 : # desktop entry
1224 mkdir -p $(d_base)/usr/share/applications
1225 cp -p debian/$(PVER).desktop \
1226 $(d_base)/usr/share/applications/$(PVER).desktop
1227
1228 : # remove some things
1229 -find debian -name .cvsignore | xargs rm -f
1230 -find debian -name '*.py[co]' | xargs rm -f
1231
1232 : # remove empty directories, when all components are in place
1233 -find debian ! -name lib-dynload ! -name dist-packages -type d -empty -delete
1234
1235 : # install debug package
1236 rm -rf $(d)-dbg
1237 install -d $(d)-dbg/$(scriptdir)/lib-dynload
1238 $(MAKE) -C $(buildd_debug) install DESTDIR=$(CURDIR)/$(d)-dbg
1239 : # install the Makefile of the shared python debug build
1240 sed $(sysconfig_substflags) \
1241 $(buildd_shdebug)/Makefile \
1242 > $(d)-dbg/$(scriptdir)/config-$(VER)d-$(DEB_HOST_MULTIARCH)/Makefile
1243 sed $(sysconfig_substflags) \
1244 $(buildd_shdebug)/$(shell cat $(buildd_shdebug)/pybuilddir.txt)/_sysconfigdata_d_$(PLAT)_$(DEB_HOST_MULTIARCH).py \
1245 > $(d)-dbg/$(scriptdir)/_sysconfigdata_d_$(PLAT)_$(DEB_HOST_MULTIARCH).py
1246 sed -i $(sysconfig_substflags) \
1247 $(d)-dbg/$(scriptdir)/_sysconfigdata_d_$(PLAT)_$(DEB_HOST_MULTIARCH).py
1248
1249 for i in $(d)-dbg/$(scriptdir)/lib-dynload/*.so; do \
1250 case "$$i" in *$(DEB_HOST_MULTIARCH)*) continue; esac; \
1251 b=$$(basename $$i .cpython-$(EXT_VER)d.so); \
1252 d=$${b}.cpython-$(EXT_VER)d-$(DEB_HOST_MULTIARCH).so; \
1253 mv $$i $(d)-dbg/$(scriptdir)/lib-dynload/$$d; \
1254 done
1255
1256 dh_installdirs -p$(p_ldbg) \
1257 usr/bin \
1258 usr/share/man/man1 \
1259 $(scriptdir)/lib-dynload \
1260 usr/include/$(PVER)d \
1261 usr/include/$(DEB_HOST_MULTIARCH)/$(PVER)d \
1262 usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig
1263
1264 cp -p $(d)-dbg/$(scriptdir)/lib-dynload/*.so \
1265 $(d_ldbg)/$(scriptdir)/lib-dynload/
1266 cp -p $(d)-dbg/$(scriptdir)/_sysconfigdata_d_$(PLAT)_$(DEB_HOST_MULTIARCH).py \
1267 $(d_ldbg)/$(scriptdir)/
1268 cp -p $(buildd_shdebug)/libpython$(VER)d.so.1.0 \
1269 $(d_ldbg)/usr/lib/$(DEB_HOST_MULTIARCH)/
1270 dh_link -p$(p_ldbg) \
1271 /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)d.so.1.0 \
1272 /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)d.so.1 \
1273 /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)d.so.1 \
1274 /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)d.so
1275 cp $(d)-dbg/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/python-$(VER)d.pc \
1276 $(d_ldbg)/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/.
1277 ln -s python-$(VER)d.pc \
1278 $(d_ldbg)/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/python-$(VER)-dbg.pc
1279 cp $(d)-dbg/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/python-$(VER)d-embed.pc \
1280 $(d_ldbg)/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/.
1281 ln -s python-$(VER)d-embed.pc \
1282 $(d_ldbg)/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/python-$(VER)-dbg-embed.pc
1283
1284 dh_installdirs -p$(p_dbg) \
1285 usr/bin \
1286 usr/share/man/man1 \
1287 usr/share/doc/$(p_base)
1288 cp -p Misc/SpecialBuilds.txt $(d_dbg)/usr/share/doc/$(p_base)/
1289 cp -p debian/$(PVER)-dbg.README.Debian \
1290 $(d_dbg)/usr/share/doc/$(p_base)/README.debug
1291 cp -p $(buildd_debug)/python $(d_dbg)/usr/bin/$(PVER)d
1292 ln -sf python$(VER)d $(d_dbg)/usr/bin/$(PVER)-dbg
1293
1294 ifneq ($(with_dbmmodule),yes)
1295 rm -f $(d_lbase)/$(scriptdir)/lib-dynload/_dbm*.so
1296 rm -f $(d_ldbg)/$(scriptdir)/lib-dynload/_dbm*.so
1297 endif
1298
1299 cp -a $(d)-dbg/$(scriptdir)/config-$(VER)d-$(DEB_HOST_MULTIARCH) \
1300 $(d_ldbg)/$(scriptdir)/
1301 dh_link -p$(p_ldbg) \
1302 /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)d.so \
1303 /$(scriptdir)/config-$(VER)d-$(DEB_HOST_MULTIARCH)/libpython$(VER)d.so \
1304 /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)d.so \
1305 /$(scriptdir)/config-$(VER)d-$(DEB_HOST_MULTIARCH)/libpython$(VER).so \
1306 /$(scriptdir)/config-$(VER)d-$(DEB_HOST_MULTIARCH)/libpython$(VER)d.a \
1307 /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)d.a
1308
1309 for i in $(d_ldev)/usr/include/$(PVER)/*; do \
1310 i=$$(basename $$i); \
1311 case $$i in pyconfig.h) continue; esac; \
1312 ln -sf ../$(PVER)/$$i $(d_ldbg)/usr/include/$(PVER)d/$$i; \
1313 done
1314 cp -p $(buildd_debug)/pyconfig.h $(d_ldbg)/usr/include/$(DEB_HOST_MULTIARCH)/$(PVER)d/
1315 sed 's/@subdir@/$(PVER)d/;s/@header@/pyconfig.h/' \
1316 debian/multiarch.h.in > $(d_ldbg)/usr/include/$(PVER)d/pyconfig.h
1317
1318 ln -sf $(PVER).1.gz $(d_dbg)/usr/share/man/man1/$(PVER)-dbg.1.gz
1319
1320 : # in $(p_ldbg), prefix python-config with triplets
1321 sed -i $(sysconfig_substflags) \
1322 $(d)-dbg/usr/bin/$(PVER)d-config
1323 cp $(d)-dbg/usr/bin/$(PVER)d-config \
1324 $(d_ldbg)/usr/bin/$(DEB_HOST_MULTIARCH)-$(PVER)d-config
1325 ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)d-config \
1326 $(d_ldbg)/usr/bin/$(DEB_HOST_MULTIARCH)-$(PVER)-dbg-config
1327 ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)-config.1.gz \
1328 $(d_ldbg)/usr/share/man/man1/$(DEB_HOST_MULTIARCH)-$(PVER)d-config.1.gz
1329 ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)-config.1.gz \
1330 $(d_ldbg)/usr/share/man/man1/$(DEB_HOST_MULTIARCH)-$(PVER)-dbg-config.1.gz
1331 ifneq ($(DEB_HOST_MULTIARCH),$(DEB_HOST_GNU_TYPE))
1332 ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)d-config \
1333 $(d_ldbg)/usr/bin/$(DEB_HOST_GNU_TYPE)-$(PVER)d-config
1334 ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)-config.1.gz \
1335 $(d_ldbg)/usr/share/man/man1/$(DEB_HOST_GNU_TYPE)-$(PVER)d-config.1.gz
1336 ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)d-config \
1337 $(d_ldbg)/usr/bin/$(DEB_HOST_GNU_TYPE)-$(PVER)-dbg-config
1338 ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)d-config.1.gz \
1339 $(d_ldbg)/usr/share/man/man1/$(DEB_HOST_GNU_TYPE)-$(PVER)-dbg-config.1.gz
1340 endif
1341 ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)d-config $(d_dbg)/usr/bin/$(PVER)d-config
1342 ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)d-config.1.gz $(d_dbg)/usr/share/man/man1/$(PVER)d-config.1.gz
1343
1344 ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)-dbg-config $(d_dbg)/usr/bin/$(PVER)-dbg-config
1345 ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)-dbg-config.1.gz $(d_dbg)/usr/share/man/man1/$(PVER)-dbg-config.1.gz
1346
1347 : # symlinks for the "old" include / config directory names
1348 ln -sf $(PVER)-config.1.gz $(d_dbg)/usr/share/man/man1/$(PVER)-dbg-config.1.gz
1349 ln -sf $(PVER).1.gz $(d_dbg)/usr/share/man/man1/$(PVER)d.1.gz
1350 ln -sf $(PVER)-config.1.gz $(d_dbg)/usr/share/man/man1/$(PVER)d-config.1.gz
1351
1352 ifeq ($(with_udeb),yes)
1353 : # Copy the most important files from $(p_min) into $(p_udeb).
1354 dh_installdirs -p$(p_udeb) \
1355 etc/$(PVER) \
1356 usr/bin \
1357 usr/include/$(PVER)u \
1358 $(scriptdir)/lib-dynload \
1359 $(scriptdir)/config-$(VER)-$(DEB_HOST_MULTIARCH)
1360 cp -p $(d_min)/usr/bin/python$(VER) $(d_udeb)/usr/bin/
1361 ln -sf python$(VER)u $(d_udeb)/usr/bin/python$(VER)
1362 ln -sf python$(VER) $(d_udeb)/usr/bin/python3
1363 cp -p $(foreach i,$(MIN_MODS),$(d_min)/$(scriptdir)/$(i).py) \
1364 $(d_udeb)/$(scriptdir)/
1365 cp -a $(foreach i,$(MIN_PACKAGES),$(d_min)/$(scriptdir)/$(i)) \
1366 $(d_udeb)/$(scriptdir)/
1367 cp -p $(foreach i,$(MIN_ENCODINGS),$(d_min)/$(scriptdir)/$(i)) \
1368 $(d_udeb)/$(scriptdir)/
1369 cp -p $(d_min)/$(scriptdir)/config-$(VER)-$(DEB_HOST_MULTIARCH)/Makefile \
1370 $(d_udeb)/$(scriptdir)/config-$(VER)-$(DEB_HOST_MULTIARCH)/
1371 cp -p $(d_min)/usr/include/$(DEB_HOST_MULTIARCH)/$(PVER)/pyconfig.h \
1372 $(d_udeb)/usr/include/$(DEB_HOST_MULTIARCH)/$(PVER)/
1373 cp -p $(d_min)/$(scriptdir)/site.py $(d_udeb)/$(scriptdir)/
1374 cp -p debian/sitecustomize.py $(d_udeb)/etc/$(PVER)/
1375 dh_link -p$(p_udeb) /etc/$(PVER)/sitecustomize.py \
1376 /$(scriptdir)/sitecustomize.py
1377 endif
1378
1379 ifeq ($(with_nopie),yes)
1380 dh_installdirs -p$(p_npie) \
1381 usr/bin
1382 cp -p $(buildd_nopie)/python $(d_npie)/usr/bin/$(PVER)
1383 endif
1384
1385 # Compatibility with older python3.X builds carrying sysconfigdata-name.diff
1386 dh_link -p$(p_lmin) \
1387 /usr/lib/python$(VER)/_sysconfigdata__$(PLAT)_$(DEB_HOST_MULTIARCH).py \
1388 /usr/lib/python$(VER)/_sysconfigdata__$(DEB_HOST_MULTIARCH).py
1389 dh_link -p$(p_ldbg) \
1390 /usr/lib/python$(VER)/_sysconfigdata_d_$(PLAT)_$(DEB_HOST_MULTIARCH).py \
1391 /usr/lib/python$(VER)/_sysconfigdata_d_$(DEB_HOST_MULTIARCH).py
1392
1393 for i in debian/*.overrides; do \
1394 b=$$(basename $$i .overrides); \
1395 install -D -m 644 $$i debian/$$b/usr/share/lintian/overrides/$$b; \
1396 done
1397
1398 touch stamps/stamp-install
1399
1400 # Build architecture-independent files here.
1401 binary-indep: build-indep install stamps/stamp-control
1402 dh_testdir -i
1403 dh_testroot -i
1404
1405 : # $(p_doc) package
1406 dh_installdirs -p$(p_doc) \
1407 usr/share/doc/$(p_base) \
1408 usr/share/doc/$(p_doc)
1409 dh_installdocs -p$(p_doc)
1410 cp -a Doc/build/html $(d_doc)/usr/share/doc/$(p_base)/
1411 rm -f $(d_doc)/usr/share/doc/$(p_base)/html/_static/jquery.js
1412 dh_link -p$(p_doc) \
1413 /usr/share/doc/$(p_base)/html /usr/share/doc/$(p_doc)/html \
1414 /usr/share/javascript/jquery/jquery.js /usr/share/doc/$(p_base)/html/_static/jquery.js \
1415 /usr/share/javascript/underscore/underscore.js /usr/share/doc/$(p_base)/html/_static/underscore.js
1416 dh_installinfo -p$(p_doc)
1417 for f in $(d_doc)/usr/share/doc/$(p_base)/html/_images/*.png; do \
1418 b=$$(basename $$f); \
1419 dh_link -p$(p_doc) /usr/share/doc/$(p_base)/html/_images/$$b /usr/share/info/$(PVER)/$$b; \
1420 done
1421
1422 : # devhelp docs
1423 cd $(buildd_static) && ./python ../debian/pyhtml2devhelp.py \
1424 ../$(d_doc)/usr/share/doc/$(p_base)/html index.html $(VER) \
1425 > ../$(d_doc)/usr/share/doc/$(p_base)/html/$(PVER).devhelp
1426 gzip -9nv $(d_doc)/usr/share/doc/$(p_base)/html/$(PVER).devhelp
1427 dh_link -p$(p_doc) \
1428 /usr/share/doc/$(p_base)/html /usr/share/devhelp/books/$(PVER)
1429
1430 : # regenerate idlelib/help.html, see idlelib.help.copy_strip
1431 sed 's/ *$$//' Doc/build/html/library/idle.html \
1432 > $(d_idle)/usr/lib/python$(VER)/idlelib/help.html
1433
1434 for i in $(p_ltst); do \
1435 rm -rf debian/$$i/usr/share/doc/$$i; \
1436 ln -s $(p_base) debian/$$i/usr/share/doc/$$i; \
1437 done
1438
1439 dh_installdebconf -i $(dh_args)
1440 dh_installexamples -i $(dh_args)
1441 -dh_icons -i $(dh_args) || dh_iconcache -i $(dh_args)
1442 dh_installchangelogs -i $(dh_args)
1443 dh_link -i $(dh_args)
1444 dh_compress -i $(dh_args) -X.py -X.cls -X.css -X.txt -X.json -X.js -Xobjects.inv
1445 dh_fixperms -i $(dh_args)
1446
1447 : # make python scripts starting with '#!' executable
1448 for i in `find debian -mindepth 3 -type f ! -name '*.dpatch' ! -perm 755`; do \
1449 if head -1 $$i | grep -q '^#!'; then \
1450 chmod 755 $$i; \
1451 echo "make executable: $$i"; \
1452 fi; \
1453 done
1454 -find $(d_doc) -name '*.txt' -perm 755 -exec chmod 644 {} \;
1455
1456 dh_installdeb -i $(dh_args)
1457 dh_gencontrol -i $(dh_args)
1458 dh_md5sums -i $(dh_args)
1459 dh_builddeb -i $(dh_args)
1460
1461 # Build architecture-dependent files here.
1462 binary-arch: build-arch install
1463 dh_testdir -a
1464 dh_testroot -a
1465 # dh_installdebconf -a
1466 dh_installexamples -a
1467 dh_installmenu -a
1468 -dh_icons -a || dh_iconcache -a
1469 # dh_installmime -a
1470 dh_installchangelogs -a
1471 for i in $(p_dev) $(p_dbg) $(p_venv) $(p_full); do \
1472 rm -rf debian/$$i/usr/share/doc/$$i; \
1473 ln -s $(p_base) debian/$$i/usr/share/doc/$$i; \
1474 done
1475 for i in $(p_lbase); do \
1476 rm -rf debian/$$i/usr/share/doc/$$i; \
1477 ln -s $(p_lmin) debian/$$i/usr/share/doc/$$i; \
1478 done
1479 for i in $(p_ldev) $(p_ldbg) $(p_lib); do \
1480 rm -rf debian/$$i/usr/share/doc/$$i; \
1481 ln -s $(p_lbase) debian/$$i/usr/share/doc/$$i; \
1482 done
1483 -find debian ! -perm -200 -print -exec chmod +w {} \;
1484 ifneq ($(with_tk),yes)
1485 rm -f $(d_lbase)/$(scriptdir)/tkinter
1486 rm -f $(d_lbase)/$(scriptdir)/lib-dynload/_tkinter*.so
1487 rm -f $(d_ldbg)/$(scriptdir)/lib-dynload/_tkinter*.so
1488 endif
1489 ifneq ($(with_gdbm),yes)
1490 rm -f $(d_lbase)/$(scriptdir)/lib-dynload/_gdbm*.so
1491 rm -f $(d_ldbg)/$(scriptdir)/lib-dynload/_gdbm*.so
1492 endif
1493
1494 find $(d_ldbg) $(d_ldev) -name '*.a' ! -type l \
1495 | xargs -n 1 $(DEB_HOST_GNU_TYPE)-objcopy -p --remove-section=.gnu.lto_.*
1496 dh_strip -a -N$(p_dbg) -N$(p_ldbg) -Xdebug -Xdbg --dbg-package=$(p_dbg)
1497 mkdir -p $(d_dbg)/usr/share/gdb/auto-load/usr/bin
1498 cp Tools/gdb/libpython.py $(d_dbg)/usr/share/gdb/auto-load/usr/bin/$(PVER)-gdb.py
1499 ln -sf $(PVER)-gdb.py $(d_dbg)/usr/share/gdb/auto-load/usr/bin/$(PVER)d-gdb.py
1500 ln -sf $(PVER)-gdb.py $(d_dbg)/usr/share/gdb/auto-load/usr/bin/$(PVER)-dbg-gdb.py
1501 mkdir -p $(d_dbg)/usr/share/gdb/auto-load/usr/lib/$(DEB_HOST_MULTIARCH)
1502 ln -sf ../../bin/$(PVER)-gdb.py \
1503 $(d_dbg)/usr/share/gdb/auto-load/usr/lib/$(DEB_HOST_MULTIARCH)/lib$(PVER).so.1.0-gdb.py
1504 ln -sf ../../bin/$(PVER)-gdb.py \
1505 $(d_dbg)/usr/share/gdb/auto-load/usr/lib/$(DEB_HOST_MULTIARCH)/lib$(PVER)d.so.1.0-gdb.py
1506 dh_link -a
1507 dh_compress -a -X.py
1508 dh_fixperms -a
1509 chmod 644 $(d_lmin)/$(scriptdir)/token.py
1510
1511 : # make python scripts starting with '#!' executable
1512 for i in `find debian -mindepth 3 -type f ! -perm 755`; do \
1513 if head -1 $$i | grep -q '^#!'; then \
1514 chmod 755 $$i; \
1515 echo "make executable: $$i"; \
1516 fi; \
1517 done
1518
1519 dh_makeshlibs -p$(p_lib) -V '$(p_lib)'
1520 dh_makeshlibs -p$(p_ldbg) -V '$(p_ldbg)'
1521 # don't include the following symbols, found in extensions
1522 # which either can be built as builtin or extension.
1523 sed -ri \
1524 -e '/^ (PyInit_|_add_one_to_index|asdl_)/d' \
1525 -e '/^ (PyExpat_XML_|PyExpat_Xml)/d' \
1526 -e '/^ (ffi_type_|_ctypes_)/d' \
1527 $(d_lib)/DEBIAN/symbols $(d_ldbg)/DEBIAN/symbols
1528 dh_installdeb -a
1529 dh_shlibdeps -a
1530 dep=`sed -n '/^shlibs:Depends/s/[^=]*=\(.*\)/\1/p' $(d_min).substvars | awk -v RS=', ' -v ORS=', ' '/^libc6/ { print }'`; \
1531 echo "shlibs:Pre-Depends=$$dep" >> $(d_min).substvars
1532 sed -i '/^shlibs:Depends/s/libc6[^,]*[, ]*//g' $(d_min).substvars
1533 dh_gencontrol -a -- $(arch_substvars)
1534 dh_md5sums -a
1535 dh_builddeb -a
1536
1537 # rules to patch the unpacked files in the source directory
1538 # ---------------------------------------------------------------------------
1539 # various rules to unpack addons and (un)apply patches.
1540 # - patch / apply-patches
1541 # - unpatch / reverse-patches
1542
1543 patchdir = debian/patches
1544
1545 patch: stamps/stamp-patch
1546 stamps/stamp-patch:
1547 dh_testdir
1548 uname -a
1549 @echo USER=$$USER, LOGNAME=$$LOGNAME
1550 @grep ^Mem /proc/meminfo
1551 @echo "DEB_BUILD_OPTIONS: $$DEB_BUILD_OPTIONS"
1552
1553 rm -rf autom4te.cache configure
1554 autoconf
1555 mkdir -p stamps
1556 echo ""; echo "Patches applied in this version:" > stamps/pxx
1557 for i in $$(cat $(patchdir)/series); do \
1558 case "$$i" in \#*) continue; esac; \
1559 echo ""; echo "$$i:"; \
1560 sed -n 's/^# *DP: */ /p' $(patchdir)/$$i; \
1561 done >> stamps/pxx
1562
1563 touch Parser/parser.c Parser/token.c
1564 touch Objects/obmalloc.c Python/dynamic_annotations.c \
1565 Python/mysnprintf.c Python/pyctype.c
1566
1567 ln -sf site-packages Lib/dist-packages
1568
1569 touch Lib/test/certdata/nullcert.pem
1570 touch Lib/test/libregrtest/__init__.py
1571 touch Lib/test/tokenizedata/__init__.py
1572
1573 # Check if patchlevel-noplus.diff is missing
1574 grep -Eq '^#define PY_VERSION +"[^+]+"$$' Include/patchlevel.h
1575
1576 mv stamps/pxx $@
1577
1578 reverse-patches: unpatch
1579 unpatch:
1580 rm -rf configure autom4te.cache
1581
1582 update-patches: $(patchdir)/series
1583 export QUILT_PATCHES=$(patchdir); \
1584 while quilt push; do quilt refresh -pab --no-timestamps --no-index; done
1585
1586 binary: binary-indep binary-arch
1587
1588 .NOTPARALLEL:
1589 .PHONY: control-file configure build clean binary-indep binary-arch binary install
1590
1591 # Local Variables:
1592 # mode: makefile
1593 # end: