How to prevent a binary from being stripped by rpmbuild?

David Howells dhowells at redhat.com
Sat Dec 10 17:18:06 UTC 2011


David Howells <dhowells at redhat.com> wrote:

> Josh Boyer <jwboyer at gmail.com> wrote:
> 
> > You might also want to redefine %{__strip} to the appropriate
> > cross-strip utility, or /bin/true.  Something like:
> > 
> > %define debug_package %{nil}
> > %define __strip /bin/true
> 
> Ah, so I can make a shell script to apply the appropriate strip binary...

Like so:

	%define __ar_no_strip $RPM_BUILD_DIR/%{srcdir}/ar-no-strip
	cat >%{__ar_no_strip} <<EOF
	#!/bin/bash
	f=\$2
	if [ \${f##*/} = libgcc.a -o \${f##*/} = libgcov.a ]
	then
		:
	else
		%{__strip} \$*
	fi
	EOF
	chmod +x %{__ar_no_strip}
	%undefine __strip
	%define __strip %{__ar-no-strip}

Interestingly, it only seems to be used for static libraries.

David


More information about the devel mailing list