diff mbox series

[[meta-swupdate] 3/7] lua: add luafilesystem

Message ID 1531042617-6503-3-git-send-email-sbabic@denx.de
State Accepted
Headers show
Series [[meta-swupdate] 3/7] lua: add luafilesystem | expand

Commit Message

Stefano Babic July 8, 2018, 9:36 a.m. UTC
LuaFileSystem is a Lua library developed to complement the set of functions
related to file systems offered by the standard Lua distribution.

Signed-off-by: Stefano Babic <sbabic@denx.de>
---
 .../luafilesystem/files/0001-Fix-for-OE.patch      | 64 ++++++++++++++++++++++
 recipes-lua/luafilesystem/luafilesystem_git.bb     | 40 ++++++++++++++
 2 files changed, 104 insertions(+)
 create mode 100644 recipes-lua/luafilesystem/files/0001-Fix-for-OE.patch
 create mode 100644 recipes-lua/luafilesystem/luafilesystem_git.bb
diff mbox series

Patch

diff --git a/recipes-lua/luafilesystem/files/0001-Fix-for-OE.patch b/recipes-lua/luafilesystem/files/0001-Fix-for-OE.patch
new file mode 100644
index 0000000..ab5e97a
--- /dev/null
+++ b/recipes-lua/luafilesystem/files/0001-Fix-for-OE.patch
@@ -0,0 +1,64 @@ 
+From c3154899776586c291dd9bc6369d7091efac19ff Mon Sep 17 00:00:00 2001
+From: Kas User <kas@example.com>
+Date: Mon, 14 May 2018 10:25:49 +0200
+Subject: [PATCH] Fix for OE
+
+Signed-off-by: Kas User <kas@example.com>
+---
+ Makefile |  2 +-
+ config   | 14 +++++++-------
+ 2 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index dfc1a8a..a521db7 100644
+--- a/Makefile
++++ b/Makefile
+@@ -12,7 +12,7 @@ OBJS= src/$T.o
+ lib: src/lfs.so
+ 
+ src/lfs.so: $(OBJS)
+-	MACOSX_DEPLOYMENT_TARGET="10.3"; export MACOSX_DEPLOYMENT_TARGET; $(CC) $(LIB_OPTION) -o src/lfs.so $(OBJS)
++	MACOSX_DEPLOYMENT_TARGET="10.3"; export MACOSX_DEPLOYMENT_TARGET; $(CC) $(LIB_OPTION) ${LDFLAGS} -o src/lfs.so $(OBJS)
+ 
+ test: lib
+ 	LUA_CPATH=./src/?.so lua tests/test.lua
+diff --git a/config b/config
+index 2fc9a78..fd73f4a 100644
+--- a/config
++++ b/config
+@@ -1,25 +1,25 @@
+ # Installation directories
+ 
+ # Default installation prefix
+-PREFIX=/usr/local
++PREFIX ?= /usr/local
+ 
+ # System's libraries directory (where binary libraries are installed)
+-LUA_LIBDIR= $(PREFIX)/lib/lua/5.1
++LUAVER ?= `pkg-config --modversion lua | cut -d'.' -f1,2`
++LUA_LIBDIR = $(PREFIX)/lib/lua/$(LUAVER)
+ 
+ # Lua includes directory
+ LUA_INC += -I$(PREFIX)/include
+ LUA_INC += -I/usr/include/lua5.1
++LUA_INC = `pkg-config --cflags lua`
+ 
+ # OS dependent
+-LIB_OPTION= -shared #for Linux
++LIB_OPTION= -shared ${LDFLAGS} #for Linux
+ #LIB_OPTION= -bundle -undefined dynamic_lookup #for MacOS X
+ 
+ LIBNAME= $T.so.$V
+ 
+ # Compilation directives
+-WARN= -O2 -Wall -fPIC -W -Waggregate-return -Wcast-align -Wmissing-prototypes -Wnested-externs -Wshadow -Wwrite-strings -pedantic
+-INCS= $(LUA_INC)
+-CFLAGS= $(WARN) $(INCS)
+-CC= gcc
++WARN= -O2 -Wall -fPIC -W -Waggregate-return -Wcast-align -Wmissing-prototypes -Wnested-externs -Wshadow -Wwrite-strings
++CFLAGS += $(WARN) $(INCS) ${LUA_INC}
+ 
+ # $Id: config,v 1.21 2007/10/27 22:42:32 carregal Exp $
+-- 
+2.7.4
+
diff --git a/recipes-lua/luafilesystem/luafilesystem_git.bb b/recipes-lua/luafilesystem/luafilesystem_git.bb
new file mode 100644
index 0000000..b699864
--- /dev/null
+++ b/recipes-lua/luafilesystem/luafilesystem_git.bb
@@ -0,0 +1,40 @@ 
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=d9b7e441d51a96b17511ee3be5a75857"
+
+DEPENDS = "lua"
+
+
+SRC_URI = "git://github.com/keplerproject/luafilesystem;protocol=https \
+	file://0001-Fix-for-OE.patch"
+
+# Modify these as desired
+PV = "1.0+git${SRCPV}"
+SRCREV = "1dfb8c41e8a7e689959baeaf2961437db9615f74"
+
+inherit pkgconfig
+
+S = "${WORKDIR}/git"
+
+EXTRA_OEMAKE = 'PREFIX=${D}/usr CROSS_COMPILE=${TARGET_PREFIX} CC="${CC} -fpic" LDFLAGS="${LDFLAGS}"'
+
+# NOTE: this is a Makefile-only piece of software, so we cannot generate much of the
+# recipe automatically - you will need to examine the Makefile yourself and ensure
+# that the appropriate arguments are passed in.
+
+FILES_${PN} = "${libdir} ${datadir}/lua" 
+
+do_configure () {
+	# Specify any needed configure commands here
+	:
+}
+
+do_compile () {
+	# You will almost certainly need to add additional arguments here
+	oe_runmake
+}
+
+do_install () {
+	# This is a guess; additional arguments may be required
+	oe_runmake install
+}
+