]> git.proxmox.com Git - proxmox-backup-restore-image.git/commitdiff
build: use system toolchain and rust dependencies
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Tue, 24 Jan 2023 10:05:28 +0000 (11:05 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 30 Jan 2023 10:13:02 +0000 (11:13 +0100)
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@proxmox.com>
debian/control
debian/rules
src/build_initramfs.sh

index 55781a4e191e5472f2161dbaac26060d4e2fea1c..b2750fd714d8c6226a9b2984bfab3b64a13a0754 100644 (file)
@@ -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,
index 657234c2f6c0b19644509776aac6f6a651670fd0..4fdf8556ff7cce5cafd1e70c6880ee99f6a64726 100755 (executable)
@@ -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
index 4d81b39821ea178a383f8da91059d50c0a3c8368..b7caf813be5bf5ac1fc14590d15c9066a05e8f9e 100755 (executable)
@@ -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"