/etc/portage/package.env

and are used for modifying environmental variables, such as those in, 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.

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