summaryrefslogtreecommitdiff
path: root/debian/rules
blob: 55ae4f2f761ddb4c70ca18bcf7db35f4732ae282 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/make -f

#export DH_VERBOSE=1

include /usr/share/python/python.mk

PYVERS=$(shell pyversions -vr)
PKGDIR=$(CURDIR)/debian/python-pycryptopp

clean:
	dh_testdir
	dh_testroot
	rm -rf dist build build-*
	find . -name '*\.pyc' -delete
	dh_clean install-stamp build-stamp \
		$(PYVERS:%=install-python%) $(PYVERS:%=build-python%) \
		$(PYVERS:%=install-debug-python%) $(PYVERS:%=build-debug-python%)

build: build-stamp

build-stamp: $(PYVERS:%=build-python%) $(PYVERS:%=build-debug-python%)
	touch $@

build-python%:
	python$* setup.py build --disable-embedded-cryptopp
	touch $@

build-debug-python%:
	python$*-dbg setup.py build --disable-embedded-cryptopp
	touch $@

install: $(PYVERS:%=install-python%) $(PYVERS:%=install-debug-python%)
	# pkg_resources is not used (see patches), no need to require setuptools
	find $(PKGDIR)/usr/ -type f -name requires.txt -delete
	# docs are in /usr/share/doc/python-pycryptopp/, remove duplicates
	rm -rf $(PKGDIR)/usr/share/doc/pycryptopp/
	rm -rf $(PKGDIR)-dbg/usr/share/doc/pycryptopp/

install-python%: build
	dh_installdirs
	python$* setup.py install $(py_setup_install_args) \
		--skip-build --single-version-externally-managed --root $(PKGDIR)
	# move test vectors outside site-packages
	if [ -d $(PKGDIR)/usr/share/python-pycryptopp/testvectors ]; then \
		rm -rf $(PKGDIR)/$(call py_libdir,$*)/pycryptopp/testvectors; \
	else	mv $(PKGDIR)/$(call py_libdir,$*)/pycryptopp/testvectors $(PKGDIR)/usr/share/python-pycryptopp/; fi
	touch $@

install-debug-python%: build
	python$*-dbg setup.py install $(py_setup_install_args) \
		--skip-build --single-version-externally-managed --root $(PKGDIR)-dbg/
	find $(PKGDIR)-dbg/usr/lib/python$*/ ! -type d ! -name '*_d\.so' -delete
	find $(PKGDIR)-dbg/usr/lib/python$*/ -depth -empty -delete
	touch $@

binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs
	dh_python2
	dh_makeshlibs
	dh_strip --dbg-package=python-pycryptopp-dbg
	rm -rf $(PKGDIR)-dbg/usr/share/doc/python-pycryptopp-dbg
	ln -s python-pycryptopp $(PKGDIR)-dbg/usr/share/doc/python-pycryptopp-dbg
	dh_compress -a -X.py
	dh_fixperms -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a -- -Z bzip2

binary-indep:

binary: binary-indep binary-arch

.PHONY: build clean binary-indep binary-arch binary install