596cdf37fbee6729d1c258ec3b7c575964eeeba2
[joel/debian/python-pysqlite2.git] / debian / rules
1 #!/usr/bin/make -f
2
3 # Uncomment this to turn on verbose mode.
4 #export DH_VERBOSE = 1
5
6 PYVERS = $(shell pyversions -r)
7
8 build: build-stamp
9
10 build-stamp: $(PYVERS:%=build-ext-%-stamp) $(PYVERS:%=dbg-build-ext-%-stamp)
11         touch $@
12
13 build-ext-%-stamp:
14         dh_testdir
15         $* setup.py build
16         touch $@
17
18 dbg-build-ext-%-stamp:
19         dh_testdir
20         $*-dbg setup.py build -g
21         touch $@
22
23 clean:
24         dh_testdir
25         dh_testroot
26         rm -f build*stamp dbg-build*stamp
27         rm -rf build
28         find . -name '*.pyc' | xargs rm -f
29         dh_clean
30
31 install: build install-prereq $(PYVERS:%=install-ext-%) $(PYVERS:%=dbg-install-ext-%)
32
33 install-prereq:
34         dh_testdir
35         dh_testroot
36         dh_prep
37         dh_installdirs
38
39 install-ext-%:
40         $* setup.py install --root=$(CURDIR)/debian/python-pysqlite2 --install-layout=deb
41         rm -rf debian/python-pysqlite2/usr/pysqlite2-doc
42         rm -rf debian/python-pysqlite2/usr/bin
43         find debian -type d -wholename '*pysqlite2/test' | xargs rm -rf
44         find debian/python-pysqlite2 -name '*.pyc' | xargs rm -f
45
46 dbg-install-ext-%:
47         $*-dbg setup.py install --root=$(CURDIR)/debian/python-pysqlite2-dbg --install-layout=deb
48         find debian/python-*-dbg ! -type d ! -name '*.so' | xargs rm -f
49         find debian/python-*-dbg -depth -empty -exec rmdir {} \;
50
51 # Build architecture-independent files here.
52 binary-indep:
53         dh_testdir
54         dh_testroot
55         dh_prep
56         dh_installdirs -i usr/share/doc/python-pysqlite2-doc/html
57
58         python setup.py build_docs
59         dh_installdocs -i build/doc/*
60         cd debian/python-pysqlite2-doc/usr/share/doc/python-pysqlite2-doc && \
61                 mv *.html _static _sources html; \
62                 ln -sf ../../../../javascript/jquery/jquery.js html/_static/jquery.js
63
64         dh_installchangelogs -i
65         dh_compress -i -Xjson -Xtxt -Xjs
66         dh_fixperms -i
67         dh_installdeb -i
68         dh_shlibdeps -i
69         dh_gencontrol -i
70         dh_md5sums -i
71         dh_builddeb -i
72
73 # Build architecture-dependent files here.
74 binary-arch: build install
75         dh_testdir -a
76         dh_testroot -a
77
78         dh_installdocs -a
79         dh_python2 -a
80         dh_installchangelogs -a
81         dh_strip -ppython-pysqlite2 --dbg-package=python-pysqlite2-dbg
82         rm -rf debian/python-pysqlite2-dbg/usr/share/doc/python-pysqlite2-dbg
83         ln -s python-pysqlite2 debian/python-pysqlite2-dbg/usr/share/doc/python-pysqlite2-dbg
84         dh_compress -a
85         dh_fixperms -a
86         dh_installdeb -a
87         dh_shlibdeps -a
88         dh_gencontrol -a
89         dh_md5sums -a
90         dh_builddeb -a
91
92 binary: binary-indep binary-arch
93
94 .PHONY: build clean binary-indep binary-arch binary install configure