File: rules

package info (click to toggle)
nifticlib 2.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 3,756 kB
  • ctags: 2,689
  • sloc: ansic: 18,065; sh: 483; makefile: 425; csh: 114; python: 88; tcl: 42
file content (73 lines) | stat: -rwxr-xr-x 2,445 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
#!/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

STATIC_BUILD_PATH=DEB_build_static
SHARED_BUILD_PATH=DEB_build_shared

CMAKE_FLAGS=-DCMAKE_INSTALL_PREFIX:PATH=/usr \
            -DNIFTI_INSTALL_INCLUDE_DIR:PATH=include/nifti \
            -DCMAKE_SKIP_RPATH:BOOL=ON \
            -DCMAKE_C_FLAGS:STRING="$$CFLAGS" \
            -DCMAKE_SHARED_LINKER_FLAGS="$$LDFLAGS -Wl,--as-needed" \
            -DCMAKE_EXE_LINKER_FLAGS="$$LDFLAGS -Wl,--as-needed" \
            -DUSE_FSL_CODE:BOOL=OFF \
            -DBUILD_TESTING:BOOL=TRUE

# 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:
	if [ ! -d $(STATIC_BUILD_PATH) ]; then mkdir $(STATIC_BUILD_PATH); fi
	if [ ! -d $(SHARED_BUILD_PATH) ]; then mkdir $(SHARED_BUILD_PATH); fi
	cd $(STATIC_BUILD_PATH) \
	    && cmake $(CURDIR) $(CMAKE_FLAGS) -DBUILD_SHARED_LIBS:BOOL=OFF \
	                                      -DBUILD_TESTING:BOOL=ON
	cd $(SHARED_BUILD_PATH) \
	    && cmake $(CURDIR) $(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
	# install manpage
	$(STATIC_BUILD_PATH)/utils/nifti_tool -help | \
		python debian/makeniftitoolmanpage.py > debian/tmp/nifti_tool.1
	# Remove unecessary header file
	rm $(CURDIR)/debian/tmp/usr/include/nifti/nifti_tool.h

override_dh_installchangelogs:
	dh_installchangelogs -k Updates.txt