File: rules

package info (click to toggle)
mlpack 4.7.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 32,064 kB
  • sloc: cpp: 233,202; python: 1,940; sh: 1,201; lisp: 414; makefile: 85
file content (139 lines) | stat: -rwxr-xr-x 4,604 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/make -f

# export DH_VERBOSE=1

# dh_python3 needs DEB_HOST_ARCH, so ... sledge hammer:
include /usr/share/dpkg/default.mk

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export LIBS="pthread"
export DESTDIR=debian/tmp

## Memory consumption issues on some autobuilders have been causing
## build failures.  There are three ways to address such issues:
## (a) reduce parallelism, e.g., dh $@ --max-parallel=2
## (b) reduce GCC memory usage, e.g., g++ --param ggc-min-expand=20 to
## reduce abrupt memory spikes, and g++ -g0 to skip debugging info.
## (c) switch to clang.

## Force Compiler to CLANG if installed. Otherwise use GCC but try to
## conserve memory. The build dependencies try to install CLANG, but
## give a dummy alternative so the build can proceed even if it is
## unavailable.
## Note: this requires build dependencies of the form
##     clang [!alpha !hppa !ia64 !m68k !sh4 !x32],
##     libomp-dev [!alpha !hppa !ia64 !m68k !sh4 !x32],

# ifeq ($(shell type clang > /dev/null && echo found),found)
# export CC=clang
# export CXX=clang++
# else

## These issues have occurred post-2.1.x in two places: Ubuntu
## Launchpad, and some particular Debian architectures including
## armhf, mips, mipsel, m68k, kfreebsd-amd64, kfreebsd-i386.

## For that reason, I am activating all of the above space-reduction
## mechanisms on Ubuntu, all 32-bit architectures, and all kfreebsd
## systems. And I am setting the build to single threaded on all
## architectures.

DH_FLAGS += --max-parallel=1

ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo yes),yes)
SAVE_SPACE=yes
endif

ifeq ($(shell dpkg-architecture --query DEB_BUILD_ARCH_BITS),32)
SAVE_SPACE=yes
endif

ifeq ($(shell dpkg-architecture --query DEB_BUILD_ARCH_OS),kfreebsd)
SAVE_SPACE=yes
endif

ifeq ($(SAVE_SPACE),yes)
ifneq (, $(filter $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU),mips mipsel))
	export DEB_CXXFLAGS_MAINT_APPEND = --param ggc-min-expand=5 -g0
else
	export DEB_CXXFLAGS_MAINT_APPEND = --param ggc-min-expand=20 -g0
endif
endif
# endif

DO_IT_TO_JULIA=OFF
TAKE_IT_TO_GO=OFF
WHY_R_WHY_NOT=OFF

%:
	dh $@ --with python3 --buildsystem=cmake ${DH_FLAGS}

# ON or OFF
# Fails as of 4.2.0, "17 < 17"
BUILD_TESTS=OFF

override_dh_auto_configure:
	dh_auto_configure -- -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) \
		-DDEBUG=ON \
		-DPROFILE=OFF \
		-DARMA_EXTRA_DEBUG=OFF \
		-DBUILD_CLI_EXECUTABLES=ON \
		-DBUILD_PYTHON_BINDINGS=ON \
		-DPYTHON_EXECUTABLE=/usr/bin/python3 \
		-DBUILD_JULIA_BINDINGS=$(DO_IT_TO_JULIA) \
		-DBUILD_GO_BINDINGS=$(TAKE_IT_TO_GO) \
		-DBUILD_R_BINDINGS=$(WHY_R_WHY_NOT) \
		-DBUILD_TESTS=$(BUILD_TESTS) \
		-DBUILD_SHARED_LIBS=ON \
		-DDISABLE_DOWNLOADS=ON \
		-DSTB_IMAGE_INCLUDE_DIR=/usr/include/stb \
		-DUSE_OPENMP=ON

ifeq ($(BUILD_TESTS),OFF)
override_dh_auto_test:
	@echo "Build time testing disabled."
endif

execute_after_dh_python3:
	dh_numpy3

execute_after_dh_install:
	@echo "use shared jquery.js javascript library"
	for f in $$(find debian/mlpack-doc -name jquery.js); do \
	  ln --verbose --symbolic --force /usr/share/javascript/jquery/jquery.js $$f; \
	done
	@echo "remove byte-compiled python files per policy"
	-find debian/python-mlpack  -name '*.pyc' -ls -delete || true
	-find debian/python3-mlpack -name '*.pyc' -ls -delete || true
	@echo "move stray documentation files into /usr/share/doc/"
	(test \! -d debian/libmlpack-dev || \
	(cd debian/libmlpack-dev && \
	 for f in $$(find usr/include -type f \! -name '*.hpp' \! -name '*.cpp'); do \
	   mkdir -p usr/share/doc/libmlpack-dev/$$(dirname $$f) && \
	   mv --verbose $$f usr/share/doc/libmlpack-dev/$$(dirname $$f)/; \
	 done))
	(test \! -d debian/python3-mlpack || \
	(cd debian/python3-mlpack && \
	 for f in $$(find usr/lib -type f -name '*.txt'); do \
	   mkdir -p usr/share/doc/python3-mlpack/$$(dirname $$f) && \
	   mv --verbose $$f usr/share/doc/python3-mlpack/$$(dirname $$f)/; \
	 done))
	@echo "remove empty directory"
	-rmdir --verbose debian/libmlpack-dev/usr/include/mlpack/core/stb/bundled

override_dh_installdocs:
	dh_installdocs -pmlpack-doc --doc-main-package libmlpack-dev
	dh_installdocs -Nmlpack-doc

override_dh_installexamples:
	dh_installexamples -pmlpack-doc --doc-main-package libmlpack-dev
	dh_installexamples -Nmlpack-doc

execute_after_dh_installexamples:
	@echo "Search and destroy stray VCS support files"
	-find debian/mlpack-doc -name .gitignore -ls -delete || true
	@echo "Remove empty directory"
	-rmdir debian/mlpack-doc/usr/share/doc/libmlpack-dev/examples/sample-ml-app/sample-ml-app/data/

override_dh_installchangelogs:
	dh_installchangelogs HISTORY.md