Managing Use flags - YoloSoftDE/gentoo-overlay GitHub Wiki

Use-flags are mandatory for almost every ebuild you will ever write. It makes the resulting package flexible to the users needs.

Adding Use-flags to your ebuild

Use-flags are added using the IUSE-variable.

IUSE="debug doc"

Use-flags with a prepeding + are enabled by default. Use-flags with a prepeding - are disabled by default.

IUSE="gnome-shell +gtk2 gtk3 metacity unity xfce-notify xfwm transparency -unity"

Creating dependencies ...

.. on other use-flags

Some of your useflags may depend on others.

IUSE="gnome-shell +gtk2 gtk3 metacity unity xfce-notify xfwm transparency -unity"

In this example, we need either gtk2 or gtk3 to be enabled. The || defines at-least-one-of

REQUIRED_USE="|| ( gtk2 gtk3 )"

Further on, transparency depends on gtk3

REQUIRED_USE="|| ( gtk2 gtk3 ) 
    transparency? ( gtk3 )"

(The ? indicates: If this useflag is set, require all useflags in the following parenthesis).

... to other packages

Sometimes, a use-flag will enable a feature that requires additional packages.

IUSE="gnome-shell +gtk2 gtk3 metacity unity xfce-notify xfwm transparency -unity"

For example: gnome-shell will need gnome-base/gnome-shell to work.

RDEPEND="gnome-shell? ( gnome-base/gnome-shell )"

https://devmanual.gentoo.org/general-concepts/use-flags/