/etc/portage/package.env

' and ' are Article description::used for modifying Portage's environmental variables, such as those specified in the file, on a per-package basis.


 * The directory contains files that have the same syntax as . The filename will be used as the key to override settings.
 * The file describes which of these files will be used on a per-package basis.

Be aware certain variables in are incremental variables. This means if the variable is already specified in then Portage will read the values set in, and then read the values set in files beneath the  directory.

In other words if  in, and   in , then Portage will see FEATURES as set to   at emerge time for any packages which  is applied. This ultimately results in ccache being disabled for packages referencing in the  file.

Example 1: Enable debug information for a specific package
Suppose a user would like to build GIMP with debug information because the user wants a development version and would like to report any crashes to GIMP upstream.

Create a file in that contains the desired changes:

Next, add an entry to followed by the name of the file created in the previous step:

Example 2: Build certain packages in a different location
Suppose the Portage build directory is in tmpfs, but some packages are too large, and run out of space. The PORTAGE_TMPDIR can be modified to exclude the packages that are too large.

Create an env file that modifies PORTAGE_TMPDIR variable and sets it to an on-disk directory:

Add large packages to :

Notice that it is possible to reference several env files for each package. (Tip originally blogged by Jeremy Olexa)

External resources

 * Portage man page