File: rules

package info (click to toggle)
shiboken 1.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 6,248 kB
  • ctags: 8,532
  • sloc: cpp: 50,923; python: 5,950; xml: 2,354; makefile: 144; ansic: 136
file content (209 lines) | stat: -rwxr-xr-x 8,201 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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
#!/usr/bin/make -f

%:
	dh $@ --with python2 --with python3 --buildsystem=cmake --parallel

# Python versions (default is first)
PYVERSIONS=$(shell pyversions -v -r)
DEFAULT_PY=$(shell pyversions -v -d)
PY3VERSIONS=$(shell py3versions -v -r)
DEFAULT_PY3=$(shell py3versions -v -d)
LIBSHIBOKEN_SOVERSION=1.2

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

# G++ versions
g++-version := $(shell readlink /usr/bin/g++ | sed -e 's/g++-\(.*\)\.\(.*\)/\1\2/')
g++-version-ge-4.5 := $(shell if test $(g++-version) -ge 45; then echo "yes"; else echo "no"; fi)

CMAKE_COMMON_OPTIONS := -DCMAKE_SKIP_RPATH=true \
			-DLIB_SUFFIX=/$(DEB_HOST_MULTIARCH)

#### CONFIGURE ####

override_dh_auto_configure: configure_2 configure_3

configure_2: $(PYVERSIONS:%=override_dh_auto_configure_dbg-%) $(PYVERSIONS:%=override_dh_auto_configure-%)
	@echo "Python2 versions configured."

configure_3: $(PY3VERSIONS:%=override_dh_auto_configure_3_dbg-%) $(PY3VERSIONS:%=override_dh_auto_configure_3-%)
	@echo "Python3 versions configured."

override_dh_auto_configure_dbg-%:
	mkdir -p build-$*-dbg
	dh_auto_configure -a --builddirectory=build-$*-dbg -- \
	$(CMAKE_COMMON_OPTIONS) \
	-DCMAKE_BUILD_TYPE:STRING="Debug" \
	-DPYTHON_SUFFIX=-python$*-dbg \
	-DCMAKE_USE_PYTHON_VERSION="$*-dbg;$*_d;$*" \
	-DPython_ADDITIONAL_VERSIONS="$*-dbg;$*_d;$*" \
	-DPYTHON_EXECUTABLE=/usr/bin/python$*-dbg

override_dh_auto_configure-%:
	mkdir -p build-$*
	dh_auto_configure --builddirectory=build-$* -- \
	$(CMAKE_COMMON_OPTIONS) \
	-DCMAKE_BUILD_TYPE:STRING="Release" \
	-DPYTHON_SUFFIX=-python$* \
	-DCMAKE_USE_PYTHON_VERSION=$* \
	-DPython_ADDITIONAL_VERSIONS=$* \
	-DPYTHON_EXECUTABLE=/usr/bin/python$* \
	-DDEFAULT_PYTHON_SUFFIX=-python${DEFAULT_PY}

override_dh_auto_configure_3_dbg-%:
	mkdir -p build-$*-dbg
	dh_auto_configure -a --builddirectory=build-$*-dbg -- \
	$(CMAKE_COMMON_OPTIONS) \
	-DCMAKE_BUILD_TYPE:STRING="Debug" \
	-DUSE_PYTHON3=ON \
	-DPYTHON_SUFFIX=-python$*-dbg \
	-DCMAKE_USE_PYTHON_VERSION="$*-dbg;$*_d;$*" \
	-DCMAKE_USE_PYTHON_COMPILATION_FLAGS="dmu;dm" \
	-DPython_ADDITIONAL_VERSIONS="$*-dbg;$*_d;$*" \
	-DPYTHON3_EXECUTABLE=/usr/bin/python$*m \
	-DPYTHON3_DBG_EXECUTABLE=/usr/bin/python$*dm

