~ubuntu-branches/ubuntu/quantal/python2.7/quantal-proposed

« back to all changes in this revision

Viewing changes to debian/rules

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2012-01-06 21:57:07 UTC
  • Revision ID: package-import@ubuntu.com-20120106215707-da7ef71vawoka4yy
Tags: 2.7.2-9ubuntu1
* Update to 20120105, taken from the 2.7 branch.
* Test build using db5.1.
* Overwrite some lintian warnings:
  - The -dbg interpreters are not unusual.
  - The -gdb.py files don't need a python dependency.
  - lintian can't handle a whatis entry starting with one word on the line.
* Fix test failures related to distutils debian installation layout.
* Add build-arch/build-indep targets.
* Regenerate Setup and Makefiles after correcting Setup.local.
* profiled-build.diff: Pass PY_CFLAGS instead of CFLAGS for the profiled
  build.
* Pass dpkg-buildflags to the build process, and build third party
  extensions with these flags.
* Add support to build using -flto (and -g1) on some architectures.
* Disable pgo builds for some architectures (for now, keep just
  amd64 armel armhf i386 powerpc ppc64).
* Build-depend on libgdbm-dev to build and run the gdbm tests.
* Build-depend on xvfb to run the tkinter tests.
* python2.7: Provide python2.7-argparse and python-argparse.
* Don't run test_threading on mips/mipsel.

Show diffs side-by-side

added added

removed removed

Lines of Context:
80
80
with_interp := static
81
81
#with_interp := shared
82
82
 
83
 
build_target := build-all
84
 
install_target := install
85
 
 
86
83
PY_INTERPRETER = /usr/bin/python$(VER)
87
84
 
88
85
ifeq ($(DEFAULT_VERSION),yes)
101
98
 
102
99
CC = gcc
103
100
 
 
101
DPKG_CFLAGS  := $(shell dpkg-buildflags --get CFLAGS)
 
102
DPKG_LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS)
 
103
OPT_CFLAGS   := $(filter-out -O%,$(DPKG_CFLAGS)) # default is -O3
 
104
DEBUG_CFLAGS := $(patsubst -O%,-O0,$(DPKG_CFLAGS))
 
105
 
104
106
# on alpha, use -O2 only, use -mieee
105
107
ifeq ($(DEB_HOST_ARCH),alpha)
106
 
    OPTSETTINGS = OPT="-g -O2 -fwrapv -mieee -Wall -Wstrict-prototypes"
107
 
    OPTDEBUGSETTINGS = OPT="-g -O0 -fwrapv -mieee -Wall -Wstrict-prototypes"
 
108
    OPT_CFLAGS += -mieee
 
109
    DEBUG_CFLAGS += -mieee
 
110
    EXTRA_OPT_FLAGS += -O2
108
111
endif
109
112
# issues with ia64 and m68k with -O3
110
 
ifneq (,$(filter $(DEB_HOST_ARCH),ia64 m68k))
111
 
    OPTSETTINGS = OPT="-fwrapv -g -O2 -Wall -Wstrict-prototypes"
112
 
endif
113
 
 
114
 
PWD             := $(shell pwd)
 
113
ifeq ($(DEB_HOST_ARCH),m68k)
 
114
    EXTRA_OPT_FLAGS += -O2
 
115
endif
 
116
 
 
117
ifeq ($(DEB_HOST_ARCH_OS),linux)
 
118
  ifneq (,$(findstring $(DEB_HOST_ARCH), amd64 armel armhf i386 powerpc ppc64))
 
119
    with_pgo := yes
 
120
  endif
 
121
endif
 
122
 
 
123
ifneq (,$(findstring $(DEB_HOST_ARCH), amd64 armel armhf i386))
 
124
  with_lto := yes
 
125
endif
 
126
 
 
127
ifneq (,$(findstring noopt, $(DEB_BUILD_OPTIONS)))
 
128
    OPT_CFLAGS := $(filter-out -O%, $(OPT_CFLAGS))
 
129
    EXTRA_OPT_CFLAGS = -O0
 
130
    with_pgo =
 
131
    with_lto =
 
132
endif
 
133
 
 
134
ifeq ($(with_lto),yes)
 
135
    EXTRA_OPT_CFLAGS += -g1 -flto -fuse-linker-plugin
 
