Configuring your system with variables

Updated 7 November 2026

This page applies to Portage 3.0.82 and Calculate Utilities 3.8.

Configuring Portage

Portage is configured with variables. In a regular distribution they are written in the /etc/portage/make.conf file, but on Calculate this path is a directory: Portage reads all files inside it. Add your own values to the /etc/portage/make.conf/custom file - it is left for the user: the other files of the directory are distributed by Calculate templates, and editing them by hand would conflict with updates of the distribution configuration.

The full set of variables is described in the Portage reference pages:

man make.conf

man portage

The custom file already contains ready-made "handles" - commented lines that only need the leading # removed:

/etc/portage/make.conf/custom
#------------------------------------
# Основные опции сборки
#------------------------------------
# Использование для обновления бинарных пакетов (по умолчанию) либо
# исходных кодов.
#FEATURES="${FEATURES} -getbinpkg"

# Список пакетов, которые будут всегда устанавливаться из исходного кода.
# Используйте пробел в качестве разделителя.
#USEPKG_EXCLUDE="--usepkg-exclude=''"

# Количество пакетов для одновременной сборки.
#EMERGE_JOBS="--jobs=1"

EMERGE_DEFAULT_OPTS="${EMERGE_DEFAULT_OPTS} ${USEPKG_EXCLUDE} ${EMERGE_JOBS}"

# Конфиги, защищённые от автоматической перезаписи
# В этих путях будут появляться файлы вида ._cfg0000_*,
# которые нужно принимать через etc-update или dispatch-conf.
CONFIG_PROTECT="/var/calculate/etc"

#------------------------------------
# Настройки компилятора
#------------------------------------
# Количество параллельных процессов, запускаемых при установке пакета.
MAKEOPTS="-j5"

# Дополнительные параметры, передаваемые компилятору. Флаг '-march=native'
# оптимизирует программы под ваше оборудование.
#CFLAGS="-O2 -march=native -pipe"
#CXXFLAGS="${CFLAGS}"

# Максимальный размер ccache
#CCACHE_SIZE="5G"

# Параметры сжатия для бинарных пакетов
BINPKG_COMPRESS_FLAGS="-19 -T4"

What the handles do:

  • FEATURES="${FEATURES} -getbinpkg" - switches updates from binary packages to source code: the getbinpkg option makes emerge always try to take ready packages from the remote binary server, and the minus before its name turns it off.
  • USEPKG_EXCLUDE - the list of packages that are always installed from source code (values are separated by a space); it is substituted into EMERGE_DEFAULT_OPTS through the --usepkg-exclude option, which also applies to binary packages from the remote server - including without the explicit -g key.
  • EMERGE_JOBS - the number of packages built simultaneously, through the --jobs option.
  • MAKEOPTS - already uncommented: -j5 sets the number of parallel compilation processes within one package.
  • CFLAGS and CXXFLAGS - additional parameters passed to the compiler; the -march=native flag optimizes programs for your hardware.
  • CCACHE_SIZE - the maximum ccache size.
  • BINPKG_COMPRESS_FLAGS - compression parameters for binary packages.

Build options

Configuration and compilation options

When building applications, Portage passes the values of the following variables to the compiler and to the configuration script:

  • CFLAGS and CXXFLAGS - compiler flags for C and C++;
  • CHOST - build platform information for the application's configuration script;
  • MAKEOPTS - passed to the make command and usually sets the degree of compilation parallelization.

The details are in the reference page:

man make

The USE variable is also used for configuring and compiling; it is described in detail on the USE flags page. Compiler variable values on Calculate are set in /etc/portage/make.conf/custom (see the Configuring Portage section).

Installation options

When Portage installs a new version of a program, the files of the outdated version are removed from the system. After emerge --unmerge starts, Portage shows a countdown before the removal; its duration is set by the CLEAN_DELAY variable (5 seconds by default).

To have emerge always start with certain keys, list them in EMERGE_DEFAULT_OPTS. If you want to confirm the installation before the merge, add --ask to the set: --verbose and --tree give detailed and tree-structured output. On Calculate this variable is already occupied: the custom file appends the USEPKG_EXCLUDE and EMERGE_JOBS values to it, while the distribution sets the base set - it usually looks like this:

EMERGE_DEFAULT_OPTS=" --autounmask --binpkg-changed-deps=n --binpkg-respect-use=y --jobs=4 --quiet-build=n "

On your system the set may differ - check it:

emerge --info | grep EMERGE_DEFAULT_OPTS

Some of the parameters are covered on the Portage features page. If you add your own keys, do not overwrite the variable entirely: append to it through ${EMERGE_DEFAULT_OPTS}, as the custom file does.

Protecting configuration files

Portage protected directories

