Hi, while bugfixing some ebuild i discovered a bug in the _"inherit flag-o-matic"_ system (taken from an ebuild i wrote): # The order the flags are replaced is IMPORTANT, because while using: # replace-flags "-march=k6" "-march=i586" # replace-flags "-march=k6-2" "-march=i586" # # following output appeared: # original CFLAGS="-march=k6-2 -O3 ..." # replaced CFLAGS="-march=i586 -2 -O3 ..." this means that gcc tries to do gcc -c -march=i586 -2 -O3 ... and here he says "unknown option!". So the point is that replace-flags takes a match of regex but the regex is not FULLY fullfilled! (here -march=k6 matches -march=k6-2 and is replaced while -2 is separated!)
the eclass doesnt use regex to replace but simple bash string replacing
Ditto. Rather than duplicating work, look at the 'gcc2_flags' function in the gcc.eclass, OR do it in this order: # replace-flags "-march=k6-2" "-march=i586" # replace-flags "-march=k6" "-march=i586" And if you really think about it, it does do exactly what you ased for :P Otherwise you have to do it like this: # replace-flags "-march=k6 " "-march=i586 " # replace-flags "-march=k6$" "-march=i586" or to that extend. Anyhow, it was not designed to error check, so not really valid in my mind. Closing ...