Saturday, August 01, 2009

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

Labels: , , ,

3 Comments:

Blogger Fai Wong said...

Done! Thanks!

http://pastebin.com/m1fe7b5e7

8/01/2009 6:52 PM  
OpenID drizzt 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/}"

8/03/2009 5:14 PM  
Blogger Zhang Le said...

Yes, that's right. And thanks. Anyway, here, substitution is enough for sqlite, ;)

8/04/2009 2:55 AM  

Post a Comment

Links to this post:

Create a Link

<< Home