File: rules

package info (click to toggle)
hivex 1.3.24-2.1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,928 kB
  • sloc: ansic: 7,385; sh: 5,314; ml: 4,424; makefile: 559; perl: 528; python: 253; ruby: 123; xml: 104; sed: 16
file content (109 lines) | stat: -rwxr-xr-x 3,449 bytes parent folder | download | duplicates (4)
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
#!/usr/bin/make -f
# -*- makefile -*-

# Notes
# -----
#
# - Bindings for all available Ruby and Python versions (as determined
#   in RUBY_VERSIONS, PYTHON_VERSIONS, respectively) are built, using
#   the minimum number of configure/make/make test/install cycles
#   (BUILD_COUNT, BUILDS). Builds are performed out-of-tree, in
#   directories debian/build-1, debian/build-2, etc..
#
# - Targets for individual builds are generated in GNU Make on the
#   fly, by evaluating expansions of the `DH_AUTO_TEMPLATE' variable
#   multiple times. (See the foreach loop below the variable
#   definition.) Multiple recipies for the `override_dh_auto_clean'
#   target as well as multiple prerequisites for the
#   `override_dh_auto_{configure,build,test}' targets are defined.
#   Only the last build contains the full feature set (including Perl
#   and OCaml bindings).
#
# - Running `debian/rules output_template' can be used to inspect the
#   targets that have been generated using `DH_AUTO_TEMPLATE'.

#export DH_VERBOSE=1

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

# Influcnce Python sysconfig.get_path() as called from configure so
# that the correct install paths are chosen.
export DEB_PYTHON_INSTALL_LAYOUT = deb_system

PYTHON_VERSIONS := $(shell py3versions --supported)
RUBY_VERSIONS   := $(shell dh_ruby --print-supported)

# Determine the number of builds needed due to script language version
# variants
BUILD_COUNT := $(lastword $(sort $(foreach lang,PYTHON RUBY,$(words $($(lang)_VERSIONS)))))
BUILDS := $(foreach n,$(wordlist 1,$(BUILD_COUNT),1 2 3 4 5 6 7 8 9),$(n))

# Template for generating dh_{clean,configure,build,test} overrides.
# $1 is replaced with the build number.
define DH_AUTO_TEMPLATE
override_dh_auto_clean::
	dh_auto_clean --builddir=$(CURDIR)/debian/build-$1

$(CURDIR)/debian/build-$1/config.status:
	dh_auto_configure --builddir=$(CURDIR)/debian/build-$1 \
		-- \
		$(if $(findstring $1,$(BUILD_COUNT)),\
			,\
			--disable-ocaml --disable-perl )\
		$(if $(word $1,$(RUBY_VERSIONS)),\
			RUBY=$(word $1,$(RUBY_VERSIONS)) \
			RAKE="$(word $1,$(RUBY_VERSIONS)) -S rake" \
			,\
			--disable-ruby) \
		$(if $(word $1,$(PYTHON_VERSIONS)),\
			PYTHON=$(word $1,$(PYTHON_VERSIONS)) \
			,\
			--disable-python)

override_dh_auto_configure: $(CURDIR)/debian/build-$1/config.status

$(CURDIR)/debian/build-$1/build-stamp:
	dh_auto_build --builddir=$(CURDIR)/debian/build-$1 \
		-- INSTALLDIRS=vendor LD_RUN_PATH=""
	touch $$@

override_dh_auto_build: $(CURDIR)/debian/build-$1/build-stamp

$(CURDIR)/debian/build-$1/test-stamp:
	dh_auto_test --builddir=$(CURDIR)/debian/build-$1
	touch $$@

override_dh_auto_test: $(CURDIR)/debian/build-$1/test-stamp

endef

$(foreach build,$(BUILDS),$(eval $(call DH_AUTO_TEMPLATE,$(build))))

output_template:
	$(foreach build,$(BUILDS),$(info $(call DH_AUTO_TEMPLATE,$(build))))

override_dh_auto_install:
	for build in $(BUILDS); do \
		dh_auto_install --builddir=$(CURDIR)/debian/build-$$build \
			-- INSTALLDIRS=vendor; \
	done

%:
	dh $@ \
		--buildsystem=autoconf \
		--without python-support \
		--with ocaml,python3,ruby

override_dh_makeshlibs:
	dh_makeshlibs -X/python3/dist-packages/

override_dh_missing:
	dh_missing -X.la -X.so.owner --fail-missing

override_dh_install:
	dh_install -X.la -X.so.owner

# Workaround for
# dh_dwz: dwz -q -- debian/ruby-hivex/usr/lib/x86_64-linux-gnu/ruby/vendor_ruby/2.5.0/_hivex.so returned exit code 1
override_dh_dwz:
	dh_dwz -X/vendor_ruby/