File: rules

package info (click to toggle)
ants 2.5.4%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 11,672 kB
  • sloc: cpp: 85,685; sh: 15,850; perl: 863; xml: 115; python: 111; makefile: 68
file content (91 lines) | stat: -rwxr-xr-x 3,071 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/make -f
# -*- makefile -*-

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
CFLAGS+=$(CPPFLAGS)
CXXFLAGS+=$(CPPFLAGS)

modulesfile = debian/ants.environment-modules

include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/pkg-info.mk

# 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 $@


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,$(DEB_VERSION_UPSTREAM),g' $< >| $@

override_dh_auto_build: $(modulesfile)
	dh_auto_build

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	cd obj-*; \
	 ctest --force-new-ctest-process $(CTEST_EXCLUDE)
endif

override_dh_auto_install:
	dh_auto_install
	: Move binaries under usr/lib/ants
	mv debian/ants/usr/bin/* debian/ants/usr/lib/ants
	: Move shared libs under usr/lib/ants/lib
	mkdir -p debian/ants/usr/lib/ants/lib
	mv debian/ants/usr/lib/$(DEB_HOST_MULTIARCH)/* debian/ants/usr/lib/ants/lib
	rm -rf debian/ants/usr/lib/$(DEB_HOST_MULTIARCH)/
	: Symlink binaries of primary importance and with ants prefix into /usr/bin, skipping .sh suffix
	for fp in debian/ants/usr/lib/ants/{ants*,ANTS*,WarpImageMultiTransform,WarpTimeSeriesImageMultiTransform,Atropos,LaplacianThickness}; do \
		f=$$(basename $$fp); \
		dh_link usr/lib/ants/$$f usr/bin/$${f%.sh}; \
	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/$(DEB_VERSION_UPSTREAM)
	: 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

override_dh_installman:
	: Create and install manpages for scripts symlinked from /usr/bin
	# Putting the path to shared libs in LD_LIBRARY_PATH so that calls to
	# executable files by help2man succeed.
	cd debian/ants/usr/bin && mkdir -p ../../../../manGen && \
    for f in *; do \
	 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:../lib/ants/lib" \
	 help2man --name="part of ANTS registration suite" --version-string $(DEB_VERSION_UPSTREAM) \
	          --no-info --no-discard-stderr ./$$f >| ../../../../manGen/$$f.1; \
     done
	dh_installman manGen/*

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