File: rules

package info (click to toggle)
gst0.10-python 0.10.19-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 4,032 kB
  • ctags: 1,854
  • sloc: sh: 11,143; python: 11,084; ansic: 1,772; perl: 1,585; makefile: 559
file content (147 lines) | stat: -rwxr-xr-x 5,647 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
#!/usr/bin/make -f

DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

CFLAGS += -Wall -g -O$(if $(findstring noopt,$(DEB_BUILD_OPTIONS)),0,2)

CFLAGS += -Wno-error
CXXFLAGS += -Wno-error

PY_DEFAULT := $(shell pyversions --default)
PY_VERSIONS = $(sort $(shell pyversions --requested) $(PY_DEFAULT))

include /usr/share/pycentral-data/pycentral.mk

PATCH_DIR := debian/patches

configure_flags := --prefix=/usr

# packages where /usr/share/doc/$p is a symlink
USD_SYMLINK_PKGS := python-gst0.10-dbg

ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
	configure_flags += --build=$(DEB_BUILD_GNU_TYPE)
else
	configure_flags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
endif

patch: patch-stamp

patch-stamp:
	dh_testdir
	# backup the original files to restore them in the clean target
	-test -r config.sub && cp config.sub config.sub.orig
	-test -r config.guess && cp config.guess config.guess.orig
	-test -r /usr/share/misc/config.sub && \
		cp -f /usr/share/misc/config.sub config.sub
	-test -r /usr/share/misc/config.guess && \
		cp -f /usr/share/misc/config.guess config.guess
	touch $@

build-stamp-%: patch-stamp
	dh_testdir
	[ ! -f Makefile ] || $(MAKE) distclean
	PYTHON=`which $*` PKG_CONFIG_PATH=/usr/lib/pkgconfig/$* CFLAGS="$(CFLAGS)" \
		./configure $(configure_flags)
	$(MAKE)
	$(MAKE) install DESTDIR=$(CURDIR)/debian/python-gst0.10 \
		PYEXECDIR=/usr/lib/$*/$(call sitedir,$*) \
		PYLIBDIR=/usr/lib/$*/$(call sitedir,$*) \
		pyexecdir=/usr/lib/$*/$(call sitedir,$*) \
		pylibdir=/usr/lib/$*/$(call sitedir,$*)
	# move installed files to a per python runtime location to allow
	# comparison of the resulting files across runtimes or shipping
	# multiple versions
	# pkg-config file (this is shipped twice because of varying pyexecdir)
	mkdir -p debian/python-gst0.10-dev/usr/lib/pkgconfig/$*
	mv debian/python-gst0.10/usr/lib/pkgconfig/*.pc debian/python-gst0.10-dev/usr/lib/pkgconfig/$*
	# defs files, should be the same whatever the build-time python runtime
	mkdir -p debian/python-gst0.10-dev/usr/share/gst-python/0.10/defs/$*
	mv debian/python-gst0.10/usr/share/gst-python/0.10/defs/*.defs debian/python-gst0.10-dev/usr/share/gst-python/0.10/defs/$*
	# examples should be in the -dev package
	mkdir -p debian/python-gst0.10-dev/usr/share/gst-python/0.10/examples
	mv debian/python-gst0.10/usr/share/gst-python/0.10/examples/* debian/python-gst0.10-dev/usr/share/gst-python/0.10/examples
	rmdir debian/python-gst0.10/usr/share/gst-python/0.10/examples
	touch $@

dbg-build-stamp-%: patch-stamp
	dh_testdir
	[ ! -f Makefile ] || $(MAKE) distclean
	PYTHON=`which $*-dbg` PKG_CONFIG_PATH=/usr/lib/pkgconfig/$* CFLAGS="$(CFLAGS) -O0" \
		./configure $(configure_flags)
	$(MAKE)
	$(MAKE) install DESTDIR=$(CURDIR)/debian/python-gst0.10-dbg \
		PYEXECDIR=/usr/lib/$*/$(call sitedir,$*) \
		PYLIBDIR=/usr/lib/$*/$(call sitedir,$*) \
		pyexecdir=/usr/lib/$*/$(call sitedir,$*) \
		pylibdir=/usr/lib/$*/$(call sitedir,$*)
	touch $@

build-arch: $(addprefix build-stamp-, $(PY_VERSIONS)) $(addprefix dbg-build-stamp-, $(PY_VERSIONS))

build: build-arch

clean:
	dh_testdir
	dh_testroot
	[ ! -f Makefile ] || $(MAKE) distclean
	# restore files from backup (before unpatching)
	-test -r config.sub.orig && mv -f config.sub.orig config.sub
	-test -r config.guess.orig && mv -f config.guess.orig config.guess
	rm -f patch-stamp build-stamp-* dbg-build-stamp-* */*.pyc *.pyc
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_install
	# check that all builds with various Python runtimes produced the same
	# *.defs files (or fail)
	for v in $(PY_VERSIONS); do \
	    echo "Comparing defs files for the default Python version ($(PY_DEFAULT)) with defs files for Python $$v"; \
	    diff --brief --recursive debian/python-gst0.10-dev/usr/share/gst-python/0.10/defs/$(PY_DEFAULT) debian/python-gst0.10-dev/usr/share/gst-python/0.10/defs/$$v; \
	done
	
	# drop all *.la files
	find debian/python-gst0.10/usr/lib/python* -name '*.la' -print0 | xargs -0r rm -f --
	# only keep *.so files and symlinks in the dbg packages
	find debian/python-*-dbg ! -type d ! -name '*.so' -print0 | xargs -0r rm -f --
	find debian/python-*-dbg -depth -empty -exec rmdir -- {} \;
	# suffix *.so files and symlinks with _d in the dbg packages
	for i in $$(find debian/python-*-dbg -name '*.so'); do \
	    b="$$(basename "$$i" .so)"; \
	    mv "$$i" "$$(dirname "$$i")/$${b}_d.so"; \
	done
	# since all Python runtimes produced the same files, only keep one set
	@echo "Cleaning up..."
	mv debian/python-gst0.10-dev/usr/share/gst-python/0.10/defs/$(PY_DEFAULT)/*.defs debian/python-gst0.10-dev/usr/share/gst-python/0.10/defs
	for v in $(PY_VERSIONS); do \
	    rm --force --recursive debian/python-gst0.10-dev/usr/share/gst-python/0.10/defs/$$v; \
	done
	# set executable bit on files with a shebang
	egrep -rlZ '^#!(.*)(python|sh)' debian/python-gst0.10 | xargs -0 chmod a+x --

binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs -s $(addprefix -N, $(USD_SYMLINK_PKGS)) ChangeLog
	dh_installdocs -s $(addprefix -N, $(USD_SYMLINK_PKGS))
	dh_link -s
	dh_link $(addprefix -p, $(USD_SYMLINK_PKGS)) \
		$(addprefix usr/share/doc/python-gst0.10 \
			usr/share/doc/,$(USD_SYMLINK_PKGS))
	dh_strip -s -Npython-gst0.10-dbg --dbg-package=python-gst0.10-dbg
	dh_compress -s -Xexample
	dh_fixperms -s
	DH_PYCENTRAL=include-links dh_pycentral -s
	dh_installdeb -s
	dh_shlibdeps -s
	dh_gencontrol -s
	dh_md5sums -s
	dh_builddeb -s

binary-indep:

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