/etc/portage/make.conf

From Gentoo Wiki
< /etc/portage(Redirected from Make.conf)
Jump to: navigation, search
This article is a stub. You can help Gentoo Wiki by expanding it.

make.conf is one of the ways to customize the Portage environment on a global level. This configuration will apply to every package that is emerged, and controls many elements of Portage's functionality, such as global USE flags, language options, Portage mirrors, and so on.

An example setup can be found at /usr/share/portage/config/make.conf.example

Precedence

Portage configuration is not limited to make.conf, global settings defined in this file are refined on a per-package basis in the /etc/portage/package.* files, as well as the local environment.

make.conf may exist as /etc/portage/make.conf or /etc/make.conf (or both), with the settings from /etc/portage/make.conf taking precedence.

Variables

There are many possible variables to customize in make.conf, but only the most commonly used are explained in detail here. For more information, and the full list of variables, consult the make.conf man page.

Note
Different configurations will require different variables to be set up. Do not treat the following as a definitive list, or a minimum set of requirements.

CHOST

This variable is passed through the configure step of ebuilds to set the build-host of the system. See the CHOST article. Note that the profile already should have defined the appropriate CHOST.

CFLAGS and CXXFLAGS

These flags are given when C or C++ packages are compiled to modify the behavior of the compiler. Not all packages will utilize these variables, as some programs require a specific set of compilation flags in order to compile correctly.

While setting proper CFLAGS can increase the speed and stability of the system, absurd settings (e.g. -O3 -fast-math -funroll-all-loops) will more likely cripple the system rather than it blazing fast.

FILE /etc/portage/make.confSane CFLAGS/CXXFLAGS
# use the 2nd optimization level (-O3 can be unstable), 
# use pipes rather than temporary files for compilation 
# stages, and tune the binary to make use of native
# processor capabilities
CFLAGS="-O2 -pipe -march=native"
# These flags apply to C++ as well
CXXFLAGS="${CFLAGS}"
Note
The make.conf manpage does not indicate that CFLAGS is an incremental flag [hopefully someone just forgot to mention it] meaning it should be used in the following fashion to avoid clobbering flags set by the profile: CFLAGS="${CFLAGS} -O2 -pipe -march=native"
Note
Also consider appending -g or even -ggdb2 to be a better Linux bug reporter. To avoid the performance hit of running debug builds it is advised to split debug symbols out of binaries and save them separately before stripping the binaries as usual. This can be achieved with FEATURES="splitdebug compressdebug" which requires dev-util/debugedit to be installed and both binutils and gdb built with USE=zlib

CPU_FLAGS_X86

FILE /etc/portage/make.conf
CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 ssse3"

FEATURES

The FEATURES variable contains a list of Portage features that the user wants enabled on the system, effectively setting Portage behavior.

The FEATURES variable is set by default via the system profile, but can be easily updated through /etc/portage/make.conf. Since this is an incremental variable, FEATURES values can be added without directly overriding the ones implemented through the system profile.

FILE /etc/portage/make.confAdding keepwork to FEATURES in Portage
FEATURES="keepwork"

For more information, please see Portage Features in the Gentoo Handbook.

GENTOO_MIRRORS

FILE /etc/portage/make.conf
GENTOO_MIRRORS="URIs"

This variable defines a list of Gentoo mirrors to check before downloading from the source defined in the ebuild. Properly chosen mirrors will generally be able to offer faster download speeds. Try using Mirrorselect to find the fastest mirror server.

See also http://www.gentoo.org/main/en/mirrors2.xml.

INPUT_DEVICES

Portage uses the variable INPUT_DEVICES for enabling support for various input devices in packages. Setting INPUT_DEVICES to evdev synaptics will pull in the correct driver:

FILE /etc/portage/make.conf
INPUT_DEVICES="evdev synaptics"

After setting this you want to update your system so the changes take effect:

root #emerge --ask --changed-use --deep world

LINGUAS

FILE /etc/portage/make.conf
LINGUAS="de pt_BR en en_US en_GB"

MAKEOPTS

This variable is used to specify arguments passed to make when packages are built from source. Make can be told to run multiple jobs in parallel (a potentially substantial speed increase, depending on processor). This can be done either through --jobs N (short form: -jN), which runs N (number) jobs at a time (without an argument, -j will flood the processor with as many jobs as possible, and is not recommended). For example, to run three jobs:

root #emerge --jobs 3 package/atom

Another option is --load-average N (short form -lN), which will have make keep the load average of the system to N, however many parallel tasks that ends up being or up to limit set by --jobs if it is set as well.

PORTDIR

This variable is deprecated in favor of settings in repos.conf.

PORTDIR_OVERLAY

This variable is deprecated in favor of settings in repos.conf.

To use layman overlays, the following should be included in make.conf:

FILE /etc/portage/make.conf
source "/var/lib/layman/make.conf"

VIDEO_CARDS

Portage uses the variable VIDEO_CARDS for enabling support for various graphics cards in packages. Setting VIDEO_CARDS to put video cards here will pull in the correct driver:

FILE /etc/portage/make.conf
 VIDEO_CARDS="put video cards here"

After setting this you want to update your system so the changes take effect:

root #emerge --ask --changed-use --deep world

USE

FILE /etc/portage/make.conf
USE="space delimited list of USE flags"

The USE variable allows the setting of a common set of USE flags for all packages. These are flags for a common set of package functionality desired (such as X11 or PulseAudio capability), or system capabilities.

Do not set package-specific USE flags here, those should be set instead in /etc/portage/package.use

For a list of the available global USE flags to be set in make.conf, see http://www.gentoo.org/dyn/use-index.xml and /usr/portage/profiles/use.desc

Licenses

FILE /etc/portage/make.confTo accept all licenses on all packages (not a good idea)
ACCEPT_LICENSE="*"
FILE /etc/portage/make.confTo accept free software only
ACCEPT_LICENSE="-* @FREE"

See also