On Mon, 11 Jan 2021 11:01:33 -0600
William Hubbs <[email protected]> wrote:

> Bug: https://bugs.gentoo.org/762769
> Signed-off-by: William Hubbs <[email protected]>
> ---
>  eclass/lua-utils.eclass | 23 ++++++++++++++++++-----
>  1 file changed, 18 insertions(+), 5 deletions(-)
> 
> diff --git a/eclass/lua-utils.eclass b/eclass/lua-utils.eclass
> index 100be14cb08..9fe4d22e93f 100644
> --- a/eclass/lua-utils.eclass
> +++ b/eclass/lua-utils.eclass
> @@ -212,8 +212,9 @@ _lua_get_library_file() {
>                       die "Invalid implementation: ${impl}"
>                       ;;
>       esac
> -     libdir=$($(tc-getPKG_CONFIG) --variable libdir ${impl}) || die
>  
> +     libdir=$($(tc-getPKG_CONFIG) --variable libdir ${impl}) || die
> +     
>       debug-print "${FUNCNAME}: libdir = ${libdir}, libname = ${libname}"
>       echo "${libdir}/${libname}"
>  }
> @@ -274,6 +275,7 @@ _lua_export() {
>                               local val
>  
>                               val=$($(tc-getPKG_CONFIG) --variable 
> INSTALL_CMOD ${impl}) || die
> +                             val="${val#${ESYSROOT#${SYSROOT}}}"
>  
>                               export LUA_CMOD_DIR=${val}
>                               debug-print "${FUNCNAME}: LUA_CMOD_DIR = 
> ${LUA_CMOD_DIR}"
> @@ -282,6 +284,7 @@ _lua_export() {
>                               local val
>  
>                               val=$($(tc-getPKG_CONFIG) --variable includedir 
> ${impl}) || die
> +                             val="${val#${ESYSROOT#${SYSROOT}}}"
>  
>                               export LUA_INCLUDE_DIR=${val}
>                               debug-print "${FUNCNAME}: LUA_INCLUDE_DIR = 
> ${LUA_INCLUDE_DIR}"
> @@ -298,6 +301,7 @@ _lua_export() {
>                               local val
>  
>                               val=$($(tc-getPKG_CONFIG) --variable 
> INSTALL_LMOD ${impl}) || die
> +                             val="${val#${ESYSROOT#${SYSROOT}}}"
>  
>                               export LUA_LMOD_DIR=${val}
>                               debug-print "${FUNCNAME}: LUA_LMOD_DIR = 
> ${LUA_LMOD_DIR}"
> @@ -364,11 +368,14 @@ lua_get_CFLAGS() {
>  # @USAGE: [<impl>]
>  # @DESCRIPTION:
>  # Obtain and print the name of the directory into which compiled Lua
> -# modules are installed, for the given implementation. If no implementation
> +# modules are installed for the given implementation. If no implementation
>  # is provided, ${ELUA} will be used.
>  #
> -# Please note that this function requires Lua and pkg-config installed,
> -# and therefore proper build-time dependencies need be added to the ebuild.
> +# Please note that this function requires Lua and pkg-config to be installed,
> +# and therefore proper build-time dependencies need to be added to the 
> ebuild.
> +#
> +# For prefix installations, this function does not include the offset in
> +# the path.
>  lua_get_cmod_dir() {
>       debug-print-function ${FUNCNAME} "${@}"
>  
> @@ -385,6 +392,9 @@ lua_get_cmod_dir() {
>  #
>  # Please note that this function requires Lua and pkg-config installed,
>  # and therefore proper build-time dependencies need be added to the ebuild.
> +#
> +# For prefix installations, this function does not include the offset in
> +# the path.
>  lua_get_include_dir() {
>       debug-print-function ${FUNCNAME} "${@}"
>  
> @@ -412,11 +422,14 @@ lua_get_LIBS() {
>  # @USAGE: [<impl>]
>  # @DESCRIPTION:
>  # Obtain and print the name of the directory into which native-Lua
> -# modules are installed, for the given implementation. If no implementation
> +# modules are installed for the given implementation. If no implementation
>  # is provided, ${ELUA} will be used.
>  #
>  # Please note that this function requires Lua and pkg-config installed,
>  # and therefore proper build-time dependencies need be added to the ebuild.
> +#
> +# For prefix installations, this function does not include the offset in
> +# the path.
>  lua_get_lmod_dir() {
>       debug-print-function ${FUNCNAME} "${@}"
>  

That's better, thanks. I would go a step further though and add a note
to lua_get_shared_lib() to say that this *does* include the SYSROOT and
prefix. It is slightly odd that this differs from lua_get_include_dir()
but I cannot find any examples where lua_get_shared_lib() is used in an
install phase.

Can you confirm that following this, you will go around and correct all
the ebuilds that use lua_get_include_dir() ? I count around 21 of them.
As I said, ${ESYSROOT} should be prepended when it is used in a build
phase. luaexpat is a good example of it being used in both a build and
an install phase.

Note that all of this is still slightly broken by the difference
between dev-util/pkgconfig and dev-util/pkgconf but I'll resolve that
as soon as I can. Most users, including most prefix users, won't notice.

-- 
James Le Cuirot (chewi)
Gentoo Linux Developer

Attachment: pgpMZXQy_kycK.pgp
Description: OpenPGP digital signature

Reply via email to