mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-23 04:00:05 +02:00
lua: Fix lua 5.1.4 runtime
This commit is contained in:
@@ -2,7 +2,7 @@ SUMMARY="Lua is a powerful, fast, light-weight, embeddable scripting language."
|
||||
HOMEPAGE="http://www.lua.org"
|
||||
SRC_URI="http://www.lua.org/ftp/lua-5.1.4.tar.gz"
|
||||
CHECKSUM_MD5="d0870f2de55d59c1c8419f36e8fac150"
|
||||
REVISION="4"
|
||||
REVISION="5"
|
||||
ARCHITECTURES="x86 x86_gcc2"
|
||||
SECONDARY_ARCHITECTURES="x86 x86_gcc2"
|
||||
|
||||
@@ -22,6 +22,7 @@ BUILD_PREREQUIRES="
|
||||
"
|
||||
|
||||
PATCHES="lua-5.1.4.patchset"
|
||||
|
||||
BUILD()
|
||||
{
|
||||
make haiku
|
||||
@@ -36,6 +37,8 @@ INSTALL()
|
||||
mkdir -p $libDir/pkgconfig
|
||||
cp etc/lua.pc $libDir/pkgconfig/lua.pc
|
||||
|
||||
ln -s $libDir/liblua.so $libDir/liblua.so.5.1
|
||||
|
||||
prepareInstalledDevelLib liblua
|
||||
fixPkgconfig
|
||||
|
||||
|
||||
@@ -1,27 +1,20 @@
|
||||
From 5944289e129f60d26f71646bc4e3404f93de138f Mon Sep 17 00:00:00 2001
|
||||
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
|
||||
Date: Sat, 5 Oct 2013 22:01:42 +0200
|
||||
Subject: Import existing haikuport patch.
|
||||
From 0ba6279d1bee18e580206f0f86e3410f65db73c5 Mon Sep 17 00:00:00 2001
|
||||
From: Alexander von Gluck IV <kallisti5@unixzen.com>
|
||||
Date: Wed, 15 Jan 2014 15:33:52 -0600
|
||||
Subject: [PATCH] lua: fix 5.1 runtime issues
|
||||
|
||||
* Thanks to the work of Chris Roberts and
|
||||
Adrien Destugues
|
||||
---
|
||||
Makefile | 6 +++---
|
||||
src/Makefile | 13 ++++++++++---
|
||||
src/luaconf.h | 11 +++++++++++
|
||||
3 files changed, 24 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 6e78f66..8b8fbfc 100644
|
||||
index 6e78f66..b2e3868 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -13,11 +13,11 @@ INSTALL_TOP= /usr/local
|
||||
INSTALL_BIN= $(INSTALL_TOP)/bin
|
||||
INSTALL_INC= $(INSTALL_TOP)/include
|
||||
INSTALL_LIB= $(INSTALL_TOP)/lib
|
||||
-INSTALL_MAN= $(INSTALL_TOP)/man/man1
|
||||
+INSTALL_MAN= `finddir B_COMMON_DOCUMENTATION_DIRECTORY`/man/man1
|
||||
#
|
||||
# You probably want to make INSTALL_LMOD and INSTALL_CMOD consistent with
|
||||
# LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h (and also with etc/lua.pc).
|
||||
-INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V
|
||||
+INSTALL_LMOD= `finddir B_COMMON_DATA_DIRECTORY`/lua/$V
|
||||
INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V
|
||||
|
||||
# How to install. If your install program does not support "-p", then you
|
||||
@@ -38,12 +38,12 @@ RANLIB= ranlib
|
||||
# == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE =========
|
||||
|
||||
@@ -37,8 +30,17 @@ index 6e78f66..8b8fbfc 100644
|
||||
TO_MAN= lua.1 luac.1
|
||||
|
||||
# Lua version and release.
|
||||
@@ -53,7 +53,7 @@ R= 5.1.4
|
||||
all: $(PLAT)
|
||||
|
||||
$(PLATS) clean:
|
||||
- cd src && $(MAKE) $@
|
||||
+ cd src && $(MAKE) V=$(V) $@
|
||||
|
||||
test: dummy
|
||||
src/lua test/hello.lua
|
||||
diff --git a/src/Makefile b/src/Makefile
|
||||
index e4a3cd6..86bd1ce 100644
|
||||
index e4a3cd6..9df0326 100644
|
||||
--- a/src/Makefile
|
||||
+++ b/src/Makefile
|
||||
@@ -20,9 +20,10 @@ MYLIBS=
|
||||
@@ -49,7 +51,7 @@ index e4a3cd6..86bd1ce 100644
|
||||
+PLATS= aix ansi bsd freebsd generic haiku linux macosx mingw posix solaris
|
||||
|
||||
LUA_A= liblua.a
|
||||
+LUA_SO= liblua.so
|
||||
+LUA_SO= liblua.so
|
||||
CORE_O= lapi.o lcode.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
|
||||
@@ -62,175 +64,31 @@ index e4a3cd6..86bd1ce 100644
|
||||
ALL_A= $(LUA_A)
|
||||
|
||||
default: $(PLAT)
|
||||
@@ -57,6 +58,9 @@ $(LUA_T): $(LUA_O) $(LUA_A)
|
||||
@@ -57,8 +58,11 @@ $(LUA_T): $(LUA_O) $(LUA_A)
|
||||
$(LUAC_T): $(LUAC_O) $(LUA_A)
|
||||
$(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
|
||||
|
||||
+$(LUA_SO): $(CORE_O) $(LIB_O)
|
||||
+ $(CC) -o $@ -shared -fPIC -Wl,-soname=liblua.so.$V $(MYLDFLAGS) $? $(LIBS)
|
||||
+ $(CC) -o $@ -shared -fPIC -Wl,-soname=liblua.so.$(V) $(LDFLAGS) $? $(LIBS)
|
||||
+
|
||||
clean:
|
||||
$(RM) $(ALL_T) $(ALL_O)
|
||||
- $(RM) $(ALL_T) $(ALL_O)
|
||||
+ $(RM) $(ALL_T) $(ALL_O) $(ALL_SO)
|
||||
|
||||
depend:
|
||||
@$(CC) $(CFLAGS) -MM l*.c print.c
|
||||
@@ -95,6 +99,9 @@ freebsd:
|
||||
generic:
|
||||
$(MAKE) all MYCFLAGS=
|
||||
|
||||
+haiku:
|
||||
+ $(MAKE) all MYCFLAGS=-DLUA_USE_HAIKU LIBS=
|
||||
+ $(MAKE) all SYSCFLAGS="-DLUA_USE_HAIKU" LIBS=
|
||||
+
|
||||
linux:
|
||||
$(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses"
|
||||
|
||||
diff --git a/src/lcode.c b/src/lcode.c
|
||||
index cff626b..679cb9c 100644
|
||||
--- a/src/lcode.c
|
||||
+++ b/src/lcode.c
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
-** $Id: lcode.c,v 2.25.1.3 2007/12/28 15:32:23 roberto Exp $
|
||||
+** $Id: lcode.c,v 2.25.1.5 2011/01/31 14:53:16 roberto Exp $
|
||||
** Code generator for Lua
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@@ -544,10 +544,6 @@ void luaK_goiftrue (FuncState *fs, expdesc *e) {
|
||||
pc = NO_JUMP; /* always true; do nothing */
|
||||
break;
|
||||
}
|
||||
- case VFALSE: {
|
||||
- pc = luaK_jump(fs); /* always jump */
|
||||
- break;
|
||||
- }
|
||||
case VJMP: {
|
||||
invertjump(fs, e);
|
||||
pc = e->u.s.info;
|
||||
@@ -572,10 +568,6 @@ static void luaK_goiffalse (FuncState *fs, expdesc *e) {
|
||||
pc = NO_JUMP; /* always false; do nothing */
|
||||
break;
|
||||
}
|
||||
- case VTRUE: {
|
||||
- pc = luaK_jump(fs); /* always jump */
|
||||
- break;
|
||||
- }
|
||||
case VJMP: {
|
||||
pc = e->u.s.info;
|
||||
break;
|
||||
diff --git a/src/ldblib.c b/src/ldblib.c
|
||||
index 67de122..2027eda 100644
|
||||
--- a/src/ldblib.c
|
||||
+++ b/src/ldblib.c
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
-** $Id: ldblib.c,v 1.104.1.3 2008/01/21 13:11:21 roberto Exp $
|
||||
+** $Id: ldblib.c,v 1.104.1.4 2009/08/04 18:50:18 roberto Exp $
|
||||
** Interface from Lua to its debug API
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@@ -45,6 +45,7 @@ static int db_setmetatable (lua_State *L) {
|
||||
|
||||
|
||||
static int db_getfenv (lua_State *L) {
|
||||
+ luaL_checkany(L, 1);
|
||||
lua_getfenv(L, 1);
|
||||
return 1;
|
||||
}
|
||||
diff --git a/src/liolib.c b/src/liolib.c
|
||||
index e79ed1c..649f9a5 100644
|
||||
--- a/src/liolib.c
|
||||
+++ b/src/liolib.c
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
-** $Id: liolib.c,v 2.73.1.3 2008/01/18 17:47:43 roberto Exp $
|
||||
+** $Id: liolib.c,v 2.73.1.4 2010/05/14 15:33:51 roberto Exp $
|
||||
** Standard I/O (and system) library
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@@ -276,7 +276,10 @@ static int read_number (lua_State *L, FILE *f) {
|
||||
lua_pushnumber(L, d);
|
||||
return 1;
|
||||
}
|
||||
- else return 0; /* read fails */
|
||||
+ else {
|
||||
+ lua_pushnil(L); /* "result" to be removed */
|
||||
+ return 0; /* read fails */
|
||||
+ }
|
||||
}
|
||||
|
||||
|
||||
diff --git a/src/llex.c b/src/llex.c
|
||||
index 6dc3193..88c6790 100644
|
||||
--- a/src/llex.c
|
||||
+++ b/src/llex.c
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
-** $Id: llex.c,v 2.20.1.1 2007/12/27 13:02:25 roberto Exp $
|
||||
+** $Id: llex.c,v 2.20.1.2 2009/11/23 14:58:22 roberto Exp $
|
||||
** Lexical Analyzer
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@@ -118,8 +118,10 @@ TString *luaX_newstring (LexState *ls, const char *str, size_t l) {
|
||||
lua_State *L = ls->L;
|
||||
TString *ts = luaS_newlstr(L, str, l);
|
||||
TValue *o = luaH_setstr(L, ls->fs->h, ts); /* entry for `str' */
|
||||
- if (ttisnil(o))
|
||||
+ if (ttisnil(o)) {
|
||||
setbvalue(o, 1); /* make sure `str' will not be collected */
|
||||
+ luaC_checkGC(L);
|
||||
+ }
|
||||
return ts;
|
||||
}
|
||||
|
||||
diff --git a/src/loadlib.c b/src/loadlib.c
|
||||
index 0d401eb..6158c53 100644
|
||||
--- a/src/loadlib.c
|
||||
+++ b/src/loadlib.c
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
-** $Id: loadlib.c,v 1.52.1.3 2008/08/06 13:29:28 roberto Exp $
|
||||
+** $Id: loadlib.c,v 1.52.1.4 2009/09/09 13:17:16 roberto Exp $
|
||||
** Dynamic library loader for Lua
|
||||
** See Copyright Notice in lua.h
|
||||
**
|
||||
@@ -639,7 +639,7 @@ LUALIB_API int luaopen_package (lua_State *L) {
|
||||
lua_pushvalue(L, -1);
|
||||
lua_replace(L, LUA_ENVIRONINDEX);
|
||||
/* create `loaders' table */
|
||||
- lua_createtable(L, 0, sizeof(loaders)/sizeof(loaders[0]) - 1);
|
||||
+ lua_createtable(L, sizeof(loaders)/sizeof(loaders[0]) - 1, 0);
|
||||
/* fill it with pre-defined loaders */
|
||||
for (i=0; loaders[i] != NULL; i++) {
|
||||
lua_pushcfunction(L, loaders[i]);
|
||||
diff --git a/src/lstrlib.c b/src/lstrlib.c
|
||||
index 1b4763d..7a03489 100644
|
||||
--- a/src/lstrlib.c
|
||||
+++ b/src/lstrlib.c
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
-** $Id: lstrlib.c,v 1.132.1.4 2008/07/11 17:27:21 roberto Exp $
|
||||
+** $Id: lstrlib.c,v 1.132.1.5 2010/05/14 15:34:19 roberto Exp $
|
||||
** Standard library for string operations and pattern-matching
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@@ -754,6 +754,7 @@ static void addintlen (char *form) {
|
||||
|
||||
|
||||
static int str_format (lua_State *L) {
|
||||
+ int top = lua_gettop(L);
|
||||
int arg = 1;
|
||||
size_t sfl;
|
||||
const char *strfrmt = luaL_checklstring(L, arg, &sfl);
|
||||
@@ -768,7 +769,8 @@ static int str_format (lua_State *L) {
|
||||
else { /* format item */
|
||||
char form[MAX_FORMAT]; /* to store the format (`%...') */
|
||||
char buff[MAX_ITEM]; /* to store the formatted item */
|
||||
- arg++;
|
||||
+ if (++arg > top)
|
||||
+ luaL_argerror(L, arg, "no value");
|
||||
strfrmt = scanformat(L, strfrmt, form);
|
||||
switch (*strfrmt++) {
|
||||
case 'c': {
|
||||
diff --git a/src/luaconf.h b/src/luaconf.h
|
||||
index e2cb261..9f28f41 100644
|
||||
index e2cb261..96c4d45 100644
|
||||
--- a/src/luaconf.h
|
||||
+++ b/src/luaconf.h
|
||||
@@ -33,6 +33,13 @@
|
||||
@@ -247,49 +105,19 @@ index e2cb261..9f28f41 100644
|
||||
#if defined(LUA_USE_LINUX)
|
||||
#define LUA_USE_POSIX
|
||||
#define LUA_USE_DLOPEN /* needs an extra library: -ldl */
|
||||
@@ -94,7 +101,11 @@
|
||||
@@ -94,8 +101,12 @@
|
||||
".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
|
||||
|
||||
#else
|
||||
-#define LUA_ROOT "/usr/local/"
|
||||
+# if defined(LUA_USE_HAIKU)
|
||||
+# define LUA_ROOT "/boot/common/"
|
||||
+# else
|
||||
+# define LUA_ROOT "/usr/local/"
|
||||
+# endif
|
||||
+#ifndef LUA_ROOT
|
||||
#define LUA_ROOT "/usr/local/"
|
||||
+#endif
|
||||
+#ifndef LUA_LDIR
|
||||
#define LUA_LDIR LUA_ROOT "share/lua/5.1/"
|
||||
+#endif
|
||||
#define LUA_CDIR LUA_ROOT "lib/lua/5.1/"
|
||||
#define LUA_PATH_DEFAULT \
|
||||
diff --git a/src/lvm.c b/src/lvm.c
|
||||
index ee3256a..8aeafda 100644
|
||||
--- a/src/lvm.c
|
||||
+++ b/src/lvm.c
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
-** $Id: lvm.c,v 2.63.1.3 2007/12/28 15:32:23 roberto Exp $
|
||||
+** $Id: lvm.c,v 2.63.1.4 2009/07/01 21:10:33 roberto Exp $
|
||||
** Lua virtual machine
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@@ -133,6 +133,7 @@ void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val) {
|
||||
|
||||
void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) {
|
||||
int loop;
|
||||
+ TValue temp;
|
||||
for (loop = 0; loop < MAXTAGLOOP; loop++) {
|
||||
const TValue *tm;
|
||||
if (ttistable(t)) { /* `t' is a table? */
|
||||
@@ -152,7 +153,9 @@ void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) {
|
||||
callTM(L, tm, t, key, val);
|
||||
return;
|
||||
}
|
||||
- t = tm; /* else repeat with `tm' */
|
||||
+ /* else repeat with `tm' */
|
||||
+ setobj(L, &temp, tm); /* avoid pointing inside table (may rehash) */
|
||||
+ t = &temp;
|
||||
}
|
||||
luaG_runerror(L, "loop in settable");
|
||||
}
|
||||
"./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \
|
||||
--
|
||||
1.8.3.4
|
||||
|
||||
|
||||
Reference in New Issue
Block a user