This is Gentoo's testing wiki. It is a non-operational environment and its textual content is outdated.

Please visit our production wiki at https://wiki.gentoo.org

/etc/portage/package.env

From Gentoo Wiki (test)
< /etc/portage(Redirected from /etc/portage/env)
Jump to:navigation Jump to:search

/etc/portage/env and /etc/portage/package.env are used for modifying Portage's environmental variables, such as those specified in the /etc/portage/make.conf file, on a per-package basis.

  • The /etc/portage/env directory contains files that have the same syntax as make.conf. The filename will be used as the key to override settings.
  • The /etc/portage/package.env file describes which of these files will be used on a per-package basis.

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

In other words if FEATURES="ccache" in make.conf, and FEATURES="-ccache" in package/env/disable-ccache.conf, then Portage will see FEATURES as set to FEATURES="ccache -ccache" at emerge time for any packages which disable-ccache.conf is applied. This ultimately results in ccache being disabled for packages referencing disable-ccache.conf in the /etc/portage/package.env 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 /etc/portage/env that contains the desired changes:

FILE /etc/portage/env/debug.conf
CFLAGS="${CFLAGS} -g"
CXXFLAGS="${CXXFLAGS} -g"
FEATURES="splitdebug"

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

FILE /etc/portage/package.env
media-gfx/gimp  debug.conf

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 a file in /etc/portage/env that modifies PORTAGE_TMPDIR variable and sets it to an on-disk directory:

FILE /etc/portage/env/no-tmpfs.conf
PORTAGE_TMPDIR="/var/tmp/portage-ondisk"

Add large packages to package.env:

app-emulation/qemu-kvm  no-tmpfs.conf
app-office/libreoffice  no-tmpfs.conf debug.conf
www-client/firefox      no-tmpfs.conf

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

See also

External resources