\section{Profile Variables}
\label{sec:profile-variables}

This section documents variables that have special meaning, or special behaviour, when defined in a
profile's \t{make.defaults} file.

\subsection{Incremental variables}
\i{Incremental} variables must stack between parent and child profiles in the following manner:
Beginning with the highest parent profile, tokenise the variable's value based on whitespace and
concatenate the lists. Then, for any token $T$ beginning with a hyphen, remove it and any previous
tokens whose value is equal to $T$ with the hyphen removed, or, if $T$ is equal to \t{-*}, remove
all previous values. Note that because of this treatment, the order of tokens in the final result is
arbitrary, not necessarily related to the order of tokens in any given profile. The following
variables must be treated in this fashion:
\begin{compactitem}
\item \t{USE}
\item \t{USE\_EXPAND}
\item \t{USE\_EXPAND\_HIDDEN}
\item \t{CONFIG\_PROTECT}
\item \t{CONFIG\_PROTECT\_MASK}
\end{compactitem}

If the package manager supports any EAPI listed in table~\ref{tab:profile-iuse-injection-table} as
using profile-defined \t{IUSE} injection, the following variables must also be treated
incrementally; otherwise, the following variables may or may not be treated incrementally:
\begin{compactitem}
\item \t{IUSE\_IMPLICIT}
\item \t{USE\_EXPAND\_IMPLICIT}
\item \t{USE\_EXPAND\_UNPREFIXED}
\end{compactitem}

Other variables, except where they affect only package-manager-specific functionality (such as
Portage's \t{FEATURES} variable), must not be treated incrementally---later definitions shall
completely override those in parent profiles.

\ChangeWhenAddingAnEAPI{6}
\begin{centertable}{Profile-defined \t{IUSE} injection for EAPIs}
    \label{tab:profile-iuse-injection-table}
    \begin{tabular}{ll}
      \toprule
      \multicolumn{1}{c}{\textbf{EAPI}} &
      \multicolumn{1}{c}{\textbf{Supports profile-defined \t{IUSE} injection?}} \\
      \midrule
      0, 1, 2, 3, 4     & No  \\
      5, 6              & Yes \\
      \bottomrule
    \end{tabular}
\end{centertable}

\subsection{Specific variables and their meanings}
The following variables have specific meanings when set in profiles.
\begin{description}
\item[ARCH] The system's architecture. Must be a value listed in \t{profiles/arch.list}; see
    section~\ref{arch.list} for more information. Must be equal to the primary \t{KEYWORD} for this
    profile.
\item[CONFIG\_PROTECT, CONFIG\_PROTECT\_MASK] Contain whitespace-delimited lists used to control the
    configuration file protection. Described more fully in chapter~\ref{sec:config-protect}.
\item[USE] Defines the list of default USE flags for this profile. Flags may be added or removed by
    the user's configuration. \t{USE\_EXPAND} values must not be specified in this way.
\item[USE\_EXPAND] Defines a list of variables which are to be treated incrementally and whose
    contents are to be expanded into the USE variable as passed to ebuilds. See
    section~\ref{sec:use-iuse-handling} for details.
\item[USE\_EXPAND\_UNPREFIXED] Similar to \t{USE\_EXPAND}, but no prefix is used. If the repository
    contains any package using an EAPI supporting profile-defined \t{IUSE} injection (see
    table~\ref{tab:profile-iuse-injection-table}), this list must contain at least \t{ARCH}\@.
    See section~\ref{sec:use-iuse-handling} for details.
\item[USE\_EXPAND\_HIDDEN] Contains a (possibly empty) subset of names from \t{USE\_EXPAND} and
    \t{USE\_EXPAND\_UNPREFIXED}\@. The package manager may use this set as a hint to avoid
    displaying uninteresting or unhelpful information to an end user.
\item[USE\_EXPAND\_IMPLICIT, IUSE\_IMPLICIT] Used to inject implicit values into \t{IUSE}\@. See
    section~\ref{sec:use-iuse-handling} for details.
\end{description}

In addition, for EAPIs listed in table~\ref{tab:profile-iuse-injection-table} as supporting profile
defined \t{IUSE} injection, the variables named in \t{USE\_EXPAND} and \t{USE\_EXPAND\_UNPREFIXED}
have special handling as described in section~\ref{sec:use-iuse-handling}.

Any other variables set in \t{make.defaults} must be passed on into the ebuild environment as-is,
and are not required to be interpreted by the package manager.

% vim: set filetype=tex fileencoding=utf8 et tw=100 spell spelllang=en :

%%% Local Variables:
%%% mode: latex
%%% TeX-master: "pms"
%%% LaTeX-indent-level: 4
%%% LaTeX-item-indent: 0
%%% TeX-brace-indent-level: 4
%%% fill-column: 100
%%% End:
