File: rules

package info (click to toggle)
htslib 1.16%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 9,804 kB
  • sloc: ansic: 59,004; perl: 1,727; makefile: 732; sh: 359
file content (128 lines) | stat: -rwxr-xr-x 3,917 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
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
#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DH_VERBOSE=1

include /usr/share/dpkg/default.mk

ifneq (,$(filter $(DEB_HOST_ARCH),i386 kfreebsd-i386 hurd-i386))
  DEB_CFLAGS_MAINT_APPEND=-msse -mfpmath=sse
endif
DEB_CFLAGS_MAINT_APPEND+=-ffat-lto-objects
DEB_LDFLAGS_MAINT_APPEND+=-Wl,-flto -fvisibility=hidden -ffat-lto-objects

export DEB_CFLAGS_MAINT_APPEND
export DEB_LDFLAGS_MAINT_APPEND

# Prune +,ds etc from version
UPSTREAM_VERSION := $(shell echo $(DEB_VERSION_UPSTREAM) | sed 's/+.*//')

libdir = /usr/lib/$(DEB_HOST_MULTIARCH)
plugindir = $(libdir)/htslib

%:
	dh $@

hello:
	echo "Upstream version: $(UPSTREAM_VERSION)"

override_dh_auto_configure:
ifneq (,$(filter $(DEB_HOST_ARCH),i386 kfreebsd-i386 hurd-i386))
	cp htslib.pc.in debian/
	cp debian/i386-htslib.pc.in ./htslib.pc.in
endif
	# create clean copy of test dir
	cp -a test test_backup
	# to help with cross building, otherwise MMAP might get turned off
	export ac_cv_func_mmap_fixed_mapped=yes \
	&& autoconf \
	&& dh_auto_configure -- \
		--enable-libcurl \
		--enable-gcs \
		--enable-s3 \
		--enable-plugins \
		--with-plugin-dir='$(libdir)/htslib' \
		--with-external-htscodecs \
		--with-plugin-path='/usr/local/lib/htslib:/usr/local/libexec/htslib:$(plugindir)'

override_dh_auto_build-arch:
	dh_auto_build -- \
	  CFLAGS="$$(dpkg-buildflags --get CFLAGS)" \
	  CPPFLAGS="-I. -DSAMTOOLS=1 $$(dpkg-buildflags --get CPPFLAGS)" \
	  PACKAGE_VERSION="$(UPSTREAM_VERSION)" \
	  libdir=$(libdir)
# re-try later	  LDLIBS=-lhts \

override_dh_auto_build-indep:

override_dh_auto_install-arch:
	for binary in sam test-regidx hts_endian test-bcf-sr test_bgzf ; do \
	    rm $(CURDIR)/test/$${binary} ; \
	done
	dh_auto_install -- prefix=/usr \
	  CFLAGS="$$(dpkg-buildflags --get CFLAGS)" \
	  CPPFLAGS="-I. -DSAMTOOLS=1 $$(dpkg-buildflags --get CPPFLAGS)" \
	  PACKAGE_VERSION="$(UPSTREAM_VERSION)" \
	  libdir=$(libdir)
	# restore clean copy of test dir before dh_install is run
	# This should not be done earlier since dh_auto_install contains some unconditional removals
	$(RM) -r test
	mv test_backup test

override_dh_strip:
	# This is apparently important for the interpretation by ldc2 in sambamba
	dh_strip -Xlibhts.a

override_dh_auto_install-indep:

override_dh_auto_test-arch:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	dh_auto_test -- \
	  CFLAGS="$$(dpkg-buildflags --get CFLAGS)" \
	  CPPFLAGS="-I. -DSAMTOOLS=1 $$(dpkg-buildflags --get CPPFLAGS)" \
	  PACKAGE_VERSION="$(UPSTREAM_VERSION)" \
	  libdir=$(libdir) \
	  || \
	  if find . -name "FAIL*" > /dev/null ; then \
	    for file in $$(find . -name "FAIL*"); do echo $${file}; cat $${file}; done && false ; \
	  fi
endif

override_dh_auto_test-indep:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	echo "Suppress test for Architecture independant builds."
endif

override_dh_install-indep:
	dh_install --indep
	sed -i 's/-ffile-prefix-map=[^[:space:]]* //g' debian/htslib-test/usr/share/htslib-test/config.mk
	sed -i 's/-fdebug-prefix-map=[^[:space:]]* //g' debian/htslib-test/usr/share/htslib-test/config.mk
	sed -i 's#\.\./\.\./htslib/#htslib/#' `grep -Rl '../../htslib/' debian/htslib-test/*`

override_dh_installdocs:
	dh_installdocs
	# Fix Perl interpreter path
	for pl in `grep -Rl '#!/usr/bin/env[[:space:]]\+perl' debian/*/usr/*` ; do \
	    sed -i '1s?^#!/usr/bin/env[[:space:]]\+perl?#!/usr/bin/perl?' $${pl} ; \
	done

override_dh_installchangelogs:
	dh_installchangelogs NEWS

override_dh_missing:
	# FIXME: No idea why these files are remaining in debian/tmp
	rm -rf debian/tmp/usr/bin debian/tmp/usr/share/man
	dh_missing

override_dh_fixperms:
	dh_fixperms
	find debian -name simple_test_driver.sh -exec chmod +x \{\} \;

override_dh_auto_clean:
ifneq (,$(filter $(DEB_HOST_ARCH),i386 kfreebsd-i386 hurd-i386))
ifneq (,$(wildcard debian/htslib.pc.in))
	cp debian/htslib.pc.in ./
endif
endif
	dh_auto_clean
	rm -rf test_backup/