[pbs-devel] [PATCH proxmox-backup-restore-image 2/2] build: use system toolchain and rust dependencies
Fabian Grünbichler
f.gruenbichler at proxmox.com
Tue Jan 24 11:05:28 CET 2023
instead of using crates.io - the build still requires network access and
depends on configured APT sources in the build environment, so there's room for
further improvement.
Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
debian/control | 8 +++++++-
debian/rules | 17 +++++++++++++++++
src/build_initramfs.sh | 2 +-
3 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/debian/control b/debian/control
index 55781a4..b2750fd 100644
--- a/debian/control
+++ b/debian/control
@@ -7,8 +7,10 @@ Build-Depends: apt-rdepends,
automake,
bc,
bison,
+ cargo,
cpio,
debhelper (>= 12~),
+ dh-cargo,
dh-python,
flex,
gcc (>= 8.3.0-6),
@@ -16,10 +18,14 @@ Build-Depends: apt-rdepends,
libblkid-dev,
libdw-dev,
libelf-dev,
+ librust-anyhow-1+default-dev,
+ librust-nix-0.26+default-dev,
+ libssl-dev,
libtool,
lintian,
perl-modules,
- python3-minimal,
+ python3,
+ rustc,
sed,
sphinx-common,
tar,
diff --git a/debian/rules b/debian/rules
index 657234c..4fdf855 100755
--- a/debian/rules
+++ b/debian/rules
@@ -3,5 +3,22 @@
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
+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)
+
+export PATH
+
+export CARGO_HOME=$(CURDIR)/debian/cargo_home
+export DEB_CARGO_CRATE=init-shim-rs
+
%:
dh $@
+
+override_dh_auto_configure:
+ cargo prepare-debian $(CARGO_HOME)/registry --link-from-system
+ dh_auto_configure
diff --git a/src/build_initramfs.sh b/src/build_initramfs.sh
index 4d81b39..b7caf81 100755
--- a/src/build_initramfs.sh
+++ b/src/build_initramfs.sh
@@ -4,7 +4,7 @@ set -e
ROOT="root"
BUILDDIR="build/initramfs"
-INIT="../../init-shim-rs/target/release/init-shim-rs"
+INIT="../../init-shim-rs/target/x86_64-unknown-linux-gnu/release/init-shim-rs"
echo "Using build dir: $BUILDDIR"
rm -rf "$BUILDDIR"
--
2.30.2
More information about the pbs-devel
mailing list