File: rules

package info (click to toggle)
rust-axum 0.8.4-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 4,356 kB
  • sloc: javascript: 35; makefile: 24; sql: 6; sh: 1
file content (40 lines) | stat: -rwxr-xr-x 1,502 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
#!/usr/bin/make -f

# resolve DEB_VERSION DEB_DISTRIBUTION
include /usr/share/dpkg/pkg-info.mk

# resolve if release is experimental
DEB_SUITE_EXP = $(filter experimental% UNRELEASED,$(DEB_DISTRIBUTION))

# resolve crate version
# * get topmost version except prerelease suffix
#   from Cargo.toml file in dir passed as argument
# * source package version if matching upstream part modulo prerelease
# * otherwise append source package version
crate_version = \
 $(shell perl -n \
 -E '/version\W+\K\d+\.\d+\.\d+/ ' \
 -E 'and say "$(DEB_VERSION_UPSTREAM)" =~ /^\Q$$&\E(?:~[a-z]+\d*)?$$/ ? "$(DEB_VERSION)" : "$$&+$(DEB_VERSION_UPSTREAM_REVISION)" and exit' \
 $1/Cargo.toml)

%:
	dh $@

# tolerate test failures when targeted experimental
override_dh_auto_test:
	dh_auto_test --buildsystem rust -- --no-fail-fast $(if $(DEB_SUITE_EXP),|| true)

# declare version for virtually provided embedded crates
packages = $(patsubst %,librust-%-dev,\
 axum axum-core axum-extra axum-macros)
override_dh_gencontrol:
	$(eval librust-axum-dev_version = $(call crate_version,axum))\
	$(eval librust-axum-core-dev_version = $(call crate_version,axum-core))\
	$(eval librust-axum-extra-dev_version = $(call crate_version,axum-extra))\
	$(eval librust-axum-macros-dev_version = $(call crate_version,axum-macros))\
	set -e; $(foreach p,$(packages),\
	 dh_gencontrol -p$p -- \
	 -v'$($p_version)' \
	 $(foreach q,$(filter-out $p,$(packages)),\
	 -V'rust:Version:$q=$($q_version)');)
	dh_gencontrol --remaining-packages