SOURCES: rpm.macros - strip kernel modules, but keep sections need...

glen glen at pld-linux.org
Mon Mar 5 22:28:09 CET 2007


Author: glen                         Date: Mon Mar  5 21:28:09 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- strip kernel modules, but keep sections needed for kernel (main pkg is now 3mb smaller)

---- Files affected:
SOURCES:
   rpm.macros (1.375 -> 1.376) 

---- Diffs:

================================================================
Index: SOURCES/rpm.macros
diff -u SOURCES/rpm.macros:1.375 SOURCES/rpm.macros:1.376
--- SOURCES/rpm.macros:1.375	Wed Feb 28 03:10:13 2007
+++ SOURCES/rpm.macros	Mon Mar  5 22:28:03 2007
@@ -316,6 +316,8 @@
 ; do echo $l; done >> %1 \
 }
 
+# vim - "
+
 # minimum file size needed for compressed documents.
 # just smaller files than this get larger when compressed.
 # some stats:
@@ -351,7 +353,15 @@
 %__spec_install_post_strip {%{!?debug: \
 %{!?no_install_post_strip:__spec_install_post_strip() { \
 if [ -d "$RPM_BUILD_ROOT" ]; then \
+	if [ -d $RPM_BUILD_ROOT/lib/modules ]; then \
+		modulelist=$(find $RPM_BUILD_ROOT/lib/modules -name '*o' -type f -print); \
+		printf "Stripping %d kernel modules..." $(echo "$modulelist" | wc -l); \
+		echo "$modulelist" | xargs -l512 chmod u+w; \
+		echo "$modulelist" | xargs -l512 %{__strip} --strip-unneeded --remove-section=.comment --remove-section=.note.GNU-stack; \
+		echo "DONE"; \
+	fi; \
 	filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*\.debug" ! -regex ".*%{_docdir}/.*" ! -regex ".*%{_includedir}/.*" %{?_noautostrip:! -regex "%{_noautostrip}"}`; \
+	# vim - " \
 	if [ -z "$filelist" ]; then \
 		return; \
 	fi; \
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/rpm.macros?r1=1.375&r2=1.376&f=u



More information about the pld-cvs-commit mailing list