public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup-restore-image 2/2] build: use system toolchain and rust dependencies
Date: Tue, 24 Jan 2023 11:05:28 +0100	[thread overview]
Message-ID: <20230124100528.1516276-2-f.gruenbichler@proxmox.com> (raw)
In-Reply-To: <20230124100528.1516276-1-f.gruenbichler@proxmox.com>

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         |  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





  reply	other threads:[~2023-01-24 10:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-24 10:05 [pbs-devel] [PATCH proxmox-backup-restore-image 1/2] init: update nix to 0.26 Fabian Grünbichler
2023-01-24 10:05 ` Fabian Grünbichler [this message]
2023-01-30 10:19 ` [pbs-devel] applied-series: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230124100528.1516276-2-f.gruenbichler@proxmox.com \
    --to=f.gruenbichler@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal