Added lua (lua host bytecode-compiler) to tools/
SVN-Revision: 11304
This commit is contained in:
parent
e19528fa6a
commit
13f0dea188
7 changed files with 4184 additions and 1 deletions
|
@ -9,7 +9,7 @@
|
|||
curdir:=tools
|
||||
|
||||
# subdirectories to descend into
|
||||
$(curdir)/builddirs := sed sstrip ipkg-utils genext2fs squashfs mtd-utils lzma mkimage firmware-utils patch-cmdline pkg-config automake $(if $(CONFIG_CCACHE),ccache) bison $(if $(CONFIG_powerpc),dtc)
|
||||
$(curdir)/builddirs := sed sstrip ipkg-utils genext2fs squashfs mtd-utils lzma mkimage firmware-utils patch-cmdline pkg-config automake $(if $(CONFIG_CCACHE),ccache) bison $(if $(CONFIG_powerpc),dtc) lua
|
||||
|
||||
# builddir dependencies
|
||||
$(curdir)/squashfs/compile := $(curdir)/lzma/install
|
||||
|
|
42
tools/lua/Makefile
Normal file
42
tools/lua/Makefile
Normal file
|
@ -0,0 +1,42 @@
|
|||
#
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
# $Id$
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=lua
|
||||
PKG_VERSION:=5.1.3
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://www.lua.org/ftp/ \
|
||||
http://ftp.gwdg.de/pub/languages/lua/ \
|
||||
http://mirrors.dotsrc.org/lua/ \
|
||||
http://www.tecgraf.puc-rio.br/lua/ftp/
|
||||
PKG_MD5SUM:=a70a8dfaa150e047866dc01a46272599
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += -DLUA_USE_LINUX
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C $(PKG_BUILD_DIR)/src luac-host
|
||||
endef
|
||||
|
||||
define Build/Install
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/luac-host $(STAGING_DIR_HOST)/bin/luac
|
||||
endef
|
||||
|
||||
define Build/Clean
|
||||
$(MAKE) -C $(PKG_BUILD_DIR)/src clean
|
||||
rm -f $(PKG_BUILD_DIR)/src/luac-host
|
||||
$(call Build/Clean/Default)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
3806
tools/lua/patches/010-lua-5.1.3-lnum-full-260308.patch
Normal file
3806
tools/lua/patches/010-lua-5.1.3-lnum-full-260308.patch
Normal file
File diff suppressed because it is too large
Load diff
154
tools/lua/patches/020-shared_liblua.patch
Normal file
154
tools/lua/patches/020-shared_liblua.patch
Normal file
|
@ -0,0 +1,154 @@
|
|||
Index: lua-5.1.3/Makefile
|
||||
===================================================================
|
||||
--- lua-5.1.3.orig/Makefile 2008-05-23 09:03:23.000000000 +0200
|
||||
+++ lua-5.1.3/Makefile 2008-05-23 09:05:51.000000000 +0200
|
||||
@@ -37,8 +37,8 @@
|
||||
|
||||
# What to install.
|
||||
TO_BIN= lua luac
|
||||
-TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
|
||||
-TO_LIB= liblua.a
|
||||
+TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp lnum_config.h
|
||||
+TO_LIB= liblua.a liblua.so.$R
|
||||
TO_MAN= lua.1 luac.1
|
||||
|
||||
# Lua version and release.
|
||||
@@ -58,6 +58,7 @@
|
||||
cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
|
||||
cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
|
||||
cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
|
||||
+ ln -s liblua.so.$R $(INSTALL_LIB)/liblua.so
|
||||
cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
|
||||
|
||||
local:
|
||||
Index: lua-5.1.3/src/ldo.h
|
||||
===================================================================
|
||||
--- lua-5.1.3.orig/src/ldo.h 2008-05-23 09:03:23.000000000 +0200
|
||||
+++ lua-5.1.3/src/ldo.h 2008-05-23 09:03:32.000000000 +0200
|
||||
@@ -46,7 +46,7 @@
|
||||
LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult);
|
||||
LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize);
|
||||
LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize);
|
||||
-LUAI_FUNC void luaD_growstack (lua_State *L, int n);
|
||||
+LUA_API void luaD_growstack (lua_State *L, int n);
|
||||
|
||||
LUAI_FUNC void luaD_throw (lua_State *L, int errcode);
|
||||
LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud);
|
||||
Index: lua-5.1.3/src/lfunc.h
|
||||
===================================================================
|
||||
--- lua-5.1.3.orig/src/lfunc.h 2008-05-23 09:03:23.000000000 +0200
|
||||
+++ lua-5.1.3/src/lfunc.h 2008-05-23 09:03:32.000000000 +0200
|
||||
@@ -18,7 +18,7 @@
|
||||
cast(int, sizeof(TValue *)*((n)-1)))
|
||||
|
||||
|
||||
-LUAI_FUNC Proto *luaF_newproto (lua_State *L);
|
||||
+LUA_API Proto *luaF_newproto (lua_State *L);
|
||||
LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e);
|
||||
LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e);
|
||||
LUAI_FUNC UpVal *luaF_newupval (lua_State *L);
|
||||
Index: lua-5.1.3/src/lmem.h
|
||||
===================================================================
|
||||
--- lua-5.1.3.orig/src/lmem.h 2008-05-23 09:03:23.000000000 +0200
|
||||
+++ lua-5.1.3/src/lmem.h 2008-05-23 09:03:32.000000000 +0200
|
||||
@@ -38,9 +38,9 @@
|
||||
((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t))))
|
||||
|
||||
|
||||
-LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize,
|
||||
+LUA_API void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize,
|
||||
size_t size);
|
||||
-LUAI_FUNC void *luaM_toobig (lua_State *L);
|
||||
+LUA_API void *luaM_toobig (lua_State *L);
|
||||
LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size,
|
||||
size_t size_elem, int limit,
|
||||
const char *errormsg);
|
||||
Index: lua-5.1.3/src/lstring.h
|
||||
===================================================================
|
||||
--- lua-5.1.3.orig/src/lstring.h 2008-05-23 09:03:23.000000000 +0200
|
||||
+++ lua-5.1.3/src/lstring.h 2008-05-23 09:03:32.000000000 +0200
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
LUAI_FUNC void luaS_resize (lua_State *L, int newsize);
|
||||
LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e);
|
||||
-LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
|
||||
+LUA_API TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
|
||||
|
||||
|
||||
#endif
|
||||
Index: lua-5.1.3/src/lundump.h
|
||||
===================================================================
|
||||
--- lua-5.1.3.orig/src/lundump.h 2008-05-23 09:03:23.000000000 +0200
|
||||
+++ lua-5.1.3/src/lundump.h 2008-05-23 09:03:32.000000000 +0200
|
||||
@@ -17,7 +17,7 @@
|
||||
LUAI_FUNC void luaU_header (char* h);
|
||||
|
||||
/* dump one chunk; from ldump.c */
|
||||
-LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip);
|
||||
+LUA_API int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip);
|
||||
|
||||
#ifdef luac_c
|
||||
/* print one chunk; from print.c */
|
||||
Index: lua-5.1.3/src/Makefile
|
||||
===================================================================
|
||||
--- lua-5.1.3.orig/src/Makefile 2008-05-23 09:03:32.000000000 +0200
|
||||
+++ lua-5.1.3/src/Makefile 2008-05-23 09:03:36.000000000 +0200
|
||||
@@ -23,6 +23,7 @@
|
||||
PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
|
||||
|
||||
LUA_A= liblua.a
|
||||
+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 lnum.o
|
||||
@@ -33,11 +34,12 @@
|
||||
LUA_O= lua.o
|
||||
|
||||
LUAC_T= luac
|
||||
-LUAC_O= luac.o print.o
|
||||
+LUAC_O= luac.o print.o lopcodes.o
|
||||
|
||||
ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O)
|
||||
-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
|
||||
+ALL_T= $(LUA_A) $(LUA_SO) $(LUA_T) $(LUAC_T)
|
||||
ALL_A= $(LUA_A)
|
||||
+ALL_SO= $(LUA_SO)
|
||||
|
||||
default: $(PLAT)
|
||||
|
||||
@@ -47,14 +49,23 @@
|
||||
|
||||
a: $(ALL_A)
|
||||
|
||||
+so: $(ALL_SO)
|
||||
+
|
||||
$(LUA_A): $(CORE_O) $(LIB_O)
|
||||
$(AR) $@ $?
|
||||
$(RANLIB) $@
|
||||
|
||||
-$(LUA_T): $(LUA_O) $(LUA_A)
|
||||
- $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
|
||||
+$(LUA_SO): $(CORE_O) $(LIB_O)
|
||||
+ $(CC) -o $@.$(PKG_VERSION) -shared -soname="$@.$(PKG_VERSION)" $? -nostdlib -lgcc
|
||||
+ ln -fs $@.$(PKG_VERSION) $@
|
||||
+
|
||||
+$(LUA_T): $(LUA_O) $(LUA_SO)
|
||||
+ $(CC) -o $@ -L. -llua $(MYLDFLAGS) $(LUA_O) $(LIBS)
|
||||
+
|
||||
+$(LUAC_T): $(LUAC_O) $(LUA_SO)
|
||||
+ $(CC) -o $@ -L. -llua $(MYLDFLAGS) $(LUAC_O) $(LIBS)
|
||||
|
||||
-$(LUAC_T): $(LUAC_O) $(LUA_A)
|
||||
+$(LUAC_T)-host: $(LUAC_O) $(LUA_A)
|
||||
$(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
|
||||
|
||||
clean:
|
||||
@@ -96,7 +107,7 @@
|
||||
$(MAKE) all MYCFLAGS=
|
||||
|
||||
linux:
|
||||
- $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses"
|
||||
+ $(MAKE) all MYCFLAGS+=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses"
|
||||
|
||||
macosx:
|
||||
$(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-lreadline"
|
113
tools/lua/patches/030-archindependent-bytecode.patch
Normal file
113
tools/lua/patches/030-archindependent-bytecode.patch
Normal file
|
@ -0,0 +1,113 @@
|
|||
diff -ur lua-5.1.3-pt2/src/ldump.c lua-5.1.3-pt3/src/ldump.c
|
||||
--- lua-5.1.3-pt2/src/ldump.c 2008-04-05 14:25:13.000000000 +0200
|
||||
+++ lua-5.1.3-pt3/src/ldump.c 2008-04-05 14:28:27.000000000 +0200
|
||||
@@ -67,12 +67,12 @@
|
||||
{
|
||||
if (s==NULL || getstr(s)==NULL)
|
||||
{
|
||||
- size_t size=0;
|
||||
+ unsigned int size=0;
|
||||
DumpVar(size,D);
|
||||
}
|
||||
else
|
||||
{
|
||||
- size_t size=s->tsv.len+1; /* include trailing '\0' */
|
||||
+ unsigned int size=s->tsv.len+1; /* include trailing '\0' */
|
||||
DumpVar(size,D);
|
||||
DumpBlock(getstr(s),size,D);
|
||||
}
|
||||
diff -ur lua-5.1.3-pt2/src/lundump.c lua-5.1.3-pt3/src/lundump.c
|
||||
--- lua-5.1.3-pt2/src/lundump.c 2008-04-05 14:25:13.000000000 +0200
|
||||
+++ lua-5.1.3-pt3/src/lundump.c 2008-04-05 14:28:27.000000000 +0200
|
||||
@@ -25,6 +25,7 @@
|
||||
ZIO* Z;
|
||||
Mbuffer* b;
|
||||
const char* name;
|
||||
+ int swap;
|
||||
} LoadState;
|
||||
|
||||
#ifdef LUAC_TRUST_BINARIES
|
||||
@@ -40,7 +41,6 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
-#define LoadMem(S,b,n,size) LoadBlock(S,b,(n)*(size))
|
||||
#define LoadByte(S) (lu_byte)LoadChar(S)
|
||||
#define LoadVar(S,x) LoadMem(S,&x,1,sizeof(x))
|
||||
#define LoadVector(S,b,n,size) LoadMem(S,b,n,size)
|
||||
@@ -52,6 +52,49 @@
|
||||
IF (r!=0, "unexpected end");
|
||||
}
|
||||
|
||||
+static void LoadMem (LoadState* S, void* b, int n, size_t size)
|
||||
+{
|
||||
+ LoadBlock(S,b,n*size);
|
||||
+ if (S->swap)
|
||||
+ {
|
||||
+ char* p=(char*) b;
|
||||
+ char c;
|
||||
+ switch (size)
|
||||
+ {
|
||||
+ case 1:
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ while (n--)
|
||||
+ {
|
||||
+ c=p[0]; p[0]=p[1]; p[1]=c;
|
||||
+ p+=2;
|
||||
+ }
|
||||
+ break;
|
||||
+ case 4:
|
||||
+ while (n--)
|
||||
+ {
|
||||
+ c=p[0]; p[0]=p[3]; p[3]=c;
|
||||
+ c=p[1]; p[1]=p[2]; p[2]=c;
|
||||
+ p+=4;
|
||||
+ }
|
||||
+ break;
|
||||
+ case 8:
|
||||
+ while (n--)
|
||||
+ {
|
||||
+ c=p[0]; p[0]=p[7]; p[7]=c;
|
||||
+ c=p[1]; p[1]=p[6]; p[6]=c;
|
||||
+ c=p[2]; p[2]=p[5]; p[5]=c;
|
||||
+ c=p[3]; p[3]=p[4]; p[4]=c;
|
||||
+ p+=8;
|
||||
+ }
|
||||
+ break;
|
||||
+ default:
|
||||
+ IF(1, "bad size");
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static int LoadChar(LoadState* S)
|
||||
{
|
||||
char x;
|
||||
@@ -83,7 +126,7 @@
|
||||
|
||||
static TString* LoadString(LoadState* S)
|
||||
{
|
||||
- size_t size;
|
||||
+ unsigned int size;
|
||||
LoadVar(S,size);
|
||||
if (size==0)
|
||||
return NULL;
|
||||
@@ -194,6 +237,7 @@
|
||||
char s[LUAC_HEADERSIZE];
|
||||
luaU_header(h);
|
||||
LoadBlock(S,s,LUAC_HEADERSIZE);
|
||||
+ S->swap=(s[6]!=h[6]); s[6]=h[6];
|
||||
IF (memcmp(h,s,LUAC_HEADERSIZE)!=0, "bad header");
|
||||
}
|
||||
|
||||
@@ -228,7 +272,7 @@
|
||||
*h++=(char)LUAC_FORMAT;
|
||||
*h++=(char)*(char*)&x; /* endianness */
|
||||
*h++=(char)sizeof(int);
|
||||
- *h++=(char)sizeof(size_t);
|
||||
+ *h++=(char)sizeof(unsigned int);
|
||||
*h++=(char)sizeof(Instruction);
|
||||
*h++=(char)sizeof(lua_Number);
|
||||
|
53
tools/lua/patches/100-no_readline.patch
Normal file
53
tools/lua/patches/100-no_readline.patch
Normal file
|
@ -0,0 +1,53 @@
|
|||
diff -ur lua-luci-5.1.3/src/luaconf.h lua-luci-5.1.3-new/src/luaconf.h
|
||||
--- lua-luci-5.1.3/src/luaconf.h 2008-04-14 13:19:54.000000000 +0200
|
||||
+++ lua-luci-5.1.3-new/src/luaconf.h 2008-04-14 13:19:17.000000000 +0200
|
||||
@@ -38,7 +38,6 @@
|
||||
#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)
|
||||
Nur in lua-luci-5.1.3-new/src: luaconf.h.orig.
|
||||
diff -ur lua-luci-5.1.3/src/Makefile lua-luci-5.1.3-new/src/Makefile
|
||||
--- lua-luci-5.1.3/src/Makefile 2008-04-14 13:19:57.000000000 +0200
|
||||
+++ lua-luci-5.1.3-new/src/Makefile 2008-04-14 13:19:17.000000000 +0200
|
||||
@@ -17,6 +17,7 @@
|
||||
MYCFLAGS=
|
||||
MYLDFLAGS=
|
||||
MYLIBS=
|
||||
+# USE_READLINE=1
|
||||
|
||||
# == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE =========
|
||||
|
||||
@@ -86,7 +87,7 @@
|
||||
@echo "MYLIBS = $(MYLIBS)"
|
||||
|
||||
# convenience targets for popular platforms
|
||||
-
|
||||
+RFLAG=$(if $(USE_READLINE),-DLUA_USE_READLINE)
|
||||
none:
|
||||
@echo "Please choose a platform:"
|
||||
@echo " $(PLATS)"
|
||||
@@ -101,16 +102,16 @@
|
||||
$(MAKE) all MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-Wl,-E"
|
||||
|
||||
freebsd:
|
||||
- $(MAKE) all MYCFLAGS="-DLUA_USE_LINUX" MYLIBS="-Wl,-E -lreadline"
|
||||
+ $(MAKE) all MYCFLAGS="-DLUA_USE_LINUX $(RFLAG)" MYLIBS="-Wl,-E$(if $(USE_READLINE), -lreadline)"
|
||||
|
||||
generic:
|
||||
$(MAKE) all MYCFLAGS=
|
||||
|
||||
linux:
|
||||
- $(MAKE) all MYCFLAGS+=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses"
|
||||
+ $(MAKE) all MYCFLAGS+="-DLUA_USE_LINUX $(RFLAG)" MYLIBS="-Wl,-E -ldl $(if $(USE_READLINE), -lreadline -lhistory -lncurses)"
|
||||
|
||||
macosx:
|
||||
- $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-lreadline"
|
||||
+ $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX $(if $(USE_READLINE), MYLIBS="-lreadline")
|
||||
# use this on Mac OS X 10.3-
|
||||
# $(MAKE) all MYCFLAGS=-DLUA_USE_MACOSX
|
||||
|
||||
Nur in lua-luci-5.1.3-new/src: Makefile.orig.
|
15
tools/lua/patches/200-lua-path.patch
Normal file
15
tools/lua/patches/200-lua-path.patch
Normal file
|
@ -0,0 +1,15 @@
|
|||
--- b/src/luaconf.h 2008-05-06 20:10:46.000000000 +0200
|
||||
+++ a/src/luaconf.h 2008-05-06 20:10:27.000000000 +0200
|
||||
@@ -95,9 +95,9 @@
|
||||
".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
|
||||
|
||||
#else
|
||||
-#define LUA_ROOT "/usr/local/"
|
||||
-#define LUA_LDIR LUA_ROOT "share/lua/5.1/"
|
||||
-#define LUA_CDIR LUA_ROOT "lib/lua/5.1/"
|
||||
+#define LUA_ROOT "/usr/"
|
||||
+#define LUA_LDIR LUA_ROOT "share/lua/"
|
||||
+#define LUA_CDIR LUA_ROOT "lib/lua/"
|
||||
#define LUA_PATH_DEFAULT \
|
||||
"./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \
|
||||
LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua"
|
Loading…
Reference in a new issue