File: rules

package info (click to toggle)
camitk 6.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 389,496 kB
  • sloc: cpp: 103,476; sh: 2,448; python: 1,618; xml: 984; makefile: 128; perl: 84; sed: 20
file content (206 lines) | stat: -rwxr-xr-x 12,379 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
#!/usr/bin/make -f

# DH_VERBOSE := 1

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# CamiTK version from d/changelog)
include /usr/share/dpkg/pkg-info.mk
FULL_VERSION := $(shell echo '$(DEB_VERSION)' | sed -e 's/^[[:digit:]]*://' -e 's/[~-].*//')
VER_MAJOR := $(shell echo '$(FULL_VERSION)' | cut -f1 -d".")
VER_MINOR := $(shell echo '$(FULL_VERSION)' | cut -f2 -d".")
VER_SHORT=$(VER_MAJOR).$(VER_MINOR)

# package aliases (see d/control)
pkg_lib = libcamitk$(VER_MAJOR)
pkg_qpb = libqtpropertybrowser$(VER_MAJOR)
pkg_cfg = camitk-config
pkg_dev = libcamitk-dev
pkg_qpb_dev = libqtpropertybrowser-dev
pkg_data = libcamitk$(VER_MAJOR)-data
pkg_doc = libcamitk$(VER_MAJOR)-doc
pkg_imp = camitk-imp
pkg_asm = camitk-actionstatemachine
PKG_LIB_DIR := $(CURDIR)/debian/$(pkg_lib)/usr/lib/$(DEB_HOST_MULTIARCH)/camitk-$(VER_SHORT)
LIB_BUILD_DIR := $(CURDIR)/camitk-build/lib/$(DEB_HOST_MULTIARCH)
PRIVATE_LIB_BUILD_DIR := $(LIB_BUILD_DIR)/camitk-$(VER_SHORT)

# List of python tests that require to install some PyPI packages, they should be not run during packaging
# (no execution of code outside the source package)
EXCLUDED_PYTHON_TESTS := "'(test-pythonhotplug-image|test-pythonhotplug-mesh|test-pythonhotplug-state|test-pythonhotplug-qt|test-pythonhotplug-meshPoints|test-pythonhotplug-transformationManager|test-pythonhotplug-userScriptValidity|test-pythonhotplug-actionPipeline|test-pythonscript-scriptVariable|test-pythonscript-numpyImageComponent|test-pythonscript-core|test-pythonscript-vtk)'"

# multi-arch support
include /usr/share/dpkg/architecture.mk

# CMake flags are of two types:
# - generic (to tell cmake to build proper binaries)
# - CamiTK specific options
# Notes:
# - if you would like a more verbose camitk at run-time,
#   you can add -DCAMITK_LOG_LEVEL=2
CMAKE_EXTRA_FLAGS = \
	-DCMAKE_SKIP_RPATH:BOOL=TRUE \
	-DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=FALSE \
	-DCMAKE_BUILD_TYPE:STRING=None \
	-DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) \
	\
	-DCEP_IMAGING:BOOL=TRUE \
	-DCEP_MODELING:BOOL=TRUE \
	-DCEP_TUTORIALS:BOOL=TRUE \
	\
	-DPYTHON_BINDING:BOOL=TRUE \
	-DPYTHON_BINDING_TEST_DISABLE:BOOL=TRUE \
	\
	-DAPIDOC_SDK:BOOL=TRUE

# Verbose is required by blhc to remove errors about pre-build of extensiongenerator lib and executable
%:
	VERBOSE=1 QT_QPA_PLATFORM=offscreen dh $@ --builddirectory=camitk-build --with python3

override_dh_auto_configure:
	# modify libdir to include multiarch
	sed -i 's+return "lib";+return "lib/$(DEB_HOST_MULTIARCH)";+g' sdk/libraries/core/CamiTKVersion.h
	dh_auto_configure -- $(CMAKE_EXTRA_FLAGS)

# let's be smart with doc
override_dh_auto_build-indep:
	# Building API DOC
	dh_auto_build -- camitk-ce-api-doc
	# Building all (required to avoid cmake error)
	dh_auto_build

# No tests needed for docs
override_dh_auto_test-indep:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	echo "No tests availaible just for the docs"
endif

