Gentoo Archives: gentoo-dev

From: Marek Szuba <marecki@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] [PATCH 1/3] lua-utils.eclass: Add lua_get_include_dir()
Date: Mon, 12 Oct 2020 14:06:08
Message-Id: 20201012140534.113655-2-marecki@gentoo.org
In Reply to: [gentoo-dev] [PATCH 0/3] lua-utils.eclass: expose header and library locations by Marek Szuba
1 For build systems which must be pointed directly to the relevant files,
2 e.g. CMake.
3
4 Signed-off-by: Marek Szuba <marecki@g.o>
5 ---
6 eclass/lua-utils.eclass | 24 ++++++++++++++++++++++++
7 1 file changed, 24 insertions(+)
8
9 diff --git a/eclass/lua-utils.eclass b/eclass/lua-utils.eclass
10 index 24ef67635d5..8f54e57dbd7 100644
11 --- a/eclass/lua-utils.eclass
12 +++ b/eclass/lua-utils.eclass
13 @@ -250,6 +250,14 @@ _lua_export() {
14 export LUA_CMOD_DIR=${val}
15 debug-print "${FUNCNAME}: LUA_CMOD_DIR = ${LUA_CMOD_DIR}"
16 ;;
17 + LUA_INCLUDE_DIR)
18 + local val
19 +
20 + val=$($(tc-getPKG_CONFIG) --variable includedir ${impl}) || die
21 +
22 + export LUA_INCLUDE_DIR=${val}
23 + debug-print "${FUNCNAME}: LUA_INCLUDE_DIR = ${LUA_INCLUDE_DIR}"
24 + ;;
25 LUA_LIBS)
26 local val
27
28 @@ -335,6 +343,22 @@ lua_get_cmod_dir() {
29 echo "${LUA_CMOD_DIR}"
30 }
31
32 +# @FUNCTION: lua_get_include_dir
33 +# @USAGE: [<impl>]
34 +# @DESCRIPTION:
35 +# Obtain and print the name of the directory containing header files
36 +# of the given Lua implementation. If no implementation is provided,
37 +# ${ELUA} will be used.
38 +#
39 +# Please note that this function requires Lua and pkg-config installed,
40 +# and therefore proper build-time dependencies need be added to the ebuild.
41 +lua_get_include_dir() {
42 + debug-print-function ${FUNCNAME} "${@}"
43 +
44 + _lua_export "${@}" LUA_INCLUDE_DIR
45 + echo "${LUA_INCLUDE_DIR}"
46 +}
47 +
48 # @FUNCTION: lua_get_LIBS
49 # @USAGE: [<impl>]
50 # @DESCRIPTION:
51 --
52 2.26.2