commit:     8547f12dc95fb46445d540486669aed209507392
Author:     Aaron Bauman <bman <AT> gentoo <DOT> org>
AuthorDate: Tue Mar  9 18:21:35 2021 +0000
Commit:     Aaron Bauman <bman <AT> gentoo <DOT> org>
CommitDate: Tue Mar  9 18:21:35 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8547f12d

dev-lua/lpeg: fix build on Darwin; keyword for x64-macos

Signed-off-by: Aaron Bauman <bman <AT> gentoo.org>

 dev-lua/lpeg/lpeg-1.0.2-r101.ebuild | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/dev-lua/lpeg/lpeg-1.0.2-r101.ebuild 
b/dev-lua/lpeg/lpeg-1.0.2-r101.ebuild
index 769fbe86123..fd6789b18f6 100644
--- a/dev-lua/lpeg/lpeg-1.0.2-r101.ebuild
+++ b/dev-lua/lpeg/lpeg-1.0.2-r101.ebuild
@@ -13,7 +13,7 @@ SRC_URI="http://www.inf.puc-rio.br/~roberto/${PN}/${P}.tar.gz";
 
 LICENSE="MIT"
 SLOT="0"
-KEYWORDS="amd64 arm arm64 ~hppa ~mips ppc ppc64 sparc x86"
+KEYWORDS="amd64 arm arm64 ~hppa ~mips ppc ppc64 sparc x86 ~x64-macos"
 IUSE="test debug doc"
 REQUIRED_USE="${LUA_REQUIRED_USE}"
 
@@ -39,6 +39,11 @@ lua_src_prepare() {
 src_prepare() {
        default
        use debug && append-cflags -DLPEG_DEBUG
+
+       if [[ ${CHOST} == *-darwin* ]] ; then
+               append-ldflags "-undefined dynamic_lookup"
+       fi
+
        lua_foreach_impl lua_src_prepare
 }
 
@@ -70,6 +75,14 @@ lua_src_install() {
        instdir="$(lua_get_lmod_dir)"
        insinto "${instdir#${EPREFIX}}"
        doins re.lua
+
+       if [[ ${CHOST} == *-darwin* ]] ; then
+               local luav=$(lua_get_version)
+               # we only want the major version (e.g. 5.1)
+               local luamv=${luav:0:3}
+               local file="lua/${luamv}/lpeg.so"
+               install_name_tool -id "${EPREFIX}/usr/$(get_libdir)/${file}" 
"${ED}/usr/$(get_libdir)/${file}" || die "Failed to adjust install_name"
+       fi
 }
 
 src_install() {

Reply via email to