File: rules

package info (click to toggle)
pyxmms 2.04-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 312 kB
  • ctags: 191
  • sloc: ansic: 1,340; python: 657; makefile: 99; sh: 57
file content (150 lines) | stat: -rwxr-xr-x 4,717 bytes parent folder | download
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#! /usr/bin/make -f

p   := python-xmms
pd  := python-xmms-doc
p21 := python2.1-xmms
p22 := python2.2-xmms
p23 := python2.3-xmms
p24 := python2.4-xmms
d21 := debian/$(p21)
d22 := debian/$(p22)
d23 := debian/$(p23)
d24 := debian/$(p24)
dd  := debian/$(pd)

MANPAGE_SOURCE := debian/pyxmms.sgml
MANPAGE        := pyxmms.3

WGET := wget
# README.Debian for "slave" packages, i.e. packages that don't hold their
# own documentation (which is located in $(pd)).
DEBIAN_SLAVE_README := debian/README.Debian

# According to Debian Policy 3.6.1
PY_BUILD_FLAGS += --debug

build: build-arch build-indep

build-arch: build21-stamp build22-stamp build23-stamp build24-stamp

build21-stamp:
	dh_testdir debian/python2.1-xmms.postinst
	rm -f build21-stamp
	python2.1 ./setup.py build $(PY_BUILD_FLAGS)
	touch build21-stamp

build22-stamp:
	dh_testdir debian/python2.2-xmms.postinst
	rm -f build22-stamp
	python2.2 ./setup.py build $(PY_BUILD_FLAGS)
	touch build22-stamp

build23-stamp:
	dh_testdir debian/python2.3-xmms.postinst
	rm -f build23-stamp
	python2.3 ./setup.py build $(PY_BUILD_FLAGS)
	touch build23-stamp

build24-stamp:
	dh_testdir debian/python2.4-xmms.postinst
	rm -f build24-stamp
	python2.4 ./setup.py build $(PY_BUILD_FLAGS)
	touch build24-stamp

build-indep: build-indep-stamp
# Dependencies:
#   - on build24-stamp because we need the .so files to generate the
#     documentation (pydoc imports the modules, and we are using Python 2.4
#     in order to run pydoc)
#   - on $(MANPAGE_SOURCE) because the manual page belongs to the debian
#     package (not provided upstream) and therefore might be modified by the
#     debian maintainer between successive builds of the package (well, the
#     dependency is not needed if he calls the clean target between those
#     builds)... not really necessary, but not harmful.
build-indep-stamp: build24-stamp $(MANPAGE_SOURCE)
	dh_testdir build-documentation.py src/_xmmscontrolmodule.c \
           debian/pyxmms.sgml
	rm -f build-indep-stamp
        # The docs are best formatted IMHO with Python >= 2.3.
	python2.4 ./build-documentation.py
	docbook-to-man "$(MANPAGE_SOURCE)" >"$(MANPAGE)"
	touch build-indep-stamp

clean:
	dh_testdir src/_xmmscontrolmodule.c
	dh_testroot
	-rm -f *-stamp
# The following lines are commented out because something along the lines of
# `rm -rf build' looks more appropriate here:
# python2.1 ./setup.py clean
# python2.2 ./setup.py clean
	rm -rf build MANIFEST "$(MANPAGE)"
	for module in common control config; do \
            rm -f doc/xmms.$${module}.html; \
        done
	dh_clean

binary-indep: build-indep
	dh_testdir doc/xmms.control.html debian/pyxmms.sgml
	dh_testroot
	dh_clean -k

# It is important to have python-xmms before python-xmms-doc in the control
# file because I don't want the README.Debian in python-xmms-doc but
# dh_installdocs automatically installs it in the first binary package listed
# in the control file...
	dh_installdocs -p$(pd) README
	dh_installdocs -p$(p) "$(DEBIAN_SLAVE_README)" NEWS
	dh_installdirs -p$(pd) usr/share/doc/python-xmms-doc/html
	dh_install -p$(pd) doc/* usr/share/doc/python-xmms-doc/html
	dh_installman -p$(pd) "$(MANPAGE)"
	dh_installchangelogs -i ChangeLog

	dh_compress -i -X.py
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

binary-arch: build-arch
	dh_testdir src/_xmmscontrolmodule.c
	dh_testroot
	dh_clean -k

# We want no precompiled files in the .deb files. We will generate them in
# postinst.
	python2.1 ./setup.py install --prefix="$$PWD/$(d21)/usr" --no-compile
	python2.2 ./setup.py install --prefix="$$PWD/$(d22)/usr" --no-compile
	python2.3 ./setup.py install --prefix="$$PWD/$(d23)/usr" --no-compile
	python2.4 ./setup.py install --prefix="$$PWD/$(d24)/usr" --no-compile
	dh_strip -a

	dh_installdocs -A -a $(DEBIAN_SLAVE_README) NEWS
	dh_installchangelogs -a ChangeLog

	dh_compress -a -X.py
	dh_fixperms -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

binary: binary-indep binary-arch

# FIXME: mktemp(1) says:
#     Debian packages using mktemp in maintainer scripts must depend on
#     debianutils >= 1.7.
# but is it really necessary when it is only used in get-orig-source?
# And, agreed, it is not essential here...
get-orig-source:
	TMPFILE="`mktemp -t PyXMMS.XXXXXXXXXX`" && \
        $(WGET) -O "$$TMPFILE" \
           http://www.via.ecp.fr/~flo/2002/PyXMMS/dist/latest && \
        LATEST_UPSTREAM_VERSION=`tar tzf "$$TMPFILE" | head -1 \
          | sed 's/.*-\([0-9]*\.[0-9]*\)\//\1/'` && \
        mv "$$TMPFILE" pyxmms_$${LATEST_UPSTREAM_VERSION}.orig.tar.gz

.PHONY: clean build build-arch build-indep binary binary-arch binary-indep \
        get-orig-source