From 85cdf839865d8161e4afd6129405342197bb63e2 Mon Sep 17 00:00:00 2001 From: Andrea Righi Date: Wed, 12 Apr 2023 15:50:29 +0200 Subject: [PATCH] UBUNTU: [Packaging] get rid of unnecessary artifacts in linux-headers There is no sane reason to ship .o and .cmd artifacts in linux-headers, so simply drop them (this allows to save ~25MB in the latest linux-headers-generic). Moreover, strip Rust's libmacros.so shipped in linux-headers to reduce the size even more. Signed-off-by: Andrea Righi --- debian/rules.d/2-binary-arch.mk | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk index dd3a95f16b50..689c9b788cd4 100644 --- a/debian/rules.d/2-binary-arch.mk +++ b/debian/rules.d/2-binary-arch.mk @@ -336,8 +336,12 @@ endif grep '^HOSTCC .*$(gcc)$$' $(hdrdir)/Makefile grep '^CC .*$(gcc)$$' $(hdrdir)/Makefile rm -rf $(hdrdir)/include2 $(hdrdir)/source + # Do not ship .o and .cmd artifacts in headers + find $(hdrdir) -name \*.o -or -name \*.cmd -exec rm -f {} \; + # Strip .so files (e.g., rust/libmacros.so) to reduce size even more + find $(hdrdir) -name libmacros.so -exec strip -s {} \; # We do not need the retpoline information. - find $(hdrdir) -name \*.o.ur-\* | xargs rm -f + find $(hdrdir) -name \*.o.ur-\* -exec rm -f {} \; # Copy over the compilation version. cp "$(builddir)/build-$*/include/generated/compile.h" \ "$(hdrdir)/include/generated/compile.h"