File: rules

package info (click to toggle)
rust-wasmtime 36.0.5%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 60,580 kB
  • sloc: cpp: 5,670; ansic: 4,079; sh: 636; javascript: 608; asm: 110; ml: 96; makefile: 61; python: 12
file content (59 lines) | stat: -rwxr-xr-x 2,541 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
#!/usr/bin/make -f

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

# 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 $@

# unlock dependencies during build
execute_before_dh_auto_configure:
	[ -f Cargo.lock.orig ] || mv Cargo.lock Cargo.lock.orig

# declare version for virtually provided embedded crates
packages = librust-cranelift-dev
vpkgstems = \
 pulley-interpreter cranelift-assembler-x64 cranelift-assembler-x64-meta
vpkgstems_cranelift = \
 bforest bitset codegen codegen-meta codegen-shared control \
 entity frontend interpreter isle jit module native object reader srcgen
vpkgstems_wasmtime = jit-icache-coherence math unwinder
packages_virtual = \
 $(patsubst %,librust-%-dev,$(vpkgstems)) \
 $(patsubst %,librust-cranelift-%-dev,$(vpkgstems_cranelift)) \
 $(patsubst %,librust-wasmtime-%-dev,$(vpkgstems_wasmtime))
override_dh_gencontrol:
	$(eval librust-cranelift-dev_version = $(call crate_version,cranelift/umbrella))\
	$(eval librust-wasmtime-dev_version = $(call crate_version,.))\
	$(eval librust-pulley-interpreter-dev_version = $(call crate_version,.))\
	$(eval librust-cranelift-assembler-x64-dev_version = $(call crate_version,cranelift/assembler-x64))\
	$(eval librust-cranelift-assembler-x64-meta-dev_version = $(call crate_version,cranelift/assembler-x64/meta))\
	$(foreach s,$(vpkgstems_cranelift),\
	 $(eval librust-cranelift-$s-dev_version = $(call crate_version,cranelift/$(subst isle,isle/isle,$(subst -,/,$s)))))\
	$(foreach s,$(vpkgstems_wasmtime),\
	 $(eval librust-wasmtime-$s-dev_version = $(librust-wasmtime-dev_version)))\
	set -e; $(foreach p,$(packages),\
	 dh_gencontrol -p$p -- \
	 -v'$($p_version)' \
	 $(foreach q,$(filter-out $p,$(packages) $(packages_virtual)),\
	 -V'rust:Version:$q=$($q_version)');)
	dh_gencontrol --remaining-packages

# avoid cleaning unless source is patched
override_dh_auto_clean:
	grep -q crates/wasi-common/WASI/ Cargo.toml || dh_auto_clean --buildsystem rust

# re-lock dependencies
execute_after_dh_auto_clean:
	[ ! -f Cargo.lock.orig ] || mv -f Cargo.lock.orig Cargo.lock