136
endif
 
137
 
 
138
make_build_target = $(if $(with_pgo),profile-opt)
 
139
 
115
140
buildd_static   := $(CURDIR)/build-static
116
141
buildd_shared   := $(CURDIR)/build-shared
117
142
buildd_debug    := $(CURDIR)/build-debug
145
170
d_doc   := debian/$(p_doc)
146
171
d_dbg   := debian/$(p_dbg)
147
172
 
148
 
# profiled build fails on some architectures ...
149
 
ifneq (,$(filter $(DEB_HOST_ARCH), hppa ia64 m68k sparc hurd-i386))
150
 
  make_build_target =
151
 
else
152
 
  make_build_target = profile-opt
153
 
endif
154
 
 
155
 
build: $(build_target)
156
 
build-all: stamps/stamp-build
157
 
stamps/stamp-build: stamps/stamp-build-static stamps/stamp-build-shared stamps/stamp-build-debug stamps/stamp-build-shared-debug stamps/stamp-mincheck stamps/stamp-check stamps/stamp-pystone stamps/stamp-pybench
158
 
        touch stamps/stamp-build
 
173
build-arch: stamps/stamp-build
 
174
build-indep: stamps/stamp-build-doc
 
175
build: build-arch
 
176
stamps/stamp-build: stamps/stamp-build-static stamps/stamp-mincheck \
 
177
    stamps/stamp-build-shared stamps/stamp-build-debug \
 
178
    stamps/stamp-build-shared-debug \
 
179
    stamps/stamp-check stamps/stamp-pystone stamps/stamp-pybench
 
180
        touch $@
159
181
 
160
182
PROFILE_EXCLUDES = test_compiler test_distutils test_platform test_subprocess \
161
183
        test_multiprocessing test_cprofile \
177
199
stamps/stamp-build-static: stamps/stamp-configure-static
178
200
        dh_testdir
179
201
        $(MAKE) $(NJOBS) -C $(buildd_static) \
 
202
                EXTRA_CFLAGS="$(EXTRA_OPT_CFLAGS)" \
180
203
                PROFILE_TASK='$(PROFILE_TASK)' $(make_build_target)
181
204
        touch stamps/stamp-build-static
182
205
 
183
206
stamps/stamp-build-shared: stamps/stamp-configure-shared
184
207
        dh_testdir
185
 
        $(MAKE) $(NJOBS) -C $(buildd_shared)
 
208
        $(MAKE) $(NJOBS) -C $(buildd_shared) \
 
209
                EXTRA_CFLAGS="$(EXTRA_OPT_CFLAGS)"
186
210
#       : # build the shared library
187
211
#       $(MAKE) $(NJOBS) -C $(buildd_shared) \
188
212
#               libpython$(VER).so
189
213
        : # build a static library with PIC objects
190
214
        $(MAKE) $(NJOBS) -C $(buildd_shared) \
 
215
                EXTRA_CFLAGS="$(EXTRA_OPT_CFLAGS)" \
191
216
                LIBRARY=libpython$(VER)-pic.a libpython$(VER)-pic.a
192
217
        touch stamps/stamp-build-shared
193
218
 
194
219
stamps/stamp-build-debug: stamps/stamp-configure-debug
195
220
        dh_testdir
196
221
        $(MAKE) $(NJOBS) -C $(buildd_debug)
 
222
                EXTRA_CFLAGS="$(DEBUG_CFLAGS)"
197
223
        touch stamps/stamp-build-debug
198
224
 
199
225
stamps/stamp-build-shared-debug: stamps/stamp-configure-shared-debug
225
251
        rm -rf $(buildd_shared)
226
252
        mkdir -p $(buildd_shared)
227
253
        cd $(buildd_shared) && \
228
 
          CC="$(CC)" $(OPTSETTINGS) \
 
254
          CC="$(CC)" \
229
255
            ../configure \
230
256
                --enable-shared \
231
257
                $(common_configure_args)
232
 
        egrep \
233
 
          "^#($$(awk '$$2 ~ /^extension$$/ {print $$1}' debian/PVER-minimal.README.Debian.in | tr '\012' '|')XX)" \
234
 
            Modules/Setup.dist \
