]> git.k1024.org Git - debian-pyxattr.git/blob - debian/rules
Improve hardening of the package (all except pie)
[debian-pyxattr.git] / debian / rules
1 #!/usr/bin/make -f
2 # Sample debian/rules that uses debhelper.
3 # GNU copyright 1997 to 1999 by Joey Hess.
4 #
5 # Modified to make a template file for a multi-binary package with separated
6 # build-arch and build-indep targets  by Bill Allombert 2001
7
8 # Uncomment this to turn on verbose mode.
9 #export DH_VERBOSE=1
10
11 # This has to be exported to make some magic below work.
12 export DH_OPTIONS
13
14 PYVERS := $(shell pyversions -vr)
15 PY3VERS := $(shell py3versions -vr)
16
17 PKGROOT=$(CURDIR)/debian/python-pyxattr
18 DBGROOT=$(CURDIR)/debian/python-pyxattr-dbg
19 PKG3ROOT=$(CURDIR)/debian/python3-pyxattr
20 DBG3ROOT=$(CURDIR)/debian/python3-pyxattr-dbg
21
22 export DEB_BUILD_MAINT_OPTIONS = hardening=+all,-pie
23 DPKG_EXPORT_BUILDFLAGS = 1
24 include /usr/share/dpkg/buildflags.mk
25
26 build: build-arch build-indep
27         touch $@
28
29 build-arch: $(PYVERS:%=build-python%) $(PY3VERS:%=build-python%)
30         $(MAKE) doc
31         touch $@
32
33 build-python%:
34         python$* setup.py build
35         python$*-dbg setup.py build
36         touch $@
37
38 build-indep:
39         touch $@
40
41 clean:
42         dh_testdir
43         dh_testroot
44         rm -f build-indep build-arch
45         $(MAKE) clean
46         rm -f $(PYVERS:%=build-python%)
47         rm -f $(PY3VERS:%=build-python%)
48         rm -rf pxattr.egg-info
49         dh_clean
50
51 install: build $(PYVERS:%=install-python%) $(PY3VERS:%=install-python%)
52         find $(DBGROOT) ! -type d ! -name '*_d.so' | xargs rm -f
53         find $(DBGROOT) -depth -empty -print0 | xargs -r0 rmdir
54
55 install-python2%:
56         python2$* setup.py install --root $(PKGROOT) --install-layout=deb
57         python2$*-dbg setup.py install --root $(DBGROOT) --install-layout=deb
58
59 install-python3%:
60         python3$* setup.py install --root $(PKG3ROOT) --install-layout=deb
61         python3$*-dbg setup.py install --root $(DBG3ROOT) --install-layout=deb
62
63 # Build architecture-dependent files here.
64 binary-arch: build install
65         dh_testdir
66         dh_testroot
67         dh_installchangelogs
68         dh_installdocs
69         dh_sphinxdoc
70         dh_strip -ppython-pyxattr --dbg-package=python-pyxattr-dbg
71         dh_strip -ppython3-pyxattr --dbg-package=python3-pyxattr-dbg
72         rm -rf $(DBGROOT)/usr/share/doc/python-pyxattr-dbg
73         ln -s python-pyxattr $(DBGROOT)/usr/share/doc/python-pyxattr-dbg
74         rm -rf $(DBG3ROOT)/usr/share/doc/python3-pyxattr-dbg
75         ln -s python3-pyxattr $(DBG3ROOT)/usr/share/doc/python3-pyxattr-dbg
76         dh_compress -X.js
77         dh_fixperms
78         dh_python2
79         dh_python3
80         dh_installdeb
81         dh_shlibdeps
82         dh_gencontrol
83         dh_md5sums
84         dh_builddeb
85
86 # Build architecture independant packages here.
87 binary-indep: build install
88 # Nothing to do
89
90 binary: binary-arch binary-indep
91 .PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure