How can I customize an ebuild in Gentoo without maintaining a customized package in own overlay?
The case is that I need to mark compiled binaries with paxctl
. But there are about 100 of such packages and I don't want to watch for updates by myself in local overlay.
Portage ebuilds aren't compiled without such marking. Now I have to change their compile flags in /etc/portage/package.env
directory. PAX-marking is a better solution but I don't know how to do that in Gentoo within the portage tree.
Best Answer
Using portage you can do this with
package.env
. The right place to look for the documentation is http://dev.gentoo.org/~zmedico/portage/doc/portage.html#config-bashrc-ebuild-phase-hooks. Basically the way you use it is as follows. First you create (assuming standard setup without customROOT
) a file in/etc/portage/env
. For example, you can create a file/etc/portage/env/paxmark
Then for all packages you want this to apply to you add an entry to
/etc/portage/package.env
:This will apply the
paxmark
script to the package that has it specified. Alternatively you can also create a/etc/portage/bashrc
script for global overrides (be very careful with that).A general warning though, as you can add pre and post hooks to all phases this can be dangerous. Be careful with what you do as all your packages that use the hook have now become no more robust than your hook script. (The above example for pax marking should be fine).