235
 
          | sed -e 's/^#//' -e 's/-Wl,-Bdynamic//;s/-Wl,-Bstatic//' \
236
 
            >> $(buildd_shared)/Modules/Setup.local
237
 
        cd $(buildd_shared) && \
238
 
          ../Modules/makesetup -c ../Modules/config.c.in -s Modules \
239
 
            Modules/Setup.config Modules/Setup.local Modules/Setup
240
 
        mv $(buildd_shared)/config.c $(buildd_shared)/Modules/
 
258
 
 
259
        $(call __post_configure,$(buildd_shared))
241
260
 
242
261
        touch stamps/stamp-configure-shared
243
262
 
245
264
        rm -rf $(buildd_static)
246
265
        mkdir -p $(buildd_static)
247
266
        cd $(buildd_static) && \
248
 
          CC="$(CC)" $(OPTSETTINGS) \
 
267
          CC="$(CC)" \
249
268
            ../configure \
250
269
                $(common_configure_args)
251
 
        egrep \
252
 
          "^#($$(awk '$$2 ~ /^extension$$/ {print $$1}' debian/PVER-minimal.README.Debian.in | tr '\012' '|')XX)" \
253
 
          Modules/Setup.dist | sed 's/^#//' \
254
 
            >> $(buildd_static)/Modules/Setup.local
255
 
        cd $(buildd_static) && \
256
 
          ../Modules/makesetup -c ../Modules/config.c.in -s Modules \
257
 
            Modules/Setup.config Modules/Setup.local Modules/Setup
258
270
 
259
 
        : # apply workaround for missing os.fsync
260
 
        sed 's/HAVE_SYNC/HAVE_FSYNC/g' $(buildd_static)/pyconfig.h \
261
 
                > $(buildd_static)/pyconfig.h.new
262
 
        touch -r $(buildd_static)/pyconfig.h $(buildd_static)/pyconfig.h.new
263
 
        mv -f $(buildd_static)/pyconfig.h.new $(buildd_static)/pyconfig.h
264
 
        mv $(buildd_static)/config.c $(buildd_static)/Modules/
 
271
        $(call __post_configure,$(buildd_static))
265
272
 
266
273
        touch stamps/stamp-configure-static
267
274
 
269
276
        rm -rf $(buildd_debug)
270
277
        mkdir -p $(buildd_debug)
271
278
        cd $(buildd_debug) && \
272
 
          CC="$(CC)" $(OPTDEBUGSETTINGS) CFLAGS="" CXXFLAGS="" \
 
279
          CC="$(CC)" \
273
280
            ../configure \
274
281
                $(common_configure_args) \
275
282
                --with-pydebug
276
 
        egrep \
277
 
          "^#($$(awk '$$2 ~ /^extension$$/ {print $$1}' debian/PVER-minimal.README.Debian.in | tr '\012' '|')XX)" \
278
 
          Modules/Setup.dist | sed 's/^#//' \
279
 
            >> $(buildd_debug)/Modules/Setup.local
280
 
        cd $(buildd_debug) && \
281
 
          ../Modules/makesetup -c ../Modules/config.c.in -s Modules \
282
 
            Modules/Setup.config Modules/Setup.local Modules/Setup
283
 
        mv $(buildd_debug)/config.c $(buildd_debug)/Modules/
284
283
 
285
 
        : # apply workaround for missing os.fsync
286
 
        sed 's/HAVE_SYNC/HAVE_FSYNC/g' $(buildd_debug)/pyconfig.h \
287
 
                > $(buildd_debug)/pyconfig.h.new
288
 
        touch -r $(buildd_debug)/pyconfig.h $(buildd_debug)/pyconfig.h.new
289
 
        mv -f $(buildd_debug)/pyconfig.h.new $(buildd_debug)/pyconfig.h
 
284
        $(call __post_configure,$(buildd_debug))
290
285
 
291
286
        touch stamps/stamp-configure-debug
292
287
 
294
289
        rm -rf $(buildd_shdebug)
295
290
        mkdir -p $(buildd_shdebug)
296
291
        cd $(buildd_shdebug) && \
297
 
          CC="$(CC)" $(OPTDEBUGSETTINGS) CFLAGS="" CXXFLAGS="" \
 
292
          CC="$(CC)" \
298
293
            ../configure \
299
294
                $(common_configure_args) \
