File: rules

package info (click to toggle)
ants 2.1.0-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 10,656 kB
  • sloc: cpp: 84,137; sh: 11,419; perl: 694; xml: 115; makefile: 74; python: 48
file content (103 lines) | stat: -rwxr-xr-x 3,216 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 -*-

srcpkg = $(shell LC_ALL=C dpkg-parsechangelog | grep '^Source:' | cut -d ' ' -f 2,2)
debver = $(shell LC_ALL=C dpkg-parsechangelog | grep '^Version:' | cut -d ' ' -f 2,2 )
uver = $(shell echo $(debver) | cut -d '-' -f 1,1 )

modulesfile = debian/ants.environment-modules

export  http_proxy=http://127.0.0.1:9/
export  https_proxy=http://127.0.0.1:9/

export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
    export CFLAGS += -O0
else
    export CFLAGS += -O2
endif

# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1

# Exclude all heavy tests while building on slowish build
# bots/platforms
BOGOMIPS = $(shell awk '/^bogomips/{print $$3;}' /proc/cpuinfo | sed -ne '1s,\..*,,gp' )
CTEST_EXCLUDE = $(shell [ "$(BOGOMIPS)" -gt 2000 ] || echo "-E '^ANTS(_|PSE)'")

export SHELL=/bin/bash

# Default mega-rule
%:
	dh $@ --parallel


override_dh_auto_configure:
	dh_auto_configure -- \
		-DANTS_SUPERBUILD:BOOL=OFF \
		-DANTS_USE_GIT_PROTOC:BOOL=OFF \
		-DCOPY_SCRIPT_FILES_TO_BIN_DIR:BOOL=OFF \
		-DCMAKE_SKIP_RPATH:BOOL=OFF \
		-DUSE_SYSTEM_ITK:BOOL=ON \
		-DUSE_VTK:BOOL=OFF \
		-DBUILD_SHARED_LIBS:BOOL=ON \
		-DRUN_SHORT_TESTS:BOOL=ON \
		-DRUN_LONG_TESTS:BOOL=OFF \
		-DEXECUTABLE_OUTPUT_PATH:PATH=$(DESTBINDIR) \
		-DCMAKE_INSTALL_RPATH:STRING="/usr/lib/ants/lib" \
		--debug-output

%modules: %modules.in
	sed -e 's,$$UVERSION,$(uver),g' $< >| $@

override_dh_auto_build: $(modulesfile)
	dh_auto_build
	: Build manpages
	cd `/bin/ls -d obj-*/bin` && mkdir -p ../man && \
    for f in *; do \
	 help2man --name="part of ANTS registration suite" --version-string $(uver) \
	          --no-info --no-discard-stderr ./$$f >| ../man/$$f.1; \
     done


override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	cd obj-*; \
	 ln -s ../debian/testdata ExternalData || : ; \
	 ctest --force-new-ctest-process $(CTEST_EXCLUDE)
else
	: # Skip unittests due to nocheck
endif

override_dh_auto_install:
	dh_auto_install
	: remove .so files 
	rm debian/ants/usr/lib/*.so
	: Move binaries under usr/lib/ants
	mv debian/ants/usr/bin/* debian/ants/usr/lib/ants
	: Symlink binaries of primary importance and with ants prefix into /usr/bin
	for fp in debian/ants/usr/lib/ants/{ants*,ANTS*,WarpImageMultiTransform,WarpTimeSeriesImageMultiTransform,Atropos,LaplacianThickness,jointfusion}; do \
		f=$$(basename $$fp); \
		dh_link usr/lib/ants/$$f usr/bin/$$f; \
	done
	: Install shell scripts
	install -t debian/ants/usr/lib/ants Scripts/*
	: Install modules file
	install -m 664 $(modulesfile) debian/ants/usr/share/modules/modulefiles/ants/$(uver)
	: Adjust ANTSPATH
	cd debian/ants/usr/lib/ants && sed -ie 's,\([^"=]*\(/bin/ants\|ANTS/release/bin\)\),/usr/lib/ants,g' *.sh *.pl && rm *.she *.ple
	: Install manpages
	dh_installman obj-*/man/*

override_dh_auto_clean:
	dh_auto_clean
	rm -rf $(BUILDDIR) debian/ants.environment-modules

# upstream tests use some tiny dataset for tests, which
# they deposited online instead of keeping under the GIT
# Since the data size is small, we just package it along,
# but that would require first building ANTs
get_upstream_external_data:
	mkdir -p .ExternalData/MD5
	# TODO