summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dev-lua/lpeg')
-rw-r--r--dev-lua/lpeg/Manifest1
-rw-r--r--dev-lua/lpeg/files/lpeg-1.0.2-makefile.patch31
-rw-r--r--dev-lua/lpeg/lpeg-1.0.2.ebuild53
3 files changed, 85 insertions, 0 deletions
diff --git a/dev-lua/lpeg/Manifest b/dev-lua/lpeg/Manifest
index c2f7797374ad..6addf6c1ed10 100644
--- a/dev-lua/lpeg/Manifest
+++ b/dev-lua/lpeg/Manifest
@@ -1 +1,2 @@
DIST lpeg-1.0.1.tar.gz 71527 BLAKE2B 5f19d308572f2d7a5ff11d7aa33f437ec682994d0a396a322764cf12a4cb659c66ce6ffaf0c76f6a250a7d767b6545478dd3bb760150b9f88be41fac9dafde0d SHA512 7b43fbee7eff443000986684bc56bba6d2796a31cf860740746c70e155bdea1b62a46b93f97e2747e3ef0f63e965148778ac2985d0f2d83e1e37ec4ebbabf4aa
+DIST lpeg-1.0.2.tar.gz 71840 BLAKE2B e0d8fb4e9d17c9018f0b206cd3f7c9c0e21398c119600b5b0705c8df19e0956347bea795c7c3ded8e62e0c09802dd8eab931a5e3769fcacf44c35aa2b17fa8d6 SHA512 110527ddf9f8e5e8a80ef0ae8847c8ba8cd2597dba3bfe2865cba9af60daafbb885f21e74231952f5ab793d021e050b482066a821c6954d52090a5eae77e9814
diff --git a/dev-lua/lpeg/files/lpeg-1.0.2-makefile.patch b/dev-lua/lpeg/files/lpeg-1.0.2-makefile.patch
new file mode 100644
index 000000000000..ec8150443da4
--- /dev/null
+++ b/dev-lua/lpeg/files/lpeg-1.0.2-makefile.patch
@@ -0,0 +1,31 @@
+Respect user CFLAGS and LDFLAGS.
+
+--- lpeg-1.0.2/makefile
++++ lpeg-1.0.2/makefile
+@@ -1,7 +1,7 @@
+ LIBNAME = lpeg
+ LUADIR = ../lua/
+
+-COPT = -O2 -DNDEBUG
++COPT = -DNDEBUG
+ # COPT = -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.0.2.ebuild b/dev-lua/lpeg/lpeg-1.0.2.ebuild
new file mode 100644
index 000000000000..5596fb03b62e
--- /dev/null
+++ b/dev-lua/lpeg/lpeg-1.0.2.ebuild
@@ -0,0 +1,53 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit flag-o-matic toolchain-funcs
+
+DESCRIPTION="Parsing Expression Grammars for Lua"
+HOMEPAGE="http://www.inf.puc-rio.br/~roberto/lpeg/"
+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 ~x86"
+IUSE="debug doc luajit"
+
+RDEPEND="
+ !luajit? ( >=dev-lang/lua-5.1:= )
+ luajit? ( dev-lang/luajit:2= )"
+
+DEPEND="
+ ${RDEPEND}
+ virtual/pkgconfig"
+
+DOCS=( HISTORY )
+HTML_DOCS=( lpeg.html re.html )
+PATCHES=( "${FILESDIR}"/${PN}-1.0.2-makefile.patch )
+
+src_prepare() {
+ default
+ use debug && append-cflags -DLPEG_DEBUG
+}
+
+src_compile() {
+ emake CC="$(tc-getCC)" \
+ LUADIR="$($(tc-getPKG_CONFIG) --variable includedir $(usex luajit 'luajit' 'lua'))"
+}
+
+src_test() {
+ $(usex luajit 'luajit' 'lua') test.lua || die
+}
+
+src_install() {
+ local instdir
+ instdir="$($(tc-getPKG_CONFIG) --variable INSTALL_CMOD $(usex luajit 'luajit' 'lua'))"
+ exeinto "${instdir#${EPREFIX}}"
+ doexe lpeg.so
+ instdir="$($(tc-getPKG_CONFIG) --variable INSTALL_LMOD $(usex luajit 'luajit' 'lua'))"
+ insinto "${instdir#${EPREFIX}}"
+ doins re.lua
+
+ use doc && einstalldocs
+}