File: rules

package info (click to toggle)
pygobject-2 2.28.6-13
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 8,076 kB
  • ctags: 7,116
  • sloc: xml: 20,728; ansic: 18,657; python: 16,282; sh: 11,109; makefile: 870
file content (176 lines) | stat: -rwxr-xr-x 5,893 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
#!/usr/bin/make -f

include /usr/share/gnome-pkg-tools/1/rules/uploaders.mk
-include /usr/share/gnome-pkg-tools/1/rules/gnome-get-source.mk

include /usr/share/python/python.mk

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

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

export echo=/bin/echo

configure_flags += \
		--prefix=/usr \
		--enable-thread \
		--build=$(DEB_BUILD_GNU_TYPE) \
		--disable-introspection \
		--disable-silent-rules \
		--disable-maintainer-mode

ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
	configure_flags += --host=$(DEB_HOST_GNU_TYPE)
endif

PYDEFAULTVER := $(shell pyversions --default --version)
PYVERS := $(shell pyversions --requested --version debian/control)
PYVERS := $(filter-out $(PYDEFAULTVER), $(PYVERS)) $(PYDEFAULTVER)

patch-stamp:
	dh_testdir
	dh_autoreconf
	touch $@

patch: patch-stamp

build-%/configure-stamp: patch-stamp
	dh_testdir
	mkdir -p build-$*
	cd build-$* && \
		PYTHON=/usr/bin/python$* CFLAGS="$(CFLAGS)" \
			$(CURDIR)/configure $(configure_flags)
	touch $@

dbg-build-%/configure-stamp: patch-stamp
	dh_testdir
	mkdir -p dbg-build-$*
	cd dbg-build-$* && \
		PYTHON=/usr/bin/python$*-dbg CFLAGS="$(CFLAGS) -O0" \
			$(CURDIR)/configure $(configure_flags)
	touch $@

build-%/build-stamp: build-%/configure-stamp
	dh_testdir
	PYTHON=/usr/bin/python$* $(MAKE) -C build-$* pyexecdir=$(call py_libdir_sh, $*)
	touch $@

dbg-build-%/build-stamp: dbg-build-%/configure-stamp
	dh_testdir
	PYTHON=/usr/bin/python$*-dbg $(MAKE) -C dbg-build-$* pyexecdir=$(call py_libdir_sh, $*)
	touch $@

build: $(PYVERS:%=build-%/build-stamp) $(PYVERS:%=dbg-build-%/build-stamp)
build-arch build-indep: build

build-%/check-stamp: build-%/build-stamp
	find gi glib gobject gio -name '*.py' -exec cp '$(CURDIR)/{}' build-$*/'{}' \;
	# don't run the tests under fakeroot, otherwise they will try to
	# connect to root's session D-BUS
	-PYTHON=/usr/bin/python$* LD_PRELOAD= xvfb-run $(MAKE) -C build-$* check
	touch $@

dbg-build-%/check-stamp: dbg-build-%/build-stamp
	find gi glib gobject gio -name '*.py' -exec cp '$(CURDIR)/{}' dbg-build-$*/'{}' \;
	# don't run the tests under fakeroot, otherwise they will try to
	# connect to root's session D-BUS
	-PYTHON=/usr/bin/python$*-dbg LD_PRELOAD= xvfb-run $(MAKE) -C dbg-build-$* check
	touch $@

check: $(PYVERS:%=build-%/check-stamp) $(PYVERS:%=dbg-build-%/check-stamp)

build-%/install-stamp: build-%/build-stamp
	dh_testdir
	dh_testroot
	PYTHON=/usr/bin/python$* $(MAKE) -C build-$* install DESTDIR=$(CURDIR)/debian/python-gobject-2-dev pyexecdir=$(call py_libdir_sh, $*)
	# dh_python2 trips over this empty dir in the sanity check for >= 2.6, so remove it
	-rmdir debian/python-gobject-2-dev/usr/lib/python$*/site-packages
	# until all reverse dependencies of pygobject have been converted to
	# dh_python2, install a library search path which is backwards
	# compatible to pysupport (see Debian#614764)
	echo "/usr/lib/pymodules/python$*/gtk-2.0/" > $(CURDIR)/debian/python-gobject-2-dev/$(call py_libdir_sh, $*)/gtk-2.0-pysupport-compat.pth
	touch $@

