summaryrefslogtreecommitdiff
path: root/dev-lua/lpeg/lpeg-1.1.0.ebuild
diff options
context:
space:
mode:
authorJonas Toth <gentoo@jonas-toth.eu>2024-08-24 20:50:52 +0200
committerArthur Zamarin <arthurzam@gentoo.org>2024-08-30 17:50:47 +0300
commit95424d06c056a62aeaac23d6958dca04739e9d20 (patch)
tree0a5ff0a08004a832fe960a4fba9a96db85a5c147 /dev-lua/lpeg/lpeg-1.1.0.ebuild
parent8815c672d5935f0711f64a9bcbce4c58f4a6fd94 (diff)
downloadgentoo-95424d06c056a62aeaac23d6958dca04739e9d20.tar.gz
gentoo-95424d06c056a62aeaac23d6958dca04739e9d20.tar.bz2
gentoo-95424d06c056a62aeaac23d6958dca04739e9d20.zip
dev-lua/lpeg: add 1.1.0
The original source code location gives certificate validation errors when downloading with `wget`. Therefore, I switched to the luarocks repository. Closes: https://bugs.gentoo.org/936599 Signed-off-by: Jonas Toth <gentoo@jonas-toth.eu> Closes: https://github.com/gentoo/gentoo/pull/38282 Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'dev-lua/lpeg/lpeg-1.1.0.ebuild')
-rw-r--r--dev-lua/lpeg/lpeg-1.1.0.ebuild100
1 files changed, 100 insertions, 0 deletions
diff --git a/dev-lua/lpeg/lpeg-1.1.0.ebuild b/dev-lua/lpeg/lpeg-1.1.0.ebuild
new file mode 100644
index 000000000000..2f1e3a74056c
--- /dev/null
+++ b/dev-lua/lpeg/lpeg-1.1.0.ebuild
@@ -0,0 +1,100 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+LUA_COMPAT=( lua5-{1..4} luajit )
+
+inherit lua flag-o-matic toolchain-funcs
+
+DESCRIPTION="Parsing Expression Grammars for Lua"
+HOMEPAGE="https://www.inf.puc-rio.br/~roberto/lpeg/"
+SRC_URI="https://luarocks.org/manifests/gvvaughan/${P}-1.src.rock -> ${P}.zip"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="amd64 arm arm64 ~hppa ~mips ppc ppc64 ~riscv sparc x86 ~x64-macos"
+IUSE="test debug doc"
+REQUIRED_USE="${LUA_REQUIRED_USE}"
+RESTRICT="!test? ( test )"
+
+RDEPEND="${LUA_DEPS}"
+DEPEND="${RDEPEND}"
+BDEPEND="
+ virtual/pkgconfig
+ app-arch/unzip
+ test? ( ${RDEPEND} )
+"
+
+DOCS=( HISTORY )
+HTML_DOCS=( lpeg.html re.html )
+PATCHES=(
+ "${FILESDIR}"/${PN}-1.1.0-makefile.patch
+)
+
+src_unpack() {
+ unpack "${P}.zip" || die
+ unpack "${WORKDIR}/${P}.tar.gz" || die
+}
+
+lua_src_prepare() {
+ if ! test -d "${S}.${ELUA}/" ; then
+ cp -ral "${S}/" "${S}.${ELUA}/" || die
+ fi
+}
+
+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
+}
+
+lua_src_compile() {
+ cd "${S}.${ELUA}/" || die
+ emake CC="$(tc-getCC)" \
+ LUADIR="${EPREFIX}/$(lua_get_include_dir)"
+}
+
+src_compile() {
+ lua_foreach_impl lua_src_compile
+}
+
+lua_src_test() {
+ cd "${S}.${ELUA}/" || die
+ ${ELUA} test.lua || die
+}
+
+src_test() {
+ lua_foreach_impl lua_src_test
+}
+
+lua_src_install() {
+ cd "${S}.${ELUA}/" || die
+ local instdir
+ instdir="$(lua_get_cmod_dir)"
+ exeinto "${instdir#${EPREFIX}}"
+ doexe lpeg.so
+ 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() {
+ lua_foreach_impl lua_src_install
+ cd "${S}" || die
+ use doc && einstalldocs
+}