new package: lua-lgi

This commit is contained in:
Tee KOBAYASHI 2022-10-22 10:17:10 +09:00 committed by xtkoba
parent bb8fe316d6
commit 43b5b97031
6 changed files with 102 additions and 0 deletions

10
packages/lua-lgi/build.sh Normal file
View File

@ -0,0 +1,10 @@
TERMUX_PKG_HOMEPAGE=https://github.com/lgi-devs/lgi
TERMUX_PKG_DESCRIPTION="Dynamic Lua binding to GObject libraries using GObject-Introspection"
TERMUX_PKG_LICENSE="MIT"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=0.9.2
TERMUX_PKG_SRCURL=https://github.com/lgi-devs/lgi/archive/${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=cfc4105482b4730b3a40097c9d9e7e35c46df2fb255370bdeb2f45a886548c4f
TERMUX_PKG_DEPENDS="glib, gobject-introspection, libffi, liblua54"
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_EXTRA_MAKE_ARGS="PREFIX=$TERMUX_PREFIX"

View File

@ -0,0 +1,29 @@
From 5cfd42c386d3adae6d211fbb4011179c3c141b04 Mon Sep 17 00:00:00 2001
From: Uli Schlachter <psychon@znc.in>
Date: Sun, 2 Aug 2020 16:14:27 +0200
Subject: [PATCH] Fix the build with Lua 5.4
Lua 5.4 changed the API to lua_resume(). This commit changes the code to
cope with that.
Signed-off-by: Uli Schlachter <psychon@znc.in>
---
lgi/callable.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lgi/callable.c b/lgi/callable.c
index e96d3af4..3234b64f 100644
--- a/lgi/callable.c
+++ b/lgi/callable.c
@@ -1355,7 +1355,10 @@ closure_callback (ffi_cif *cif, void *ret, void **args, void *closure_arg)
}
else
{
-#if LUA_VERSION_NUM >= 502
+#if LUA_VERSION_NUM >= 504
+ int nresults;
+ res = lua_resume (L, NULL, npos, &nresults);
+#elif LUA_VERSION_NUM >= 502
res = lua_resume (L, NULL, npos);
#else
res = lua_resume (L, npos);

View File

@ -0,0 +1,30 @@
--- a/lgi/Makefile
+++ b/lgi/Makefile
@@ -7,13 +7,13 @@
PREFIX = /usr/local
HOST_OS = $(shell uname -s | tr A-Z a-z)
-LUA_VERSION=5.1
-LUA_LIBDIR = $(PREFIX)/lib/lua/$(LUA_VERSION)
-LUA_SHAREDIR = $(PREFIX)/share/lua/$(LUA_VERSION)
+PKG_CONFIG ?= pkg-config
+LUA_VERSION=5.4
+LUA_LIBDIR = $(shell $(PKG_CONFIG) lua54 --variable INSTALL_CMOD)
+LUA_SHAREDIR = $(shell $(PKG_CONFIG) lua54 --variable INSTALL_LMOD)
-PKG_CONFIG = pkg-config
GINAME = gobject-introspection-1.0
-PKGS = $(GINAME) gmodule-2.0 libffi
+PKGS = $(GINAME) gmodule-2.0 libffi lua54
VERSION_FILE = version.lua
ifneq ($(filter cygwin% msys% mingw%, $(HOST_OS)),)
@@ -27,7 +27,7 @@
CCSHARED = -fno-common
GOBJECT_INTROSPECTION_LIBDIR = $(shell $(PKG_CONFIG) --variable=libdir $(GINAME))
else
-CORE = corelgilua51.so
+CORE = corelgilua54.so
LIBFLAG = -shared
CCSHARED = -fPIC
endif

View File

@ -0,0 +1,11 @@
--- a/lgi/core.c
+++ b/lgi/core.c
@@ -684,7 +684,7 @@
}
G_MODULE_EXPORT int
-luaopen_lgi_corelgilua51 (lua_State* L)
+luaopen_lgi_corelgilua54 (lua_State* L)
{
LgiStateMutex *mutex;
gint state_id;

View File

@ -0,0 +1,11 @@
--- a/lgi/core.lua
+++ b/lgi/core.lua
@@ -11,7 +11,7 @@
-- This module decides what kind of core routines should be loaded.
-- Currently only one implementation exists, standard-Lua C-side
-- implementation, LuaJIT-FFI-based one is planned.
-local core = require 'lgi.corelgilua51'
+local core = require 'lgi.corelgilua54'
-- Helper methods for converting between CamelCase and uscore_delim
-- names.

View File

@ -0,0 +1,11 @@
--- a/lgi/override/cairo.lua
+++ b/lgi/override/cairo.lua
@@ -20,7 +20,7 @@
local enum = require 'lgi.enum'
local ti = ffi.types
-cairo._module = core.module('cairo', 2)
+cairo._module = core.module('cairo')
local module_gobject = core.gi.cairo.resolve
-- Versioning support.