USE Flags
From Gentoo Linux Wiki
Contents |
[edit] What is a USE flag?
In Gentoo a USE flag is a representation of an option, a global setting for your final system. USE flags affect how many of the packages on your system will build.
As an example, mail-client/mutt offers eighteen flags. Some flags enable or disable compile-time options: pop, imap and nntp all control compile-time options. The mutt source file contains all the code for these options; the flag merely enables or disables them. Without the pop and imap flags, for instance, mutt can only read mail stored in local files.
Some flags enable an application feature that requires certain commands or libraries: gdbm, berkdb, ssl and sasl all enable features that require certain userspace libraries such as Sleepycat DBM or OpenSSL. These dependencies may, in turn, depend on other software packages as well.
Some flags are specific to just fix bugs. These are usually localized and temporary. Their descriptions usually hint that they are the case. For example, the buffysize flag description reads, "Enables buffysize workaround, see bug #72422."
[edit] Choosing the right USE flags for you
Choosing the right USE flags, although very important, is also quite simple. First, consult the list of USE flags available locally at /usr/portage/profiles/use.desc or online at the Gentoo-Portage USE Flag Listing. The description of each use flag should help you decide which to choose. If you are not sure leave it out; there are some default USE flags set for you already..
[edit] Viewing USE flag descriptions using grep
Using grep, you can easily find out what a USE flag means. Just use this (replace the word "useflag" with the USE flag you're searching for):
If that does not return any results, you can search package-specific USE flags as well:
If you have app-portage/gentoolkit installed, you could use the euse command instead:
[edit] Viewing a package's current USE flags
To view what USE flags would be used to install a package with your current settings:
or
More information about eix, a package that can speed up portage searches, can be found in the Eix article.
[edit] Viewing a list of packages that has some USE flag
To view what packages that can use some USE flag:
equery is a part of app-portage/gentoolkit.
[edit] Setting your USE flags
Now that you have chosen what flags you wish to use it is time to place them somewhere. There are two ways to edit your USE flags. One is with a specific USE flag-editing program: these will automatically edit your make.conf for you. The second method for editing your USE flags is to do it manually.
[edit] euse
euse - Part of the app-portage/gentoolkit package
euse is a good way to handle USE Flags. Read the euse MAN page.
[edit] ufed
ufed - Use Flag Editor
app-portage/ufed will show you which flags have been specified by default and a description for each USE flag. Within the program, you can edit which USE flags will be used. But without a detailed description per USE flag, ufed is still weak.
[edit] Profuse
A good replacement for ufed is profuse (app-portage/profuse). This program has a GUI, relatively good descriptions for USE flags and does not make such big mistakes in writing the make.conf as ufed. But, as always when changing config-files, it is recommended to make a backup of the /etc/make.conf before using ufed or profuse.
[edit] flagedit
Flagedit (app-portage/flagedit) is an easy to use command line USE flag, and keyword, editor. It can set USE flags both on a per-package basis, and globally. It can also be used to edit keywords, again on a per-package basis as well as globally.
See flagedit --help for examples and details after installing it.
[edit] make.conf
You may use an editor of your choice to manually edit your USE flags in /etc/make.conf. You alter the USE="" line in order to change your use flags. To enable a flag simply add it to the USE line: do not prefix the flagname with a plus sign, e.g. use kde, but not +kde. To disable, add it with a minus sign as a prefix: -kde.
[edit] package.use
The file /etc/portage/package.use can enable and disable flags on a per-package basis. This allows the user fine-grained control over package compilation without a drastic increase in the number of USE flags:
net-irc/xchat -perl -python net-p2p/bittornado -gtk www-client/mozilla-firefox java mozdevelop
In the above example:
- X-Chat will be installed without built-in Perl and Python interpreters,
- BitTornado will be installed without a Python-GTK GUI interface, and
- Mozilla Firefox will be built with Java support and the Venkman web developers' features.
Though emerge fully supports package.use, not all portage-related tools do: use caution.
[edit] Paludis users
If you're using paludis, set your use flags in /etc/paludis/use.conf. Its syntax is similar, but it also accepts wildcards (*).
[edit] Default USE flags
Fix me:
|
The current default USE flags for an x86 Linux system:
...
USE="berkdb crypt ipv6 ncurses nls pam perl python readline ssl tcpd zlib"
USE="${USE} fortran mudflap openmp"
USE="${USE} dri"
# isdn USE flag defaults
USE="${USE} pppd isdnlog"
USE="${USE} cli pcre reflection session spl"
USE="${USE} xorg"
USE="${USE} iconv"
...The 2006.1 and later profiles are comparatively smaller than earlier ones because 2006.1 introduced the desktop and server subprofiles. While the server subprofile isn't officially supported at the current time, the separate desktop subprofile allows servers to use a reduced basic profile with few USE flags, while desktop users can use the desktop subprofile which enables many of the graphical and other options that a desktop user would expect.
This system removed a previous problem where server users would have to deal with turning off a large number of USE flags that they never wanted. For example, the defaults included graphical USE flags that would cause X, Gnome or KDE to be installed, packages seldom used in servers.
There is a symbolic link /etc/make.profile/ that points to a directory such as /usr/portage/profiles/default-linux/x86/2005.1/ (for older installations, the name may be /usr/portage/profiles/default-x86-2004.0/ or /usr/portage/profiles/default-x86-1.4/). The file make.defaults in your make.profile folder dictates the default USE flags. Look at the other files in that folder while you are at it. Some people actually prefer to make their own profiles instead of editing /etc/make.conf.
[edit] USE flag definitions
Any USE flag's exact effect may be a mystery without looking at the ebuild but here some general descriptions for most use flags:
- Descriptions of known global USE flags
- Gentoo-Portagehas definitions for some local USE flags; select a package and click the link to the USE flags for that package to see the descriptions. For a list of all known USE flags, Gentoo-Portage has compiled a comprehensive list.
