emerge — configuration — ebuild repository — dispatch-conf
world file — USE flags — ebuilds — profiles
upgrades — using testing packages — binary packages
tools — gentoolkit — eselect
Portage FAQ — cheat sheet — FAQ
USE 标志是体现某个概念的支持和依赖信息的关键字。它们是 Gentoo 的核心功能，管理 Gentoo 系统需要很好地理解如何处理它们。
USE flags serve to configure Portage to determine how each package will be configured on installation or update. USE flags can configure many aspects of a package, and the available USE flags and corresponding optional functionality depend on each individual piece of software. They often set compile time options, or what associated optional libraries or utilities will be linked with a package.
This ability to choose options only available when installing a package is one of the great advantages Gentoo leverages from being source based.
The whole distribution comes with reasonable USE flags by default, and these are further refined by selecting a profile to suit planned system usage. Packages each have their own set of available USE flags, depending on what can be configured for the package, and these are also set to reasonable defaults. The order in which USE flags are applied is specified by the USE_ORDER variable.
关于如何实现 USE 标志的基本概念可以在 Handbook/zh-cn 中找到。
Technically, the Gentoo ebuild repository comes with a small set of default USE flags. Default USE flags are further defined by the selected profile. Each package comes with a set of available USE flags, and these can also have a default state, if this is justified in the context of the package. Each layer overrides the previous, to configure Portage to set up the installation of each package.
The presence of a USE flag in one of these files will set that USE flag. Including a USE flag preceded by a minus sign ("-") will unset that USE flag. If a USE flag is not present in one of these places, the default will be used.
Though a USE flag may in theory be temporarily set on the command line in an environment variable (for example USE="<flags>" emerge -av <package>), do not use this to install packages. Any USE flag set in this way will be lost when upgrading or re-emerging the package.
要查看当前启用了哪些 USE 标志：
portageq envvar USE | xargs -n 1
要检查某个 USE 标志是否被激活以及哪些软件包使用它，请运行：
euse -I <use_flag>
eix --installed-with-use <use_flag>
<use_flag> 替换为要检查的 USE 标志。
emerge 命令有一些与 USE 标志相关的选项，例如：
- emerge --changed-use (-U)
- emerge --complete-graph-if-new-use < y | n >
- emerge --newuse (-N)
详情见 man 1 emerge。
"Local" vs "global" USE flags
The technical difference between "local" and "global" flags is simply a difference of where their descriptions are saved in the ebuild repository. "Global" USE flags are described in use.desc files (example) for a whole profile, whereas "local" USE flags are described in metadata.xml files (example), for a single package. When deciding where to define them, developers determine if a USE flag has a general function common to several packages, or a specific function for a single package.
For the end user, whether a USE flag is "global" or "local" has little importance. "Global" flags may sometimes be more suited to being set in the USE variable in make.conf, but there is absolutely no hard rule. In any case, as much as possible, no USE flags should be set in make.conf unless necessary, and /etc/portage/package.use should be preferred to set USE flags on a per-package basis. Following this advice should ease system administration in the long run.
一些工具可用于分析和管理 USE 标志：
- /etc/portage/package.use — 提供了比 /etc/portage/make.conf 中的 USE 变量更细粒度的 USE 标记的单个包控制。
- Complete Handbook/Finishing off
- Gentoo Handbook documentation on USE flags
- Gentoo Java USE flags
- Toolkit USE Flags — summarizes main points from discussions about toolkit (GTK, Qt) USE flags (gtk2, gtk3, qt4, qt5, etc.).
- https://packages.gentoo.org/useflags - USE flags on Gentoo Packages Database.
- cat /var/db/repos/gentoo/profiles/use.desc - The common USE flag description list can be seen locally on systems with Portage installed.
- https://www.gentoo.org/support/use-flags/ - The full USE flag index.
- https://devmanual.gentoo.org/general-concepts/use-flags/ - USE flags conceptually explained in the Gentoo Developer Handbook.