Debian Codegraph @

debian/rules

raw
1 #!/usr/bin/make -f
2 # -*- makefile -*-
3
4 # Notes
5 # -----
6 #
7 # - Bindings for all available Ruby and Python versions (as determined
8 # in RUBY_VERSIONS, PYTHON_VERSIONS, respectively) are built, using
9 # the minimum number of configure/make/make test/install cycles
10 # (BUILD_COUNT, BUILDS). Builds are performed out-of-tree, in
11 # directories debian/build-1, debian/build-2, etc..
12 #
13 # - Targets for individual builds are generated in GNU Make on the
14 # fly, by evaluating expansions of the `DH_AUTO_TEMPLATE' variable
15 # multiple times. (See the foreach loop below the variable
16 # definition.) Multiple recipies for the `override_dh_auto_clean'
17 # target as well as multiple prerequisites for the
18 # `override_dh_auto_{configure,build,test}' targets are defined.
19 # Only the last build contains the full feature set (including Perl
20 # and OCaml bindings).
21 #
22 # - Running `debian/rules output_template' can be used to inspect the
23 # targets that have been generated using `DH_AUTO_TEMPLATE'.
24
25 #export DH_VERBOSE=1
26
27 include /usr/share/dpkg/pkg-info.mk
28
29 # Influcnce Python sysconfig.get_path() as called from configure so
30 # that the correct install paths are chosen.
31 export DEB_PYTHON_INSTALL_LAYOUT = deb_system
32
33 PYTHON_VERSIONS := $(shell py3versions --supported)
34 RUBY_VERSIONS := $(shell dh_ruby --print-supported)
35
36 # Determine the number of builds needed due to script language version
37 # variants
38 BUILD_COUNT := $(lastword $(sort $(foreach lang,PYTHON RUBY,$(words $($(lang)_VERSIONS)))))
39 BUILDS := $(foreach n,$(wordlist 1,$(BUILD_COUNT),1 2 3 4 5 6 7 8 9),$(n))
40
41 # Template for generating dh_{clean,configure,build,test} overrides.
42 # $1 is replaced with the build number.
43 define DH_AUTO_TEMPLATE
44 override_dh_auto_clean::
45 dh_auto_clean --builddir=$(CURDIR)/debian/build-$1
46
47 $(CURDIR)/debian/build-$1/config.status:
48 dh_auto_configure --builddir=$(CURDIR)/debian/build-$1 \
49 -- \
50 $(if $(findstring $1,$(BUILD_COUNT)),\
51 ,\
52 --disable-ocaml --disable-perl )\
53 $(if $(word $1,$(RUBY_VERSIONS)),\
54 RUBY=$(word $1,$(RUBY_VERSIONS)) \
55 RAKE="$(word $1,$(RUBY_VERSIONS)) -S rake" \
56 ,\
57 --disable-ruby) \
58 $(if $(word $1,$(PYTHON_VERSIONS)),\
59 PYTHON=$(word $1,$(PYTHON_VERSIONS)) \
60 ,\
61 --disable-python)
62
63 override_dh_auto_configure: $(CURDIR)/debian/build-$1/config.status
64
65 $(CURDIR)/debian/build-$1/build-stamp:
66 dh_auto_build --builddir=$(CURDIR)/debian/build-$1 \
67 -- INSTALLDIRS=vendor LD_RUN_PATH=""
68 touch $$@
69
70 override_dh_auto_build: $(CURDIR)/debian/build-$1/build-stamp
71
72 $(CURDIR)/debian/build-$1/test-stamp:
73 dh_auto_test --builddir=$(CURDIR)/debian/build-$1
74 touch $$@
75
76 override_dh_auto_test: $(CURDIR)/debian/build-$1/test-stamp
77
78 endef
79
80 $(foreach build,$(BUILDS),$(eval $(call DH_AUTO_TEMPLATE,$(build))))
81
82 output_template:
83 $(foreach build,$(BUILDS),$(info $(call DH_AUTO_TEMPLATE,$(build))))
84
85 override_dh_auto_install:
86 for build in $(BUILDS); do \
87 dh_auto_install --builddir=$(CURDIR)/debian/build-$$build \
88 -- INSTALLDIRS=vendor; \
89 done
90
91 %:
92 dh $@ \
93 --buildsystem=autoconf \
94 --without python-support \
95 --with ocaml,python3,ruby
96
97 override_dh_makeshlibs:
98 dh_makeshlibs -X/python3/dist-packages/
99
100 override_dh_missing:
101 dh_missing -X.la -X.so.owner --fail-missing
102
103 override_dh_install:
104 dh_install -X.la -X.so.owner
105
106 # Workaround for
107 # 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
108 override_dh_dwz:
109 dh_dwz -X/vendor_ruby/