override_dh_auto_configure_3-%:
	mkdir -p build-$*
	dh_auto_configure --builddirectory=build-$* -- \
	$(CMAKE_COMMON_OPTIONS) \
	-DCMAKE_BUILD_TYPE:STRING="Release" \
	-DUSE_PYTHON3=ON \
	-DPYTHON_SUFFIX=-python$* \
	-DCMAKE_USE_PYTHON_VERSION=$* \
	-DCMAKE_USE_PYTHON_COMPILATION_FLAGS="mu;m" \
	-DPython_ADDITIONAL_VERSIONS=$* \
	-DPYTHON3_EXECUTABLE=/usr/bin/python$*m \
	-DPYTHON3_DBG_EXECUTABLE=/usr/bin/python$*dm \
	-DDEFAULT_PYTHON_SUFFIX=.cpython-$(subst .,,${DEFAULT_PY3})m

#### BUILD ####

override_dh_auto_build: build_2 build_3
	dh_auto_build -i --builddirectory=build-$(DEFAULT_PY) -- doc

build_2: $(PYVERSIONS:%=override_dh_auto_build_dbg-%) $(PYVERSIONS:%=override_dh_auto_build-%)
	@echo "Python2 versions built."

build_3: $(PY3VERSIONS:%=override_dh_auto_build_dbg-%) $(PY3VERSIONS:%=override_dh_auto_build-%)
	@echo "Python3 versions built."

override_dh_auto_build_dbg-%:
	dh_auto_build -a --builddirectory=build-$*-dbg

override_dh_auto_build-%:
	dh_auto_build -a --builddirectory=build-$*

#### INSTALL ####

override_dh_auto_install: install_2 install_3

install_2: $(PYVERSIONS:%=override_dh_auto_install_dbg-%) $(PYVERSIONS:%=override_dh_auto_install-%)
	@echo "Python2 versions installed."

install_3: $(PY3VERSIONS:%=override_dh_auto_install_dbg-%) $(PY3VERSIONS:%=override_dh_auto_install-%)
	@echo "Python3 versions installed."

override_dh_auto_install_dbg-%:
	dh_auto_install -a --builddirectory=build-$*-dbg --destdir=debian/tmp-dbg

override_dh_auto_install-%:
	dh_auto_install -a --builddirectory=build-$*

#### STRIP ####
override_dh_strip:
	dh_strip -a --dbg-package=shiboken-dbg --exclude=-dbg.so

#### TEST ####

override_dh_auto_test: test_2 test_3

test_2: $(PYVERSIONS:%=override_dh_auto_test_dbg-%) $(PYVERSIONS:%=override_dh_auto_test-%)
	@echo "Python2 versions tested."

test_3: $(PY3VERSIONS:%=override_dh_auto_test_dbg-%) $(PY3VERSIONS:%=override_dh_auto_test-%)
	@echo "Python3 versions tested."

override_dh_auto_test_dbg-%:
	dh_auto_test -a --builddirectory=build-$*-dbg

override_dh_auto_test_dbg-3.4:
	# The tests for the other and sample libraries segfault. The same goes for the shiboken_module.
	dh_auto_test -a --builddirectory=build-3.4-dbg -- ARGS="-E '^(other|sample|shiboken_module)'"

override_dh_auto_test-%:
	dh_auto_test -a --builddirectory=build-$*

#### CLEAN ####
override_dh_auto_clean:
	rm -rf build-*
	rm -rf debian/tmp-dbg
	rm -f debian/libshiboken*.symbols
	rm -f debian/libshiboken*.symbols-py*
	rm -f debian/libshiboken-py3-*.symbols
	rm -f debian/libshiboken-py3-*.symbols-py*
	- rm -f tests/py3kcompat.pyc
	- rm -f tests/__pycache__/py3k*.cpython-*.pyc

#### DEBIAN INSTALL ####

override_dh_install: override_dh_install_done
	dh_install -i

override_dh_install_real:
	# Install the debug variant
	dh_install --sourcedir=debian/tmp-dbg -pshiboken-dbg
	
	# Install the other variants
	dh_install -a --list-missing --remaining-packages

