[pve-devel] [PATCH installer 07/14] debian: strip unused library dependencies

Christoph Heiss c.heiss at proxmox.com
Wed Jul 10 15:27:46 CEST 2024


Rust links in some dynamic libraries even if only used by a disabled
feature gate. This is needed due to the upcoming move of the HTTP
features into the `proxmox-installer-common` crate.

Very similar to how it is done in the `proxmox-backup` repository, which
needs the same for very similar reasons.

Signed-off-by: Christoph Heiss <c.heiss at proxmox.com>
---
 debian/control | 1 +
 debian/rules   | 9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/debian/control b/debian/control
index eb4d3be..b7ddc11 100644
--- a/debian/control
+++ b/debian/control
@@ -26,6 +26,7 @@ Build-Depends: cargo:native,
                librust-toml-0.7-dev,
                librust-ureq-2.6-dev,
                libtest-mockmodule-perl,
+               patchelf,
                perl,
                rustc:native,
                shellcheck,
diff --git a/debian/rules b/debian/rules
index 1c03065..1c4eda8 100755
--- a/debian/rules
+++ b/debian/rules
@@ -10,3 +10,12 @@ export BUILD_MODE=release
 
 override_dh_missing:
 	dh_missing --fail-missing
+
+override_dh_strip:
+	dh_strip
+	for f in $$(find debian/proxmox-installer debian/proxmox-auto-install-assistant -executable -type f); do \
+	  if file -bi "$$f" | grep -qP '^application'; then \
+	    echo "stripping unused dependencies from $$f"; \
+	    ldd -u "$$f" | grep -oP '[^/:]+$$' | sed 's/^/--remove-needed /g' | xargs patchelf "$$f"; \
+	  fi; \
+	done
-- 
2.45.1





More information about the pve-devel mailing list