Ok, last attempt to revive this blog ;-)
Well, there’s a little trick that I’d like to share with you guys that use Gentoo. Some time ago, I had to modify the value of the $CFLAGS environment variable for 2 packages in the Portage because they had some problems when the debugging option was enabled for configure. After some search, I’ve found the solution for this. Here goes the step-by-step (it’s pretty easy, I promise):
1) First, find the package’s path inside the Portage. This path is basically compounded by <category>/<package_name>. Let’s suppose that this path is app-editors/vim, so if your Portage is under /etc/portage, you should have a directory called /usr/portage/app-editors/vim/.
2) Now, you should create a file named /etc/portage/env/<category>/<package_name>, just like that:
#> touch /etc/portage/env/app-editors/vim
3) Edit this file with you preferred editor and put there the $CFLAGS value that you want, like that:
CFLAGS=”-D_HAVE_XYZ_”
If you want to append some value to the existing $CFLAGS, just do it:
CFLAGS=”${CFLAGS} -D_HAVE_XYZ_”
4) You are ready to go! :D
See? It’s pretty easy. Note that you can also add other variables (like $LDFLAGS), and emerge will handle them for you. If you have some trouble with the procedure, just let me know :-).
See ya!
You can also do other really cool stuff with those like add arbitrary code to run before or after any ebuild phase. This is called ebuild phase hooks: http://dev.gentoo.org/~zmedico/portage/doc/portage.html#config-bashrc-ebuild-phase-hooks
Hey Donnie,
Thanks for your comment. I appreciated your “improvement” over my post :-).
Regards.
Sergiosdj,
I never had the need to add some extra/diferent CFLAGS to specific packages. But when I do, I’ll know how.
See ya on monday ;-)
[]’s
sergiosdj, what a nice surprise!
I’ve just googled about it and the first result was this post =D
[]’s
sergiosdj, for some reason i am unable to touch files in /etc/portage/var…i wonder why…