For build systems which must be pointed directly to the relevant files,
e.g. CMake.

Signed-off-by: Marek Szuba <mare...@gentoo.org>
---
 eclass/lua-utils.eclass | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/eclass/lua-utils.eclass b/eclass/lua-utils.eclass
index 100be14cb08..922f72b80d6 100644
--- a/eclass/lua-utils.eclass
+++ b/eclass/lua-utils.eclass
@@ -329,6 +329,11 @@ _lua_export() {
                                export LUA_SHARED_LIB="${val}".so
                                debug-print "${FUNCNAME}: LUA_SHARED_LIB = 
${LUA_SHARED_LIB}"
                                ;;
+                       LUA_STATIC_LIB)
+                               local val=$(_lua_get_library_file ${impl})
+                               export LUA_STATIC_LIB="${val}".a
+                               debug-print "${FUNCNAME}: LUA_STATIC_LIB = 
${LUA_STATIC_LIB}"
+                               ;;
                        LUA_VERSION)
                                local val
 
@@ -443,6 +448,25 @@ lua_get_shared_lib() {
        echo "${LUA_SHARED_LIB}"
 }
 
+# @FUNCTION: lua_get_static_lib
+# @USAGE: [<impl>]
+# @DESCRIPTION:
+# Obtain and print the expected name, with path, of the main static library
+# of the given Lua implementation. If no implementation is provided,
+# ${ELUA} will be used.
+#
+# Note that it is up to the ebuild maintainer to ensure Lua actually
+# provides a static library.
+#
+# Please note that this function requires Lua and pkg-config installed,
+# and therefore proper build-time dependencies need be added to the ebuild.
+lua_get_static_lib() {
+       debug-print-function ${FUNCNAME} "${@}"
+
+       _lua_export "${@}" LUA_STATIC_LIB
+       echo "${LUA_STATIC_LIB}"
+}
+
 # @FUNCTION: lua_get_version
 # @USAGE: [<impl>]
 # @DESCRIPTION:
-- 
2.26.2


Reply via email to