#!/usr/bin/make -f unexport LANG LC_ALL LC_CTYPE LC_COLLATE LC_TIME LC_NUMERIC LC_MESSAGES unexport CFLAGS CXXFLAGS CPPFLAGS LDFLAGS export SHELL = /bin/bash # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 vafilt = $(subst $(2)=,,$(filter $(2)=%,$(1))) DPKG_VARS := $(shell dpkg-architecture) DEB_BUILD_ARCH ?= $(call vafilt,$(DPKG_VARS),DEB_BUILD_ARCH) DEB_BUILD_GNU_TYPE ?= $(call vafilt,$(DPKG_VARS),DEB_BUILD_GNU_TYPE) DEB_HOST_ARCH ?= $(call vafilt,$(DPKG_VARS),DEB_HOST_ARCH) DEB_HOST_ARCH_BITS ?= $(call vafilt,$(DPKG_VARS),DEB_HOST_ARCH_BITS) DEB_HOST_ARCH_ENDIAN ?= $(call vafilt,$(DPKG_VARS),DEB_HOST_ARCH_ENDIAN) DEB_HOST_ARCH_OS ?= $(call vafilt,$(DPKG_VARS),DEB_HOST_ARCH_OS) DEB_HOST_GNU_TYPE ?= $(call vafilt,$(DPKG_VARS),DEB_HOST_GNU_TYPE) DEB_HOST_MULTIARCH ?= $(call vafilt,$(DPKG_VARS),DEB_HOST_MULTIARCH) changelog_values := $(shell dpkg-parsechangelog \ | awk '/^(Version|Source):/ {print $$2}') PKGSOURCE := $(word 1, $(changelog_values)) PKGVERSION := $(word 2, $(changelog_values)) LAST_CHANGE := $(shell dpkg-parsechangelog -S Date) export BUILD_DATE := $(shell LC_ALL=C date -u +'%b %e %Y' -d '$(LAST_CHANGE)') export BUILD_TIME := $(shell LC_ALL=C date -u +'%H:%M:%S' -d '$(LAST_CHANGE)') SPHINXOPTS := -D today='$(shell LC_ALL=C date -u +'%B %d, %Y' -d '$(LAST_CHANGE)')' SPHINXOPTS += -D html_last_updated_fmt='$(shell LC_ALL=C date -u +'%B %d, %Y' -d '$(LAST_CHANGE)')' export SPHINXOPTS on_buildd := $(shell [ -f /CurrentlyBuilding -o "$$LOGNAME" = buildd -o "$$USER" = buildd ] && echo yes) dh_compat2 := $(shell dpkg --compare-versions "$$(dpkg-query -f '$${Version}' -W debhelper)" lt 9.20150811ubuntu2 && echo DH_COMPAT=2) ifneq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS))) WITHOUT_CHECK := yes endif WITHOUT_BENCH := ifneq (,$(findstring nobench, $(DEB_BUILD_OPTIONS))) WITHOUT_BENCH := yes endif ifneq (,$(filter $(DEB_HOST_ARCH), hurd-i386)) WITHOUT_BENCH := disabled on $(DEB_HOST_ARCH) endif ifeq ($(on_buildd),yes) ifneq (,$(findstring $(DEB_HOST_ARCH), hppa mips mipsel mipsn32 mipsn32el mips64 mips64el mipsr6 mipsr6el mipsn32r6 mipsn32r6el mips64r6 mips64r6el s390)) WITHOUT_CHECK := yes endif endif ifneq (,$(filter $(DEB_HOST_ARCH), hurd-i386 kfreebsd-amd64 kfreebsd-i386)) WITHOUT_CHECK := yes endif ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) WITHOUT_BENCH := yes WITHOUT_CHECK := yes endif COMMA = , ifneq (,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS)))) NJOBS := -j $(subst parallel=,,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS)))) endif distribution := $(shell lsb_release -is) distrelease := $(shell lsb_release -cs) derivative := $(shell if dpkg-vendor --derives-from Ubuntu; then echo Ubuntu; \ elif dpkg-vendor --derives-from Debian; then echo Debian; \ else echo Unknown; fi) VER=2.7 NVER=2.8 PVER=python2.7 PRIORITY=$(shell echo $(VER) | tr -d '.')0 PREVVER := $(shell awk '/^python/ && NR > 1 {print substr($$2,2,length($$2)-2); exit}' debian/changelog) # default versions are built from the python-defaults source package # keep the definition to adjust package priorities. DEFAULT_VERSION = yes STATIC_PYTHON=yes MIN_MODS := $(shell awk '/^ / && $$2 == "module" { print $$1 }' \ debian/PVER-minimal.README.Debian.in) MIN_EXTS := $(shell awk '/^ / && $$2 ~ /^extension/ { print $$1 }' \ debian/PVER-minimal.README.Debian.in) MIN_BUILTINS := $(shell awk '/^ / && $$2 == "builtin" { print $$1 }' \ debian/PVER-minimal.README.Debian.in) MIN_PACKAGES := $(shell awk '/^ / && $$2 == "package" { print $$1 }' \ debian/PVER-minimal.README.Debian.in) MIN_ENCODINGS := $(foreach i, \ $(filter-out \ big5% bz2% cp932.py cp949.py cp950.py euc_% \ gb% iso2022% johab.py shift_jis% , \ $(shell cd Lib/encodings && echo *.py)), \ encodings/$(i)) \ codecs.py stringprep.py with_tk := no with_gdbm := no with_interp := static #with_interp := shared PY_INTERPRETER = /usr/bin/python$(VER) ifeq ($(DEFAULT_VERSION),yes) ifneq (,$(filter $(distrelease),lenny etch squeeze wheezy lucid precise trusty xenial yakkety)) PY_PRIO = standard else PY_PRIO = optional endif #PYSTDDEP = , python (>= $(VER)) PY_MINPRIO = $(PY_PRIO) else PY_PRIO = optional PY_MINPRIO = $(PY_PRIO) endif ifneq (,$(filter $(distrelease),stretch lenny squeeze wheezy precise xenial yakkety zesty)) with_fpectl = yes endif ifeq (,$(filter $(distrelease),lenny etch squeeze wheezy lucid maverick natty oneiric)) bd_qual = :any endif ifeq (,$(filter $(distrelease),lenny etch squeeze wheezy lucid maverick natty oneiric)) ma_filter = cat else ma_filter = grep -v '^Multi-Arch:' endif ifneq (,$(filter $(distrelease),jessie experimental)) bd_gcc = endif ifeq (,$(filter $(distrelease),lenny etch squeeze wheezy lucid maverick natty oneiric precise quantal raring saucy trusty)) bd_dpkgdev = dpkg-dev (>= 1.17.11), endif ifeq (,$(filter $(distrelease),lenny etch squeeze wheezy lucid maverick natty oneiric precise quantal raring saucy trusty utopic vivid wily xenial)) pf_bluetooth = $(EMPTY) endif CC = $(DEB_HOST_GNU_TYPE)-gcc CXX=$(DEB_HOST_GNU_TYPE)-g++ AR=$(DEB_HOST_GNU_TYPE)-ar RANLIB=$(DEB_HOST_GNU_TYPE)-ranlib DPKG_CFLAGS := $(shell dpkg-buildflags --get CPPFLAGS; dpkg-buildflags --get CFLAGS) DPKG_CFLAGS := $(subst -fstack-protector-strong,-fstack-protector,$(DPKG_CFLAGS)) DPKG_LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS) OPT_CFLAGS := $(filter-out -O%,$(DPKG_CFLAGS)) # default is -O3 DEBUG_CFLAGS := $(filter-out -D_FORTIFY_SOURCE=%,$(patsubst -O%,-O0,$(DPKG_CFLAGS))) # on alpha, use -O2 only, use -mieee ifeq ($(DEB_HOST_ARCH),alpha) OPT_CFLAGS += -mieee DEBUG_CFLAGS += -mieee EXTRA_OPT_FLAGS += -O2 endif # issues with ia64 and m68k with -O3 ifeq ($(DEB_HOST_ARCH),m68k) EXTRA_OPT_FLAGS += -O2 endif ifneq (,$(filter $(DEB_HOST_ARCH), ppc64 ppc64el)) OPT_CFLAGS += -fexceptions DEBUG_CFLAGS += -fexceptions endif ifeq ($(DEB_HOST_ARCH_OS),linux) ifneq (,$(filter $(DEB_HOST_ARCH), amd64 arm64 armel armhf i386 powerpc ppc64 ppc64el s390x x32)) with_pgo := yes endif endif ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) with_pgo := endif ifneq (,$(filter $(DEB_HOST_ARCH), amd64 arm64 armel armhf i386 powerpc ppc64 ppc64el s390x x32)) with_lto := yes endif ifeq ($(with_lto),yes) LTO_CFLAGS = -g -flto -fuse-linker-plugin with_fat_lto := $(shell dpkg --compare-versions $$($(CC) --version \ | sed -n '/^$(CC)/s/.* //p') ge 4.9 && echo yes) ifeq ($(with_fat_lto),yes) LTO_CFLAGS += -ffat-lto-objects endif EXTRA_OPT_CFLAGS += $(LTO_CFLAGS) AR=$(DEB_HOST_GNU_TYPE)-gcc-ar RANLIB=$(DEB_HOST_GNU_TYPE)-gcc-ranlib endif ifneq ($(with_fpectl),yes) ifeq ($(derivative),Ubuntu) arch_substvars = '-Vpyfpe:Breaks=$(shell tr '\n' ' ' < debian/pyfpe-breaks.$(derivative))' else ifeq ($(derivative),Debian) arch_substvars = '-Vpyfpe:Breaks=$(shell tr '\n' ' ' < debian/pyfpe-breaks.$(derivative))' endif endif make_build_target = $(if $(with_pgo),profile-opt) buildd_static := $(CURDIR)/build-static buildd_shared := $(CURDIR)/build-shared buildd_debug := $(CURDIR)/build-debug buildd_shdebug := $(CURDIR)/build-shdebug d := debian/tmp scriptdir = usr/share/lib/python$(VER) scriptdir = usr/share/python$(VER) scriptdir = usr/lib/python$(VER) # package names and directories p_base := $(PVER) p_min := $(PVER)-minimal p_lib := lib$(PVER) p_tk := $(PVER)-tk p_gdbm := $(PVER)-gdbm p_dev := $(PVER)-dev p_exam := $(PVER)-examples p_idle := idle-$(PVER) p_doc := $(PVER)-doc p_dbg := $(PVER)-dbg p_lbase := lib$(PVER)-stdlib p_lmin := lib$(PVER)-minimal p_ldev := lib$(PVER)-dev p_ldbg := lib$(PVER)-dbg p_ltst := lib$(PVER)-testsuite d_base := debian/$(p_base) d_min := debian/$(p_min) d_lib := debian/$(p_lib) d_tk := debian/$(p_tk) d_gdbm := debian/$(p_gdbm) d_dev := debian/$(p_dev) d_exam := debian/$(p_exam) d_idle := debian/$(p_idle) d_doc := debian/$(p_doc) d_dbg := debian/$(p_dbg) d_lbase := debian/$(p_lbase) d_lmin := debian/$(p_lmin) d_ldev := debian/$(p_ldev) d_ldbg := debian/$(p_ldbg) d_ltst := debian/$(p_ltst) build-arch: stamps/stamp-build build-indep: stamps/stamp-build-doc build: build-arch stamps/stamp-build: stamps/stamp-build-static stamps/stamp-mincheck \ stamps/stamp-build-shared stamps/stamp-build-debug \ stamps/stamp-build-shared-debug \ stamps/stamp-check stamps/stamp-pystone stamps/stamp-pybench touch $@ PROFILE_EXCLUDES = test_compiler test_distutils test_platform test_subprocess \ test_multiprocessing test_cprofile \ test_thread test_threaded_import test_threadedtempfile \ test_socketserver \ test_threading test_threading_local test_threadsignals \ test_dbm_dumb test_dbm_ndbm test_pydoc test_sundry test_gdb \ ifneq (,$(filter $(DEB_HOST_ARCH), arm armel)) PROFILE_EXCLUDES += test_float endif ifneq (,$(filter $(DEB_HOST_ARCH), sparc kfreebsd-amd64 kfreebsd-i386)) PROFILE_EXCLUDES += test_io endif PROFILE_EXCLUDES += test_zipfile PROFILE_EXCLUDES += test_xmlrpc PROFILE_EXCLUDES += test_bsddb3 PROFILE_TASK = ../Lib/test/regrtest.py \ -x $(sort $(TEST_EXCLUDES) $(PROFILE_EXCLUDES)) stamps/stamp-build-static: stamps/stamp-configure-static dh_testdir $(MAKE) $(NJOBS) -C $(buildd_static) \ EXTRA_CFLAGS="$(EXTRA_OPT_CFLAGS)" \ PROFILE_TASK='$(PROFILE_TASK)' $(make_build_target) : # check that things are correctly built ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) ifneq (,$(filter $(DEB_HOST_ARCH_OS), linux)) cd $(buildd_static) && ./python -c 'from _multiprocessing import SemLock' endif endif touch stamps/stamp-build-static stamps/stamp-build-shared: stamps/stamp-configure-shared dh_testdir $(MAKE) $(NJOBS) -C $(buildd_shared) \ EXTRA_CFLAGS="$(EXTRA_OPT_CFLAGS)" # : # build the shared library # $(MAKE) $(NJOBS) -C $(buildd_shared) \ # libpython$(VER).so : # build a static library with PIC objects $(MAKE) $(NJOBS) -C $(buildd_shared) \ EXTRA_CFLAGS="$(EXTRA_OPT_CFLAGS)" \ LIBRARY=libpython$(VER)-pic.a libpython$(VER)-pic.a touch stamps/stamp-build-shared stamps/stamp-build-debug: stamps/stamp-configure-debug dh_testdir $(MAKE) $(NJOBS) -C $(buildd_debug) \ EXTRA_CFLAGS="$(DEBUG_CFLAGS)" touch stamps/stamp-build-debug stamps/stamp-build-shared-debug: stamps/stamp-configure-shared-debug dh_testdir : # build the shared debug library $(MAKE) $(NJOBS) -C $(buildd_shdebug) \ EXTRA_CFLAGS="$(DEBUG_CFLAGS)" touch stamps/stamp-build-shared-debug common_configure_args = \ --prefix=/usr \ --enable-ipv6 \ --enable-unicode=ucs4 \ --with-dbmliborder=bdb:gdbm \ --with-system-expat \ --with-computed-gotos ifneq (,$(filter $(DEB_HOST_ARCH), avr32 or1k)) common_configure_args += --without-ffi else common_configure_args += --with-system-ffi endif ifeq ($(with_fpectl),yes) common_configure_args += \ --with-fpectl endif ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) common_configure_args += --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) config_site = ac_cv_file__dev_ptmx=yes ac_cv_file__dev_ptc=yes ifeq (,$(filter $(DEB_HOST_ARCH),arm m68k)) ifeq ($(DEB_HOST_ARCH_ENDIAN),little) config_site += ac_cv_little_endian_double=yes else config_site += ac_cv_big_endian_double=yes endif endif endif stamps/stamp-configure-shared: stamps/stamp-patch rm -rf $(buildd_shared) mkdir -p $(buildd_shared) cd $(buildd_shared) && \ CC="$(CC)" CXX="$(CXX)" AR="$(AR)" RANLIB="$(RANLIB)" \ CFLAGS="$(OPT_CFLAGS)" LDFLAGS="$(DPKG_LDFLAGS)" \ $(config_site) \ ../configure \ --enable-shared \ $(common_configure_args) $(call __post_configure,$(buildd_shared)) touch stamps/stamp-configure-shared stamps/stamp-configure-static: stamps/stamp-patch rm -rf $(buildd_static) mkdir -p $(buildd_static) cd $(buildd_static) && \ CC="$(CC)" CXX="$(CXX)" AR="$(AR)" RANLIB="$(RANLIB)" \ CFLAGS="$(OPT_CFLAGS)" LDFLAGS="$(DPKG_LDFLAGS)" \ $(config_site) \ ../configure \ $(common_configure_args) $(call __post_configure,$(buildd_static)) touch stamps/stamp-configure-static stamps/stamp-configure-debug: stamps/stamp-patch rm -rf $(buildd_debug) mkdir -p $(buildd_debug) cd $(buildd_debug) && \ CC="$(CC)" CXX="$(CXX)" AR="$(AR)" RANLIB="$(RANLIB)" \ CFLAGS="$(DEBUG_CFLAGS)" LDFLAGS="$(DPKG_LDFLAGS)" \ $(config_site) \ ../configure \ $(common_configure_args) \ --with-pydebug $(call __post_configure,$(buildd_debug)) touch stamps/stamp-configure-debug stamps/stamp-configure-shared-debug: stamps/stamp-patch rm -rf $(buildd_shdebug) mkdir -p $(buildd_shdebug) cd $(buildd_shdebug) && \ CC="$(CC)" CXX="$(CXX)" AR="$(AR)" RANLIB="$(RANLIB)" \ CFLAGS="$(DEBUG_CFLAGS)" LDFLAGS="$(DPKG_LDFLAGS)" \ $(config_site) \ ../configure \ $(common_configure_args) \ --enable-shared \ --with-pydebug $(call __post_configure,$(buildd_shdebug)) touch stamps/stamp-configure-shared-debug define __post_configure egrep \ "^#($$(awk -v ORS='|' '$$2 ~ /^extension$$/ {print $$1}' debian/PVER-minimal.README.Debian.in)XX)" \ Modules/Setup.dist \ | sed -e 's/^#//' -e 's/-Wl,-Bdynamic//;s/-Wl,-Bstatic//' \ >> $(1)/Modules/Setup.local : # unconditionally run makesetup cd $(1) && \ ../Modules/makesetup -c ../Modules/config.c.in -s Modules \ Modules/Setup.config Modules/Setup.local Modules/Setup mv $(1)/config.c $(1)/Modules/ : # and fix the timestamps $(MAKE) -C $(1) Makefile Modules/config.c : # apply workaround for missing os.fsync sed 's/HAVE_SYNC/HAVE_FSYNC/g' $(1)/pyconfig.h \ > $(1)/pyconfig.h.new touch -r $(1)/pyconfig.h $(1)/pyconfig.h.new mv -f $(1)/pyconfig.h.new $(1)/pyconfig.h : # this second rule doesn't build with -fPIC, remove it for shared builds. $(if $(findstring build-sh,$(1)), \ sed '/^Modules\/_math.o: .*PY_CORE_CFLAGS/d' $(1)/Makefile > $(1)/Makefile.fixed; \ touch -r $(1)/Makefile $(1)/Makefile.fixed; \ mv -f $(1)/Makefile.fixed $(1)/Makefile \ ) endef stamps/stamp-mincheck: stamps/stamp-build-static debian/PVER-minimal.README.Debian.in ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) for m in $(MIN_MODS) $(MIN_PACKAGES) $(MIN_EXTS) $(MIN_BUILTINS); do \ echo "import $$m"; \ done > $(buildd_static)/minmods.py cd $(buildd_static) && ./python ../debian/pymindeps.py minmods.py \ > $(buildd_static)/mindeps.txt if [ -x /usr/bin/dot ]; then \ cd $(buildd_static); \ ./python ../debian/depgraph.py < mindeps.txt > mindeps.dot; \ dot -Tpng -o $(buildd_static)/mindeps.png \ $(buildd_static)/mindeps.dot; \ else true; fi cd $(buildd_static) && ./python ../debian/mincheck.py \ minmods.py mindeps.txt endif touch stamps/stamp-mincheck TEST_RESOURCES = all ifeq ($(on_buildd),yes) TEST_RESOURCES := $(TEST_RESOURCES),-network,-urlfetch,-bsddb endif TESTOPTS = -w -l -u$(TEST_RESOURCES) #TESTOPTS = -v -l -u$(TEST_RESOURCES) TEST_EXCLUDES = ifeq ($(on_buildd),yes) TEST_EXCLUDES += test_codecmaps_cn test_codecmaps_hk \ test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw \ test_normalization test_ossaudiodev ifneq (,$(filter $(DEB_HOST_ARCH), mips mipsel powerpc kfreebsd-i386 sparc)) TEST_EXCLUDES += test_threading endif ifeq (,$(wildcard $(HOME))) TEST_EXCLUDES += test_site endif endif ifeq (,$(wildcard /dev/dsp)) TEST_EXCLUDES += test_linuxaudiodev test_ossaudiodev endif ifneq (,$(filter $(DEB_HOST_ARCH), armel hppa powerpc)) TEST_EXCLUDES += test_multiprocessing endif ifneq (,$(filter $(DEB_HOST_ARCH), hppa)) TEST_EXCLUDES += test_fork1 test_socketserver test_threading test_wait3 test_wait4 test_gdb endif ifneq (,$(filter $(DEB_HOST_ARCH), arm avr32)) TEST_EXCLUDES += test_ctypes endif TEST_EXCLUDES += test_bsddb3 TEST_EXCLUDES += test_ensurepip ifneq (,$(filter $(DEB_HOST_ARCH), arm armel avr32 m68k)) ifeq ($(on_buildd),yes) TEST_EXCLUDES += test_compiler endif endif TEST_EXCLUDES += test_gdb # fails on some buildds ifneq (,$(filter $(DEB_HOST_ARCH), amd64 armel armhf mips mipsel sparc)) TEST_EXCLUDES += test_io endif ifneq (,$(filter $(DEB_HOST_ARCH), alpha)) TEST_EXCLUDES += test_signal endif ifneq (,$(filter $(DEB_HOST_ARCH), kfreebsd-amd64 kfreebsd-i386)) TEST_EXCLUDES += test_io test_signal endif ifneq (,$(filter $(DEB_HOST_ARCH), hurd-i386)) TEST_EXCLUDES += test_io test_random test_signal test_socket test_socketserver test_ssl \ test_threading test_subprocess endif ifneq (,$(filter $(DEB_HOST_ARCH), ia64)) TEST_EXCLUDES += test_threading test_subprocess endif # see http://bugs.python.org/issue25698 TEST_EXCLUDES += test_cpickle ifneq (,$(TEST_EXCLUDES)) TESTOPTS += -x $(sort $(TEST_EXCLUDES)) ifneq (,$(filter $(DEB_HOST_ARCH), mips mipsel)) TESTOPTS_DEBUG := $(TESTOPTS) else TESTOPTS_DEBUG := $(filter-out test_gdb,$(TESTOPTS)) endif endif ifneq (,$(wildcard /usr/bin/localedef)) SET_LOCPATH = LOCPATH=$(CURDIR)/locales endif stamps/stamp-check: ifeq ($(WITHOUT_CHECK),yes) echo "check run disabled for this build" > $(buildd_static)/test_results else : # build locales needed by the testsuite rm -rf locales mkdir locales if which localedef >/dev/null 2>&1; then \ sh debian/locale-gen; \ fi @echo ========== test environment ============ @env @echo ======================================== ifeq (,$(findstring $(DEB_HOST_ARCH), alpha)) ( \ echo '#! /bin/sh'; \ echo 'set -x'; \ echo 'export TERM=$${TERM:-dumb}'; \ echo '$(buildd_static)/python $(CURDIR)/debian/script.py test_results '\''make test TESTOPTS="$(TESTOPTS_DEBUG)"'\'; \ echo 'echo DONE'; \ ) > $(buildd_debug)/run_tests chmod 755 $(buildd_debug)/run_tests @echo "BEGIN test debug" -tmphome=$$(mktemp -d); export HOME=$$tmphome; \ cd $(buildd_debug) && time xvfb-run -a -e xvfb-run.log ./run_tests; \ rm -rf $$tmphome @echo "END test debug" endif ( \ echo '#! /bin/sh'; \ echo 'set -x'; \ echo 'export TERM=$${TERM:-dumb}'; \ echo 'export $(SET_LOCPATH)'; \ echo '$(buildd_static)/python $(CURDIR)/debian/script.py test_results '\''make test EXTRA_CFLAGS="$(EXTRA_OPT_CFLAGS)" TESTOPTS="$(TESTOPTS)"'\'; \ echo 'echo DONE'; \ ) > $(buildd_static)/run_tests chmod 755 $(buildd_static)/run_tests @echo "BEGIN test static" -tmphome=$$(mktemp -d); export HOME=$$tmphome; \ cd $(buildd_static) && time xvfb-run -a -e xvfb-run.log ./run_tests; \ rm -rf $$tmphome @echo "END test static" ( \ echo '#! /bin/sh'; \ echo 'set -x'; \ echo 'export TERM=$${TERM:-dumb}'; \ echo 'export $(SET_LOCPATH)'; \ echo '$(buildd_static)/python $(CURDIR)/debian/script.py test_results '\''make test EXTRA_CFLAGS="$(EXTRA_OPT_CFLAGS)" TESTOPTS="$(TESTOPTS)"'\'; \ echo 'echo DONE'; \ ) > $(buildd_shared)/run_tests chmod 755 $(buildd_shared)/run_tests @echo "BEGIN test shared" -tmphome=$$(mktemp -d); export HOME=$$tmphome; \ cd $(buildd_shared) && time xvfb-run -a -e xvfb-run.log ./run_tests; \ rm -rf $$tmphome @echo "END test shared" endif cp -p $(buildd_static)/test_results debian/ touch stamps/stamp-check stamps/stamp-pystone: ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) @echo "BEGIN pystone static" cd $(buildd_static) && ./python ../Lib/test/pystone.py cd $(buildd_static) && ./python ../Lib/test/pystone.py @echo "END pystone static" @echo "BEGIN pystone shared" cd $(buildd_shared) \ && LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}. ./python ../Lib/test/pystone.py cd $(buildd_shared) \ && LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}. ./python ../Lib/test/pystone.py @echo "END pystone shared" @echo "BEGIN pystone debug" cd $(buildd_debug) && ./python ../Lib/test/pystone.py cd $(buildd_debug) && ./python ../Lib/test/pystone.py @echo "END pystone debug" endif touch stamps/stamp-pystone #ifeq (,$(filter $(DEB_HOST_ARCH), arm armel avr32 hppa mips mipsel m68k)) pybench_options = -C 2 -n 5 -w 4 #endif stamps/stamp-pybench: ifeq ($(WITHOUT_BENCH),yes) echo "pybench run disabled for this build" > $(buildd_static)/pybench.log else @echo "BEGIN pybench static" cd $(buildd_static) \ && time ./python ../Tools/pybench/pybench.py -f run1.pybench $(pybench_options) cd $(buildd_static) \ && ./python ../Tools/pybench/pybench.py -f run2.pybench -c run1.pybench $(pybench_options) @echo "END pybench static" @echo "BEGIN pybench shared" cd $(buildd_shared) \ && LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}. \ ./python ../Tools/pybench/pybench.py -f run1.pybench $(pybench_options) cd $(buildd_shared) \ && LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}. \ ./python ../Tools/pybench/pybench.py -f run2.pybench -c run1.pybench $(pybench_options) @echo "END pybench shared" @echo "BEGIN shared/static comparision" $(buildd_static)/python Tools/pybench/pybench.py \ -s $(buildd_static)/run2.pybench -c $(buildd_shared)/run2.pybench \ | tee $(buildd_static)/pybench.log @echo "END shared/static comparision" endif touch stamps/stamp-pybench minimal-test: rm -rf mintest mkdir -p mintest/lib mintest/dynlib mintest/testlib mintest/all-lib cp -p $(buildd_static)/python mintest/ cp -p $(foreach i,$(MIN_MODS),Lib/$(i).py) \ mintest/lib/ cp -a $(foreach i,$(MIN_PACKAGES),Lib/$(i)) \ mintest/lib/ cp -p $(wildcard $(foreach i,$(MIN_EXTS),$(buildd_static)/build/lib*/$(i).*.so)) \ mintest/dynlib/ cp -p Lib/unittest.py mintest/lib/ cp -pr Lib/test mintest/lib/ cp -pr Lib mintest/all-lib cp -p $(buildd_static)/build/lib*/*.so mintest/all-lib/ ( \ echo "import sys"; \ echo "sys.path = ["; \ echo " '$(CURDIR)/mintest/lib',"; \ echo " '$(CURDIR)/mintest/dynlib',"; \ echo "]"; \ cat Lib/test/regrtest.py; \ ) > mintest/lib/test/mintest.py cd mintest && ./python -E -S lib/test/mintest.py \ -x test_codecencodings_cn test_codecencodings_hk \ test_codecencodings_jp test_codecencodings_kr \ test_codecencodings_tw test_codecs test_multibytecodec \ stamps/stamp-doc-html: dh_testdir $(MAKE) -C Doc html @mkdir -p stamps touch stamps/stamp-doc-html build-doc: stamps/stamp-patch stamps/stamp-build-doc stamps/stamp-build-doc: stamps/stamp-doc-html touch stamps/stamp-build-doc control-file: sed -e "s/@PVER@/$(PVER)/g" \ -e "s/@VER@/$(VER)/g" \ -e "s/@PYSTDDEP@/$(PYSTDDEP)/g" \ -e "s/@PRIO@/$(PY_PRIO)/g" \ -e "s/@MINPRIO@/$(PY_MINPRIO)/g" \ -e "s/@bd_qual@/$(bd_qual)/g" \ -e "s/@bd_gcc@/$(bd_gcc)/g" \ -e "s/@bd_dpkgdev@/$(bd_dpkgdev)/g" \ -e "s/@pf_bluetooth@/$(pf_bluetooth)/g" \ debian/control.in \ | $(ma_filter) \ > debian/control.tmp ifeq ($(derivative),Ubuntu) ifneq (,$(findstring ubuntu, $(PKGVERSION))) m='Ubuntu Core Developers '; \ sed -i "/^Maintainer:/s/\(.*\)/Maintainer: $$m\nXSBC-Original-\1/" \ debian/control.tmp endif endif [ -e debian/control ] \ && cmp -s debian/control debian/control.tmp \ && rm -f debian/control.tmp && exit 0; \ mv debian/control.tmp debian/control clean: control-file dh_testdir dh_testroot dh_autotools-dev_restoreconfig $(MAKE) -f debian/rules unpatch rm -rf stamps .pc rm -f debian/test_results $(MAKE) -C Doc clean sed 's/^@/#/' Makefile.pre.in | $(MAKE) -f - srcdir=. distclean rm -rf Lib/test/db_home rm -rf $(buildd_static) $(buildd_shared) $(buildd_debug) $(buildd_shdebug) find -name '*.py[co]' | xargs -r rm -f rm -f Lib/lib2to3/*.pickle rm -rf Lib/plat-$(DEB_HOST_MULTIARCH) rm -rf locales rm -rf $(d)-dbg $(d)-shdbg for f in debian/*.in; do \ f2=`echo $$f | sed "s,PVER,$(PVER),g;s/@VER@/$(VER)/g;s,\.in$$,,"`; \ if [ $$f2 != debian/control ] && [ $$f2 != debian/source.lintian-overrides ]; then \ rm -f $$f2; \ fi; \ done dh_clean stamps/stamp-control: : # We have to prepare the various control files for f in debian/*.in; do \ f2=`echo $$f | sed "s,PVER,$(PVER),g;s/@VER@/$(VER)/g;s,\.in$$,,"`; \ if [ $$f2 != debian/control ]; then \ sed -e "s/@PVER@/$(PVER)/g;s/@VER@/$(VER)/g" \ -e "s/@PRIORITY@/$(PRIORITY)/g" \ -e "s,@SCRIPTDIR@,/$(scriptdir),g" \ -e "s,@INFO@,$(info_docs),g" \ -e "s,@HOST_QUAL@,:$(DEB_HOST_ARCH),g" \ <$$f >$$f2; \ fi; \ done ifeq ($(DEB_HOST_ARCH_BITS),64) sed -i 's/\(Py_InitModule4[^@]*\)@/\1_64@/' \ debian/lib$(PVER).symbols debian/lib$(PVER)-dbg.symbols endif 2to3-man: help2man --no-info --version-string=$(VER) --no-discard-stderr \ --name 'Python2 to Python3 converter' \ 2to3-$(VER) > debian/2to3-$(VER).1 install: build-arch stamps/stamp-install stamps/stamp-install: stamps/stamp-build control-file stamps/stamp-control dh_testdir dh_testroot dh_prep dh_installdirs : # make install into tmp and subsequently move the files into : # their packages' directories. install -d $(d)/usr ifeq ($(with_interp),static) $(MAKE) -C $(buildd_static) install DESTDIR=$(CURDIR)/$(d) else $(MAKE) -C $(buildd_shared) install DESTDIR=$(CURDIR)/$(d) endif mkdir -p $(d)/usr/include/$(DEB_HOST_MULTIARCH)/$(PVER) mv $(d)/usr/include/$(PVER)/pyconfig.h \ $(d)/usr/include/$(DEB_HOST_MULTIARCH)/$(PVER)/. mv $(d)/usr/bin/python-config.sh $(d)/usr/bin/python$(VER)-config sed -i \ -e 's/-O3/-O2/g;s/$(LTO_CFLAGS)//g' \ -e 's/-fprofile-use *-fprofile-correction//g' \ -e 's/-fstack-protector /-fstack-protector-strong /g' \ $(d)/usr/bin/python$(VER)-config : # fiddle around with the platform directory mkdir -p $(d)/$(scriptdir)/plat-$(DEB_HOST_MULTIARCH)/ set -x; echo XXXXXX; \ for i in Lib/plat-linux2/*; do \ n=$$(basename $$i); \ if [ ! -f $(d)/$(scriptdir)/plat-$(DEB_HOST_MULTIARCH)/$$n ]; then \ cp -p $$i $(d)/$(scriptdir)/plat-$(DEB_HOST_MULTIARCH)/; \ fi; \ done rm -f $(d)/$(scriptdir)/lib-dynload/*.py cp -p $(buildd_shared)/$(shell cat $(buildd_shared)/pybuilddir.txt)/_sysconfigdata.py \ $(d)/$(scriptdir)/. mv $(d)/$(scriptdir)/_sysconfigdata.py \ $(d)/$(scriptdir)/plat-$(DEB_HOST_MULTIARCH)/_sysconfigdata_nd.py sed -i \ -e 's/-O3/-O2/g;s/$(LTO_CFLAGS)//g' \ -e 's/-fprofile-use *-fprofile-correction//g' \ -e 's/-fstack-protector /-fstack-protector-strong /g' \ $(d)/$(scriptdir)/plat-$(DEB_HOST_MULTIARCH)/_sysconfigdata_nd.py cp -p debian/_sysconfigdata.py $(d)/$(scriptdir) -find $(d)/usr/lib/python$(VER) -name '*_failed*.so' find $(d)/usr/lib/python$(VER) -name '*_failed*.so' | xargs -r rm -f test -f $(d)/usr/lib/python$(VER)/lib-dynload/_bsddb.so for i in $(d)/$(scriptdir)/lib-dynload/*.so; do \ b=$$(basename $$i .so); \ d=$${b}.$(DEB_HOST_MULTIARCH).so; \ mv $$i $(d)/$(scriptdir)/lib-dynload/$$d; \ done mv $(d)/usr/lib/libpython*.a $(d)/usr/lib/$(DEB_HOST_MULTIARCH)/ if [ -d $(d)/usr/lib/python$(VER)/site-packages ]; then \ mv $(d)/usr/lib/python$(VER)/site-packages \ $(d)/usr/lib/python$(VER)/dist-packages; \ fi : # remove files, which are not packaged rm -f $(d)/usr/bin/smtpd.py rm -rf $(d)/usr/lib/python$(VER)/ctypes/macholib rm -f $(d)/$(scriptdir)/plat-*/regen rm -f $(d)/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/python.pc rm -f $(d)/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/python2.pc rm -f $(d)/usr/bin/python2{,-config} rm -f $(d)/usr/share/man/man1/python.1 rm -f $(d)/usr/share/man/man1/python2{,-config}.1 rm -f $(d)/$(scriptdir)/lib2to3/*.pickle if [ -d $(d)/$(scriptdir)/ensurepip/_bundled ]; then \ echo "don't ship the prebuilt ensurepip/_bundled wheels."; \ rm -rf $(d)/$(scriptdir)/ensurepip/_bundled; \ fi : # cannot build it, zlib maintainer won't provide a mingw build find $(d) -name 'wininst*.exe' | xargs -r rm -f : # fix some file permissions chmod a-x $(d)/$(scriptdir)/{fractions,lib-tk/Tix}.py : # move manpages to new names if [ -d $(d)/usr/man/man1 ]; then \ mkdir -p $(d)/usr/share/man; \ mv $(d)/usr/man/man1/* $(d)/usr/share/man/man1/; \ rm -rf $(d)/usr/man/; \ fi cp -p debian/pydoc.1 $(d)/usr/share/man/man1/pydoc$(VER).1 : # Symlinks to /usr/bin for some tools ln -sf ../lib/python$(VER)/pdb.py $(d)/usr/bin/pdb$(VER) cp -p debian/pdb.1 $(d)/usr/share/man/man1/pdb$(VER).1 : # versioned install only rm -f $(d)/usr/bin/python-config mv $(d)/usr/bin/2to3 $(d)/usr/bin/2to3-$(VER) cp debian/2to3-$(VER).1 $(d)/usr/share/man/man1/2to3-$(VER).1 # : # remove the bsddb stuff # rm -rf $(d)/$(scriptdir)/bsddb # rm -f $(d)/$(scriptdir)/lib-dynload/_bsddb.so : # Remove version information from the egg-info file mv $(d)/$(scriptdir)/lib-dynload/Python-$(VER)*.egg-info \ $(d)/$(scriptdir)/lib-dynload/Python-$(VER).egg-info dh_installdirs -p$(p_lib) \ usr/lib/$(DEB_HOST_MULTIARCH) \ $(scriptdir)/config-$(DEB_HOST_MULTIARCH) \ usr/share/doc : # install the shared library cp -p $(buildd_shared)/libpython$(VER).so.1.0 \ $(d_lib)/usr/lib/$(DEB_HOST_MULTIARCH)/ dh_link -p$(p_lib) \ /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER).so.1.0 \ /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER).so.1 \ /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER).so.1 \ /$(scriptdir)/config-$(DEB_HOST_MULTIARCH)/libpython$(VER).so ln -sf $(p_base) $(d_lib)/usr/share/doc/$(p_lib) ln -sf libpython$(VER).so.1 $(d)/usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER).so ifeq ($(with_interp),shared) : # install the statically linked runtime install -m755 $(buildd_static)/python $(d)/usr/bin/python$(VER)-static endif mv $(d)/usr/bin/pydoc $(d)/usr/bin/pydoc$(VER) cp -p Tools/i18n/pygettext.py $(d)/usr/bin/pygettext$(VER) cp -p debian/pygettext.1 $(d)/usr/share/man/man1/pygettext$(VER).1 : # install the Makefile of the shared python build sed -e '/^OPT/s,-O3,-O2,' \ -e 's/$(LTO_CFLAGS)//g' \ -e 's/-fstack-protector /-fstack-protector-strong /g' \ -e 's,^RUNSHARED *=.*,RUNSHARED=,' \ -e '/BLDLIBRARY/s/-L\. //' \ build-shared/Makefile > $(d)/$(scriptdir)/config-$(DEB_HOST_MULTIARCH)/Makefile : # Move the binary and the minimal libraries into $(p_lmin). dh_installdirs -p$(p_lmin) \ etc/$(PVER) \ usr/bin \ usr/include/$(PVER) \ usr/share/man/man1 \ $(scriptdir)/lib-dynload $(dh_compat2) dh_movefiles -p$(p_lmin) --sourcedir=$(d) \ $(foreach i,$(MIN_MODS),$(scriptdir)/$(i).py) \ $(foreach i,$(MIN_PACKAGES),$(scriptdir)/$(i)) \ $(foreach i,$(MIN_ENCODINGS),$(scriptdir)/$(i)) \ /$(scriptdir)/plat-$(DEB_HOST_MULTIARCH)/_sysconfigdata_nd.py \ $(scriptdir)/site.py \ $(shell cd $(d); for i in $(MIN_EXTS); do \ test -e $(scriptdir)/lib-dynload/$$i.so \ && echo $(scriptdir)/lib-dynload/$$i.so; \ done; true) : # Move the binary and the minimal libraries into $(p_min). dh_installdirs -p$(p_min) \ usr/bin \ usr/share/man/man1 $(dh_compat2) dh_movefiles -p$(p_min) --sourcedir=$(d) \ usr/bin/python$(VER) \ usr/share/man/man1/python$(VER).1 : # Install sitecustomize.py. cp -p debian/sitecustomize.py $(d_lmin)/etc/$(PVER)/ dh_link -p$(p_lmin) /etc/$(PVER)/sitecustomize.py \ /$(scriptdir)/sitecustomize.py : # Move the static library and the header files into $(p_ldev). # mv $(d)/usr/share/include/python$(VER)/* $(d)/usr/include/python$(VER)/. # rm -rf $(d)/usr/share/include cp $(d)/usr/bin/python$(VER)-config $(d)/usr/bin/$(DEB_HOST_MULTIARCH)-python$(VER)-config dh_installdirs -p$(p_ldev) \ usr/bin \ $(scriptdir) \ usr/include \ usr/share/man/man1 $(dh_compat2) dh_movefiles -p$(p_ldev) --sourcedir=$(d) \ usr/bin/$(DEB_HOST_MULTIARCH)-python$(VER)-config \ usr/lib/python$(VER)/config-$(DEB_HOST_MULTIARCH) \ usr/include \ usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER).{a,so} \ usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/python-$(VER)*.pc sed 's/@subdir@/$(PVER)/;s/@header@/pyconfig.h/' \ debian/multiarch.h.in > $(d_ldev)/usr/include/$(PVER)/pyconfig.h cp -p debian/python-config.1 \ $(d_ldev)/usr/share/man/man1/$(DEB_HOST_MULTIARCH)-python$(VER)-config.1 ifneq ($(DEB_HOST_MULTIARCH),$(DEB_HOST_GNU_TYPE)) ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)-config \ $(d_ldev)/usr/bin/$(DEB_HOST_GNU_TYPE)-$(PVER)-config ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)-config.1.gz \ $(d_ldev)/usr/share/man/man1/$(DEB_HOST_GNU_TYPE)-$(PVER)-config.1.gz endif sed -i \ -e '/^Cflags:/s,$$, -I$${includedir}/$(DEB_HOST_MULTIARCH)/python$(VER),' \ -e '/^libdir=/d;s/-L\$${libdir} *//' \ $(d_ldev)/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/python-$(VER).pc dh_link -p$(p_ldev) \ /usr/lib/$(PVER)/config-$(DEB_HOST_MULTIARCH)/libpython$(VER).a \ /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER).a cp -p $(buildd_shared)/libpython$(VER)-pic.a \ $(d_ldev)/usr/lib/python$(VER)/config-$(DEB_HOST_MULTIARCH)/ : # Move the static library and the header files into $(p_dev). dh_installdirs -p$(p_dev) \ usr/share/doc/python$(VER)/$(DEB_HOST_MULTIARCH) \ usr/share/man/man1 \ $(scriptdir) \ $(scriptdir)/doc/html cp -p Misc/HISTORY Misc/README.valgrind Misc/gdbinit \ debian/README.maintainers \ $(d_dev)/usr/share/doc/python$(VER)/ cp -p debian/test_results $(buildd_static)/pybench.log \ $(d_dev)/usr/share/doc/python$(VER)/$(DEB_HOST_MULTIARCH)/ $(dh_compat2) dh_movefiles -p$(p_dev) --sourcedir=$(d) \ usr/bin/python$(VER)-config \ usr/lib/python$(VER)/distutils/command/wininst-*.exe ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)-config $(d_dev)/usr/bin/$(PVER)-config ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)-config.1.gz $(d_dev)/usr/share/man/man1/$(PVER)-config.1.gz ifeq ($(with_tk),yes) : # Move the Tkinter files into $(p_tk). dh_installdirs -p$(p_tk) \ $(scriptdir) \ usr/lib/python$(VER)/lib-dynload $(dh_compat2) dh_movefiles -p$(p_tk) --sourcedir=$(d) \ usr/lib/python$(VER)/lib-dynload/_tkinter.so endif ifeq ($(with_gdbm),yes) : # gdbm and dbm modules into $(p_gdbm). dh_installdirs -p$(p_gdbm) \ usr/lib/python$(VER)/lib-dynload $(dh_compat2) dh_movefiles -p$(p_gdbm) --sourcedir=$(d) \ usr/lib/python$(VER)/lib-dynload/gdbm.so endif : # The test framework into $(p_lbase) $(dh_compat2) dh_movefiles -p$(p_lbase) --sourcedir=$(d) \ $(scriptdir)/test/support \ $(scriptdir)/test/{regrtest.py,test_support.py,__init__.py,pystone.py} : # The complete testsuite into $(p_ltst) $(dh_compat2) dh_movefiles -p$(p_ltst) --sourcedir=$(d) \ $(scriptdir)/test \ $(scriptdir)/ctypes/test \ $(scriptdir)/bsddb/test \ $(scriptdir)/email/test \ $(scriptdir)/json/tests \ $(scriptdir)/sqlite3/test \ $(scriptdir)/distutils/tests \ $(scriptdir)/lib2to3/tests \ $(scriptdir)/unittest/test \ $(scriptdir)/lib-tk/test : # test_ctypes fails with test_macholib.py installed rm -f $(d_ltst)/$(scriptdir)/ctypes/test/test_macholib.py : # test_bdist_wininst fails, '*.exe' files are not installed rm -f $(d_ltst)/$(scriptdir)/distutils/tests/test_bdist_wininst.py : # IDLE mv $(d)/usr/bin/idle $(d)/usr/bin/idle-python$(VER) rm -f $(d)/usr/lib/python$(VER)/idlelib/idle.bat dh_installdirs -p$(p_idle) \ usr/bin \ usr/share/man/man1 $(dh_compat2) dh_movefiles -p$(p_idle) --sourcedir=$(d) \ usr/lib/python$(VER)/idlelib \ usr/bin/idle-python$(VER) cp -p debian/idle-$(PVER).1 $(d_idle)/usr/share/man/man1/ : # Move the demos and tools into $(p_exam)'s doc directory dh_installdirs -p$(p_exam) \ usr/share/doc/python$(VER)/examples cp -rp Demo Tools $(d_exam)/usr/share/doc/python$(VER)/examples/ rm -rf $(d_exam)/usr/share/doc/python$(VER)/examples/Demo/sgi : # IDLE is in its own package: rm -rf $(d_exam)/usr/share/doc/python$(VER)/examples/Tools/idle : # XXX: We don't need rgb.txt, we'll use our own: rm -rf $(d_exam)/usr/share/doc/python$(VER)/examples/Tools/pynche/X : # XXX: Some files in upstream Demo and Tools have strange : # exec permissions, make lintian glad: -chmod 644 $(d_tk)/$(scriptdir)/lib-tk/Tix.py -chmod 644 $(d)/$(scriptdir)/runpy.py cd $(d_exam)/usr/share/doc/python$(VER)/examples && chmod 644 \ Demo/{classes/*.py*,comparisons/patterns} \ Demo/{rpc/test,threads/*.py*,md5test/*} \ Demo/pdist/{client.py,cmdfw.py,cmptree.py,cvslib.py,cvslock.py,FSProxy.py,mac.py,rcsclient.py,rcslib.py,security.py,server.py,sumtree.py} \ Demo/scripts/morse.py \ Demo/sockets/{broadcast.py,ftp.py,mcast.py,radio.py} \ Demo/tix/{bitmaps/{tix.gif,*x[pb]m*},samples/*.py} \ Demo/tkinter/guido/{AttrDialog.py,hanoi.py,hello.py,imagedraw.py,imageview.py,listtree.py,ManPage.py,ShellWindow.py,wish.py} \ Tools/scripts/pydocgui.pyw \ Tools/scripts/mailerdaemon.py rm -f $(d_exam)/usr/share/doc/python$(VER)/examples/Demo/scripts/newslist.* : # Replace all '#!' calls to python with $(PY_INTERPRETER) : # and make them executable for i in `find debian -mindepth 3 -type f ! -name '*.dpatch'`; do \ sed '1s,#!.*python[^ ]*\(.*\),#! $(PY_INTERPRETER)\1,' \ $$i > $$i.temp; \ if cmp --quiet $$i $$i.temp; then \ rm -f $$i.temp; \ else \ mv -f $$i.temp $$i; \ chmod 755 $$i; \ echo "fixed interpreter: $$i"; \ fi; \ done : # Move the docs into $(p_base)'s /usr/share/doc/$(PVER) directory, : # all other packages only have a copyright file. dh_installdocs -p$(p_base) \ README Misc/NEWS Misc/ACKS ln -sf NEWS.gz $(d_base)/usr/share/doc/$(p_base)/changelog.gz dh_installdocs --all -N$(p_base) -N$(p_dev) -N$(p_dbg) -N$(p_lib) debian/README.Debian : # IDLE has its own changelogs, docs... dh_installchangelogs -p$(p_idle) Lib/idlelib/ChangeLog dh_installdocs -p$(p_idle) Lib/idlelib/{NEWS,README,TODO,extend}.txt mkdir -p $(d_idle)/usr/share/applications cp -p debian/idle.desktop \ $(d_idle)/usr/share/applications/idle-$(PVER).desktop : # those packages have own README.Debian's install -m 644 -p debian/README.$(p_base) \ $(d_base)/usr/share/doc/$(PVER)/README.Debian install -m 644 -p debian/README.$(p_idle) \ $(d_idle)/usr/share/doc/$(p_idle)/README.Debian ifeq ($(with_tk),yes) cp -p debian/README.Tk $(d_tk)/usr/share/doc/$(p_tk)/ endif : # library files into $(p_lbase) dh_installdirs -p$(p_lbase) \ usr/lib dh_movefiles -p$(p_lbase) \ usr/lib/python$(VER) : # The rest goes into $(p_base) mkdir -p $(d)/usr/lib/python$(VER)/dist-packages (cd $(d) && tar cf - .) | (cd $(d_base) && tar xpf -) sh debian/dh_rmemptydirs -p$(p_base) rm -f $(d_base)/usr/bin/python : # install egg-info for arparse install -m 644 debian/argparse.egg-info $(d_lbase)/$(scriptdir)/ : # Install menu icon dh_installdirs -p$(p_base) usr/share/pixmaps cp -p debian/pylogo.xpm $(d_base)/usr/share/pixmaps/$(PVER).xpm : # generate binfmt file mkdir -p $(d_min)/usr/share/binfmts ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) $(buildd_static)/python debian/mkbinfmt.py $(PVER) \ > $(d_min)/usr/share/binfmts/$(PVER) else $(PVER) debian/mkbinfmt.py $(PVER) > $(d_min)/usr/share/binfmts/$(PVER) endif : # desktop entry mkdir -p $(d_base)/usr/share/applications cp -p debian/$(PVER).desktop \ $(d_base)/usr/share/applications/$(PVER).desktop : # remove some things -find debian -name .cvsignore | xargs rm -f -find debian -name '*.py[co]' | xargs rm -f : # remove empty directories, when all components are in place -find debian ! -name lib-dynload -type d -empty -delete : # install debug package rm -rf $(d)-dbg $(d)-shdbg : # need some files from the shared build $(MAKE) -C $(buildd_shdebug) install DESTDIR=$(CURDIR)/$(d)-shdbg $(MAKE) -C $(buildd_debug) install DESTDIR=$(CURDIR)/$(d)-dbg mv $(d)-dbg/usr/lib/libpython*.a $(d)-dbg/usr/lib/$(DEB_HOST_MULTIARCH)/ mv $(d)-shdbg/$(scriptdir)/_sysconfigdata.py \ $(d)-shdbg/$(scriptdir)/_sysconfigdata_d.py for i in $(d)-dbg/$(scriptdir)/lib-dynload/*_d.so; do \ b=$$(basename $$i _d.so); \ d=$${b}.$(DEB_HOST_MULTIARCH)_d.so; \ mv $$i $(d)-dbg/$(scriptdir)/lib-dynload/$$d; \ done for i in $(d)-shdbg/$(scriptdir)/lib-dynload/*_d.so; do \ b=$$(basename $$i _d.so); \ d=$${b}.$(DEB_HOST_MULTIARCH)_d.so; \ mv $$i $(d)-shdbg/$(scriptdir)/lib-dynload/$$d; \ done dh_installdirs -p$(p_ldbg) \ usr/bin \ usr/share/man/man1 \ $(scriptdir)/lib-dynload \ $(scriptdir)/plat-$(DEB_HOST_MULTIARCH) \ usr/include/$(PVER)_d \ usr/include/$(DEB_HOST_MULTIARCH)/$(PVER)_d \ usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig \ cp -p $(d)-shdbg/$(scriptdir)/lib-dynload/*.so \ $(d_ldbg)/$(scriptdir)/lib-dynload/ cp -p $(buildd_shdebug)/libpython$(VER)_d.so.1.0 \ $(d_ldbg)/usr/lib/$(DEB_HOST_MULTIARCH)/ dh_link -p$(p_ldbg) \ /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)_d.so.1.0 \ /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)_d.so.1 \ /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)_d.so.1 \ /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)_d.so sed -e '/^Libs:/s,-lpython$(VER),-lpython$(VER)_d,' \ -e '/^Cflags:/s,python$(VER),python$(VER)_d,' \ -e '/^Cflags:/s,$$, -I$${includedir}/$(DEB_HOST_MULTIARCH)/python$(VER)_d,' \ -e '/^libdir=/d;s/-L\$${libdir} *//' \ $(d)-dbg/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/python-$(VER).pc \ > $(d_ldbg)/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/python-$(VER)-dbg.pc : # in $(p_ldbg), prefix python-config with triplets cp $(d)-shdbg/usr/bin/python-config.sh \ $(d_ldbg)/usr/bin/$(DEB_HOST_MULTIARCH)-$(PVER)-dbg-config ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)-config.1.gz \ $(d_ldbg)/usr/share/man/man1/$(DEB_HOST_MULTIARCH)-$(PVER)-dbg-config.1.gz ifneq ($(DEB_HOST_MULTIARCH),$(DEB_HOST_GNU_TYPE)) ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)-dbg-config \ $(d_ldbg)/usr/bin/$(DEB_HOST_GNU_TYPE)-$(PVER)-dbg-config ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)-config.1.gz \ $(d_ldbg)/usr/share/man/man1/$(DEB_HOST_GNU_TYPE)-$(PVER)-dbg-config.1.gz endif dh_installdirs -p$(p_dbg) \ usr/bin \ $(scriptdir)/lib-dynload \ usr/share/man/man1 \ usr/share/doc/$(p_base) cp -p Misc/SpecialBuilds.txt $(d_dbg)/usr/share/doc/$(p_base)/ cp -p debian/$(PVER)-dbg.README.Debian \ $(d_dbg)/usr/share/doc/$(p_base)/README.debug cp -p $(buildd_debug)/python $(d_dbg)/usr/bin/$(PVER)-dbg cp -p $(d)-shdbg/usr/bin/python-config.sh \ $(d_dbg)/usr/bin/$(PVER)-dbg-config # cp -p $(buildd_debug)/build/lib*/*_d.so \ $(d_dbg)/$(scriptdir)/lib-dynload/ cp -p $(d)-shdbg/$(scriptdir)/_sysconfigdata_d.py \ $(d_ldbg)/$(scriptdir)/plat-$(DEB_HOST_MULTIARCH)/ ifneq ($(with_gdbm),yes) rm -f $(d_ldbg)/$(scriptdir)/lib-dynload/gdbm.$(DEB_HOST_MULTIARCH)_d.so rm -f $(d_dbg)/usr/lib/debug/$(scriptdir)/lib-dynload/gdbm.$(DEB_HOST_MULTIARCH).so endif ifneq ($(with_tk),yes) rm -f $(d_ldbg)/$(scriptdir)/lib-dynload/_tkinter.$(DEB_HOST_MULTIARCH)_d.so rm -f $(d_dbg)/usr/lib/debug/$(scriptdir)/lib-dynload/_tkinter.$(DEB_HOST_MULTIARCH).so endif # rm -f $(d_dbg)/$(scriptdir)/lib-dynload/_bsddb_d.so cp -a $(d)-dbg/$(scriptdir)/config-$(DEB_HOST_MULTIARCH)_d \ $(d_ldbg)/$(scriptdir)/ ln -sf ../../$(DEB_HOST_MULTIARCH)/libpython$(VER)_d.so \ $(d_ldbg)/$(scriptdir)/config-$(DEB_HOST_MULTIARCH)_d/libpython$(VER)_d.so ln -sf libpython$(VER)_d.so \ $(d_ldbg)/$(scriptdir)/config-$(DEB_HOST_MULTIARCH)_d/libpython$(VER).so ln -sf libpython$(VER)_d.a \ $(d_ldbg)/$(scriptdir)/config-$(DEB_HOST_MULTIARCH)_d/libpython$(VER).a for i in $(d_ldev)/usr/include/$(PVER)/*; do \ i=$$(basename $$i); \ case $$i in pyconfig.h) continue; esac; \ ln -sf ../$(PVER)/$$i $(d_ldbg)/usr/include/$(PVER)_d/$$i; \ done cp -p $(buildd_debug)/pyconfig.h $(d_ldbg)/usr/include/$(DEB_HOST_MULTIARCH)/$(PVER)_d/ sed 's/@subdir@/$(PVER)_d/;s/@header@/pyconfig.h/' \ debian/multiarch.h.in > $(d_ldbg)/usr/include/$(PVER)_d/pyconfig.h ln -sf $(PVER).1.gz $(d_dbg)/usr/share/man/man1/$(PVER)-dbg.1.gz ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)-dbg-config \ $(d_dbg)/usr/bin/$(PVER)-dbg-config ln -sf $(PVER)-config.1.gz $(d_dbg)/usr/share/man/man1/$(PVER)-dbg-config.1.gz for i in debian/*.overrides; do \ b=$$(basename $$i .overrides); \ install -D -m 644 $$i debian/$$b/usr/share/lintian/overrides/$$b; \ done touch stamps/stamp-install # Build architecture-independent files here. binary-indep: build-indep install stamps/stamp-control dh_testdir -i dh_testroot -i : # $(p_doc) package dh_installdirs -p$(p_doc) \ usr/share/doc/$(p_base) \ usr/share/doc/$(p_doc) dh_installdocs -p$(p_doc) cp -a Doc/build/html $(d_doc)/usr/share/doc/$(p_base)/ rm -f $(d_doc)/usr/share/doc/$(p_base)/html/_static/jquery.js rm -f $(d_doc)/usr/share/doc/$(p_base)/html/_static/underscore.js dh_link -p$(p_doc) \ /usr/share/doc/$(p_base)/html \ /usr/share/doc/$(p_doc)/html \ /usr/share/javascript/jquery/jquery.js \ /usr/share/doc/$(p_base)/html/_static/jquery.js \ /usr/share/javascript/underscore/underscore.js \ /usr/share/doc/$(p_base)/html/_static/underscore.js : # devhelp docs $(buildd_static)/python debian/pyhtml2devhelp.py \ $(d_doc)/usr/share/doc/$(p_base)/html index.html $(VER) \ > $(d_doc)/usr/share/doc/$(p_base)/html/$(PVER).devhelp gzip -9nv $(d_doc)/usr/share/doc/$(p_base)/html/$(PVER).devhelp dh_link -p$(p_doc) \ /usr/share/doc/$(p_base)/html /usr/share/devhelp/books/$(PVER) for i in $(p_ltst); do \ rm -rf debian/$$i/usr/share/doc/$$i; \ ln -s $(p_lbase) debian/$$i/usr/share/doc/$$i; \ done dh_installdebconf -i $(dh_args) dh_installexamples -i $(dh_args) -dh_icons -i $(dh_args) || dh_iconcache -i $(dh_args) dh_installchangelogs -i $(dh_args) dh_link -i $(dh_args) dh_compress -i $(dh_args) -X.py -X.cls -X.css -X.txt -X.json -X.js -Xobjects.inv -Xgdbinit dh_fixperms -i $(dh_args) : # make python scripts starting with '#!' executable for i in `find debian -mindepth 3 -type f ! -name '*.dpatch' ! -perm 755`; do \ if head -1 $$i | grep -q '^#!'; then \ chmod 755 $$i; \ echo "make executable: $$i"; \ fi; \ done -find $(d_doc) -name '*.txt' -perm 755 -exec chmod 644 {} \; dh_installdeb -i $(dh_args) dh_gencontrol -i $(dh_args) dh_md5sums -i $(dh_args) dh_builddeb -i $(dh_args) # Build architecture-dependent files here. binary-arch: build-arch install dh_testdir -a dh_testroot -a # dh_installdebconf -a dh_installexamples -a -dh_icons -a || dh_iconcache -a # dh_installmime -a dh_installchangelogs -a for i in $(p_dev) $(p_dbg); do \ rm -rf debian/$$i/usr/share/doc/$$i; \ ln -s $(p_base) debian/$$i/usr/share/doc/$$i; \ done for i in $(p_lbase); do \ rm -rf debian/$$i/usr/share/doc/$$i; \ ln -s $(p_lmin) debian/$$i/usr/share/doc/$$i; \ done for i in $(p_ldev) $(p_ldbg) $(p_lib); do \ rm -rf debian/$$i/usr/share/doc/$$i; \ ln -s $(p_lbase) debian/$$i/usr/share/doc/$$i; \ done -find debian ! -perm -200 -print -exec chmod +w {} \; ifneq ($(with_tk),yes) rm -f $(d_lbase)/$(scriptdir)/lib-dynload/_tkinter.$(DEB_HOST_MULTIARCH).so endif ifneq ($(with_gdbm),yes) rm -f $(d_lbase)/$(scriptdir)/lib-dynload/gdbm.$(DEB_HOST_MULTIARCH).so endif find $(d_ldbg) $(d_ldev) -name '*.a' ! -type l \ | xargs -n 1 $(DEB_HOST_GNU_TYPE)-objcopy -p --remove-section=.gnu.lto_.* dh_strip -a -N$(p_dbg) -N$(p_ldbg) -Xdebug -Xdbg --dbg-package=$(p_dbg) mkdir -p $(d_dbg)/usr/share/gdb/auto-load/usr/bin cp Tools/gdb/libpython.py $(d_dbg)/usr/share/gdb/auto-load/usr/bin/$(PVER)-gdb.py ln -sf $(PVER)-gdb.py $(d_dbg)/usr/share/gdb/auto-load/usr/bin/$(PVER)-dbg-gdb.py mkdir -p $(d_dbg)/usr/share/gdb/auto-load/usr/lib/$(DEB_HOST_MULTIARCH) ln -sf ../../bin/$(PVER)-gdb.py \ $(d_dbg)/usr/share/gdb/auto-load/usr/lib/$(DEB_HOST_MULTIARCH)/lib$(PVER).so.1.0-gdb.py ln -sf ../../bin/$(PVER)-gdb.py \ $(d_dbg)/usr/share/gdb/auto-load/usr/lib/$(DEB_HOST_MULTIARCH)/lib$(PVER)_d.so.1.0-gdb.py dh_link -a dh_compress -a -X.py dh_fixperms -a : # make python scripts starting with '#!' executable for i in `find debian -mindepth 3 -type f ! -name '*.dpatch' ! -perm 755`; do \ if head -1 $$i | grep -q '^#!'; then \ chmod 755 $$i; \ echo "make executable: $$i"; \ fi; \ done dh_makeshlibs -p$(p_lib) -V '$(p_lib)' dh_makeshlibs -p$(p_ldbg) -V '$(p_ldbg)' # don't include the following symbols, found in extensions # which either can be built as builtin or extension. sed -ri '/^ (_check_|asdl_|fast_save_|init)/d' \ $(d_lib)/DEBIAN/symbols $(d_ldbg)/DEBIAN/symbols dh_shlibdeps -p$(p_min) -- -dPre-Depends dh_shlibdeps -a -N$(p_min) dh_installdeb -a dh_gencontrol -a -- $(arch_substvars) dh_md5sums -a dh_builddeb -a # rules to patch the unpacked files in the source directory # --------------------------------------------------------------------------- # various rules to unpack addons and (un)apply patches. # - patch / apply-patches # - unpatch / reverse-patches patchdir = debian/patches glibc_version := $(shell dpkg -s locales | awk '/^Version:/ {print $$2}') broken_utimes := $(shell dpkg --compare-versions $(glibc_version) lt 2.3.5 && echo yes || echo no) $(patchdir)/series: $(patchdir)/series.in cpp -E \ -D$(derivative) \ $(if $(filter $(broken_utimes),yes),-DBROKEN_UTIMES) \ $(if $(filter $(with_fpectl),yes),-DWITH_FPECTL) \ -Darch_os_$(DEB_HOST_ARCH_OS) -Darch_$(DEB_HOST_ARCH) \ -o - $(patchdir)/series.in \ | egrep -v '^(#.*|$$)' > $(patchdir)/series patch: stamps/stamp-patch stamps/stamp-patch: $(patchdir)/series dh_testdir uname -a @echo USER=$$USER, LOGNAME=$$LOGNAME QUILT_PATCHES=$(patchdir) quilt push -a || test $$? = 2 rm -rf autom4te.cache configure autoconf mkdir -p stamps echo ""; echo "Patches applied in this version:" > stamps/pxx for i in $$(cat $(patchdir)/series); do \ echo ""; echo "$$i:"; \ sed -n 's/^# *DP: */ /p' $(patchdir)/$$i; \ done >> stamps/pxx mv stamps/pxx $@ dh_autotools-dev_updateconfig : # don't build pgen for cross builds, adjust timestamps touch Parser/acceler.c Parser/grammar1.c Parser/listnode.c \ Parser/node.c Parser/parser.c Parser/parsetok.c Parser/bitset.c \ Parser/metagrammar.c Parser/firstsets.c Parser/grammar.c \ Parser/pgen.c touch Objects/obmalloc.c Python/mysnprintf.c Python/pyctype.c \ Parser/tokenizer_pgen.c Parser/printgrammar.c Parser/pgenmain.c @sleep 0.1 touch Grammar/Grammar @sleep 0.1 touch Include/graminit.h @sleep 0.1 touch Python/graminit.c ln -sf site-packages Lib/dist-packages reverse-patches: unpatch unpatch: QUILT_PATCHES=$(patchdir) quilt pop -a -R || test $$? = 2 rm -f stamps/stamp-patch $(patchdir)/series rm -rf configure autom4te.cache rm -f Lib/dist-packages update-patches: $(patchdir)/series export QUILT_PATCHES=$(patchdir); \ export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \ export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \ while quilt push; do quilt refresh; done binary: binary-indep binary-arch .NOTPARALLEL: .PHONY: control-file configure build clean binary-indep binary-arch binary install # Local Variables: # mode: makefile # end: