[pbs-devel] [RFC proxmox-backup] buildsys: build and package statically linked client binary

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Apr 9 11:53:16 CEST 2025


Am 09.04.25 um 11:09 schrieb Fabian Grünbichler:
> I think the following going in first and rebasing on top might make
> sense:
> 
> ----8<----
> commit 1793d3cd1ee9e1175354350f7c3dde92c9ed4413
> Author:     Fabian Grünbichler <f.gruenbichler at proxmox.com>
> AuthorDate: Wed Apr 9 10:32:20 2025 +0200
> Commit:     Fabian Grünbichler <f.gruenbichler at proxmox.com>
> CommitDate: Wed Apr 9 10:32:20 2025 +0200
> 
>     build: always set --target
>     
>     since it affects whether cargo puts build artifacts directly into
>     target/debug (or target/release) or into a target-specific
>     sub-directory.
>     
>     the package build will always pass `--target $(DEB_HOST_RUST_TYPE)`,
>     since it invokes the cargo wrapper in /usr/share/cargo/bin/cargo, so
>     this change unifies the behaviour across plain `make` and `make
>     deb`.
> 
>     direct calls to `cargo build/test/..` will still work as before.
>     
>     Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
> 
> diff --git a/Makefile b/Makefile
> index 428ef40b9..2543b1e37 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1,8 +1,10 @@
>  include /usr/share/dpkg/default.mk
> +include /usr/share/rustc/architecture.mk
>  include defines.mk
>  
>  PACKAGE := proxmox-backup
>  ARCH := $(DEB_BUILD_ARCH)
> +export DEB_HOST_RUST_TYPE
>  
>  SUBDIRS := etc www docs templates
>  
> @@ -39,10 +41,11 @@ SUBCRATES != cargo metadata --no-deps --format-version=1 \
>  STATIC_TARGET ?= x86_64-unknown-linux-gnu
>  
>  ifeq ($(BUILD_MODE), release)
> -CARGO_BUILD_ARGS += --release
> +CARGO_BUILD_ARGS += --release --target $(DEB_HOST_RUST_TYPE)
>  COMPILEDIR := target/$(DEB_HOST_RUST_TYPE)/release
>  STATIC_COMPILEDIR := target/$(STATIC_TARGET)/release
>  else
> +CARGO_BUILD_ARGS += --target $(DEB_HOST_RUST_TYPE)
>  COMPILEDIR := target/$(DEB_HOST_RUST_TYPE)/debug
>  STATIC_COMPILEDIR := target/$(STATIC_TARGET)/debug
>  endif
>  ---->8----
Reviewed-by: Thomas Lamprecht <t.lamprecht at proxmox.com>

feel free to push directly.




More information about the pbs-devel mailing list