Multilib/multilib-build

multilib-build is the common eclass that is used to build all multilib building logic in Gentoo. This eclass is seldom inherited directly. Instead, its API is exposed via other eclasses such as multilib-minimal.

The multilib-build eclass adds multilib-specific USE flags to IUSE. It does not export any phase functions or dependencies. However, MULTILIB_USEDEP variable is provided to help construct proper multilib dependencies.

MULTILIB_COMPAT
Optional. Must be set above the inherit line.

If defined, specifies the list of ABI flags corresponding to the ABIs supported by ebuild. The eclass will emit flags and enable support only for the specified ABIs. Note that the variable affects all architectures — i.e. if you specify flags for abi_x86 only, the ebuild will cease to support non-x86 arches.

This option can be used for binary packages where upstream provides variants only for some of the ABIs. For example, on x86 binary packages would commonly restrict to abi_x86_32 and abi_x86_64 (i.e. leave out unsupported abi_x86_x32).

Please note that MULTILIB_COMPAT causes REQUIRED_USE to be defined, requiring at least one of the supported flags to be enabled. The ebuild will reject to run on any profile (and architecture) not supporting one of the specified ABIs. You will need to package.mask the ebuild on the profiles that do not support ABIs required.

This also effectively restricts the ebuild from running on non-multilib architectures. If you need to do that, please report an enhancement requests against the eclass.

MULTILIB_USEDEP
Contains a USE dependency string that can be used to enforce matching multilib ABIs on package dependencies.

multilib_copy_sources
Usage: multilib_copy_sources

Create a separate copy of package sources for each of enabled ABIs. The sources will be obtained from initial BUILD_DIR (or S, if BUILD_DIR is unset), and they will be copied to implementation-specific build directories.

This function is usually necessary to use custom build systems that do not support out-of-source builds. Whenever possible, out-of-source builds are preferred.

Multilib phase-scope variables
Those variables are available in multilib-enabled functions, e.g. called via multilib_foreach_abi or in multilib-minimal sub-phases.

MULTILIB_ABI_FLAG
The USE flag name corresponding to the ABI for which the build is currently performed.

Please note that this variable can be unset if no USE flag is in effect, e.g. when performing build on non-multilib architecture, or when using multilib-portage. In this case, the phase will be run only once, and the ebuild should assume it's using the native ABI.

multilib_is_native_abi
Usage: multilib_is_native_abi

Determines whether the current ABI is considered the native ABI, and therefore all the features that are limited for native ABI are to be enabled. This function is guaranteed to return true for exactly one ABI. It can be used to avoid building program executables and documentation multiple times, and to disable the dependencies that do not support multilib.

Technically, multilib_is_native_abi returns true in one of the following cases:


 * 1) The current ABI is equal to the DEFAULT_ABI.
 * 2) The MULTILIB_COMPLETE variable is set (it is used by multilib-portage, and must not be set by users directly).

multilib_native_use_with
Usage: multilib_native_use_with [ []]

A wrapper on top of use_with EAPI function. Outputs --with- option if the flag is enabled and multilib_is_native_abi is true, --without- otherwise.

multilib_native_use_enable
Usage: multilib_native_use_enable [ []]

A wrapper on top of use_enable EAPI function. Outputs --enable- option if the flag is enabled and multilib_is_native_abi is true, --disable- otherwise.

multilib_native_usex
Usage: multilib_native_usex [ [ [ [ ]]]]

A wrapper on top of usex EAPI function. Requires EAPI 5 or eutils eclass inherit.

Outputs the concatenation of   (or yes if not provided) and   if the flag is enabled and multilib_is_native_abi is true, the concatenation of   (or no) and   otherwise.