File: rules

package info (click to toggle)
odil 0.10.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 4,852 kB
  • sloc: cpp: 51,770; python: 3,781; xml: 182; makefile: 103
file content (127 lines) | stat: -rwxr-xr-x 4,041 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
#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# needed for the tests
export DCMDICTPATH=$(shell ls /usr/share/libdcmtk*/dicom.dic | head -n 1)

# Find all Python versions
PYTHON2=$(shell pyversions -vrd)
PYTHON3=$(shell py3versions -vrd)
ALLPY=$(PYTHON2) $(PYTHON3)

%:
	dh $@ --builddirectory=build --with python2,python3

# Base build: no wrappers
override_dh_auto_configure-arch:
	dh_auto_configure -- \
	  -DBUILD_EXAMPLES=OFF \
	  -DBUILD_PYTHON_WRAPPERS=OFF -DBUILD_JAVASCRIPT_WRAPPERS=OFF

override_dh_auto_build-nopy:
	dh_auto_build
	mv build build-nopy

# Reconfigure base build for specific Python version and build wrappers
# WARNING: Python2 and Python3 MUST be built sequentially since they use the
# same build directory
override_dh_auto_build-py: override_dh_auto_build-nopy
	set -e; \
	for Python in $(ALLPY); do \
	  echo "=== Building for Python $${Python} ==="; \
	  cp -a build-nopy build; \
	  dh_auto_configure -- \
	    -DBUILD_EXAMPLES=OFF \
	    -DBUILD_PYTHON_WRAPPERS=ON -DBUILD_JAVASCRIPT_WRAPPERS=OFF \
	    -DPYTHON_EXECUTABLE=/usr/bin/python$${Python}; \
	  dh_auto_build; \
	  mv build build-py$${Python}; \
	done

override_dh_auto_build-arch: override_dh_auto_build-nopy override_dh_auto_build-py

override_dh_auto_build-indep:
	dh_auto_configure --builddirectory=build-indep -- \
	  -DBUILD_EXAMPLES=OFF \
	  -DBUILD_PYTHON_WRAPPERS=ON -DBUILD_JAVASCRIPT_WRAPPERS=OFF \
	  -DPYTHON_EXECUTABLE=/usr/bin/python$(PYTHON3)
	mkdir -p documentation/_build
	cd documentation && doxygen
	find documentation/_build -name "*.md5" -delete

# Run C++ tests only on base build
override_dh_auto_test-arch-nopy:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	ln -s build-nopy build
	cd build && ../tests/run --no-network -e ".*"
	rm build
endif

# Run Python tests only on python build
# WARNING: Python2 and Python3 MUST be tested sequentially since they use the
# same build directory
override_dh_auto_test-arch-py: override_dh_auto_test-arch-nopy
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	set -e; \
	for Python in $(ALLPY); do \
	  echo "=== Testing for Python $${Python} ==="; \
	  ln -s build-py$${Python} build; \
	  ln -sr ./build/wrappers/python ./build/odil; \
	  ln -sr ./wrappers/python/*.py ./build/odil; \
	  cd build && \
	    ../tests/run --no-network \
	      --nose nosetests$$(dpkg --compare-versions $${Python} ge 3 && echo "3") \
	      -E ".*"; \
	  cd ..; \
	  rm ./build/odil/*py; \
	  rm ./build/odil; \
	  rm build; \
	done
endif

override_dh_auto_test-arch: override_dh_auto_test-arch-nopy override_dh_auto_test-arch-py

override_dh_auto_install-arch-nopy:
	ln -s build-nopy build
	$(MAKE) -C build/src install DESTDIR=$(CURDIR)/debian/tmp
	rm build

# WARNING: Python2 and Python3 MUST be installed sequentially since they use the
# same build directory
override_dh_auto_install-arch-py: override_dh_auto_install-arch-nopy
	set -e; \
	for Python in $(ALLPY); do \
	  echo "=== Installing for Python $${Python} ==="; \
	  ln -s build-py$${Python} build; \
	  $(MAKE) -C build/wrappers/python install DESTDIR=$(CURDIR)/debian/tmp; \
	  rm build; \
	done

override_dh_auto_install-arch: override_dh_auto_install-arch-nopy override_dh_auto_install-arch-py

override_dh_auto_install-indep:
	ln -s build-indep build
	$(MAKE) -C build/applications install DESTDIR=$(CURDIR)/debian/tmp
	rm build

override_dh_install-arch:
	dh_install
	d-shlibmove \
		--devunversioned \
		--commit --multiarch --exclude-a --exclude-la \
		--movedev debian/tmp/usr/include/* usr/include \
		--override s/libboost_log.*-dev/libboost-log-dev/ \
		debian/tmp/usr/lib/*.so

override_dh_clean:
	dh_clean
	find tests -name "*pyc" -delete
	rm -rf build-nopy $(ALLPY:%=build-py%) build-indep documentation/_build

override_dh_dwz:
	echo "Ignore dh_dwz due to 'dwz -q -- debian/python-odil/usr/lib/python2.7/dist-packages/odil/_odil.x86_64-linux-gnu.so returned exit code 1'"

# These steps are not needed for arch-independent packages
override_dh_auto_configure-indep:
override_dh_auto_test-indep: