File: rules

package info (click to toggle)
rust-swc-core 35.0.0~ds-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 62,804 kB
  • sloc: javascript: 873; xml: 538; sh: 358; makefile: 35; python: 5
file content (50 lines) | stat: -rwxr-xr-x 1,810 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
#!/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 $@

override_dh_installchangelogs:
	dh_installchangelogs -plibrust-swc-core-dev CHANGELOG-CORE.md
	dh_installchangelogs --remaining-packages CHANGELOG.md

# declare version for virtually provided embedded crates
packages = $(patsubst %,librust-%-dev,\
 better-scoped-tls hstr)
packages += $(patsubst %,librust-swc-%-dev,\
 allocator atoms common core \
 html-ast html-codegen html-parser html-utils \
 macros-common malloc visit)
packages_virtual = $(patsubst %,librust-%-dev,\
 ast-node from-variant string-enum)
packages_virtual += $(patsubst %,librust-swc-%-dev,\
 eq-ignore-macros html-codegen-macros html-visit transform-common)
override_dh_gencontrol:
	$(foreach p,$(packages) $(packages_virtual),\
	  $(foreach q,$(subst -,_,$(patsubst librust-%-dev,%,$p)),\
	   $(eval $p_version = $(call crate_version,crates/$q))))
	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 nightly crates/swc_core/Cargo.toml || dh_auto_clean --buildsystem=rust