| 1 |
#!/usr/bin/make -f |
| 2 |
# -*- mode: makefile; coding: utf-8 -*- |
| 3 |
|
| 4 |
# Uncomment this to turn on verbose mode. |
| 5 |
#export DH_VERBOSE=1 |
| 6 |
|
| 7 |
build: |
| 8 |
dh $@ --with python3,bash-completion --buildsystem=pybuild |
| 9 |
%: |
| 10 |
dh $@ --with python3,bash-completion --buildsystem=pybuild |
| 11 |
|
| 12 |
.PHONY: build |
| 13 |
|
| 14 |
PYVERS := $(shell py3versions -vd) |
| 15 |
BUILD_DIR := $(shell pybuild -p $(PYVERS) --print '{build_dir}') |
| 16 |
|
| 17 |
include /usr/share/dpkg/architecture.mk |
| 18 |
|
| 19 |
override_dh_python3: |
| 20 |
dh_python3 --shebang=/usr/bin/python3 |
| 21 |
|
| 22 |
override_dh_auto_build: |
| 23 |
dh_auto_build |
| 24 |
$(MAKE) build-chg |
| 25 |
|
| 26 |
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) |
| 27 |
NJOBS := $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) |
| 28 |
PARALLEL_TEST_JOBS := --jobs $(NJOBS) |
| 29 |
endif |
| 30 |
|
| 31 |
ARCH_IS_MIPS := $(if $(subst mips,,$(DEB_HOST_ARCH)),,T) |
| 32 |
ARCH_IS_KFREEBSD-i386 := $(if $(subst kfreebsd-i386,,$(DEB_HOST_ARCH)),,T) |
| 33 |
ARCH_IS_ARMEL := $(if $(subst armel,,$(DEB_HOST_ARCH)),,T) |
| 34 |
ARCH_IS_SPARC := $(if $(subst sparc,,$(DEB_HOST_ARCH)),,T) |
| 35 |
|
| 36 |
common_test_flags = \ |
| 37 |
--with-hg=$(BUILD_DIR)/../scripts/hg \ |
| 38 |
--verbose \ |
| 39 |
--timeout 1800 \ |
| 40 |
$(PARALLEL_TEST_JOBS) |
| 41 |
test_flags = \ |
| 42 |
$(common_test_flags) \ |
| 43 |
--blacklist $(CURDIR)/debian/mercurial.test_blacklist |
| 44 |
ifeq ($(DEB_HOST_ARCH), riscv64) |
| 45 |
test_flags += \ |
| 46 |
--blacklist $(CURDIR)/debian/mercurial.test_blacklist_riscv64 |
| 47 |
endif |
| 48 |
|
| 49 |
override_dh_auto_test: |
| 50 |
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) |
| 51 |
http_proxy='' $(MAKE) tests PYTHON=python3 TESTFLAGS="$(test_flags)" PYTHONPATH=$(BUILD_DIR) |
| 52 |
# run blacklisted tests but ignore their results |
| 53 |
-cd tests && PYTHONPATH=$(BUILD_DIR) python3 run-tests.py $(common_test_flags) `grep ^test ../debian/mercurial.test_blacklist` |
| 54 |
endif |
| 55 |
|
| 56 |
execute_after_dh_install: |
| 57 |
if test -d $(CURDIR)/debian/mercurial ; then \ |
| 58 |
$(MAKE) -f debian/rules install-archdep ; \ |
| 59 |
fi |
| 60 |
if test -d $(CURDIR)/debian/mercurial-common ; then \ |
| 61 |
$(MAKE) -f debian/rules install-archindep ;\ |
| 62 |
fi |
| 63 |
|
| 64 |
install-archdep: |
| 65 |
# remove arch-independent python stuff |
| 66 |
find debian/mercurial/usr/lib \ |
| 67 |
! -name '*.so' ! -type d -delete , \ |
| 68 |
-type d -empty -delete |
| 69 |
|
| 70 |
install-archindep: |
| 71 |
# remove arch-dependent python stuff |
| 72 |
find debian/mercurial-common/usr/lib \ |
| 73 |
-name '*.so' ! -type d -delete , \ |
| 74 |
-type d -empty -delete |
| 75 |
install -DTm 644 contrib/zsh_completion \ |
| 76 |
debian/mercurial-common/usr/share/zsh/vendor-completions/_mercurial |
| 77 |
install -DTm 644 tests/run-tests.py \ |
| 78 |
debian/mercurial-common/usr/share/mercurial/tests/run-tests.py |
| 79 |
|
| 80 |
override_dh_python3-arch: |
| 81 |
dh_python3 |
| 82 |
find debian/mercurial/usr/share -type d -empty -delete ; \ |
| 83 |
|
| 84 |
override_dh_auto_clean: mercurial/__version__.py |
| 85 |
dh_auto_clean |
| 86 |
$(MAKE) clean |
| 87 |
$(RM) -rv tmp/ |
| 88 |
|
| 89 |
mercurial/__version__.py: |
| 90 |
@echo "$@ is missing (you probably call 'make clean' directly)." |
| 91 |
@echo "Restore it from sources before building the package" |
| 92 |
@echo "Aborting." |
| 93 |
exit 1 |