300
295
                --enable-shared \
301
296
                --with-pydebug
 
297
 
 
298
        $(call __post_configure,$(buildd_shdebug))
 
299
 
 
300
        touch stamps/stamp-configure-shared-debug
 
301
 
 
302
define __post_configure
302
303
        egrep \
303
 
          "^#($$(awk '$$2 ~ /^extension$$/ {print $$1}' debian/PVER-minimal.README.Debian.in | tr '\012' '|')XX)" \
 
304
          "^#($$(awk -v ORS='|' '$$2 ~ /^extension$$/ {print $$1}' debian/PVER-minimal.README.Debian.in)XX)" \
304
305
          Modules/Setup.dist \
305
306
            | sed -e 's/^#//' -e 's/-Wl,-Bdynamic//;s/-Wl,-Bstatic//' \
306
 
            >> $(buildd_shdebug)/Modules/Setup.local
307
 
        cd $(buildd_shdebug) && \
 
307
            >> $(1)/Modules/Setup.local
 
308
 
 
309
        : # unconditionally run makesetup
 
310
        cd $(1) && \
308
311
          ../Modules/makesetup -c ../Modules/config.c.in -s Modules \
309
312
            Modules/Setup.config Modules/Setup.local Modules/Setup
310
 
        mv $(buildd_shdebug)/config.c $(buildd_shdebug)/Modules/
 
313
        mv $(1)/config.c $(1)/Modules/
 
314
 
 
315
        : # and fix the timestamps
 
316
        $(MAKE) -C $(1) Makefile Modules/config.c
311
317
 
312
318
        : # apply workaround for missing os.fsync
313
 
        sed 's/HAVE_SYNC/HAVE_FSYNC/g' $(buildd_shdebug)/pyconfig.h \
314
 
                > $(buildd_shdebug)/pyconfig.h.new
315
 
        touch -r $(buildd_shdebug)/pyconfig.h $(buildd_shdebug)/pyconfig.h.new
316
 
        mv -f $(buildd_shdebug)/pyconfig.h.new $(buildd_shdebug)/pyconfig.h
317
 
 
318
 
        touch stamps/stamp-configure-shared-debug
 
319
        sed 's/HAVE_SYNC/HAVE_FSYNC/g' $(1)/pyconfig.h \
 
320
                > $(1)/pyconfig.h.new
 
321
        touch -r $(1)/pyconfig.h $(1)/pyconfig.h.new
 
322
        mv -f $(1)/pyconfig.h.new $(1)/pyconfig.h
 
323
endef
319
324
 
320
325
stamps/stamp-mincheck: stamps/stamp-build-static debian/PVER-minimal.README.Debian.in
321
326
        for m in $(MIN_MODS) $(MIN_PACKAGES) $(MIN_EXTS) $(MIN_BUILTINS); do \
343
348
  TEST_EXCLUDES += test_tcl test_codecmaps_cn test_codecmaps_hk \
344
349
        test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw \
345
350
        test_normalization test_ossaudiodev
346
 
  ifneq (,$(filter $(DEB_HOST_ARCH), powerpc kfreebsd-i386))
 
351
  ifneq (,$(filter $(DEB_HOST_ARCH), mips mipsel powerpc kfreebsd-i386))
347
352
    TEST_EXCLUDES += test_threading
348
353
  endif
349
354
endif
359
364
ifneq (,$(filter $(DEB_HOST_ARCH), arm avr32))
360
365
  TEST_EXCLUDES += test_ctypes
361
366
endif
362
 
ifneq (,$(filter $(DEB_HOST_ARCH), m68k avr32 kfreebsd-amd64 kfreebsd-i386))
 
367
#ifneq (,$(filter $(DEB_HOST_ARCH), m68k avr32 kfreebsd-amd64 kfreebsd-i386))
 
368
ifneq (,$(filter $(DEB_HOST_ARCH), m68k avr32))
363
369
  TEST_EXCLUDES += test_bsddb3
364
370
endif
365
371
ifneq (,$(filter $(DEB_HOST_ARCH), arm armel avr32 m68k))
367
373
    TEST_EXCLUDES += test_compiler
368
374
  endif
369
375
endif
 
376
#ifneq (,$(filter $(DEB_HOST_ARCH), kfreebsd-amd64 kfreebsd-i386))
 
