Let's gentooize: %filterout_* macros

sparky at pld-linux.org sparky at pld-linux.org
Fri Aug 4 19:01:35 CEST 2006


I'd like to change our:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%debugcflags	-O0 -g -Wall
%rpmcflags	%%{?debug:%debugcflags}%{!?debug:%optflags}%{?debuginfocflags}
%rpmcxxflags	%{rpmcflags}
%rpmldflags	%{!?no_build_with_as_needed:-Wl,--as-needed}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


To this one:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%debugcflags	-O0 -g -Wall
%optldflags	-Wl,--as-needed

%filter_out \
	@out = grep { $f = $_; not grep {$f =~ /^$_$/} (@f)} (@in);	\
	$" = " "; print "@out"

%rpmcflags %(perl -e '
	@in = qw(%{?debug:%debugcflags}%{!?debug:%optflags}%{?debuginfocflags});
	@f = qw(%{?filterout_c});
	%{filter_out}
')

%rpmcxxflags %(perl -e '
	@in = qw(%{rpmcflags});
	@f = qw(%{?filterout_cxx});
	%{filter_out}
')

%rpmldflags %(perl -e '
	@in = qw(%{optldflags});
	@f = qw(%{?filterout_ld});
	%{filter_out}
')
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Well, it shouldn't be perl, but i don't know how to write it in awk.


Use of those macros is very simple:
put:
%define	filterout_ld	-Wl,--as-needed --as-needed
in any package which hates --as-needed

or
%define filterout_ld	-Wl,-s -s
in glibc.spec and elfutils.spec

cflags filtering may be useful for all of us in packages we know work
well without -fwrapv or -fno-strict-aliasing

and will be useful for people who use some additional flags which 
sometimes may brake executable


What do you think about it ? And is there any volunteer for rewriting it
in awk ?

-- 
 ____  Sparky{PI] -- Przemyslaw _  ___  _  _  ........... LANG...Pl..Ca..Es..En
/____) ___  ___  _ _ || Iskra  |  | _ \| |  | : WWW........ppcrcd.pld-linux.org
\____\| -_)'___| ||^'||//\\// <   |  _/| |  | : JID......sparky<at>jabberes.org
(____/||   (_-_|_||  ||\\ ||   |_ |_|  |_| _| : Mail....sparky<at>pld-linux.org


More information about the pld-devel-en mailing list