File: rules

package info (click to toggle)
blis 0.5.1-11
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 19,884 kB
  • sloc: ansic: 233,209; fortran: 21,763; sh: 5,344; makefile: 1,729; asm: 1,480; python: 995
file content (184 lines) | stat: -rwxr-xr-x 7,584 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
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#!/usr/bin/make -f
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export PYTHON=/usr/bin/python3  # for the upstream build system

# Select target architecture
CONFIG_amd64      = x86_64
CONFIG_armhf      = generic
CONFIG_arm64      = cortexa57
CONFIG_ppc64el    = generic
CONFIG            = $(word 1, $(CONFIG_$(DEB_HOST_ARCH)) generic)

# SOVERSION
SOVER := 2

ifneq (,$(filter $(DEB_HOST_ARCH), amd64 kfreebsd-amd64 arm64 mips64el ppc64el s390x ppc64 riscv64 sparc64))
FLAVORS := $(SOVER)-openmp $(SOVER)-pthread $(SOVER)-serial 64-$(SOVER)-openmp 64-$(SOVER)-pthread 64-$(SOVER)-serial
else
FLAVORS := $(SOVER)-openmp $(SOVER)-pthread $(SOVER)-serial
endif

FLAGS := \
	--enable-verbose-make \
	--prefix=/usr \
	--enable-cblas \
	--enable-static \
	--enable-shared \
	--libdir=/usr/lib/$(DEB_HOST_MULTIARCH)

