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 <andrea.righi@canonical.com>
This commit is contained in:
Andrea Righi
2023-04-12 15:50:29 +02:00
committed by Paolo Pisati
parent 4887aa770e
commit 85cdf83986
+5 -1
View File
@@ -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"