# run all the available tests (only for Archictecture: any
# as tests can only be run if and once the framework is build)
override_dh_auto_test-arch:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	# Some tests generate source code and build it but do not receive the hardening flags
	# As this generated source code do not end up in the distributed binary,
	# this can be considered as blhc false positive : just ignore them
	@echo 'blhc: ignore-line-regexp: .*camitk-test-tmp.*'
	@echo 'blhc: ignore-line-regexp: .*CamiTKExtensionCheck.*'
	@echo 'blhc: ignore-line-regexp: .*CMakeCXXCompilerABI.cpp.*'
	# Use the CamiTK test suite
	# Note: all tests require an X server, xvfb-run is needed to have a virtual one
	# Another way: xvfb-run --auto-servernum $(MAKE) -C camitk-build ARGS="-V" test
	# e.g. to test config: (cd camitk-build && xvfb-run --auto-servernum --server-args="-screen 0 1024x768x24" ctest -VV --timeout 1800 -R application-config)
	# The build dir path is needed for extensions, public and private libraries during test
	# to know about all camitk extension directories and properly manage inner-dependencies
	# between extensions (i.e., mml component extension depends on physicalmodel component extensions)
	# Lib dependencies can be in any extensions (viewers, component and action extensions) lib directory
	export LD_LIBRARY_PATH=$(LIB_BUILD_DIR)/:$(PRIVATE_LIB_BUILD_DIR)/viewers/:$(PRIVATE_LIB_BUILD_DIR)/components/:$(PRIVATE_LIB_BUILD_DIR)/actions/:$(PRIVATE_LIB_BUILD_DIR)/ ; \
	(cd camitk-build && xvfb-run --auto-servernum --server-args="-screen 0 1024x768x24" ctest -V --timeout 1800 --exclude-regex "$(EXCLUDED_PYTHON_TESTS)")
endif