377
#  TEST_EXCLUDES += test_io
 
378
#endif
370
379
ifneq (,$(filter $(DEB_HOST_ARCH), hurd-i386))
371
380
  TEST_EXCLUDES += test_io test_random test_signal test_socketserver test_ssl test_threading
372
381
endif
396
405
        @echo "BEGIN test static"
397
406
        -time \
398
407
          $(SET_LOCPATH) \
399
 
          $(MAKE) -C $(buildd_static) test \
400
 
            TESTOPTS="$(TESTOPTS)" 2>&1 \
 
408
          xvfb-run -a -e xvfb-run.log \
 
409
            $(MAKE) -C $(buildd_static) test \
 
410
              EXTRA_CFLAGS="$(EXTRA_OPT_CFLAGS)" \
 
411
              TESTOPTS="$(TESTOPTS)" 2>&1 \
401
412
            | tee $(buildd_static)/test_results
402
413
        @echo "END test static"
403
414
        @echo "BEGIN test shared"
404
415
        -time \
405
416
          $(SET_LOCPATH) \
406
 
          $(MAKE) -C $(buildd_shared) test \
407
 
            TESTOPTS="$(TESTOPTS)" 2>&1 \
 
417
          xvfb-run -a -e xvfb-run.log \
 
418
            $(MAKE) -C $(buildd_shared) test \
 
419
              EXTRA_CFLAGS="$(EXTRA_OPT_CFLAGS)" \
 
420
              TESTOPTS="$(TESTOPTS)" 2>&1 \
408
421
            | tee $(buildd_shared)/test_results
409
422
        @echo "END test shared"
410
 
  ifeq (0,1)
411
423
  ifeq (,$(findstring $(DEB_HOST_ARCH), alpha))
412
424
        @echo "BEGIN test debug"
413
425
        -time \
414
426
          $(SET_LOCPATH) \
415
 
          $(MAKE) -C $(buildd_debug) test \
416
 
            TESTOPTS="$(TESTOPTS)" 2>&1 \
 
427
          xvfb-run -a -e xvfb-run.log \
 
428
            $(MAKE) -C $(buildd_debug) test \
 
429
              TESTOPTS="$(TESTOPTS)" 2>&1 \
417
430
            | tee $(buildd_debug)/test_results
418
431
        @echo "END test debug"
419
432
  endif
420
 
  endif
421
433
endif
422
434
        cp -p $(buildd_static)/test_results debian/
423
435
        touch stamps/stamp-check
570
582
 
571
583
2to3-man:
572
584
        help2man --no-info --version-string=$(VER) --no-discard-stderr \
 
585
          --name 'Python2 to Python3 converter' \
573
586
          2to3-$(VER) > debian/2to3-$(VER).1
574
587
 
575
 
install: $(build_target) stamps/stamp-install
 
588
install: build-arch stamps/stamp-install
576
589
stamps/stamp-install: stamps/stamp-build control-file stamps/stamp-control
577
590
        dh_testdir
578
591
        dh_testroot
894
907
        done
895
908
        cp -p $(buildd_debug)/pyconfig.h $(d_dbg)/usr/include/$(PVER)_d/
896
909
        ln -sf $(PVER).1.gz $(d_dbg)/usr/share/man/man1/$(PVER)-dbg.1.gz
 
910
        ln -sf $(PVER)-config.1.gz $(d_dbg)/usr/share/man/man1/$(PVER)-dbg-config.1.gz
897
911
 
898
912
        for i in debian/*.overrides; do \
899
913
          b=$$(basename $$i .overrides); \
903
917
        touch stamps/stamp-install
904
918
 
905
919
# Build architecture-independent files here.
906
 
binary-indep: $(install_target) $(build_target) stamps/stamp-build-doc stamps/stamp-control
 
920
binary-indep: build-indep install stamps/stamp-control
907
921
        dh_testdir -i
908
922
        dh_testroot -i
909
923
 
950
964
        dh_builddeb -i $(dh_args)
951
965
 
952
966
# Build architecture-dependent files here.
953
 
binary-arch: build install
 
967
binary-arch: build-arch install
954
968
        dh_testdir -a
955
969
        dh_testroot -a
956
970
#       dh_installdebconf -a