LUA-SINGLE.ECLASS

Section: eclass-manpages (5)
Updated: Dec 2020
Index Return to Main Contents

NAME

lua-single.eclass - An eclass for Lua packages not installed for multiple implementations.

DESCRIPTION

An extension of lua.eclass suite for packages which don't support being installed for multiple Lua implementations. This mostly includes software embedding Lua.

This eclass sets correct IUSE. It also provides LUA_DEPS and LUA_REQUIRED_USE that need to be added to appropriate ebuild metadata variables.

The eclass exports LUA_SINGLE_USEDEP that is suitable for depending on other packages using the eclass. Dependencies on packages using lua.eclass should be created via lua_gen_cond_dep() function, using LUA_USEDEP placeholder.

Please note that packages support multiple Lua implementations (using lua.eclass) cannot depend on packages not supporting them (using this eclass).

Note that since this eclass always inherits lua-utils as well, in ebuilds using the former there is no need to explicitly inherit the latter in order to use helper functions such as lua_get_CFLAGS.

SUPPORTED EAPIS

7

EXAMPLE

EAPI=7

LUA_COMPAT=( lua5-{1..3} )

inherit lua-single

[...]

REQUIRED_USE="${LUA_REQUIRED_USE}"
DEPEND="${LUA_DEPS}"
RDEPEND="${DEPEND}
    $(lua_gen_cond_dep '
        dev-lua/foo[${LUA_USEDEP}]
    ')
"
BDEPEND="virtual/pkgconfig"

# Only neeed if the setup phase has to do more than just call lua-single_pkg_setup
pkg_setup() {
    lua-single_pkg_setup
    [...]
}

src_install() {
    emake LUA_VERSION="$(lua_get_version)" install
}

FUNCTIONS

lua_gen_cond_dep <dependency> [<pattern>...]
Output a list of <dependency>-ies made conditional to USE flags of Lua implementations which are both in LUA_COMPAT and match any of the patterns passed as the remaining parameters.

The patterns can be fnmatch-style patterns (matched via bash == operator against LUA_COMPAT values). Remember to escape or quote the fnmatch patterns to prevent accidental shell filename expansion.

In order to enforce USE constraints on the packages, verbatim be placed in the dependency specification. It will get expanded within the function into a proper USE dependency string.

Example:

LUA_COMPAT=( lua5-{1..3} )
RDEPEND="$(lua_gen_cond_dep \
    'dev-lua/backported_core_module[${LUA_USEDEP}]' lua5-1 lua5-2 )"

It will cause the variable to look like:

RDEPEND="lua_single_target_lua5-1? (
    dev-lua/backported_core_module[lua_targets_lua5-1(-)?,...] )
lua_single_target_lua5-2? (
    dev-lua/backported_core_module[lua_targets_lua5-2(-)?,...] )"
lua_gen_impl_dep [<requested-use-flags> [<impl-pattern>...]]
Output a dependency on Lua implementations with the specified USE dependency string appended, or no USE dependency string if called without the argument (or with empty argument). If any implementation patterns are passed, the output dependencies will be generated only for the implementations matching them.

The patterns can be fnmatch-style patterns (matched via bash == operator against LUA_COMPAT values). Remember to escape or quote the fnmatch patterns to prevent accidental shell filename expansion.

Use this function when you need to request different USE flags on the Lua interpreter depending on package's USE flags. If you only need a single set of interpreter USE flags, just set LUA_REQ_USE and use ${LUA_DEPS} globally.

Example:

LUA_COMPAT=( lua5-{1..3} )
RDEPEND="foo? ( $(lua_gen_impl_dep 'deprecated(+)' lua5-3 ) )"

It will cause the variable to look like:

RDEPEND="foo? (
lua_single_target_lua5-3? ( dev-lang/lua:5.3[deprecated(+)] )
)"
lua_setup
Determine what the selected Lua implementation is and set the Lua build environment up for it.
lua-single_pkg_setup
Runs lua_setup.

ECLASS VARIABLES

