From: Ian Jackson Date: Wed, 14 Dec 2022 20:32:01 +0000 (+0000) Subject: Make default build profile be debcargo X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=c5fd2ddf10484a079f0003d46a5c247a75be1b66;p=hippotat.git Make default build profile be debcargo Signed-off-by: Ian Jackson --- diff --git a/debian/.gitignore b/debian/.gitignore index 12a005c..a2d663b 100644 --- a/debian/.gitignore +++ b/debian/.gitignore @@ -9,3 +9,4 @@ hippotat-server hippotat-server.substvars hippotat-common hippotat-common.substvars +cargo_home diff --git a/debian/rules b/debian/rules index 59f8e29..68e2632 100755 --- a/debian/rules +++ b/debian/rules @@ -5,3 +5,33 @@ override_dh_installinit: dh_installinit --name=hippotatd + +# For local testing with upstream dependencies: +# NAILING_CARGO=nailing-cargo make check +# NAILING_CARGO=nailing-cargo dpkg-buildpackage -Pcargo-upstream -uc - + +ifeq (,$(filter cargo-upstream, $(DEB_BUILD_PROFILES))) + +include /usr/share/dpkg/architecture.mk +include /usr/share/dpkg/buildflags.mk +include /usr/share/rustc/architecture.mk +export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS +export DEB_HOST_RUST_TYPE DEB_HOST_GNU_TYPE + +PATH:=/usr/share/cargo/bin:$(PATH) +CARGO_HOME=$(shell pwd)/debian/cargo_home +DEB_CARGO_CRATE=hippotat +export PATH CARGO_HOME DEB_CARGO_CRATE + +TARGET_RELEASE_DIR = target/$(DEB_HOST_RUST_TYPE)/release +export TARGET_RELEASE_DIR + +execute_before_dh_auto_build: + if test -f Cargo.lock; then mv Cargo.lock Cargo.lock.upstream; fi + cargo prepare-debian /usr/share/cargo/registry + +execute_before_dh_auto_clean: + if test -f Cargo.lock.upstream; \ + then mv Cargo.lock.upstream Cargo.lock; fi + +endif