File: rules

package info (click to toggle)
persalys 13.1.1%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 71,916 kB
  • sloc: xml: 496,859; cpp: 53,848; python: 3,435; sh: 332; makefile: 131; ansic: 14
file content (85 lines) | stat: -rwxr-xr-x 3,320 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
#!/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)

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

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_auto_clean:
	# If we populated a persalys directory for Python modules during the tests,
	# we remove them.
	if [ -e builddir/lib/test/persalys ]; then rm -rf builddir/lib/test/persalys; fi
	if [ -e python/test/persalys ]; then rm -rf python/test/persalys; fi
	dh_auto_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_install:
	dh_install
	# Installing and renaming icon
	mkdir -p debian/persalys/usr/share/icons/hicolor/64x64/apps
	cp images/Ps-icon-64.png debian/persalys/usr/share/icons/hicolor/64x64/apps/persalys-icon.png

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