3.3 Portage features

Portage features

Portage has several additional features. Many of these features rely on certain software tools that improve performance, reliability, security, etc.

To enable or disable certain Portage features you need to edit /etc/make.conf's FEATURES variable which contains the various feature keywords, separated by white space. In several cases you will also need to install the additional tool on which the feature relies.

Not all features that Portage supports are listed here. For a full overview, please consult the make.conf man page.

To find out what FEATURES are default set, run emerge --info and search for the FEATURES variable (or grep it out):

emerge --info | grep FEATURES

Distributed compiling

Using distcc

Distcc is a program to distribute compilations across several, not necessarily identical, machines on a network. The distcc client sends all necessary information to the available distcc servers (running distccd) so they can compile pieces of source code for the client. The net result is a faster compilation time.

Installing distcc

Distcc ships with a graphical monitor to monitor tasks that your computer is sending away for compilation. If you use Gnome then put "gnome" in your USE variable. However, if you do not use Gnome and would still like to have the monitor then you should put "gtk" in your USE variable.

To install distcc execute:

emerge distcc

Activating Portage support

Add distcc to the FEATURES variable in /etc/make.conf. Then edit the MAKEOPTS variable to your liking. A known guideline is to fill in "-jX" with X the number of CPUs that run distccd (including the current host) plus one, but you might have better results with other numbers.

Now run distcc-config and enter the list of available distcc servers. For a simple example we assume that the available DistCC servers are (the current host), and (two "remote" hosts):

distcc-config --set-hosts ""

Do not forget to run the distccd daemon as well:

rc-update add distccd default
/etc/init.d/distccd start

Caching compilation

About ccache

Ccache is a fast compiler cache. When you compile a program, it will cache intermediate results so that, whenever you recompile the same program, the compilation time is greatly reduced. Generally, it can by reduced by 5-10 times for subsequent recompiles.

If you want to learn more, please visit the ccache homepage.

Installing ccache

To install ccache, execute emerge ccache:

emerge ccache

Activating Portage support

Open /etc/make.conf and add ccache to the FEATURES variable. Next, add a new variable named CCACHE_SIZE and set it to "2G":


To check if ccache functions, ask ccache to provide you with its statistics. Because Portage uses a different ccache home directory, you need to set the CCACHE_DIR variable as well:

CCACHE_DIR="/var/tmp/ccache" ccache -s

/var/tmp/ccache is Portage' default ccache home directory; if you want to alter this setting you can set the CCACHE_DIR variable in /etc/make.conf.

However, when you run ccache, it would use the default location of ${HOME}/.ccache, which is why you needed to set the CCACHE_DIR variable when asking for the Portage ccache statistics.

Using ccache for non-Portage C compiling

If you would like to use ccache for non-Portage compilations, add /usr/lib/ccache/bin to the beginning of your PATH variable (before /usr/bin). This can be accomplished by editing /etc/env.d/00basic, which is the first environment file defining the PATH variable:


Binary packages support

Creating prebuilt packages

Portage supports the installation of prebuilt packages. Though Calculate Linux distributions include them, their number is limited to the distribution set. Besides, you may want to create package with custom USE flags.

To create a prebuilt package you can use quickpkg, if the package is already installed on your system, or emerge with the --buildpkg or --buildpkgonly options.

If you want Portage to create a prebuilt package of every single package you install, add buildpkg to the FEATURES variable.

Installing binary packages

Calculate Linux distributions use a binary update repository that contains packages which are part of the distribution image. Each of the distros has a source profile as well as the binary one; the latter is set by default. Only one stable version of every binary package in available for install in the binary profile.

Note that before installing a binary package from the repository, you need to update the calculate overlay with layman -s calculate.

Apart from masking packages, the profile sets the FEATURES variable at getbinpkg, giving priority to binary packages install.

The path to the repository is set in the PORTAGE_BINHOST variable of the distribution's profile. /etc/make.conf, for instance, contains paths pointing to alternative repositories.

You can install binary packages even if you use a source profile. To do so, run emerge with the -g (or --getbinpkg) and -k (or --usepkg) options. The former tells emerge to download the prebuilt package from the previously defined server while the latter asks emerge to try to install the prebuilt package first before fetching the sources and compiling it.

For example, if you want to install gnumeric from binary packages:

emerge -kg gnumeric

For full information on installing prebuilt packages, refer to the emerge man page.

Thank you!