Setting CFLAGS on a per-package basis

Update: as reported by Fai Wong, -O1 is actually fine. Obviously, it must be some flag(s) which is(are) enabled at -O2 but not at -O1 caused this problem. However, it is not a priority ATM. Anyone who is interested in it is welcome to investigate it further.

As I have mentioned earlier, sqlite compiled with -O2 may cause xulrunner to segfault in N32 userland on Loongson. Well, I almost forget it.

So to remove the -O2 from CFLAGS once and for all, I adopted the technique described here.
zhangle@2f env $ pwd
/etc/portage/env
zhangle@2f env $ find
.
./dev-db
./dev-db/sqlite
./O2-removal
zhangle@2f env $ cat O2-removal
pre_pkg_setup() {
elog "bashrc is removing \"-O2\" from CFLAGS for $PN"
CFLAGS="${CFLAGS/-O2/}"
}
zhangle@2f env $ ls -l dev-db/sqlite
lrwxrwxrwx 1 zhangle zhangle 13 2009-08-01 16:10 dev-db/sqlite -> ../O2-removal

Comments

Unknown said…
Done! Thanks!

http://pastebin.com/m1fe7b5e7
Anonymous said…
Maybe it's better to add -O0 or -O to CFLAGS instead that remove -O2 since some packages defaults to -O2.

CFLAGS+=" -O" instead of CFLAGS="${CFLAGS/-O2/}"
r0bertz said…
Yes, that's right. And thanks. Anyway, here, substitution is enough for sqlite, ;)

Popular posts from this blog

The diff between the original SEC complaint against Ripple and the amended one

Send $SGB (Songbird) to another wallet using a script

Rippled thread cpu usage