# packages for specific arch
override_dh_install:
	# $(CURDIR) is the current source dir
	# camitk dynamic library
	dh_install -p$(pkg_lib) --autodest debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libcamitkcore.so.*
	dh_install -p$(pkg_lib) --autodest debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libmonitoring.so.*
	dh_install -p$(pkg_lib) --autodest debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libcamitkextensiongenerator.so.*
	dh_install -p$(pkg_lib) --autodest debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libcamitkitktemplates.so.*
	dh_install -p$(pkg_lib) --autodest debian/tmp/usr/lib/python3/dist-packages/camitk.cpython*.so
	dh_install -p$(pkg_lib) --autodest debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/camitk-$(VER_SHORT)/viewers/lib*.so.*
	dh_install -p$(pkg_lib) --autodest debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/camitk-$(VER_SHORT)/actions/lib*.so.*
	dh_install -p$(pkg_lib) --autodest debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/camitk-$(VER_SHORT)/components/lib*.so.*

	# camitk-config package contains only the app, man page and icon
	dh_install -p$(pkg_cfg) --autodest debian/tmp/usr/bin/camitk-config
	dh_install -p$(pkg_cfg) --autodest debian/tmp/usr/share/pixmaps/camitk-config.xpm
	dh_installman -p$(pkg_cfg) debian/tmp/usr/share/man/man1/camitk-config.1

	# separate packaging for qtpropertybrowser (can be used independently from camitk)
	dh_install -p$(pkg_qpb) --autodest debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libqtpropertybrowser.so.*

	# camitk developer package
	# camitk so and headers and static libs
	dh_install -p$(pkg_dev) debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libcamitkcore.so usr/lib/$(DEB_HOST_MULTIARCH)
	dh_install -p$(pkg_dev) debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libmonitoring.so usr/lib/$(DEB_HOST_MULTIARCH)
	dh_install -p$(pkg_dev) debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libcamitkextensiongenerator.so usr/lib/$(DEB_HOST_MULTIARCH)
	dh_install -p$(pkg_dev) debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libcamitkitktemplates.so usr/lib/$(DEB_HOST_MULTIARCH)
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/camitk-$(VER_SHORT)/viewers/lib*.so
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/camitk-$(VER_SHORT)/actions/lib*.so
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/camitk-$(VER_SHORT)/components/lib*.so
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/camitk-$(VER_SHORT)/lib*.a
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/include/camitk-$(VER_SHORT)/libraries/camitkcore
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/include/camitk-$(VER_SHORT)/libraries/cepcoreschema
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/include/camitk-$(VER_SHORT)/libraries/cepgenerator
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/include/camitk-$(VER_SHORT)/libraries/camitkextensiongenerator
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/include/camitk-$(VER_SHORT)/libraries/camitkitktemplates
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/include/camitk-$(VER_SHORT)/viewers
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/include/camitk-$(VER_SHORT)/actions
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/include/camitk-$(VER_SHORT)/components
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/include/camitk-$(VER_SHORT)/libraries/pmlschema
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/include/camitk-$(VER_SHORT)/libraries/pml
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/include/camitk-$(VER_SHORT)/libraries/lmlschema
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/include/camitk-$(VER_SHORT)/libraries/lml
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/include/camitk-$(VER_SHORT)/libraries/mmlschema
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/include/camitk-$(VER_SHORT)/libraries/monitoring
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/include/camitk-$(VER_SHORT)/libraries/monitoringgui
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/share/camitk-$(VER_SHORT)/cmake/*.cmake
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/share/camitk-$(VER_SHORT)/cmake/macros/*.cmake
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/share/camitk-$(VER_SHORT)/cmake/macros/camitk/*.cmake
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/share/camitk-$(VER_SHORT)/cmake/macros/camitk/manifest/*.cmake
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/share/camitk-$(VER_SHORT)/cmake/macros/camitk/packaging/*.cmake
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/share/camitk-$(VER_SHORT)/cmake/macros/camitk/test/*.cmake
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/share/camitk-$(VER_SHORT)/cmake/macros/camitk/test/level/*.cmake
	# wizard
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/bin/camitk-wizard
	dh_installman -p$(pkg_dev) debian/tmp/usr/share/man/man1/camitk-wizard.1
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/share/applications/camitk-wizard.desktop
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/share/pixmaps/camitk-wizard.xpm
	# cepgenerator
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/bin/camitk-cepgenerator
	dh_installman -p$(pkg_dev) debian/tmp/usr/share/man/man1/camitk-cepgenerator.1
	# extensiongenerator
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/bin/camitk-extensiongenerator
	dh_installman -p$(pkg_dev) debian/tmp/usr/share/man/man1/camitk-extensiongenerator.1
	# test programs
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/bin/camitk-testactions
	dh_installman -p$(pkg_dev) debian/tmp/usr/share/man/man1/camitk-testactions.1
	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/bin/camitk-testcomponents
	dh_installman -p$(pkg_dev) debian/tmp/usr/share/man/man1/camitk-testcomponents.1

	# qtpropertybrowser so and headers (includes are put directly in usr/include as package should be generic/independant from CamiTK)
	dh_install -p$(pkg_qpb_dev) debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libqtpropertybrowser.so usr/lib/$(DEB_HOST_MULTIARCH)
	dh_install -p$(pkg_qpb_dev) debian/tmp/usr/include/camitk-$(VER_SHORT)/libraries/qtpropertybrowser usr/include

	# imp
	dh_install -p$(pkg_imp) --autodest debian/tmp/usr/bin/camitk-imp
	dh_install -p$(pkg_imp) --autodest debian/tmp/usr/share/applications/camitk-imp.desktop
	dh_install -p$(pkg_imp) --autodest debian/tmp/usr/share/pixmaps/camitk-imp.xpm
	dh_installman -p$(pkg_imp) debian/tmp/usr/share/man/man1/camitk-imp.1

	# asm
	dh_install -p$(pkg_asm) --autodest debian/tmp/usr/bin/camitk-actionstatemachine
	dh_install -p$(pkg_asm) --autodest debian/tmp/usr/share/applications/camitk-actionstatemachine.desktop
	dh_install -p$(pkg_asm) --autodest debian/tmp/usr/share/pixmaps/camitk-actionstatemachine.xpm
	dh_installman -p$(pkg_asm) debian/tmp/usr/share/man/man1/camitk-actionstatemachine.1

	# packages for indep arch
	# api doc
	dh_install -p$(pkg_doc) debian/tmp/usr/share/camitk-$(VER_SHORT)/apidoc usr/share/doc/camitk-$(VER_SHORT)

	# all test data excluding extra licence files (everything is already specified in d/c)
	dh_install -p$(pkg_data) --exclude=LICENSE --autodest debian/tmp/usr/share/camitk-$(VER_SHORT)/testdata

# required to avoid FTBFS for architecture build all or any
override_dh_missing:
	dh_missing --list-missing

# dpkg-shlibdeps needs to know about camitk extension directories to manage inner-dependencies
# between extensions (i.e., mml component extension depends on physicalmodel component extensions)
# Lib dependencies can be in any extensions lib directory (viewers, component and action extensions)
override_dh_shlibdeps:
	dh_shlibdeps -l$(PKG_LIB_DIR)/viewers/:$(PKG_LIB_DIR)/components/:$(PKG_LIB_DIR)/actions/:$(PKG_LIB_DIR)/

# see http://lists.debian.org/debian-mentors/2012/07/msg00124.html
get-orig-source:
	mkdir -p ../tarballs
	PERL_LWP_SSL_VERIFY_HOSTNAME=0 uscan --rename --verbose --force-download --destdir=../tarballs