#!/usr/bin/make -f # resolve DEB_VERSION 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 $@ --sourcedirectory cranelift/umbrella # unlock dependencies during build execute_before_dh_auto_configure: [ -f Cargo.lock.orig ] || mv Cargo.lock Cargo.lock.orig override_dh_gencontrol: dh_gencontrol -plibrust-cranelift-dev -- -v'$(call crate_version,cranelift/umbrella)' dh_gencontrol --remaining-packages # declare version for virtually provided embedded crates packages = librust-cranelift-dev vpkgstems = bforest codegen codegen-meta codegen-shared control entity frontend isle packages_virtual = $(patsubst %,librust-cranelift-%-dev,$(vpkgstems)) override_dh_gencontrol: $(eval librust-cranelift-dev_version = $(call crate_version,cranelift/umbrella))\ $(foreach s,$(vpkgstems),\ $(eval librust-cranelift-$s-dev_version = $(call crate_version,cranelift/$(subst isle,isle/isle,$(subst -,/,$s)))))\ 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.lock Cargo.lock