File: rules

package info (click to toggle)
nifticlib 3.0.1-8
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 2,436 kB
  • sloc: ansic: 31,214; sh: 927; makefile: 459; csh: 138; python: 88; tcl: 42
file content (103 lines) | stat: -rwxr-xr-x 3,331 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
#!/usr/bin/make -f
# -*- makefile -*-

# This has to be exported to make some magic below work.
export DH_OPTIONS

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

STATIC_BUILD_PATH=DEB_build_static
SHARED_BUILD_PATH=DEB_build_shared

# TODO: possibly consider enabling CIFTI code -- needed by AFNI: -DUSE_CIFTI_CODE=ON \

CMAKE_FLAGS=-DNIFTI_INSTALL_INCLUDE_DIR:PATH=include/nifti \
            -DUSE_FSL_CODE:BOOL=OFF \
            -DUSE_CIFTI_CODE=OFF \
            -DNIFTI_BUILD_TESTING:BOOL=OFF

# one ring to rule them all ...
%:
	dh $@ --buildsystem=cmake

override_dh_auto_clean:
	rm -rf $(STATIC_BUILD_PATH) $(SHARED_BUILD_PATH)
	rm -rf docs/html
	dh_clean

override_dh_auto_configure:
	dh_auto_configure --builddir=$(STATIC_BUILD_PATH) -- \
	    $(CMAKE_FLAGS) \
	    -DBUILD_SHARED_LIBS:BOOL=OFF \
	    -DBUILD_TESTING:BOOL=ON
	dh_auto_configure --builddir=$(SHARED_BUILD_PATH) -- \
	    $(CMAKE_FLAGS) \
	    -DBUILD_SHARED_LIBS:BOOL=ON \
	    -DBUILD_TESTING:BOOL=OFF

override_dh_auto_build:
	# build static libs
	cd $(STATIC_BUILD_PATH) && $(MAKE) VERBOSE=1
	# build shared libs and binaries
	cd $(SHARED_BUILD_PATH) && $(MAKE) VERBOSE=1
	# build api reference
	cd docs && doxygen Doxy_nifti.txt
	# remove jquery (use from package dependency)
	rm -f docs/html/jquery.js

override_dh_auto_test:
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	cd $(STATIC_BUILD_PATH) && ctest
endif

override_dh_auto_install:
	# install binaries and shared libs
	cd $(SHARED_BUILD_PATH) && $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
	# install static libs
	cd $(STATIC_BUILD_PATH)/znzlib \
		&& $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
	cd $(STATIC_BUILD_PATH)/niftilib \
		&& $(MAKE)	install DESTDIR=$(CURDIR)/debian/tmp
	cd $(STATIC_BUILD_PATH)/nifticdf \
		&& $(MAKE)	install DESTDIR=$(CURDIR)/debian/tmp
	cp -a DEB_build_static/*/lib*.a debian/tmp/usr/lib
	# install manpage
	$(STATIC_BUILD_PATH)/utils/nifti_tool -help | \
		python3 debian/makeniftitoolmanpage.py > debian/tmp/nifti_tool.1
	# Remove unecessary header file
	rm -f $(CURDIR)/debian/tmp/usr/include/nifti/nifti_tool.h
	d-shlibmove --commit \
		    --multiarch \
		    --devunversioned \
		    --exclude-la \
		    --override s/libznz[0-9.]*-dev/libznz-dev/ \
		    --movedev debian/tmp/usr/include/* usr/include \
		    debian/tmp/usr/lib/libnifti*.so
	d-shlibmove --commit \
		    --multiarch \
		    --devunversioned \
		    --exclude-la \
		    --movedev debian/libnifti2-dev/usr/include/nifti/znzlib.h usr/include/nifti \
		    debian/tmp/usr/lib/libznz*.so
	d-shlibmove --commit \
		    --multiarch \
		    --devunversioned \
		    --exclude-la \
		    --override s/libznz[0-9.]*-dev/libznz-dev/ \
		    --movedev debian/libnifti2-dev/usr/include/nifti/nifti1_io.h usr/include/nifti \
		    --movedev debian/libnifti2-dev/usr/include/nifti/nifti2_io.h usr/include/nifti \
		    debian/tmp/usr/lib/libniftiio*.so
	d-shlibmove --commit \
		    --multiarch \
		    --devunversioned \
		    --exclude-la \
		    --override s/libznz[0-9.]*-dev/libznz-dev/ \
		    --movedev debian/libnifti2-dev/usr/include/nifti/nifticdf.h usr/include/nifti \
		    debian/tmp/usr/lib/libnifticdf*.so
	find debian -name "lib*.la" -delete

override_dh_installchangelogs:
	dh_installchangelogs -k Updates.txt