dev-lua/lua-utf8: UTF8 module for Lua (new package)
authorVictor Payno <vpayno+gentoo@gmail.com>
Mon, 27 Jan 2020 19:12:44 +0000 (11:12 -0800)
committerGeorgy Yakovlev <gyakovlev@gentoo.org>
Sun, 15 Mar 2020 23:22:04 +0000 (16:22 -0700)
Signed-off-by: Victor Payno <vpayno+gentoo@gmail.com>
UTF-8 support for Lua
Closes: https://github.com/gentoo/gentoo/pull/14477

Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
dev-lua/lua-utf8/Manifest [new file with mode: 0644]
dev-lua/lua-utf8/files/lua-utf8.Makefile [new file with mode: 0644]
dev-lua/lua-utf8/lua-utf8-0.1.1.ebuild [new file with mode: 0644]
dev-lua/lua-utf8/metadata.xml [new file with mode: 0644]

diff --git a/dev-lua/lua-utf8/Manifest b/dev-lua/lua-utf8/Manifest
new file mode 100644 (file)
index 0000000..b236960
--- /dev/null
@@ -0,0 +1 @@
+DIST lua-utf8-0.1.1.tar.gz 35475 BLAKE2B 99ffece901878fc966e0314886ca20255834c76b9266b1806acda7afb84d6a358c556b9a88c10497d2874d7902fac5905907ab25fefb4ba38544d46e3bae1471 SHA512 e0a8632b9391c7e7b35e371f4e95899ec58adb4988f1fe5a7101310f7c774c3a3e88073f156cf7799c57f69c0fc53aff4486beb1e7006bfaa96d86e248e38897
diff --git a/dev-lua/lua-utf8/files/lua-utf8.Makefile b/dev-lua/lua-utf8/files/lua-utf8.Makefile
new file mode 100644 (file)
index 0000000..ebbaece
--- /dev/null
@@ -0,0 +1,41 @@
+# this file builds lua-utf8
+
+MY_USE_LUA?=luajit
+PKG_CONFIG?=pkg-config
+PREFIX?=/usr/local
+DESTDIR?=/
+
+LUA_LIBDIR      := $(shell $(PKG_CONFIG) --variable INSTALL_CMOD $(MY_USE_LUA))
+LUA_INC         := $(shell $(PKG_CONFIG) --variable INSTALL_INC $(MY_USE_LUA))
+LUA_SHARE       := $(shell $(PKG_CONFIG) --variable INSTALL_LMOD $(MY_USE_LUA))
+CWARNS          := -Wall -pedantic
+CFLAGS          += -I$(LUA_INC) -fPIC $(CWARNS)
+LIB_OPTION      := -shared
+
+SONAME          := lua-utf8.so
+SONAMEV         := $(SONAME).0
+LIBRARY         := $(SONAMEV).1.1
+SRC             := lutf8lib.c
+OBJ             := $(patsubst %.c, %.o, $(SRC))
+
+FILES           := parseucd.lua
+
+all: $(LIBRARY) $(SONAMEV) $(SONAME)
+
+$(SONAMEV):
+       ln -s $(LIBRARY) $@
+
+$(SONAME):
+       ln -s $(SONAMEV) $@
+
+$(LIBRARY): $(OBJ)
+       $(CC) $(CFLAGS) $(LIB_OPTION) -o $(LIBRARY) $(OBJ) -lc
+
+install:
+       install -d $(DESTDIR)$(LUA_LIBDIR)
+       install $(SONAME) $(DESTDIR)$(LUA_LIBDIR)
+       install -d $(DESTDIR)$(LUA_SHARE)
+       install --mode=0444 $(FILES) $(DESTDIR)$(LUA_SHARE)
+
+clean:
+       rm -rf $(LIBRARY) $(SONAMEV) $(SONAME) *.o
diff --git a/dev-lua/lua-utf8/lua-utf8-0.1.1.ebuild b/dev-lua/lua-utf8/lua-utf8-0.1.1.ebuild
new file mode 100644 (file)
index 0000000..00f5147
--- /dev/null
@@ -0,0 +1,43 @@
+# Copyright 2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+inherit toolchain-funcs
+
+DESCRIPTION="UTF-8 support for Lua"
+HOMEPAGE="https://github.com/starwing/luautf8"
+SRC_URI="https://github.com/starwing/luautf8/archive/${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="luajit test"
+
+RESTRICT="!test? ( test )"
+
+BDEPEND="virtual/pkgconfig"
+RDEPEND="
+       !luajit? ( >=dev-lang/lua-5.1:= )
+       luajit? ( dev-lang/luajit:2 )"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}/${PN//-/}-${PV}"
+
+src_prepare() {
+       default
+
+       cp -v ${FILESDIR}/${PN}.Makefile ${S}/Makefile || die
+}
+
+src_compile() {
+       emake DESTDIR="${D}" PREFIX="${EPREFIX}" MY_USE_LUA="$(usex luajit 'luajit' 'lua')" PKG_CONFIG="$(tc-getPKG_CONFIG)"
+}
+
+src_install() {
+       emake DESTDIR="${D}" PREFIX="${EPREFIX}" MY_USE_LUA="$(usex luajit 'luajit' 'lua')" PKG_CONFIG="$(tc-getPKG_CONFIG)" install
+       einstalldocs
+}
+
+src_test() {
+       LUA_CPATH=./src/?.so $(usex luajit 'luajit' 'lua') test.lua || die
+}
diff --git a/dev-lua/lua-utf8/metadata.xml b/dev-lua/lua-utf8/metadata.xml
new file mode 100644 (file)
index 0000000..efc3ff4
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+       <maintainer type="person">
+               <email>vpayno+gentoo@gmail.com</email>
+               <name>Victor Payno</name>
+       </maintainer>
+       <maintainer type="person">
+               <email>gyakovlev@gentoo.org</email>
+               <name>Georgy Yakovlev</name>
+       </maintainer>
+       <longdescription lang="en">
+               This module adds UTF-8 support to Lua.
+
+               It use data extracted from Unicode Character Database, and tested on Lua 5.2.3, Lua 5.3.0 and LuaJIT.
+       </longdescription>
+       <upstream>
+               <remote-id type="github">starwing/luautf8</remote-id>
+       </upstream>
+</pkgmetadata>