File: rules

package info (click to toggle)
stopt 6.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,264 kB
  • sloc: cpp: 75,778; python: 6,012; makefile: 72; sh: 57
file content (103 lines) | stat: -rwxr-xr-x 3,795 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# If noopt was not passed, building with -O3 instead of -O2 to enhance
# numerical performance.
ifeq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
export DEB_CXXFLAGS_MAINT_APPEND=-O3
export DEB_CXXFLAGS_MAINT_STRIP=-O2
endif

include /usr/share/dpkg/buildflags.mk
CFLAGS+=$(CPPFLAGS)
CXXFLAGS+=$(CPPFLAGS)
DPKG_EXPORT_BUILDFLAGS = 1
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

include /usr/share/dpkg/pkg-info.mk

PY3VER=$(shell py3versions -d)

SOVERSION_STOPT=5
VERSION_STOPT=$(shell echo $(DEB_VERSION_UPSTREAM) | sed -E 's/~rc[0-9]*// ; s/\+dfsg[0-9]*//')

# Using --oversubscribe if Open MPI is used, and no flag for MPICH.
ifeq (, $(shell dpkg --list | grep "libmpich-dev"))
OVERSUBSCRIBE_FLAG=--oversubscribe
else
OVERSUBSCRIBE_FLAG=
endif

%:
	dh $@ --with python3

override_dh_auto_clean:
	dh_auto_clean
	# Removing the build directory of the LaTeX documentation.
	-rm -rf texdocBuild/

override_dh_auto_configure-arch:
	# Skipping the build with mpi with BUILD_MPI=OFF until stopt can be built
	# against openmpi 5.x
	dh_auto_configure -- \
	        -DCMAKE_LIBRARY_ARCHITECTURE="$(DEB_HOST_MULTIARCH)" \
	        -DCMAKE_INSTALL_PREFIX="/usr" \
	        -DBUILD_MPI=OFF \
	        -DCMAKE_BUILD_RPATH_USE_ORIGIN=ON \
	        -DSOVERSION_STOPT="$(SOVERSION_STOPT)" \
	        -DVERSION_STOPT="$(VERSION_STOPT)" \
	        -DPython3_INCLUDE_DIRS=$(shell python3-config --includes | sed 's/.*-I//') \
	        -DPython3_LIBRARIES=$(shell ls /usr/lib/$(DEB_HOST_MULTIARCH)/libpython*.so | grep "$(PY3VER)") \
	        -DPython3_NumPy_INCLUDE_DIRS=/usr/lib/python3/dist-packages/numpy/core/include \
	        -DMPIEXEC_PREFLAGS=$(OVERSUBSCRIBE_FLAG)

override_dh_auto_configure-indep:

override_dh_auto_build-indep:
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	# Building the LaTeX documentation.
	# Two sets of paths have to be changed because we used a MUT package.
	cp -a texdoc/ texdocBuild/
	cd texdocBuild && \
	        sed -i 's|../StOpt/StOpt/|../StOpt/|g' documentation.tex && \
	        sed -i 's|../StOpt/test/|../test/|g' documentation.tex && \
	        pdflatex documentation.tex && \
	        bibtex documentation.aux && \
	        pdflatex documentation.tex && \
	        pdflatex documentation.tex
endif

# Tests cannot be run safely in parallel.
override_dh_auto_test-arch:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	dh_auto_test -a --no-parallel
endif

# No test to perform for the architecture-independent packages
override_dh_auto_test-indep:

override_dh_installdocs-indep:
	dh_installdocs -i
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	mkdir -p debian/stopt-doc/usr/share/doc/stopt-doc/
	cp texdocBuild/documentation.pdf debian/stopt-doc/usr/share/doc/stopt-doc/
endif

override_dh_installexamples-indep:
	dh_installexamples -i
	cp -a test/python/ debian/stopt-examples/usr/share/doc/stopt-examples/examples/
	# Some Python tests cannot be run because we don't package all built .so...
	# some of them being designed for the tests only.
	rm -rf debian/stopt-examples/usr/share/doc/stopt-examples/examples/python/functional/
	rm -rf debian/stopt-examples/usr/share/doc/stopt-examples/examples/python/unit/geners/testSomeBinaryArchiveStorage.py
	rm -rf debian/stopt-examples/usr/share/doc/stopt-examples/examples/python/unit/global
	rm -rf debian/stopt-examples/usr/share/doc/stopt-examples/examples/python/unit/sddp
	rm -rf debian/stopt-examples/usr/share/doc/stopt-examples/examples/python/unit/tree

override_dh_fixperms-indep:
	dh_fixperms -i
	#Setting all Python scripts (that are shipped as examples) as being executable
	for F in $$(find debian/stopt-examples/usr/share/doc/stopt-examples/examples/python/ -name "test*.py"); do \
	        chmod a+x $$F; \
	done