File: rules

package info (click to toggle)
vlfeat 0.9.21+dfsg0-6
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 6,824 kB
  • sloc: ansic: 23,180; python: 1,782; makefile: 197; xml: 188; sh: 49
file content (92 lines) | stat: -rwxr-xr-x 2,950 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
#!/usr/bin/make -f
# -*- makefile -*-

export DEB_BUILD_MAINT_OPTIONS=hardening=+bindnow


# grab the version from the debian changelog
VERSION := $(shell sed -n 's/.*(\([0-9\.]*[0-9]\).*).*/\1/;; p; q;' debian/changelog)

# grab the API version from the library SONAME
API_VERSION = $(shell objdump -p bin/*/libvl.so | perl -ne 'if(/^\s+SONAME\s+libvl.so./p) {print $${^POSTMATCH}; exit;}')

%:
	dh $@

override_dh_auto_build:
	make PYTHON=python3 MKOCTFILE=`which mkoctfile` VERB=1 CFLAGS+=-g all doc


override_dh_auto_install: $(addprefix install/,data $(wildcard toolbox/*))
	cp bin/*/libvl.so libvl.so.$(VERSION)
	ln -fs libvl.so.$(VERSION) libvl.so
	ln -fs libvl.so.$(VERSION) libvl.so.$(API_VERSION)

override_dh_gencontrol:
	dh_octave_substvar
	dh_gencontrol

override_dh_strip: strip_mex
	dh_strip --dbgsym-migration='libvlfeat$(API_VERSION)-dbg (<< 0.9.21+dfsg0-1~)'

override_dh_installdocs:
	dh_installdocs -Xbuild/

override_dh_auto_clean:
	dh_auto_clean
	rm -f VERSION libvl.so* *.o
	rm -rf toolbox/noprefix/ toolbox/mex/



# The rest is all for octave. There's some CDBS infrastructure to automate this,
# but it's designed for octave-only source packages. I have both in one source,
# so I can't use it

include /usr/share/octave/debian/defs.make


# I want to take all the *.m in toolbox/xxx/ for all xxx except mex and doc and
# noprefix. I want to take only some particular toolbox/*.m. There are many
# other files strewn around that I want to ignore. This is somewhat
# convoluted...

OCTAVE_MPATH   := debian/octave-vlfeat$(MDIR)/vlfeat/toolbox
OCTAVE_BINPATH := debian/octave-vlfeat$(OCTDIR)/vlfeat/toolbox
OCTAVE_PHONY_TARGETS := $(addprefix install/,data $(wildcard toolbox/*) toolbox/mex toolbox/noprefix)
.PHONY: $(OCTAVE_PHONY_TARGETS)

OCT_TARGET=$(@:install/%=%)

$(addprefix install/toolbox/, vl_harris.m vl_help.m vl_root.m):
	install -d $(OCTAVE_MPATH)
	install -m 0644 $(OCT_TARGET) $(OCTAVE_MPATH)

# installing the .mex files with executable bits set to let dh_shlibdeps index
# them. I remove these bits as soon as dh_shlibdeps does its thing
install/toolbox/mex:
	install -d $(OCTAVE_BINPATH)
	install -m 0755 $(OCT_TARGET)/*/*/*.mex $(OCTAVE_BINPATH)

override_dh_shlibdeps:
	dh_shlibdeps
	chmod 0644 $(OCTAVE_BINPATH)/*.mex

override_dh_compress:
	dh_compress -X.m

$(filter-out %.m install/data install/toolbox/mex install/toolbox/doc install/toolbox/noprefix,$(OCTAVE_PHONY_TARGETS)):
	if [ -d $(OCT_TARGET) ]; then							\
		install -d $(OCTAVE_MPATH);						\
		install -d $(OCTAVE_MPATH)/$(notdir $(OCT_TARGET));			\
		install -m 0644 $(OCT_TARGET)/*.m $(OCTAVE_MPATH)/$(notdir $(OCT_TARGET));	\
	fi

install/data:
	install -d $(OCTAVE_MPATH)/../data
	install -m 0644 data/* $(OCTAVE_MPATH)/../data

# dh_strip doesn't see the .mex files as needing stripping, so I do it myself
.PHONY: strip_mex
strip_mex:
	strip --remove-section=.comment --remove-section=.note --strip-unneeded $(OCTAVE_BINPATH)/*.mex