pkg/lua: add download and build of lua as pkg
- download of v5.3.4 of Lua from git - building using RIOT build system - patched to remove the need for _times and _link to be provided to Lua via newlib.
This commit is contained in:
parent
3738acb062
commit
69888b5c4c
12
pkg/lua/Makefile
Normal file
12
pkg/lua/Makefile
Normal file
@ -0,0 +1,12 @@
|
||||
PKG_NAME=lua
|
||||
PKG_URL=https://github.com/lua/lua.git
|
||||
PKG_VERSION=e354c6355e7f48e087678ec49e340ca0696725b1
|
||||
PKG_LICENSE=MIT
|
||||
|
||||
.PHONY: all
|
||||
|
||||
all:
|
||||
@cp Makefile.lua $(PKG_BUILDDIR)
|
||||
"$(MAKE)" -C $(PKG_BUILDDIR) -f Makefile.lua
|
||||
|
||||
include $(RIOTBASE)/pkg/pkg.mk
|
||||
1
pkg/lua/Makefile.include
Normal file
1
pkg/lua/Makefile.include
Normal file
@ -0,0 +1 @@
|
||||
INCLUDES += -I$(PKGDIRBASE)/lua
|
||||
9
pkg/lua/Makefile.lua
Normal file
9
pkg/lua/Makefile.lua
Normal file
@ -0,0 +1,9 @@
|
||||
SRC := $(filter-out lua.c luac.c,$(wildcard *.c))
|
||||
|
||||
# This builds for native using POSIX system calls and some extra libraries, and
|
||||
# removes a compiler warning that warns against using tmpnam().
|
||||
ifeq ($(BOARD),native)
|
||||
CFLAGS += -DLUA_USE_LINUX
|
||||
endif
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
||||
6
pkg/lua/doc.txt
Normal file
6
pkg/lua/doc.txt
Normal file
@ -0,0 +1,6 @@
|
||||
/**
|
||||
* @defgroup pkg_lua Lua ported to RIOT
|
||||
* @ingroup pkg
|
||||
* @brief Provides Lua support for RIOT
|
||||
* @see https://github.com/lua/lua
|
||||
*/
|
||||
@ -0,0 +1,62 @@
|
||||
From b681cb20ee6bfc31b8ba23ec321140aae6e53e9d Mon Sep 17 00:00:00 2001
|
||||
From: danpetry <daniel.petry@fu-berlin.de>
|
||||
Date: Wed, 23 May 2018 14:09:17 +0200
|
||||
Subject: [PATCH 1/1] Remove dependency on nonexistent RIOT syscalls
|
||||
|
||||
Os.rename and os.clock, in Lua, now always return an error message.
|
||||
Also, l_randomizePivot, which is used by table.sort, will always
|
||||
supply 0 rather than a pseudorandom number.
|
||||
---
|
||||
loslib.c | 7 ++-----
|
||||
ltablib.c | 4 +++-
|
||||
2 files changed, 5 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/loslib.c b/loslib.c
|
||||
index dd2bb378..f9e5cbd2 100644
|
||||
--- a/loslib.c
|
||||
+++ b/loslib.c
|
||||
@@ -157,9 +157,7 @@ static int os_remove (lua_State *L) {
|
||||
|
||||
|
||||
static int os_rename (lua_State *L) {
|
||||
- const char *fromname = luaL_checkstring(L, 1);
|
||||
- const char *toname = luaL_checkstring(L, 2);
|
||||
- return luaL_fileresult(L, rename(fromname, toname) == 0, NULL);
|
||||
+ return luaL_error(L, "This function is not implemented in RIOT yet");
|
||||
}
|
||||
|
||||
|
||||
@@ -181,8 +179,7 @@ static int os_getenv (lua_State *L) {
|
||||
|
||||
|
||||
static int os_clock (lua_State *L) {
|
||||
- lua_pushnumber(L, ((lua_Number)clock())/(lua_Number)CLOCKS_PER_SEC);
|
||||
- return 1;
|
||||
+ return luaL_error(L, "This function is not implemented in RIOT yet");
|
||||
}
|
||||
|
||||
|
||||
diff --git a/ltablib.c b/ltablib.c
|
||||
index 588bf40d..8895b653 100644
|
||||
--- a/ltablib.c
|
||||
+++ b/ltablib.c
|
||||
@@ -235,13 +235,15 @@ static int unpack (lua_State *L) {
|
||||
/* type for array indices */
|
||||
typedef unsigned int IdxT;
|
||||
|
||||
-
|
||||
/*
|
||||
** Produce a "random" 'unsigned int' to randomize pivot choice. This
|
||||
** macro is used only when 'sort' detects a big imbalance in the result
|
||||
** of a partition. (If you don't want/need this "randomness", ~0 is a
|
||||
** good choice.)
|
||||
*/
|
||||
+
|
||||
+#define l_randomizePivot() 0
|
||||
+
|
||||
#if !defined(l_randomizePivot) /* { */
|
||||
|
||||
#include <time.h>
|
||||
--
|
||||
2.17.0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user