SRCS := $(filter-out debian $(FLAVORS), $(wildcard ./*))


%:
	dh $@ -Smakefile

create_symlinks:
	# BLIS/BLAS
	# armhf: upstream's armv7a kernel assumes NEON. Using generic kernels currently.
	# ln -sr libblis$(SOVER)-symbols.armhf libblis$(SOVER)-$$j.symbols.$$i
	set -e; cd debian; for j in openmp pthread serial; do \
		ln -sr libblis$(SOVER)-XXX.symbols.generic libblis$(SOVER)-$$j.symbols ;\
		for i in amd64 arm64; do  \
			ln -sr libblis$(SOVER)-XXX.symbols.$$i libblis$(SOVER)-$$j.symbols.$$i ;\
		done;\
		for i in i386 x32; do \
			ln -sr libblis$(SOVER)-XXX.symbols.i386 libblis$(SOVER)-$$j.symbols.$$i ;\
		done;\
	done;
	# BLIS64/BLAS64
	set -e; cd debian; for j in openmp pthread serial; do \
		ln -sr libblis64-$(SOVER)-symbols.generic libblis64-$(SOVER)-$$j.symbols ;\
		for i in amd64 arm64; do \
			ln -sr libblis64-$(SOVER)-symbols.$$i libblis64-$(SOVER)-$$j.symbols.$$i ;\
		done;\
	done;

config_%:
	# Generate maintainer scripts from templates
	set -e; cd debian; if test -z "$$(echo $* | grep 64)"; then \
		cp libblis2-XXX.postinst     libblis$*.postinst; \
		cp libblis2-XXX.prerm        libblis$*.prerm; \
		cp libblis-XXX-dev.postinst  libblis$(subst $(SOVER),,$*)-dev.postinst; \
		cp libblis-XXX-dev.prerm     libblis$(subst $(SOVER),,$*)-dev.prerm; \
		for SCRIPT in libblis$*.postinst libblis$*.prerm \
			libblis$(subst $(SOVER),,$*)-dev.postinst \
			libblis$(subst $(SOVER),,$*)-dev.prerm; do \
			sed -i -e "s/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g" \
				-e "s/@SUBDIR@/blis$(subst $(SOVER),,$*)/g" \
				-e "s/@SOVER@/$(SOVER)/g" \
				$$SCRIPT; \
			if test -n "$$(echo $* | grep openmp)"; then \
				sed -i -e "s/@BLIS_PRI@/38/g" $$SCRIPT; \
			elif test -n "$$(echo $* | grep pthread)"; then \
				sed -i -e "s/@BLIS_PRI@/37/g" $$SCRIPT; \
			else \
				sed -i -e "s/@BLIS_PRI@/36/g" $$SCRIPT; \
			fi; \
		done; \
	else \
		cp libblis64-2-XXX.postinst     libblis$*.postinst; \
		cp libblis64-2-XXX.prerm        libblis$*.prerm; \
		cp libblis64-XXX-dev.postinst   libblis$(subst $(SOVER)-,,$*)-dev.postinst; \
		cp libblis64-XXX-dev.prerm      libblis$(subst $(SOVER)-,,$*)-dev.prerm; \
		for SCRIPT in libblis$*.postinst libblis$*.prerm \
			libblis$(subst $(SOVER)-,,$*)-dev.postinst \
			libblis$(subst $(SOVER)-,,$*)-dev.prerm; do \
			sed -i -e "s/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g" \
				-e "s/@SUBDIR@/blis$(subst $(SOVER)-,,$*)/g" \
				-e "s/@SOVER@/$(SOVER)/g" \
				$$SCRIPT; \
			if test -n "$$(echo $* | grep openmp)"; then \
				sed -i -e "s/@BLIS_PRI@/38/g" $$SCRIPT; \
			elif test -n "$$(echo $* | grep pthread)"; then \
				sed -i -e "s/@BLIS_PRI@/37/g" $$SCRIPT; \
			else \
				sed -i -e "s/@BLIS_PRI@/36/g" $$SCRIPT; \
			fi; \
		done; \
	fi;
	# Run upstream configure script in duplicated source root directories
	mkdir $*
	cp -r $(SRCS) $*/
	set -e; cd $*; if test -z "$$(echo $* | grep 64)"; then \
		if test -z "$$(echo $* | grep serial)"; then \
			./configure $(FLAGS) -t $(subst $(SOVER)-,,$*) $(CONFIG); \
		else \
			./configure $(FLAGS) --disable-threading $(CONFIG); \
		fi; \
		echo "$*/usr/lib/*/libblis.so.* usr/lib/$(DEB_HOST_MULTIARCH)/" > \
			debian/libblis$*.install; \
	else \
		if test -z "$$(echo $* | grep serial)"; then \
			./configure $(FLAGS) -b 64 -i 64 -t $(subst 64-$(SOVER)-,,$*) $(CONFIG); \
		else \
			./configure $(FLAGS) -b 64 -i 64 --disable-threading $(CONFIG); \
		fi; \
		echo "$*/usr/lib/*/libblis64.so.* usr/lib/$(DEB_HOST_MULTIARCH)/" > \
			debian/libblis$*.install; \
	fi;

override_dh_auto_configure: $(addprefix config_, $(FLAVORS)) create_symlinks
	:

build_%:
	set -e; if test -n "$$(echo $* | grep 64)"; then \
		dh_auto_build -B$* -- DEB_LIBBLAS=libblas64.so.3 LIBBLIS=libblis64 ; \
	else \
		dh_auto_build -B$* -- DEB_LIBBLAS=libblas.so.3; \
	fi;

override_dh_auto_build: $(addprefix build_, $(FLAVORS))
	:

test_%:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	set -e; if test -n "$$(echo $* | grep 64)"; then \
		$(MAKE) -C$* check LIBBLIS=libblis64; \
	else \
		$(MAKE) -C$* check; \
	fi;
endif

override_dh_auto_test: $(addprefix test_, $(FLAVORS))
	:

install_%:
	# Don't use the debian/tmp directory
	-$(RM) -rf debian/tmp/*
	# In case we forgot to compile something
	-set -e; if test -n "$$(echo $* | grep 64)"; then \
		dh_auto_install -B$* -- LIBBLIS=libblis64; \
	else \
		dh_auto_install -B$*; \
	fi;
	# Don't use the debian/tmp directory
	-$(RM) -rf debian/tmp/*

	# Install things manually
	set -e; if test -z "$$(echo $* | grep 64)"; then \
		install -Dm0644 $*/lib/*/libblis.so     debian/libblis$*/usr/lib/$(DEB_HOST_MULTIARCH)/blis$(subst $(SOVER),,$*)/libblis.so.$(SOVER) ;\
		install -Dm0644 $*/lib/*/libblas.so.3   debian/libblis$*/usr/lib/$(DEB_HOST_MULTIARCH)/blis$(subst $(SOVER),,$*)/libblas.so.3 ;\
		ln -s libblas.so.3                      debian/libblis$*/usr/lib/$(DEB_HOST_MULTIARCH)/blis$(subst $(SOVER),,$*)/libblas.so ;\
		install -Dm0644 $*/lib/*/libblis.a      debian/libblis$(subst $(SOVER),,$*)-dev/usr/lib/$(DEB_HOST_MULTIARCH)/blis$(subst $(SOVER),,$*)/libblis.a ;\
		ln -s libblis.so.$(SOVER)               debian/libblis$(subst $(SOVER),,$*)-dev/usr/lib/$(DEB_HOST_MULTIARCH)/blis$(subst $(SOVER),,$*)/libblis.so ;\
		install -Dm0644 $*/include/*/blis.h     debian/libblis$(subst $(SOVER),,$*)-dev/usr/include/$(DEB_HOST_MULTIARCH)/blis$(subst $(SOVER),,$*)/blis.h ;\
		install -Dm0644 $*/include/*/cblas.h    debian/libblis$(subst $(SOVER),,$*)-dev/usr/include/$(DEB_HOST_MULTIARCH)/blis$(subst $(SOVER),,$*)/cblas-blis.h ;\
	else \
		install -Dm0644 $*/lib/*/libblis64.so   debian/libblis$*/usr/lib/$(DEB_HOST_MULTIARCH)/blis$(subst $(SOVER)-,,$*)/libblis64.so.$(SOVER) ;\
		install -Dm0644 $*/lib/*/libblas64.so.3 debian/libblis$*/usr/lib/$(DEB_HOST_MULTIARCH)/blis$(subst $(SOVER)-,,$*)/libblas64.so.3 ;\
		ln -s libblas64.so.3                    debian/libblis$*/usr/lib/$(DEB_HOST_MULTIARCH)/blis$(subst $(SOVER)-,,$*)/libblas64.so ;\
		install -Dm0644 $*/lib/*/libblis64.a    debian/libblis$(subst $(SOVER)-,,$*)-dev/usr/lib/$(DEB_HOST_MULTIARCH)/blis$(subst $(SOVER)-,,$*)/libblis64.a ;\
		ln -s libblis64.so.$(SOVER)             debian/libblis$(subst $(SOVER)-,,$*)-dev/usr/lib/$(DEB_HOST_MULTIARCH)/blis$(subst $(SOVER)-,,$*)/libblis64.so ;\
		install -Dm0644 $*/include/*/blis.h     debian/libblis$(subst $(SOVER)-,,$*)-dev/usr/include/$(DEB_HOST_MULTIARCH)/blis$(subst $(SOVER)-,,$*)/blis64.h ;\
		install -Dm0644 $*/include/*/cblas.h    debian/libblis$(subst $(SOVER)-,,$*)-dev/usr/include/$(DEB_HOST_MULTIARCH)/blis$(subst $(SOVER)-,,$*)/cblas64-blis.h ;\
	fi;

override_dh_auto_install: $(addprefix install_, $(FLAVORS))
	# Don't use the debian/tmp directory
	-$(RM) -rf debian/tmp/*

override_dh_makeshlibs:
	dh_makeshlibs -Xlibblas

override_dh_dwz:
	dh_dwz --no-dwz-multifile