diff mbox series

[meta-oe,3/4] lpeg: add recipe for 1.1.0

Message ID 20261119104903.176376-4-f_l_k@t-online.de
State Under Review
Headers show
Series tree-sitter grammars and neovim | expand

Commit Message

Markus Volk Nov. 19, 2026, 10:47 a.m. UTC
LPeg is a pattern-matching library for Lua and a build dependency of
neovim. Upstream only builds a Lua module without a soname, so build it
as liblpeg.so.1 for linking and add a lua/5.1/lpeg.so link so that
LuaJIT can load it with require "lpeg"; dev-so is skipped for that
module link.

Tested on intel-corei7-64: neovim links against it, and LuaJIT loads
it with require "lpeg".

AI-Generated: Uses Claude Code (Claude Opus 5.5)
Signed-off-by: Markus Volk <f_l_k@t-online.de>
---
 meta-oe/recipes-devtools/lpeg/lpeg_1.1.0.bb | 35 +++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/lpeg/lpeg_1.1.0.bb
diff mbox series

Patch

diff --git a/meta-oe/recipes-devtools/lpeg/lpeg_1.1.0.bb b/meta-oe/recipes-devtools/lpeg/lpeg_1.1.0.bb
new file mode 100644
index 0000000000..3ba37ef4df
--- /dev/null
+++ b/meta-oe/recipes-devtools/lpeg/lpeg_1.1.0.bb
@@ -0,0 +1,35 @@ 
+SUMMARY = "Parsing Expression Grammars for Lua"
+DESCRIPTION = "LPeg is a pattern-matching library for Lua based on Parsing \
+Expression Grammars. It is built as a shared library with a soname, so that \
+programs embedding LuaJIT such as neovim can link against it; it is \
+also installed as a Lua module for LuaJIT."
+HOMEPAGE = "https://www.inf.puc-rio.br/~roberto/lpeg/"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://lpeg.html;beginline=1388;endline=1421;md5=c6b4557382727a792e7134685abbf862"
+
+SRC_URI = "https://www.inf.puc-rio.br/~roberto/lpeg/lpeg-${PV}.tar.gz"
+SRC_URI[sha256sum] = "4b155d67d2246c1ffa7ad7bc466c1ea899bbc40fef0257cc9c03cecbaed4352a"
+
+DEPENDS = "luajit"
+
+inherit pkgconfig
+
+do_compile() {
+    oe_runmake lpeg.so \
+        CC="${CC}" \
+        CFLAGS="${CFLAGS} -std=c99 -fPIC $(pkg-config --cflags luajit)" \
+        DLLFLAGS="${LDFLAGS} -shared -Wl,-soname,liblpeg.so.1"
+}
+
+do_install() {
+    install -d ${D}${libdir}/lua/5.1
+    install -m 0755 ${S}/lpeg.so ${D}${libdir}/liblpeg.so.${PV}
+    ln -sf liblpeg.so.${PV} ${D}${libdir}/liblpeg.so.1
+    ln -sf liblpeg.so.${PV} ${D}${libdir}/liblpeg.so
+    ln -sf ../../liblpeg.so.1 ${D}${libdir}/lua/5.1/lpeg.so
+}
+
+FILES:${PN} += "${libdir}/lua"
+INSANE_SKIP:${PN} = "dev-so"
+
+BBCLASSEXTEND = "native"