override_dh_install_done: override_dh_install_real
ifneq (,$(filter libshiboken-dev, $(shell dh_listpackages)))
	# Setup the default version symbolic links
	ln -sf libshiboken-python${DEFAULT_PY}.so \
	               debian/libshiboken-dev/usr/lib/$(DEB_HOST_MULTIARCH)/libshiboken.so
	# Make sure the pkg-config is the default's
	install -D -m 644 build-${DEFAULT_PY}/data/shiboken.pc \
			debian/libshiboken-dev/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/shiboken.pc
	# Make sure the cmake file is Python2's default
	install -D -m 644 build-${DEFAULT_PY}/data/ShibokenConfig.cmake debian/libshiboken-dev/usr/lib/$(DEB_HOST_MULTIARCH)/cmake/Shiboken-$(shell grep 'set(PACKAGE_VERSION ' build-${DEFAULT_PY}/data/ShibokenConfigVersion.cmake | sed -e 's/.*PACKAGE_VERSION \(.*\))/\1/g')/ShibokenConfig.cmake
endif
ifneq (,$(filter shiboken-dbg, $(shell dh_listpackages)))
	ln -sf libshiboken-python${DEFAULT_PY}-dbg.so \
	               debian/shiboken-dbg/usr/lib/$(DEB_HOST_MULTIARCH)/libshiboken-dbg.so
endif

#### Shared libs ####
override_dh_makeshlibs: $(PYVERSIONS:%=override_dh_makeshlibs-%) $(PY3VERSIONS:%=override_dh_makeshlibs_py3-%)
	cat debian/libshiboken${LIBSHIBOKEN_SOVERSION}.symbols-py* > debian/libshiboken${LIBSHIBOKEN_SOVERSION}.symbols
	cat debian/libshiboken-py3-${LIBSHIBOKEN_SOVERSION}.symbols-py* > debian/libshiboken-py3-${LIBSHIBOKEN_SOVERSION}.symbols
	dh_makeshlibs -a

override_dh_makeshlibs-%:
	echo "libshiboken-python$*.so.${LIBSHIBOKEN_SOVERSION} libshiboken${LIBSHIBOKEN_SOVERSION} #MINVER#" > debian/libshiboken${LIBSHIBOKEN_SOVERSION}.symbols-py$*
	cat debian/libshiboken${LIBSHIBOKEN_SOVERSION}.symbols.pristine >> debian/libshiboken${LIBSHIBOKEN_SOVERSION}.symbols-py$*
ifeq ($(g++-version-ge-4.5),yes)
	# g++ version is >= 4.5, add related symbols
	sed -e 's|^ _| (ge-g++4.5)_|g' debian/libshiboken${LIBSHIBOKEN_SOVERSION}.symbols.g++-ge-4.5 >> debian/libshiboken${LIBSHIBOKEN_SOVERSION}.symbols-py$*
else
	# g++ version is < 4.5, add related symbols
	sed -e 's|^ _| (lt-g++4.5)_|g' debian/libshiboken${LIBSHIBOKEN_SOVERSION}.symbols.g++-lt-4.5 >> debian/libshiboken${LIBSHIBOKEN_SOVERSION}.symbols-py$*
endif

override_dh_makeshlibs_py3-%:
	echo "libshiboken.cpython-$(subst .,,$*)m.so.${LIBSHIBOKEN_SOVERSION} libshiboken-py3-${LIBSHIBOKEN_SOVERSION} #MINVER#" > debian/libshiboken-py3-${LIBSHIBOKEN_SOVERSION}.symbols-py$*
	cat debian/libshiboken${LIBSHIBOKEN_SOVERSION}.symbols.pristine >> debian/libshiboken-py3-${LIBSHIBOKEN_SOVERSION}.symbols-py$*
ifeq ($(g++-version-ge-4.5),yes)
	# g++ version is >= 4.5, add related symbols
	sed -e 's|^ _| (ge-g++4.5)_|g' debian/libshiboken${LIBSHIBOKEN_SOVERSION}.symbols.g++-ge-4.5 >> debian/libshiboken-py3-${LIBSHIBOKEN_SOVERSION}.symbols-py$*
else
	# g++ version is < 4.5, add related symbols
	sed -e 's|^ _| (lt-g++4.5)_|g' debian/libshiboken${LIBSHIBOKEN_SOVERSION}.symbols.g++-lt-4.5 >> debian/libshiboken-py3-${LIBSHIBOKEN_SOVERSION}.symbols-py$*
endif


override_dh_installdocs:
	dh_installdocs
ifneq (,$(filter shiboken-doc, $(shell dh_listpackages)))
	dh_sphinxdoc -pshiboken-doc
endif