From: Christoph Heiss <c.heiss@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [RFC PATCH installer] buildsys: add static version of proxmox-auto-install-assistant
Date: Fri, 16 Aug 2024 18:19:03 +0200 [thread overview]
Message-ID: <20240816161942.2044889-1-c.heiss@proxmox.com> (raw)
This adds a separate debian package to the build, containing a
statically-built version of `proxmox-auto-install-assistant`, as
was suggested in #4788 [0] (for proxmox-backup-client), separately by
Thomas also.
Rust nowadays makes building static binaries pretty easy, even when
OpenSSL etc. is used.
NB: When run through lintian, the resulting package produces the
`shared-library-lacks-prerequisites`, which overalls seems rather
irrelevant (or even bogus?) in our case [1].
[0] https://bugzilla.proxmox.com/show_bug.cgi?id=4788
[1] https://lists.debian.org/debian-lint-maint/2023/02/msg00045.html
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
Marked RFC to see if the packaging is overall sane -- I haven't done a
lot of (Debian) packaging yet, so please don't hesitate with
suggestions.
Makefile | 22 +++++++++++++++----
debian/control | 10 +++++++++
...xmox-auto-install-assistant-static.install | 1 +
...roxmox-auto-install-assistant-static.links | 1 +
4 files changed, 30 insertions(+), 4 deletions(-)
create mode 100644 debian/proxmox-auto-install-assistant-static.install
create mode 100644 debian/proxmox-auto-install-assistant-static.links
diff --git a/Makefile b/Makefile
index e96a0f2..d288e82 100644
--- a/Makefile
+++ b/Makefile
@@ -5,14 +5,19 @@ BUILDDIR ?= $(PACKAGE)-$(DEB_VERSION_UPSTREAM)
DEB=$(PACKAGE)_$(DEB_VERSION)_$(DEB_HOST_ARCH).deb
ASSISTANT_DEB=proxmox-auto-install-assistant_$(DEB_VERSION)_$(DEB_HOST_ARCH).deb
+ASSISTANT_STATIC_DEB=proxmox-auto-install-assistant-static_$(DEB_VERSION)_$(DEB_HOST_ARCH).deb
DSC=$(PACKAGE)_$(DEB_VERSION).dsc
CARGO ?= cargo
+CARGO_STATIC_TARGET ?= x86_64-unknown-linux-gnu
+
ifeq ($(BUILD_MODE), release)
CARGO_BUILD_ARGS += --release
CARGO_COMPILEDIR := target/release
+CARGO_STATIC_COMPILEDIR := target/$(CARGO_STATIC_TARGET)/release
else
CARGO_COMPILEDIR := target/debug
+CARGO_STATIC_COMPILEDIR := target/$(CARGO_STATIC_TARGET)/debug
endif
INSTALLER_SOURCES=$(shell git ls-files) country.dat
@@ -71,9 +76,10 @@ country.dat: country.pl
deb: $(DEB)
$(ASSISTANT_DEB): $(DEB)
+$(ASSISTANT_STATIC_DEB): auto-install-assistant-static
$(DEB): $(BUILDDIR)
cd $(BUILDDIR); dpkg-buildpackage -b -us -uc
- lintian $(DEB)
+ lintian $(DEB) $(ASSISTANT_STATIC_DEB)
test-$(DEB): $(INSTALLER_SOURCES)
rsync --exclude='test*.img' --exclude='*.deb' --exclude='build' -a * build
@@ -109,7 +115,7 @@ VARLIBDIR=$(DESTDIR)/var/lib/proxmox-installer
HTMLDIR=$(VARLIBDIR)/html/common
.PHONY: install
-install: $(INSTALLER_SOURCES) $(COMPILED_BINS)
+install: $(INSTALLER_SOURCES) $(COMPILED_BINS) auto-install-assistant-static
$(MAKE) -C banner install
$(MAKE) -C Proxmox install
install -D -m 644 interfaces $(DESTDIR)/etc/network/interfaces
@@ -120,6 +126,7 @@ install: $(INSTALLER_SOURCES) $(COMPILED_BINS)
install -D -m 755 proxinstall $(DESTDIR)/usr/bin/proxinstall
install -D -m 755 proxmox-low-level-installer $(DESTDIR)/$(BINDIR)/proxmox-low-level-installer
$(foreach i,$(USR_BIN), install -m755 $(CARGO_COMPILEDIR)/$(i) $(DESTDIR)$(BINDIR)/ ;)
+ install -D -m 755 $(CARGO_STATIC_COMPILEDIR)/proxmox-auto-install-assistant $(DESTDIR)$(BINDIR)/proxmox-auto-install-assistant-static
install -D -m 755 checktime $(DESTDIR)/usr/bin/checktime
install -D -m 644 xinitrc $(DESTDIR)/.xinitrc
install -D -m 755 spice-vdagent.sh $(DESTDIR)/.spice-vdagent.sh
@@ -134,13 +141,20 @@ cargo-build:
--package proxmox-auto-install-assistant --bin proxmox-auto-install-assistant \
--package proxmox-chroot --bin proxmox-chroot $(CARGO_BUILD_ARGS)
+.PHONY: auto-install-assistant-static
+auto-install-assistant-static:
+ RUSTFLAGS='-C target-feature=+crt-static' cargo build \
+ --package proxmox-auto-install-assistant \
+ --target $(CARGO_STATIC_TARGET) $(CARGO_BUILD_ARGS)
+
%-banner.png: %-banner.svg
rsvg-convert -o $@ $<
.PHONY: upload
upload: UPLOAD_DIST ?= $(DEB_DISTRIBUTION)
-upload: $(DEB) $(ASSISTANT_DEB)
- tar cf - $(DEB) $(ASSISTANT_DEB) | ssh -X repoman@repo.proxmox.com -- upload --product pve,pmg,pbs --dist $(UPLOAD_DIST)
+upload: $(DEB) $(ASSISTANT_DEB) $(ASSISTANT_STATIC_DEB)
+ tar cf - $(DEB) $(ASSISTANT_DEB) $(ASSISTANT_STATIC_DEB) \
+ | ssh -X repoman@repo.proxmox.com -- upload --product pve,pmg,pbs --dist $(UPLOAD_DIST)
%.img:
truncate -s 2G $@
diff --git a/debian/control b/debian/control
index 04b0c6e..6bf3cd5 100644
--- a/debian/control
+++ b/debian/control
@@ -61,3 +61,13 @@ Description: Assistant to help with automated installations
Provides a helper that can assist with creating an answer file for a automated
installation of a Proxmox project, and preparing a official ISO image to use
this answer file.
+
+Package: proxmox-auto-install-assistant-static
+Architecture: any
+Recommends: xorriso,
+Conflicts: proxmox-auto-install-assistant
+Provides: proxmox-auto-install-assistant
+Description: Assistant to help with automated installations - static build
+ Provides a helper that can assist with creating an answer file for a automated
+ installation of a Proxmox project, and preparing a official ISO image to use
+ this answer file.
diff --git a/debian/proxmox-auto-install-assistant-static.install b/debian/proxmox-auto-install-assistant-static.install
new file mode 100644
index 0000000..abd2c64
--- /dev/null
+++ b/debian/proxmox-auto-install-assistant-static.install
@@ -0,0 +1 @@
+usr/bin/proxmox-auto-install-assistant-static
diff --git a/debian/proxmox-auto-install-assistant-static.links b/debian/proxmox-auto-install-assistant-static.links
new file mode 100644
index 0000000..28e003c
--- /dev/null
+++ b/debian/proxmox-auto-install-assistant-static.links
@@ -0,0 +1 @@
+usr/bin/proxmox-auto-install-assistant-static usr/bin/proxmox-auto-install-assistant
--
2.45.2
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next reply other threads:[~2024-08-16 16:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-16 16:19 Christoph Heiss [this message]
2024-11-11 22:31 ` Thomas Lamprecht
2024-11-12 10:07 ` Christoph Heiss
2024-11-12 10:20 ` 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=20240816161942.2044889-1-c.heiss@proxmox.com \
--to=c.heiss@proxmox.com \
--cc=pve-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.