aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--package/utils/lua5.3/Makefile127
-rw-r--r--package/utils/lua5.3/patches-host/001-include-version-number.patch67
-rw-r--r--package/utils/lua5.3/patches-host/100-no_readline.patch54
-rw-r--r--package/utils/lua5.3/patches/001-include-version-number.patch67
-rw-r--r--package/utils/lua5.3/patches/100-no_readline.patch54
5 files changed, 369 insertions, 0 deletions
diff --git a/package/utils/lua5.3/Makefile b/package/utils/lua5.3/Makefile
new file mode 100644
index 0000000000..f308fe6c1a
--- /dev/null
+++ b/package/utils/lua5.3/Makefile
@@ -0,0 +1,127 @@
+#
+# Copyright (C) 2006-2014 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=lua
+PKG_VERSION:=5.3.5
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.lua.org/ftp/ \
+ http://www.tecgraf.puc-rio.br/lua/ftp/
+PKG_HASH:=0c2eed3f960446e1a3e4b9a1ca2f3ff893b6ce41942cf54d5dd59ab4b3b058ac
+PKG_BUILD_PARALLEL:=1
+
+PKG_LICENSE:=MIT
+PKG_LICENSE_FILES:=COPYRIGHT
+
+HOST_PATCH_DIR := ./patches-host
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/host-build.mk
+
+define Package/lua5.3/Default
+ SUBMENU:=Lua
+ SECTION:=lang
+ CATEGORY:=Languages
+ TITLE:=Lua programming language
+ URL:=http://www.lua.org/
+ MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
+endef
+
+define Package/lua5.3/Default/description
+ Lua is a powerful, efficient, lightweight, embeddable scripting language. It
+ supports procedural programming, object-oriented programming, functional
+ programming, data-driven programming, and data description.
+endef
+
+define Package/lua5.3
+$(call Package/lua5.3/Default)
+ TITLE+= (interpreter)
+ PROVIDES:=lua
+endef
+
+define Package/lua5.3/description
+$(call Package/lua5.3/Default/description)
+ This package contains the Lua language interpreter.
+endef
+
+define Package/luac5.3
+$(call Package/lua5.3/Default)
+ TITLE+= (compiler)
+ PROVIDES:=luac
+endef
+
+define Package/luac5.3/description
+$(call Package/lua5.3/Default/description)
+ This package contains the Lua language compiler.
+endef
+
+TARGET_CFLAGS += -DLUA_USE_LINUX $(FPIC) -std=gnu99
+
+define Build/Compile
+ $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
+ CC="$(TARGET_CROSS)gcc" \
+ AR="$(TARGET_CROSS)ar rcu" \
+ RANLIB="$(TARGET_CROSS)ranlib" \
+ INSTALL_ROOT=/usr \
+ CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
+ PKG_VERSION=$(PKG_VERSION) \
+ linux
+ rm -rf $(PKG_INSTALL_DIR)
+ mkdir -p $(PKG_INSTALL_DIR)
+ $(MAKE) -C $(PKG_BUILD_DIR) \
+ INSTALL_TOP="$(PKG_INSTALL_DIR)/usr" \
+ install
+endef
+
+define Host/Configure
+ $(SED) 's,"/usr/local/","$(STAGING_DIR_HOSTPKG)/",' $(HOST_BUILD_DIR)/src/luaconf.h
+endef
+
+ifeq ($(HOST_OS),Darwin)
+ LUA_OS:=macosx
+else
+ ifeq ($(HOST_OS),FreeBSD)
+ LUA_OS:=freebsd
+ else
+ LUA_OS:=linux
+ endif
+endif
+
+define Host/Compile
+ $(MAKE) -C $(HOST_BUILD_DIR) \
+ CC="$(HOSTCC) -std=gnu99" \
+ $(LUA_OS)
+endef
+
+define Host/Install
+ $(MAKE) -C $(HOST_BUILD_DIR) \
+ INSTALL_TOP="$(STAGING_DIR_HOSTPKG)" \
+ install
+endef
+
+define Build/InstallDev
+ $(INSTALL_DIR) $(1)/usr/include
+ $(CP) $(PKG_INSTALL_DIR)/usr/include/lua5.3/lua{,lib,conf}.h $(1)/usr/include/
+ $(CP) $(PKG_INSTALL_DIR)/usr/include/lua5.3/lauxlib.h $(1)/usr/include/
+endef
+
+define Package/lua5.3/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lua5.3 $(1)/usr/bin/
+endef
+
+define Package/luac5.3/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/luac5.3 $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,lua5.3))
+$(eval $(call BuildPackage,luac5.3))
+$(eval $(call HostBuild))
diff --git a/package/utils/lua5.3/patches-host/001-include-version-number.patch b/package/utils/lua5.3/patches-host/001-include-version-number.patch
new file mode 100644
index 0000000000..08990f52ca
--- /dev/null
+++ b/package/utils/lua5.3/patches-host/001-include-version-number.patch
@@ -0,0 +1,67 @@
+From 96576b44a1b368bd6590eb0778ae45cc9ccede3f Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Fri, 21 Jun 2019 14:08:38 +0200
+Subject: [PATCH] include version number
+
+Including it allows multiple lua versions to coexist.
+
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+---
+
+diff --git a/Makefile b/Makefile
+--- a/Makefile
++++ b/Makefile
+@@ -12,7 +12,7 @@ PLAT= none
+ # LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h.
+ INSTALL_TOP= /usr/local
+ INSTALL_BIN= $(INSTALL_TOP)/bin
+-INSTALL_INC= $(INSTALL_TOP)/include
++INSTALL_INC= $(INSTALL_TOP)/include/lua$V
+ INSTALL_LIB= $(INSTALL_TOP)/lib
+ INSTALL_MAN= $(INSTALL_TOP)/man/man1
+ INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V
+@@ -39,10 +39,10 @@ RM= rm -f
+ PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris
+
+ # What to install.
+-TO_BIN= lua luac
++TO_BIN= lua$V luac$V
+ TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp
+-TO_LIB= liblua.a
+-TO_MAN= lua.1 luac.1
++TO_LIB= liblua$V.a
++TO_MAN= lua$V.1 luac$V.1
+
+ # Lua version and release.
+ V= 5.3
+diff --git a/doc/lua.1 b/doc/lua5.3.1
+rename from doc/lua.1
+rename to doc/lua5.3.1
+diff --git a/doc/luac.1 b/doc/luac5.3.1
+rename from doc/luac.1
+rename to doc/luac5.3.1
+diff --git a/src/Makefile b/src/Makefile
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -28,7 +28,7 @@ MYOBJS=
+
+ PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris
+
+-LUA_A= liblua.a
++LUA_A= liblua$V.a
+ CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \
+ lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \
+ ltm.o lundump.o lvm.o lzio.o
+@@ -36,10 +36,10 @@ LIB_O= lauxlib.o lbaselib.o lbitlib.o lc
+ lmathlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o loadlib.o linit.o
+ BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS)
+
+-LUA_T= lua
++LUA_T= lua$V
+ LUA_O= lua.o
+
+-LUAC_T= luac
++LUAC_T= luac$V
+ LUAC_O= luac.o
+
+ ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
diff --git a/package/utils/lua5.3/patches-host/100-no_readline.patch b/package/utils/lua5.3/patches-host/100-no_readline.patch
new file mode 100644
index 0000000000..bb014c57ba
--- /dev/null
+++ b/package/utils/lua5.3/patches-host/100-no_readline.patch
@@ -0,0 +1,54 @@
+--- a/src/luaconf.h
++++ b/src/luaconf.h
+@@ -61,14 +61,12 @@
+ #if defined(LUA_USE_LINUX)
+ #define LUA_USE_POSIX
+ #define LUA_USE_DLOPEN /* needs an extra library: -ldl */
+-#define LUA_USE_READLINE /* needs some extra libraries */
+ #endif
+
+
+ #if defined(LUA_USE_MACOSX)
+ #define LUA_USE_POSIX
+ #define LUA_USE_DLOPEN /* MacOS does not need -ldl */
+-#define LUA_USE_READLINE /* needs an extra library: -lreadline */
+ #endif
+
+
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -23,6 +23,7 @@ MYCFLAGS=
+ MYLDFLAGS=
+ MYLIBS=
+ MYOBJS=
++# USE_READLINE=1
+
+ # == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE =======
+
+@@ -83,6 +84,7 @@ echo:
+
+ # Convenience targets for popular platforms
+ ALL= all
++RFLAG=$(if $(USE_READLINE),-DLUA_USE_READLINE)
+
+ none:
+ @echo "Please do 'make PLATFORM' where PLATFORM is one of these:"
+@@ -102,15 +104,15 @@ c89:
+
+
+ freebsd:
+- $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX -DLUA_USE_READLINE -I/usr/include/edit" SYSLIBS="-Wl,-E -ledit" CC="cc"
++ $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX $(RFLAG) -I/usr/include/edit" SYSLIBS="-Wl,-E -ledit" CC="cc"
+
+ generic: $(ALL)
+
+ linux:
+- $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline"
++ $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" $(RFLAG) SYSLIBS="-Wl,-E -ldl $(if $(USE_READLINE), -lreadline)"
+
+ macosx:
+- $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" SYSLIBS="-lreadline"
++ $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" $(RFLAG) SYSLIBS="$(if $(USE_READLINE), -lreadline)"
+
+ mingw:
+ $(MAKE) "LUA_A=lua53.dll" "LUA_T=lua.exe" \
diff --git a/package/utils/lua5.3/patches/001-include-version-number.patch b/package/utils/lua5.3/patches/001-include-version-number.patch
new file mode 100644
index 0000000000..08990f52ca
--- /dev/null
+++ b/package/utils/lua5.3/patches/001-include-version-number.patch
@@ -0,0 +1,67 @@
+From 96576b44a1b368bd6590eb0778ae45cc9ccede3f Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Fri, 21 Jun 2019 14:08:38 +0200
+Subject: [PATCH] include version number
+
+Including it allows multiple lua versions to coexist.
+
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+---
+
+diff --git a/Makefile b/Makefile
+--- a/Makefile
++++ b/Makefile
+@@ -12,7 +12,7 @@ PLAT= none
+ # LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h.
+ INSTALL_TOP= /usr/local
+ INSTALL_BIN= $(INSTALL_TOP)/bin
+-INSTALL_INC= $(INSTALL_TOP)/include
++INSTALL_INC= $(INSTALL_TOP)/include/lua$V
+ INSTALL_LIB= $(INSTALL_TOP)/lib
+ INSTALL_MAN= $(INSTALL_TOP)/man/man1
+ INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V
+@@ -39,10 +39,10 @@ RM= rm -f
+ PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris
+
+ # What to install.
+-TO_BIN= lua luac
++TO_BIN= lua$V luac$V
+ TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp
+-TO_LIB= liblua.a
+-TO_MAN= lua.1 luac.1
++TO_LIB= liblua$V.a
++TO_MAN= lua$V.1 luac$V.1
+
+ # Lua version and release.
+ V= 5.3
+diff --git a/doc/lua.1 b/doc/lua5.3.1
+rename from doc/lua.1
+rename to doc/lua5.3.1
+diff --git a/doc/luac.1 b/doc/luac5.3.1
+rename from doc/luac.1
+rename to doc/luac5.3.1
+diff --git a/src/Makefile b/src/Makefile
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -28,7 +28,7 @@ MYOBJS=
+
+ PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris
+
+-LUA_A= liblua.a
++LUA_A= liblua$V.a
+ CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \
+ lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \
+ ltm.o lundump.o lvm.o lzio.o
+@@ -36,10 +36,10 @@ LIB_O= lauxlib.o lbaselib.o lbitlib.o lc
+ lmathlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o loadlib.o linit.o
+ BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS)
+
+-LUA_T= lua
++LUA_T= lua$V
+ LUA_O= lua.o
+
+-LUAC_T= luac
++LUAC_T= luac$V
+ LUAC_O= luac.o
+
+ ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
diff --git a/package/utils/lua5.3/patches/100-no_readline.patch b/package/utils/lua5.3/patches/100-no_readline.patch
new file mode 100644
index 0000000000..bb014c57ba
--- /dev/null
+++ b/package/utils/lua5.3/patches/100-no_readline.patch
@@ -0,0 +1,54 @@
+--- a/src/luaconf.h
++++ b/src/luaconf.h
+@@ -61,14 +61,12 @@
+ #if defined(LUA_USE_LINUX)
+ #define LUA_USE_POSIX
+ #define LUA_USE_DLOPEN /* needs an extra library: -ldl */
+-#define LUA_USE_READLINE /* needs some extra libraries */
+ #endif
+
+
+ #if defined(LUA_USE_MACOSX)
+ #define LUA_USE_POSIX
+ #define LUA_USE_DLOPEN /* MacOS does not need -ldl */
+-#define LUA_USE_READLINE /* needs an extra library: -lreadline */
+ #endif
+
+
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -23,6 +23,7 @@ MYCFLAGS=
+ MYLDFLAGS=
+ MYLIBS=
+ MYOBJS=
++# USE_READLINE=1
+
+ # == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE =======
+
+@@ -83,6 +84,7 @@ echo:
+
+ # Convenience targets for popular platforms
+ ALL= all
++RFLAG=$(if $(USE_READLINE),-DLUA_USE_READLINE)
+
+ none:
+ @echo "Please do 'make PLATFORM' where PLATFORM is one of these:"
+@@ -102,15 +104,15 @@ c89:
+
+
+ freebsd:
+- $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX -DLUA_USE_READLINE -I/usr/include/edit" SYSLIBS="-Wl,-E -ledit" CC="cc"
++ $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX $(RFLAG) -I/usr/include/edit" SYSLIBS="-Wl,-E -ledit" CC="cc"
+
+ generic: $(ALL)
+
+ linux:
+- $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline"
++ $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" $(RFLAG) SYSLIBS="-Wl,-E -ldl $(if $(USE_READLINE), -lreadline)"
+
+ macosx:
+- $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" SYSLIBS="-lreadline"
++ $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" $(RFLAG) SYSLIBS="$(if $(USE_READLINE), -lreadline)"
+
+ mingw:
+ $(MAKE) "LUA_A=lua53.dll" "LUA_T=lua.exe" \