LUA_COMPAT (REQUIRED) (SET BEFORE INHERIT)
This variable contains a list of Lua implementations the package supports. It must be set before the `inherit' call. It has to be an array.

Example:

LUA_COMPAT=( lua5-1 lua5-2 lua5-3 )

Please note that you can also use bash brace expansion if you like:

LUA_COMPAT=( lua5-{1..3} )
LUA_COMPAT_OVERRIDE (USER VARIABLE)
This variable can be used when working with ebuilds to override the in-ebuild LUA_COMPAT. It is a string listing all the implementations which package will be built for. It need be specified in the calling environment, and not in ebuilds.

It should be noted that in order to preserve metadata immutability, LUA_COMPAT_OVERRIDE does not affect IUSE nor dependencies. The state of LUA_TARGETS is ignored, and all the implementations in LUA_COMPAT_OVERRIDE are built. Dependencies need to be satisfied manually.

Example:

LUA_COMPAT_OVERRIDE='lua5-2' emerge -1v dev-lua/foo
LUA_REQ_USE (SET BEFORE INHERIT)
The list of USE flags required to be enabled on the chosen Lua implementations, formed as a USE-dependency string. It should be valid for all implementations in LUA_COMPAT, so it may be necessary to use USE defaults. This must be set before calling `inherit'.

Example:

LUA_REQ_USE="deprecated"

It will cause the Lua dependencies to look like:

lua_targets_luaX-Y? ( dev-lang/lua:X.Y[deprecated] )
LUA_DEPS (GENERATED BY ECLASS)
This is an eclass-generated Lua dependency string for all implementations listed in LUA_COMPAT.

Example use:

RDEPEND="${LUA_DEPS}
    dev-foo/mydep"
DEPEND="${RDEPEND}"

Example value:

lua_targets_lua5-1? ( dev-lang/lua:5.1 )
lua_targets_lua5-2? ( dev-lang/lua:5.2 )
LUA_REQUIRED_USE (GENERATED BY ECLASS)
This is an eclass-generated required-use expression which ensures at least one Lua implementation has been enabled.

This expression should be utilized in an ebuild by including it in REQUIRED_USE, optionally behind a use flag.

Example use:

REQUIRED_USE="lua? ( ${LUA_REQUIRED_USE} )"

Example value:

|| ( lua_targets_lua5-1 lua_targets_lua5-2 )
LUA_SINGLE_USEDEP (GENERATED BY ECLASS)
This is an eclass-generated USE-dependency string which can be used to depend on another lua-single package being built for the same Lua implementations.

If you need to depend on a multi-impl (lua.eclass) package, use lua_gen_cond_dep with LUA_USEDEP placeholder instead.

Example use:

RDEPEND="dev-lua/foo[${LUA_SINGLE_USEDEP}]"

Example value:

lua_single_target_lua5-1(-)?
LUA_USEDEP (GENERATED BY ECLASS)
This is an eclass-generated USE-dependency string which can be used to depend on another Lua package being built for the same Lua implementations.

Example use:

RDEPEND="dev-lua/foo[${LUA_USEDEP}]"

Example value:

lua_targets_lua5-1(-)?,lua_targets_lua5-2(-)?

AUTHORS

Marek Szuba <marecki@gentoo.org>
Based on python-single-r1.eclass by Michał Górny <mgorny@gentoo.org> et al.

MAINTAINERS

William Hubbs <williamh@gentoo.org>
Marek Szuba <marecki@gentoo.org>

REPORTING BUGS

Please report bugs via https://bugs.gentoo.org/

FILES

lua-single.eclass

SEE ALSO

ebuild(5)
https://gitweb.gentoo.org/repo/gentoo.git/log/eclass/lua-single.eclass


Index

NAME
DESCRIPTION
SUPPORTED EAPIS
EXAMPLE
FUNCTIONS
ECLASS VARIABLES
AUTHORS
MAINTAINERS
REPORTING BUGS
FILES
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 03:27:01 GMT, December 03, 2020