summaryrefslogtreecommitdiff
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
parentdev-lua/messagepack: add 0.5.4, EAPI=8 (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')
-rw-r--r--dev-lua/lpeg/Manifest1
-rw-r--r--dev-lua/lpeg/files/lpeg-1.1.0-makefile.patch31
-rw-r--r--dev-lua/lpeg/lpeg-1.1.0.ebuild100
3 files changed, 132 insertions, 0 deletions
diff --git a/dev-lua/lpeg/Manifest b/dev-lua/lpeg/Manifest
index ef58ad92dd6f..786381a3e016 100644
--- a/dev-lua/lpeg/Manifest
+++ b/dev-lua/lpeg/Manifest
@@ -1 +1,2 @@
DIST lpeg-1.0.2.tar.gz 71840 BLAKE2B e0d8fb4e9d17c9018f0b206cd3f7c9c0e21398c119600b5b0705c8df19e0956347bea795c7c3ded8e62e0c09802dd8eab931a5e3769fcacf44c35aa2b17fa8d6 SHA512 110527ddf9f8e5e8a80ef0ae8847c8ba8cd2597dba3bfe2865cba9af60daafbb885f21e74231952f5ab793d021e050b482066a821c6954d52090a5eae77e9814
+DIST lpeg-1.1.0.zip 78933 BLAKE2B 90895d74088d59529229825dd0058f69d0cb035d0b5ef9be49d9643c02e7b37ffcf358daa6b7129ff8df2247946dd12627d2ed1be23f61c51112303b702842b1 SHA512 5be6d3d9608881d044185e4e9cb5a7577d94b82276f4273f5dda7e2da93e13b926eaced9fc577dd83a4af231224c85a0336ddb920d94fbb334f8f55f7f21f8b4
diff --git a/dev-lua/lpeg/files/lpeg-1.1.0-makefile.patch b/dev-lua/lpeg/files/lpeg-1.1.0-makefile.patch
new file mode 100644
index 000000000000..afef6f6c05b5
--- /dev/null
+++ b/dev-lua/lpeg/files/lpeg-1.1.0-makefile.patch
@@ -0,0 +1,31 @@
+Respect user CFLAGS and LDFLAGS.
+
+--- lpeg-1.1.0/makefile
++++ lpeg-1.1.0/makefile
+@@ -1,7 +1,7 @@
+ LIBNAME = lpeg
+ LUADIR = ../lua/
+
+-COPT = -O2 -DNDEBUG
++COPT = -DNDEBUG
+ # COPT = -O0 -DLPEG_DEBUG -g
+
+ CWARNS = -Wall -Wextra -pedantic \
+@@ -22,7 +22,7 @@
+ # -Wunreachable-code \
+
+
+-CFLAGS = $(CWARNS) $(COPT) -std=c99 -I$(LUADIR) -fPIC
++CFLAGS += $(CWARNS) $(COPT) -std=c99 -I$(LUADIR) -fPIC
+ CC = gcc
+
+ FILES = lpvm.o lpcap.o lptree.o lpcode.o lpprint.o
+@@ -36,7 +36,7 @@
+ $(MAKE) lpeg.so "DLLFLAGS = -bundle -undefined dynamic_lookup"
+
+ lpeg.so: $(FILES)
+- env $(CC) $(DLLFLAGS) $(FILES) -o lpeg.so
++ env $(CC) $(DLLFLAGS) $(LDFLAGS) $(FILES) -o lpeg.so
+
+ $(FILES): makefile
+
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
+}