File: rules

package info (click to toggle)
persalys 17.0.1%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 73,312 kB
  • sloc: xml: 496,863; cpp: 56,490; python: 3,605; sh: 389; makefile: 127; ansic: 14
file content (77 lines) | stat: -rwxr-xr-x 2,856 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
#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
CFLAGS+=$(CPPFLAGS)
CXXFLAGS+=$(CPPFLAGS)

include /usr/share/dpkg/architecture.mk

ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
	NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
	test_makeflags = -j$(NUMJOBS)
endif

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

override_dh_clean:
	rm -rf builddir
	rm -rf python/test/persalys
	dh_clean

override_dh_auto_configure:
	dh_auto_configure -Bbuilddir -- \
            -DUSE_SPHINX=OFF \
            -DUSE_SALOME=OFF \
            -DCMAKE_CXX_FLAGS:STRING="$(CXXFLAGS)" \
            -DCMAKE_MODULE_LINKER_FLAGS:STRING="$(LDFLAGS)" \
            -DCMAKE_SKIP_INSTALL_RPATH:BOOL=ON \
            -DCMAKE_INSTALL_PREFIX:PATH=/usr \
            -DINSTALL_DESTDIR:PATH=$(CURDIR)/debian/persalys \
            -DLINK_PYTHON_LIBRARY:BOOL=OFF \
            -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python3

override_dh_auto_build:
	$(MAKE) $(test_makeflags) -C builddir

override_dh_auto_install:
	dh_auto_install -Bbuilddir
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	# Building the folder of the persalys Python module in the Python test
	# directory so that it is found during the tests.
	if [ ! -e python/test/persalys ]; then \
	        mkdir python/test/persalys ; \
	        cp python/src/__init__.py python/test/persalys ; \
	        cp builddir/python/src/persalys.py python/test/persalys ; \
	        cp builddir/python/src/_persalys*.so python/test/persalys ; \
	fi
	# Looking for the shared lib that is about to be installed.
	LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$${LD_LIBRARY_PATH}:}$(CURDIR)/debian/libpersalys0/usr/lib/$(DEB_HOST_MULTIARCH) \
	  CTEST_OUTPUT_ON_FAILURE=1 \
	  xvfb-run -s "-screen 0 1024x768x24" $(MAKE) $(test_makeflags) -C builddir test ARGS="$(test_makeflags) -R pyinstallcheck"
	find $(CURDIR)/debian/persalys -name "*.pyc" -o -name "__pycache__" | xargs rm -rf
endif

override_dh_makeshlibs:
	dh_makeshlibs -Xpyshared

override_dh_compress:
	dh_compress -X.pdf -X.svn -X.py

override_dh_auto_test:
	# Building the folder of the persalys Python module in the C++ test directory
	# so that it is found during the tests.
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	if [ ! -e builddir/lib/test/persalys ]; then \
	        mkdir builddir/lib/test/persalys ; \
	        cp python/src/__init__.py builddir/lib/test/persalys ; \
	        cp builddir/python/src/persalys.py builddir/lib/test/persalys ; \
	        cp builddir/python/src/_persalys*.so builddir/lib/test/persalys ; \
	fi
	# 'make test' does not build binary tests
	$(MAKE) $(test_makeflags) -C builddir tests
	CTEST_OUTPUT_ON_FAILURE=1 \
	  xvfb-run -s "-screen 0 1024x768x24" $(MAKE) -C builddir test ARGS="$(test_makeflags) -R cppcheck"
endif