diff options
author | Marek Szuba <marecki@gentoo.org> | 2020-10-05 19:12:27 +0200 |
---|---|---|
committer | Marek Szuba <marecki@gentoo.org> | 2020-10-12 14:14:52 +0200 |
commit | 7ac3151dba659011178da29302c7b7207010454a (patch) | |
tree | 8c8a27dab0d60d0ac2d510b6ae20618244719ba8 /eclass | |
parent | dev-util/spirv-llvm-translator: remove old (diff) | |
download | gentoo-7ac3151dba659011178da29302c7b7207010454a.tar.gz gentoo-7ac3151dba659011178da29302c7b7207010454a.tar.bz2 gentoo-7ac3151dba659011178da29302c7b7207010454a.zip |
lua-utils.eclass: Support luajit
According to discussions on IRC, luajit should work as a drop-in
replacement for lua5.1 - and indeed, at least for x11-wm/awesome
it has worked.
Note that for the time being dev-lang/luajit uses the same module
directories as dev-lang/lua:5.1, which may lead to weird behaviour in
multi-impl ebuilds supporting both lua5-1 and luajit. Hopefully we will
get luajit to use its own directories so that it is fully independent,
same as we install pypy3 modules in their own directory hierarchy in
spite of compatibility with cpython-3.6.
Signed-off-by: Marek Szuba <marecki@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/lua-utils.eclass | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/eclass/lua-utils.eclass b/eclass/lua-utils.eclass index 490d19a00198..24ef67635d55 100644 --- a/eclass/lua-utils.eclass +++ b/eclass/lua-utils.eclass @@ -14,8 +14,6 @@ # A utility eclass providing functions to query Lua implementations, # install Lua modules and scripts. # -# Please note that for the time being this eclass does NOT support luajit. -# # This eclass neither sets any metadata variables nor exports any phase # functions. It can be inherited safely. @@ -39,6 +37,7 @@ inherit toolchain-funcs # @DESCRIPTION: # All supported Lua implementations, most preferred last _LUA_ALL_IMPLS=( + luajit lua5-1 lua5-2 lua5-3 @@ -141,9 +140,16 @@ _lua_wrapper_setup() { local ELUA LUA _lua_export "${impl}" ELUA LUA - # Lua interpreter and compiler + # Lua interpreter ln -s "${EPREFIX}"/usr/bin/${ELUA} "${workdir}"/bin/lua || die - ln -s "${EPREFIX}"/usr/bin/${ELUA/a/ac} "${workdir}"/bin/luac || die + + # Lua compiler, or a stub for it in case of luajit + if [[ ${ELUA} == luajit ]]; then + # Just in case + ln -s "${EPREFIX}"/bin/true "${workdir}"/bin/luac || die + else + ln -s "${EPREFIX}"/usr/bin/${ELUA/a/ac} "${workdir}"/bin/luac || die + fi # pkg-config ln -s "${EPREFIX}"/usr/$(get_libdir)/pkgconfig/${ELUA}.pc \ @@ -201,6 +207,10 @@ _lua_export() { local impl var case "${1}" in + luajit) + impl=${1} + shift + ;; lua*) impl=${1/-/.} shift @@ -259,6 +269,9 @@ _lua_export() { LUA_PKG_DEP) local d case ${impl} in + luajit) + LUA_PKG_DEP="dev-lang/luajit:=" + ;; lua*) LUA_PKG_DEP="dev-lang/lua:${impl#lua}" ;; |