dbg-build-%/install-stamp: dbg-build-%/build-stamp
	dh_testdir
	dh_testroot
	PYTHON=/usr/bin/python$*-dbg $(MAKE) -C dbg-build-$* install DESTDIR=$(CURDIR)/debian/python-gobject-2-dbg pyexecdir=$(call py_libdir_sh, $*)
	find debian/python-gobject-2-dbg ! -type d ! \( -name '*.so' -o -name '*.so.*' \) -delete
	find debian/python-gobject-2-dbg -type d -empty -delete
	touch $@

install-stamp: $(PYVERS:%=build-%/build-stamp) $(PYVERS:%=dbg-build-%/build-stamp)
	dh_testdir
	dh_testroot
	# remove the install stamps to force a reinstall (since dh_clean is
	# removing the package dirs)
	dh_prep
	rm -f $(PYVERS:%=build-%/install-stamp) $(PYVERS:%=dbg-build-%/install-stamp)
	$(MAKE) -f debian/rules $(PYVERS:%=build-%/install-stamp) $(PYVERS:%=dbg-build-%/install-stamp)
	find debian/python-gobject-2-dev -name \*.la -delete
	mkdir -p debian/python-gobject-2/usr/lib
	mv debian/python-gobject-2-dev/usr/lib/python* debian/python-gobject-2/usr/lib/
	mv debian/python-gobject-2-dev/usr/lib/libpyglib-*so.* \
	   debian/python-gobject-2/usr/lib
	rm -rf debian/python-gobject-2-dev/usr/lib/python*
	for i in $$(find debian/python-gobject-2-dbg -name '*.so' -path 'debian/python-gobject-2-dbg/usr/lib/python*/*-packages/*'); do \
		b=$$(basename $$i .so); \
		mv $$i $$(dirname $$i)/$${b}_d.so; \
	done

	touch $@

install: install-stamp

clean::
	dh_testdir
	dh_testroot
	rm -f install-stamp
	rm -f patch-stamp
	rm -rf build-* dbg-build-*
	dh_autoreconf_clean
	dh_clean *.pyc */*.pyc

maybe_check = $(if $(findstring nocheck,$(DEB_BUILD_OPTIONS)),,check)

binary-indep: install $(maybe_check)
	dh_testdir
	dh_testroot
	dh_installdocs -i
	dh_installexamples -i
	dh_installchangelogs ChangeLog -i
	dh_link -i
	dh_compress -i -X.py
	dh_fixperms -i
	# More permission fixing
	chmod 755 `grep -rl "^#\!.*python" debian/python-gobject-2-dev/usr`
	dh_python2 -i /usr/share/pygobject
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

binary-arch: install $(maybe_check)
	dh_testdir
	dh_testroot
	dh_installdocs -s
	dh_installexamples -s
	dh_installchangelogs -s ChangeLog
	dh_strip -ppython-gobject-2 --dbg-package=python-gobject-2-dbg
	rm -rf debian/python-gobject-2-dbg/usr/share/doc/python-gobject-2-dbg
	ln -sf python-gobject-2 debian/python-gobject-2-dbg/usr/share/doc/python-gobject-2-dbg
	dh_link -s
	dh_compress -s -X.py
	dh_fixperms -s
	dh_python2 -a
	dh_makeshlibs -ppython-gobject-2   -V'python-gobject-2 (>= 2.28.1)'
	dh_makeshlibs -ppython-gobject-2-dbg -V'python-gobject-2-dbg (>= 2.28.1)'
	dh_installdeb -s
	dh_shlibdeps -s
	dh_gencontrol -s
	dh_md5sums -s
	dh_builddeb -s

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