Files shipped by a new version of a program are overwritten on top of the old ones - except those in protected directories. The list of protected paths is set by the CONFIG_PROTECT variable (directories are separated by spaces); usually these are the locations of configuration files. A file that was supposed to be written into a protected directory is not overwritten: instead, files of the ._cfg0000_* form appear in the directory, and the user receives a warning about a new configuration version. Such files must be accepted through etc-update or dispatch-conf.

The custom file contains CONFIG_PROTECT="/var/calculate/etc" - the distribution's configuration is under protection too. The actual value of the variable is visible in the emerge --info output:

emerge --info | grep 'CONFIG_PROTECT='
CONFIG_PROTECT="/etc /usr/share/config /var/bind /var/calculate/etc"

Details of configuration file protection are in the emerge reference page, CONFIGURATION FILES section:

man emerge

Excluding directories from protection

To lift protection from individual subdirectories of a protected directory, use the CONFIG_PROTECT_MASK variable.

Download options

Server locations

When the requested data is not present on the system, Portage downloads it from the Internet. Server addresses are set by the following variables:

  • GENTOO_MIRRORS - the list of servers with package source code (distfiles); the files themselves are kept on Calculate in the /var/calculate/distfiles directory (the value of DISTDIR);
  • PORTAGE_BINHOST - the server with ready binary packages for your system.

The /etc/portage/make.conf/binhost file with the binary server address is created by a Calculate template:

/etc/portage/make.conf/binhost
#------------------------------------------------------------------------------
# Modified Calculate Utilities 3.7.6.8
# Processed template files:
# /var/db/repos/calculate/profiles/templates/6_ac_update_sync/binhost/binhost
# To modify this file, create a /etc/portage/make.conf/binhost.clt template.
#------------------------------------------------------------------------------

PORTAGE_BINHOST="http://mirror.mephi.ru/calculate/grp/x86_64"

Не правьте файл binhost вручную

The file is managed by a distribution template, so change its content through your own template /etc/portage/make.conf/binhost.clt (see Templates). cl-update -m list shows the list of binary servers available for the distribution - with it you can pick another server without editing the file by hand.

The address of the repository from which the local tree is updated is set not in make.conf but in the files of the /etc/portage/repos.conf directory: the sync-type variable describes the server type, sync-uri sets the specific server. On Calculate the directory contains the zz-calculate.conf file, owned by the distribution: it must not be changed. Add your own repositories as a new file in the same directory - details on the Stepping aside from the official tree page.

If Internet access requires a proxy server, declare the http_proxy, ftp_proxy and RSYNC_PROXY variables.

Download commands

To download package source code, Portage uses wget by default; the behavior is changed by the FETCHCOMMAND variable. Resuming a partially downloaded file also goes through wget and is configured by the RESUMECOMMAND variable.

Make sure your FETCHCOMMAND and RESUMECOMMAND commands save the files to the right place: the variables use ${URI} (the source code address) and ${DISTDIR} (the distfiles directory) internally. For individual protocols, dedicated commands are set: FETCHCOMMAND_HTTP, FETCHCOMMAND_FTP, RESUMECOMMAND_HTTP, RESUMECOMMAND_FTP and so on.

Rsync configuration

The repositories of the Calculate distribution are synchronized by the distribution's own mechanism (sync-type: calculate), so the variables of this section apply to third-party repositories configured for rsync; the regular tree update is performed by cl-update -s. The rsync command itself, with which Portage updates the tree, cannot be replaced, but its behavior can be tuned with variables:

  • PORTAGE_RSYNC_OPTS - the set of options used when syncing (separated by spaces); only change it if you know exactly what you are doing: some options are mandatory and are applied even when the value is empty;
  • PORTAGE_RSYNC_EXTRA_OPTS - additional sync options, each separated by a space: --timeout= is the number of idle seconds after which rsync considers the connection lost (180 by default; 300 or more is set on a slow connection), --exclude-from=/etc/portage/rsync_excludes is a file with the list of packages and categories that rsync will skip when updating, --quiet - less output on screen, --verbose - the full file list, --progress - a progress indicator for each file;
  • PORTAGE_RSYNC_RETRIES - the number of attempts to connect to the mirror before giving up.

The details are in the reference page:

man rsync

Branches and features

Selecting a branch

The delivery branch is controlled by the ACCEPT_KEYWORDS variable: by default it is the stable branch of your architecture (on Calculate - amd64). More about branches is on the Mixing branches page. The system profile on Calculate is set by the distribution, and you should not switch it with eselect - this breaks the distribution's operation.

Portage features

Individual Portage capabilities are enabled by the FEATURES variable (for example, the getbinpkg option, described in the Configuring Portage section). An overview of the capabilities is on the Portage features page.

How Portage behaves

Resource allocation

The PORTAGE_NICENESS variable lets you raise or lower the priority of Portage: its value is added to the current nice value of the process. Details of nice values are in the reference page:

man nice

Output options

The NOCOLOR variable determines whether to disable the colorization of Portage messages.

See also