summaryrefslogtreecommitdiff
path: root/recipes/lua
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/lua')
-rw-r--r--recipes/lua/files/advanced-readline.patch336
-rw-r--r--recipes/lua/files/debian.patch674
-rw-r--r--recipes/lua/files/make.patch20
-rw-r--r--recipes/lua/lua-build.inc40
-rw-r--r--recipes/lua/lua-gtk2/lua-gtk2-0.3_fixbuild.patch352
-rw-r--r--recipes/lua/lua-gtk2_0.3.bb23
-rw-r--r--recipes/lua/lua-native_5.0.2.bb15
-rw-r--r--recipes/lua/lua.inc25
-rw-r--r--recipes/lua/lua5.1/lua5.1.pc11
-rw-r--r--recipes/lua/lua5.1/makefile.patch22
-rw-r--r--recipes/lua/lua5.1_5.1.4.bb37
-rw-r--r--recipes/lua/lua_5.0.2.bb14
12 files changed, 1569 insertions, 0 deletions
diff --git a/recipes/lua/files/advanced-readline.patch b/recipes/lua/files/advanced-readline.patch
new file mode 100644
index 0000000000..93a7da8389
--- /dev/null
+++ b/recipes/lua/files/advanced-readline.patch
@@ -0,0 +1,336 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- lua-5.0.2/etc/saconfig.c~advanced-readline
++++ lua-5.0.2/etc/saconfig.c
+@@ -1,14 +1,14 @@
+-/* sa-config.c -- configuration for stand-alone Lua interpreter
++/* saconfig.c -- configuration for stand-alone Lua interpreter
+ *
+ * #define LUA_USERCONFIG to this file
+ *
+ * Here are the features that can be customized using #define:
+ *
+-*** Line edit and history:
++*** Line editing and history:
+ * #define USE_READLINE to use the GNU readline library.
+ *
+ * To use another library for this, use the code below as a start.
+-* Make sure you #define lua_readline and lua_saveline accordingly.
++* Make sure you #define lua_{read,save,init,exit}line accordingly.
+ * If you do not #define lua_readline, you'll get a version based on fgets
+ * that uses a static buffer of size MAXINPUT.
+ *
+@@ -41,13 +41,20 @@
+
+ #ifdef USE_READLINE
+ /*
+-* This section implements of lua_readline and lua_saveline for lua.c using
+-* the GNU readline and history libraries. It should also work with drop-in
+-* replacements such as editline and libedit (you may have to include
+-* different headers, though).
++* This section implements lua_xxxxline for lua.c using the GNU readline
++* and history libraries or compatible replacements.
+ *
++* It has been successfully tested with:
++*
++* GNU readline 2.2.1 (1998-07-17)
++* GNU readline 4.0 (1999-02-18) [harmless compiler warning]
++* GNU readline 4.3 (2002-07-16)
++* NETBSD libedit 2.6.5 (2002-03-25)
++* NETBSD libedit 2.6.9 (2004-05-01)
+ */
+
++#define lua_initline myinitline
++#define lua_exitline myexitline
+ #define lua_readline myreadline
+ #define lua_saveline mysaveline
+
+@@ -55,33 +62,226 @@
+ #include <readline/readline.h>
+ #include <readline/history.h>
+
+-static int myreadline (lua_State *L, const char *prompt) {
+- char *s=readline(prompt);
+- if (s==NULL)
+- return 0;
+- else {
+- lua_pushstring(L,s);
+- lua_pushliteral(L,"\n");
+- lua_concat(L,2);
+- free(s);
+- return 1;
+- }
++/* Environment variable names for the history file and the history size */
++#ifndef LUA_HISTORY_ENV
++#define LUA_HISTORY_ENV "LUA_HISTORY"
++#endif
++
++#ifndef LUA_HISTSIZE_ENV
++#define LUA_HISTSIZE_ENV "LUA_HISTSIZE"
++#endif
++
++static char *myhist;
++static int myhistsize;
++
++static lua_State *myL; /* readline does not pass user data to callbacks */
++
++/* Read a line from the terminal with line editing */
++static int myreadline(lua_State *L, const char *prompt)
++{
++ char *s;
++ if (!(s = readline(prompt))) return 0;
++ lua_pushstring(L, s);
++ lua_pushliteral(L, "\n");
++ lua_concat(L, 2);
++ free(s);
++ return 1;
+ }
+
+-static void mysaveline (lua_State *L, const char *s) {
++/* Add a line to the history */
++static void mysaveline(lua_State *L, const char *s)
++{
+ const char *p;
+- for (p=s; isspace(*p); p++)
+- ;
+- if (*p!=0) {
+- size_t n=strlen(s)-1;
+- if (s[n]!='\n')
++ for (p = s; isspace(*p); p++) ;
++ if (*p) {
++ size_t n = strlen(s)-1;
++ if (s[n] != '\n') {
+ add_history(s);
+- else {
+- lua_pushlstring(L,s,n);
+- s=lua_tostring(L,-1);
++ } else {
++ lua_pushlstring(L, s, n);
++ s = lua_tostring(L, -1);
+ add_history(s);
+- lua_remove(L,-1);
++ lua_pop(L, 1);
++ }
++ }
++}
++
++/* Reserved lua keywords */
++static const char * const reskeywords[] = {
++ "and", "break", "do", "else", "elseif", "end", "false",
++ "for", "function", "if", "in", "local", "nil", "not", "or",
++ "repeat", "return", "then", "true", "until", "while", NULL
++};
++
++static int valididentifier(const char *s)
++{
++ if (!(isalpha(*s) || *s == '_')) return 0;
++ for (s++; *s; s++) if (!(isalpha(*s) || isdigit(*s) || *s == '_')) return 0;
++ return 1;
++}
++
++/* Dynamically resizable match list */
++typedef struct {
++ char **list;
++ size_t idx, allocated, matchlen;
++} dmlist;
++
++/* Add prefix + string + suffix to list and compute common prefix */
++static int dmadd(dmlist *ml, const char *p, size_t pn, const char *s, int suf)
++{
++ char *t = NULL;
++
++ if (ml->idx+1 >= ml->allocated &&
++ !(ml->list = realloc(ml->list, sizeof(char *)*(ml->allocated += 32))))
++ return -1;
++
++ if (s) {
++ size_t n = strlen(s);
++ if (!(t = (char *)malloc(sizeof(char)*(pn+n+(suf?2:1))))) return 1;
++ memcpy(t, p, pn);
++ memcpy(t+pn, s, n);
++ n += pn;
++ t[n] = suf;
++ if (suf) t[++n] = '\0';
++
++ if (ml->idx == 0) {
++ ml->matchlen = n;
++ } else {
++ size_t i;
++ for (i = 0; i < ml->matchlen && i < n && ml->list[1][i] == t[i]; i++) ;
++ ml->matchlen = i; /* Set matchlen to common prefix */
++ }
++ }
++
++ ml->list[++ml->idx] = t;
++ return 0;
++}
++
++/* Get __index field of metatable of object on top of stack */
++static int getmetaindex(lua_State *L)
++{
++ if (!lua_getmetatable(L, -1)) { lua_pop(L, 1); return 0; }
++ lua_pushstring(L, "__index");
++ lua_rawget(L, -2);
++ lua_replace(L, -2);
++ if (lua_isnil(L, -1) || lua_rawequal(L, -1, -2)) { lua_pop(L, 2); return 0; }
++ lua_replace(L, -2);
++ return 1;
++} /* 1: obj -- val, 0: obj -- */
++
++/* Get field from object on top of stack. Avoid calling metamethods */
++static int safegetfield(lua_State *L, const char *s, size_t n)
++{
++ int i = 20; /* Avoid infinite metatable loops */
++ do {
++ if (lua_istable(L, -1)) {
++ lua_pushlstring(L, s, n);
++ lua_rawget(L, -2);
++ if (!lua_isnil(L, -1)) { lua_replace(L, -2); return 1; }
++ lua_pop(L, 1);
++ }
++ } while (--i > 0 && getmetaindex(L));
++ lua_pop(L, 1);
++ return 0;
++} /* 1: obj -- val, 0: obj -- */
++
++/* Completion function */
++static char **mycomplete(const char *text, int start, int end)
++{
++ dmlist ml;
++ const char *s;
++ size_t i, n, dot;
++ int savetop;
++
++ if (!(text[0] == '\0' || isalpha(text[0]) || text[0] == '_')) return NULL;
++
++ ml.list = NULL;
++ ml.idx = ml.allocated = ml.matchlen = 0;
++
++ savetop = lua_gettop(myL);
++ lua_pushvalue(myL, LUA_GLOBALSINDEX);
++ for (n = (size_t)(end-start), i = dot = 0; i < n; i++)
++ if (text[i] == '.' || text[i] == ':') {
++ if (!safegetfield(myL, text+dot, i-dot)) goto error; /* invalid prefix */
++ dot = i+1; /* points to first char after dot/colon */
++ }
++
++ /* Add all matches against keywords if there is no dot/colon */
++ if (dot == 0)
++ for (i = 0; (s = reskeywords[i]) != NULL; i++)
++ if (!strncmp(s, text, n) && dmadd(&ml, NULL, 0, s, ' ')) goto error;
++
++ /* Add all valid matches from all tables/metatables */
++ i = 20; /* Avoid infinite metatable loops */
++ do {
++ if (lua_istable(myL, -1))
++ for (lua_pushnil(myL); lua_next(myL, -2); lua_pop(myL, 1))
++ if (lua_type(myL, -2) == LUA_TSTRING) {
++ s = lua_tostring(myL, -2);
++ /* Only match names starting with '_' if explicitly requested */
++ if (!strncmp(s, text+dot, n-dot) && valididentifier(s) &&
++ (*s != '_' || text[dot] == '_')) {
++ int suf = ' '; /* default suffix is a space */
++ switch (lua_type(myL, -1)) {
++ case LUA_TTABLE: suf = '.'; break; /* No way to guess ':' */
++ case LUA_TFUNCTION: suf = '('; break;
++ case LUA_TUSERDATA:
++ if (lua_getmetatable(myL, -1)) { lua_pop(myL, 1); suf = ':'; }
++ break;
++ }
++ if (dmadd(&ml, text, dot, s, suf)) goto error;
++ }
++ }
++ } while (--i > 0 && getmetaindex(myL));
++
++ if (ml.idx > 1) {
++ /* list[0] holds the common prefix of all matches (may be "") */
++ if (!(ml.list[0] = (char *)malloc(sizeof(char)*(ml.matchlen+1)))) {
++error:
++ lua_settop(myL, savetop);
++ return NULL;
+ }
++ memcpy(ml.list[0], ml.list[1], ml.matchlen);
++ ml.list[0][ml.matchlen] = '\0';
++ /* Add the NULL list terminator */
++ if (dmadd(&ml, NULL, 0, NULL, 0)) goto error;
++ } else if (ml.idx == 1) {
++ ml.list[0] = ml.list[1]; /* Only return common prefix */
++ ml.list[1] = NULL;
+ }
++
++ lua_settop(myL, savetop);
++ return ml.list;
++}
++
++/* Initialize library */
++static void myinitline(lua_State *L, char *pname)
++{
++ char *s;
++
++ myL = L;
++
++ /* This allows for $if lua ... $endif in ~/.inputrc */
++ rl_readline_name = pname;
++ /* Break words at every non-identifier character except '.' and ':' */
++ rl_completer_word_break_characters =
++ "\t\r\n !\"#$%&'()*+,-/;<=>?@[\\]^`{|}~";
++ rl_completer_quote_characters = "\"'";
++ rl_completion_append_character = '\0';
++ rl_attempted_completion_function = mycomplete;
++ rl_initialize();
++
++ /* Start using history, optionally set history size and load history file */
++ using_history();
++ if ((s = getenv(LUA_HISTSIZE_ENV)) &&
++ (myhistsize = atoi(s))) stifle_history(myhistsize);
++ if ((myhist = getenv(LUA_HISTORY_ENV))) read_history(myhist);
++}
++
++/* Finalize library */
++static void myexitline(lua_State *L)
++{
++ /* Optionally save history file */
++ if (myhist) write_history(myhist);
+ }
+ #endif
+--- lua-5.0.2/src/lua/lua.c~advanced-readline
++++ lua-5.0.2/src/lua/lua.c
+@@ -265,6 +265,19 @@
+
+
+ /*
++** these macros can be used to perform initialization and finalization
++** for lua_saveline and lua_readline
++*/
++#ifndef lua_initline
++#define lua_initline(L,pname) /* empty */
++#endif
++
++#ifndef lua_exitline
++#define lua_exitline(L) /* empty */
++#endif
++
++
++/*
+ ** this macro can be used by some `history' system to save lines
+ ** read in manual input
+ */
+@@ -352,6 +365,7 @@
+ const char *oldprogname = progname;
+ progname = NULL;
+ do_path();
++ lua_initline(L, PROGNAME); /* progname may contain a path, so use PROGNAME */
+ while ((status = load_string()) != -1) {
+ if (status == 0) status = lcall(0, 0);
+ report(status);
+@@ -365,6 +379,7 @@
+ }
+ lua_settop(L, 0); /* clear stack */
+ fputs("\n", stdout);
++ lua_exitline(L);
+ progname = oldprogname;
+ }
+
diff --git a/recipes/lua/files/debian.patch b/recipes/lua/files/debian.patch
new file mode 100644
index 0000000000..38ca37946d
--- /dev/null
+++ b/recipes/lua/files/debian.patch
@@ -0,0 +1,674 @@
+--- lua-5.0.2.orig/doc/lua.1
++++ lua-5.0.2/doc/lua.1
+@@ -152,6 +152,16 @@
+ .TP
+ .B \-v
+ show version information.
++.TP
++.B \-C
++load the compatibility library into the interpreter. If you specify
++this, then you will also need to specify the
++.B \-i
++option in order to enter an interactive interpreter.
++.TP
++.B \-P
++suppress the creation of a standard LUA_PATH variable. Use this if
++you need to run scripts which conflict with system-installed libraries.
+ .SH "SEE ALSO"
+ .BR luac (1)
+ .br
+@@ -163,5 +173,11 @@
+ L. H. de Figueiredo,
+ and
+ W. Celes
+-(lua@tecgraf.puc-rio.br)
++.LP
++.BI <lua@tecgraf.puc-rio.br>
++.LP
++Debian modifications to the manpage by
++Daniel Silverstone
++.LP
++.BI <dsilvers@debian.org>
+ .\" EOF
+--- lua-5.0.2.orig/src/luac/Makefile
++++ lua-5.0.2/src/luac/Makefile
+@@ -12,8 +12,8 @@
+
+ all: $T
+
+-$T: $(OBJS) $(LIB)/liblua.a $(LIB)/liblualib.a
+- $(CC) -o $@ $(MYLDFLAGS) $(OBJS) -L$(LIB) -llua -llualib $(EXTRA_LIBS) $(DLLIB)
++$T: $(OBJS) $(LIB)/liblua.a $(LIB)/liblualib.a
++ $(CC) -o $@ $(MYLDFLAGS) $(OBJS) -L$(LIB) -llua -llualib $(EXTRA_LIBS)
+
+ # print.c needs opcode names from lopcodes.c
+ lopcodes.o: ../lopcodes.c ../lopcodes.h
+--- lua-5.0.2.orig/src/lib/Makefile
++++ lua-5.0.2/src/lib/Makefile
+@@ -9,16 +9,18 @@
+ OBJS= lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o ltablib.o lstrlib.o loadlib.o
+ SRCS= lauxlib.c lbaselib.c ldblib.c liolib.c lmathlib.c ltablib.c lstrlib.c loadlib.c
+
+-T= $(LIB)/liblualib.a
++SOBJS := $(patsubst %.o,%.os,$(OBJS))
++
++T= $(LIB)/liblualib.a
+
+ all: $T
+
+-$T: $(OBJS)
++$T: $(OBJS) $(SOBJS)
+ $(AR) $@ $(OBJS)
+ $(RANLIB) $@
+
+ clean:
+- rm -f $(OBJS) $T
++ rm -f $(OBJS) $(SOBJS) $T
+
+ co:
+ co -q -f -M $(SRCS)
+--- lua-5.0.2.orig/src/lib/liolib.c
++++ lua-5.0.2/src/lib/liolib.c
+@@ -149,7 +149,14 @@
+ if (f == stdin || f == stdout || f == stderr)
+ return 0; /* file cannot be closed */
+ else {
+- int ok = (pclose(f) != -1) || (fclose(f) == 0);
++ int ok;
++ errno = 0;
++ ok = (pclose(f) != -1);
++ if (!ok) {
++ if (errno == ECHILD) ok = 1; /* pclose worked, but could reap child */
++ else ok = (fclose(f) == 0);
++ }
++
+ if (ok)
+ *(FILE **)lua_touserdata(L, 1) = NULL; /* mark file as closed */
+ return ok;
+--- lua-5.0.2.orig/src/lua/Makefile
++++ lua-5.0.2/src/lua/Makefile
+@@ -12,8 +12,8 @@
+
+ all: $T
+
+-$T: $(OBJS) $(LIB)/liblua.a $(LIB)/liblualib.a
+- $(CC) -o $@ $(MYLDFLAGS) $(OBJS) -L$(LIB) -llua -llualib $(EXTRA_LIBS) $(DLLIB)
++$T: $(OBJS) $(LIB)/liblua.a $(LIB)/liblualib.a
++ $(CC) -o $@ $(MYLDFLAGS) $(OBJS) -L$(LIB) -llua -llualib $(EXTRA_LIBS) $(DLLIB)
+
+ $(LIB)/liblua.a:
+ cd ..; $(MAKE)
+--- lua-5.0.2.orig/src/lua/lua.c
++++ lua-5.0.2/src/lua/lua.c
+@@ -65,7 +65,57 @@
+
+ static const char *progname = PROGNAME;
+
++/* These bits are added for Debian's -P functionality */
+
++static int done_path = 0;
++static int suppress_path = 0;
++
++static const char* paths[] = {
++ "~/.lua",
++ "~/share/lua",
++ "/usr/share/lua",
++ "/usr/local/share/lua",
++ NULL
++};
++
++static void do_path()
++{
++ const char** p = paths;
++ int any;
++ if( done_path || suppress_path ) return;
++ if( ! L ) return;
++ done_path = 1;
++ lua_pushliteral(L,"LUA_PATH");
++ lua_pushliteral(L,"");
++ while( *p ) {
++ any = 0;
++ if( **p == '~' ) {
++ const char* home = getenv("HOME");
++ if( home ) {
++ lua_pushstring(L,home);
++ lua_pushstring(L,*p+1);
++ lua_pushliteral(L,"/?.lua;");
++ lua_pushstring(L,home);
++ lua_pushstring(L,*p+1);
++ lua_pushliteral(L,"/?;");
++ any = 6;
++ }
++ } else {
++ lua_pushstring(L,*p);
++ lua_pushliteral(L,"/?.lua;");
++ lua_pushstring(L,*p);
++ lua_pushliteral(L,"/?;");
++ any = 4;
++ }
++ if( any ) {
++ lua_concat(L,any+1);
++ }
++ p++;
++ }
++ lua_pushliteral(L, "?.lua;?");
++ lua_concat(L,2);
++ lua_settable(L, LUA_GLOBALSINDEX);
++}
+
+ static const luaL_reg lualibs[] = {
+ {"base", luaopen_base},
+@@ -85,13 +135,12 @@
+ static void lstop (lua_State *l, lua_Debug *ar) {
+ (void)ar; /* unused arg. */
+ lua_sethook(l, NULL, 0, 0);
+- luaL_error(l, "interrupted!");
++ lua_pushnil(l);
++ lua_error(l);
+ }
+
+
+ static void laction (int i) {
+- signal(i, SIG_DFL); /* if another SIGINT happens before lstop,
+- terminate process (default action) */
+ lua_sethook(L, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1);
+ }
+
+@@ -105,6 +154,9 @@
+ " -i enter interactive mode after executing `script'\n"
+ " -l name load and run library `name'\n"
+ " -v show version information\n"
++ " -C load the compatibility library before startup\n"
++ " -P suppress the setting of LUA_PATH. If not specified\n"
++ " very early, this setting may not take effect.\n"
+ " -- stop handling options\n" ,
+ progname);
+ }
+@@ -120,23 +172,42 @@
+ const char *msg;
+ if (status) {
+ msg = lua_tostring(L, -1);
+- if (msg == NULL) msg = "(error with no message)";
+- l_message(progname, msg);
++ if (msg == NULL) {
++ const char *str;
++ lua_getglobal(L, "LUA_DEFAULT_ERROR"); /* try global variable */
++ str = lua_tostring(L, -1);
++ lua_pop(L, 1);
++ if (str) {
++ if (*str != '\0') msg = str;
++ } else msg = "(error with no message)";
++ }
++ if (msg) l_message(progname, msg);
+ lua_pop(L, 1);
+ }
+ return status;
+ }
+
++static void sig_catch(int sig, void (*handler)(int))
++{
++ struct sigaction sa;
++ sa.sa_handler = handler;
++ sa.sa_flags = 0;
++ sigemptyset(&sa.sa_mask);
++ sigaction(sig, &sa, 0); /* XXX ignores errors */
++}
++
+
+ static int lcall (int narg, int clear) {
+ int status;
+ int base = lua_gettop(L) - narg; /* function index */
++ do_path();
++ lua_settop(L,base);
+ lua_pushliteral(L, "_TRACEBACK");
+ lua_rawget(L, LUA_GLOBALSINDEX); /* get traceback function */
+ lua_insert(L, base); /* put it under chunk and args */
+- signal(SIGINT, laction);
++ sig_catch(SIGINT, laction);
+ status = lua_pcall(L, narg, (clear ? 0 : LUA_MULTRET), base);
+- signal(SIGINT, SIG_DFL);
++ sig_catch(SIGINT, SIG_DFL);
+ lua_remove(L, base); /* remove traceback function */
+ return status;
+ }
+@@ -179,6 +250,7 @@
+
+
+ static int load_file (const char *name) {
++ do_path();
+ lua_pushliteral(L, "require");
+ lua_rawget(L, LUA_GLOBALSINDEX);
+ if (!lua_isfunction(L, -1)) { /* no `require' defined? */
+@@ -279,6 +351,7 @@
+ int status;
+ const char *oldprogname = progname;
+ progname = NULL;
++ do_path();
+ while ((status = load_string()) != -1) {
+ if (status == 0) status = lcall(0, 0);
+ report(status);
+@@ -352,6 +425,18 @@
+ return 1; /* stop if file fails */
+ break;
+ }
++ case 'C': {
++ const char *filename = "compat.lua";
++ if (load_file(filename))
++ return 1; /* stop if file fails */
++ break;
++ }
++ case 'P': {
++ if( done_path )
++ l_message(progname, "option `-P' is too late, ignored");
++ suppress_path = 1;
++ break;
++ }
+ case 'c': {
+ l_message(progname, "option `-c' is deprecated");
+ break;
+@@ -413,6 +498,7 @@
+ status = handle_luainit();
+ if (status == 0) {
+ status = handle_argv(s->argv, &interactive);
++ do_path();
+ if (status == 0 && interactive) manual_input();
+ }
+ s->status = status;
+--- lua-5.0.2.orig/src/Makefile
++++ lua-5.0.2/src/Makefile
+@@ -67,16 +67,19 @@
+ lvm.h \
+ lzio.h
+
+-T= $(LIB)/liblua.a
++T= $(LIB)/liblua.a
++
++SOBJS := $(patsubst %.o,%.os,$(OBJS))
+
+ all: $T
+
+-$T: $(OBJS)
++$T: $(OBJS) $(SOBJS)
+ $(AR) $@ $(OBJS)
+ $(RANLIB) $@
+
++
+ clean:
+- rm -f $(OBJS) $T
++ rm -f $(OBJS) $(SOBJS) $T
+
+ co:
+ co -q -f -M $(SRCS)
+--- lua-5.0.2.orig/lua-config
++++ lua-5.0.2/lua-config
+@@ -0,0 +1,165 @@
++#!/usr/bin/lua
++-- -*- Lua -*-
++
++-- This file is under the terms of the MIT licence. Do as you will.
++
++-- Process the arg table
++function usage()
++ info();
++ io.stderr:write([[Usage: lua-config <options>
++
++ Valid options are:
++
++ --include Outputs the -I switches needed to find <lua.h> etc.
++
++ --static Outputs the full path to the static libraries
++
++ --libs Outputs the -L and -l switches needed to find the library
++ --libs-only-L Outputs only the -L switches
++ --libs-only-l Outputs only the -l switches
++
++ --extralibs Outputs the -l switches appropriate to the extra libs needed by lua
++
++ Note that --static is mututally exclusive with the --libs* options
++
++ Also, you can specify the following
++
++ --vmonly Outputs only the switches for finding the VM libraries
++ --libonly Outputs only the switches for finding the standard libraries
++ --both Outputs the switches for both [The default]
++
++ Example:
++
++ gcc `lua-config --include` my_prog.c -o my_prog `lua-config --libs`
++
++]] );
++ os.exit(1);
++end
++
++function version()
++ io.stdout:write( [[5.0.0
++]] );
++ os.exit(0);
++end
++
++function info()
++ io.stdout:write( [[lua-config version 1.10 (c) Daniel Silverstone 2002
++
++lua-config was written for the Debian GNU/Linux project. This version
++of lua-config will provide switches appropriate to Lua 5.0
++
++]] );
++end
++
++if( table.getn(arg) == 0 ) then
++ usage()
++end
++
++output_vm = 1
++output_lib = 1
++
++output_static = 0
++output_libs_l = 0
++output_libs_L = 0
++output_include = 0
++output_extras = 0
++
++table.foreachi( arg,
++ function(n,param)
++ if( param == '--version' ) then
++ version()
++ end
++ if( param == '--help' ) then
++ usage()
++ end
++ if( param == '--include' ) then
++ output_include = 1;
++ return
++ end
++ if( param == '--libs' ) then
++ output_libs_l = 1;
++ output_libs_L = 1;
++ return
++ end
++ if( param == '--libs-only-L' ) then
++ output_libs_L = 1;
++ return
++ end
++ if( param == '--libs-only-l' ) then
++ output_libs_l = 1;
++ return
++ end
++ if( param == '--extralibs' ) then
++ output_extras = 1;
++ return
++ end
++ if( param == '--static' ) then
++ output_static = 1;
++ return
++ end
++ if( param == '--vmonly' ) then
++ output_vm = 1;
++ output_lib = 0;
++ return
++ end
++ if( param == '--libonly' ) then
++ output_lib = 1;
++ output_vm = 0;
++ return
++ end
++ if( param == '--both' ) then
++ output_lib = 1;
++ output_vm = 1;
++ return
++ end
++ io.stderr:write( "Unknown argument ", param );
++ usage();
++ end );
++
++if( (output_extras + output_libs_l + output_libs_L + output_include + output_static) == 0 ) then
++ usage()
++end
++
++if( (output_static + (output_libs_l or output_libs_L)) > 1 ) then
++ usage();
++end
++
++outargs = {}
++
++if( output_include == 1 ) then
++ table.insert( outargs, "-I/usr/include/lua" );
++end
++
++if( output_libs_L == 1 ) then
++ table.insert( outargs, "-L/usr/include" );
++end
++
++if( output_libs_l == 1 ) then
++ if( output_lib == 1 ) then
++ table.insert( outargs, "-llualib" );
++ end
++ if( output_vm == 1 ) then
++ table.insert( outargs, "-llua" );
++ end
++end
++
++if( output_static == 1 ) then
++ if( output_lib == 1 ) then
++ table.insert( outargs, "/usr/lib/liblualib.a" );
++ end
++ if( output_vm == 1 ) then
++ table.insert( outargs, "/usr/lib/liblua.a" );
++ end
++end
++
++if( output_extras == 1 ) then
++ table.insert( outargs, "-lm" );
++end
++
++io.stdout:write( outargs[1] );
++
++for i=2,table.getn(outargs) do
++ io.stdout:write( " ", outargs[i] );
++end
++
++io.stdout:write( "\n" );
+--- lua-5.0.2.orig/config
++++ lua-5.0.2/config
+@@ -25,15 +25,15 @@
+ # interface (e.g., Linux, Solaris, IRIX, BSD, AIX, HPUX, and probably others),
+ # uncomment the next two lines.
+ #
+-#LOADLIB= -DUSE_DLOPEN=1
+-#DLLIB= -ldl
++LOADLIB= -DUSE_DLOPEN=1
++DLLIB= -ldl
+ #
+ # In Linux with gcc, you should also uncomment the next definition for
+ # MYLDFLAGS, which passes -E (= -export-dynamic) to the linker. This option
+ # allows dynamic libraries to link back to the `lua' program, so that they do
+ # not need the Lua libraries. (Other systems may have an equivalent facility.)
+ #
+-#MYLDFLAGS= -Wl,-E
++MYLDFLAGS= -Wl,-E
+ #
+ # On Windows systems. support for dynamic loading is enabled by default.
+ # To disable this support, uncomment the next line.
+@@ -92,7 +92,7 @@
+ # or if you are using a modified interpreter that does not need them,
+ # then comment the following line or add the appropriates libraries.
+ #
+-EXTRA_LIBS= -lm
++#EXTRA_LIBS= -lm
+
+ # If you want to customize the stand-alone Lua interpreter, uncomment and
+ # edit the following two lines; also edit etc/saconfig.c to suit your needs.
+@@ -100,8 +100,8 @@
+ # to add -lreadline (and perhaps also -lhistory and -lcurses or -lncurses)
+ # to EXTRA_LIBS.
+ #
+-#USERCONF=-DLUA_USERCONFIG='"$(LUA)/etc/saconfig.c"' -DUSE_READLINE
+-#EXTRA_LIBS= -lm -ldl -lreadline # -lhistory -lcurses -lncurses
++USERCONF=-DLUA_USERCONFIG='"$(LUA)/etc/saconfig.c"' -DUSE_READLINE
++EXTRA_LIBS= -lreadline -lm -ldl # -lhistory -lcurses -lncurses
+
+ # ------------------------------------------------------------------ C compiler
+
+@@ -119,7 +119,7 @@
+ # debug information. If you only want the shared libraries, you may want to
+ # add -fPIC to MYCFLAGS.
+ #
+-MYCFLAGS= -O2
++MYCFLAGS= -O3 -g
+ #MYCFLAGS= -O3 -fomit-frame-pointer # -fPIC
+
+ # Write here any options you may need for your C linker.
+@@ -148,19 +148,20 @@
+
+ # Locations for "make install". You may need to be root do "make install".
+ #
+-INSTALL_ROOT= /usr/local
++INSTALL_ROOT= $(PREFIX)/usr/
+ INSTALL_BIN= $(INSTALL_ROOT)/bin
+-INSTALL_INC= $(INSTALL_ROOT)/include
++INSTALL_INC= $(INSTALL_ROOT)/include/lua
+ INSTALL_LIB= $(INSTALL_ROOT)/lib
+-INSTALL_MAN= $(INSTALL_ROOT)/man/man1
++INSTALL_MAN= $(INSTALL_ROOT)/share/man/man1
++INSTALL_SHARE= $(INSTALL_ROOT)/share/lua
+
+ # You may prefer to use "install" instead of "cp" if you have it.
+ # If you use "install", you may also want to change the permissions after -m.
+ #
+-INSTALL_EXEC= cp
+-INSTALL_DATA= cp
+-#INSTALL_EXEC= install -m 0755
+-#INSTALL_DATA= install -m 0644
++#INSTALL_EXEC= cp
++#INSTALL_DATA= cp
++INSTALL_EXEC= install -m 0755
++INSTALL_DATA= install -m 0644
+
+ # == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE =========
+
+@@ -173,6 +174,10 @@
+ INCS= -I$(INC) $(EXTRA_INCS)
+ DEFS= $(NUMBER) $(EXTRA_DEFS)
+
+-CFLAGS= $(MYCFLAGS) $(WARN) $(INCS) $(DEFS)
++CFLAGS= $(MYCFLAGS) $(WARN) $(INCS) $(DEFS) -DINSTALL_SHARE=\"$(INSTALL_SHARE)\"
++
++# Extra rule for .os files
++%.os: %.c
++ $(CC) $(CFLAGS) -fPIC -DPIC -o $@ -c $<
+
+ # (end of config)
+--- lua-5.0.2.orig/Makefile
++++ lua-5.0.2/Makefile
+@@ -38,9 +38,13 @@
+
+ # shared libraries (for Linux)
+ so:
+- ld -o lib/liblua.so.$V -shared src/*.o
+- ld -o lib/liblualib.so.$V -shared src/lib/*.o
+- cd lib; ln -fs liblua.so.$V liblua.so; ln -fs liblualib.so.$V liblualib.so
++ gcc -o lib/liblua.so.$V -shared -Wl,-soname,liblua.so.$V \
++ src/*.os -lc
++ ln -fs liblua.so.$V lib/liblua-build.so
++ gcc -o lib/liblualib.so.$V -shared -Wl,-soname,liblualib.so.$V \
++ src/lib/*.os -Llib -llua-build -lm -ldl -lc
++ cd lib; ln -fs liblua.so.$V liblua.so; \
++ ln -fs liblualib.so.$V liblualib.so
+
+ # binaries using shared libraries
+ sobin:
+--- lua-5.0.2.orig/lua.pc
++++ lua-5.0.2/lua.pc
+@@ -0,0 +1,11 @@
++prefix=/usr
++exec_prefix=/usr
++libdir=/usr/lib
++includedir=/usr/include/
++
++Name: lua
++Description: The Lua 5.0 programming language
++Version: 5.0.0
++Libs: -L${libdir} -llua
++Cflags: -I${includedir}/lua
++
+--- lua-5.0.2.orig/lualib.pc
++++ lua-5.0.2/lualib.pc
+@@ -0,0 +1,12 @@
++prefix=/usr
++exec_prefix=/usr
++libdir=/usr/lib
++includedir=/usr/include/
++
++Name: lua
++Description: The Lua 5.0 programming language addon libraries
++Version: 5.0.0
++Requires: lua
++Libs: -L${libdir} -llualib
++Cflags: -I${includedir}/lua
++
+--- lua-5.0.2.orig/lua-config.1
++++ lua-5.0.2/lua-config.1
+@@ -0,0 +1,64 @@
++.\" Manual page for lua-config
++.\" Written by Daniel Silverstone <dsilvers@debian.org>
++.\" For the Debian GNU/Linux system
++
++.TH lua-config 1
++.SH NAME
++lua-config \- Lua configuration information
++.SH SYNOPSIS
++Basic usage
++.PP
++.B gcc
++`
++.B lua-config
++.I \-\-include
++`
++my_prog.c
++.B \-o
++my_prog
++`
++.B lua-config
++.I \-\-libs
++`
++
++.SH DESCRIPTION
++The lua-config script allows you to determine useful information
++about the chosen version of lua running on the Debian GNU/Linux
++system in use.
++More information can be found by running
++.B lua-config
++without any arguments.
++.SH CAVEATS
++This script is unique to Debian and as such you shouldn't rely
++on its presence on every system. Lua is an embedded language
++by default and different Linux distributions each take a different
++approach to making it possible to compile with Lua. The
++.B pkg-config
++system also provides a way to look for libraries and is more likely
++to be supported across different Linux distributions. Debian's
++.B pkg-config
++name for Lua 5.0 is
++.I lua
++and the libraries are in
++.I lualib.
++These
++.B pkg-config
++files can be found in the
++.I liblua-dev
++and
++.I liblualib-dev
++packages.
++.SH AUTHOR
++lua-config was written by
++.B Daniel Silverstone
++.BI <dsilvers@debian.org>.
++
++This manual page was written by
++.B Daniel Silverstone
++.BI <dsilvers@debian.org>.
++For the Debian project. It may be used without restriction in any
++other system.
++.SH "SEE ALSO"
++.IR lua (1)
++.IR pkg-config (1)
++
diff --git a/recipes/lua/files/make.patch b/recipes/lua/files/make.patch
new file mode 100644
index 0000000000..0abb552827
--- /dev/null
+++ b/recipes/lua/files/make.patch
@@ -0,0 +1,20 @@
+
+#
+# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
+#
+
+--- lua-5.0.2/Makefile~make 2004-12-18 02:09:42.006884000 -0500
++++ lua-5.0.2/Makefile 2004-12-18 02:10:35.951683632 -0500
+@@ -38,10 +38,10 @@
+
+ # shared libraries (for Linux)
+ so:
+- gcc -o lib/liblua.so.$V -shared -Wl,-soname,liblua.so.$V \
++ $(CC) -o lib/liblua.so.$V -shared -Wl,-soname,liblua.so.$V \
+ src/*.os -lc
+ ln -fs liblua.so.$V lib/liblua-build.so
+- gcc -o lib/liblualib.so.$V -shared -Wl,-soname,liblualib.so.$V \
++ $(CC) -o lib/liblualib.so.$V -shared -Wl,-soname,liblualib.so.$V \
+ src/lib/*.os -Llib -llua-build -lm -ldl -lc
+ cd lib; ln -fs liblua.so.$V liblua.so; \
+ ln -fs liblualib.so.$V liblualib.so
diff --git a/recipes/lua/lua-build.inc b/recipes/lua/lua-build.inc
new file mode 100644
index 0000000000..ad9f6b84f0
--- /dev/null
+++ b/recipes/lua/lua-build.inc
@@ -0,0 +1,40 @@
+LOADLIB = "-DUSE_DLOPEN=1 -fPIC"
+DLLIB = "-ldl"
+MYLDFLAGS = "${LDFLAGS} -Wl,-E"
+MYCFLAGS = "${CFLAGS}"
+USERCONF = '-DLUA_USERCONFIG="\"$(LUA)/etc/saconfig.c\"" -DUSE_READLINE'
+# EXTRA_LIBS= "-lm -ldl -lreadline # -lhistory -lcurses -lncurses"
+EXTRA_LIBS= "-lm -ldl -lreadline"
+
+PARALLEL_MAKE = ""
+EXTRA_OEMAKE = "'CC=${CC}' 'MYCFLAGS=${MYCFLAGS}' \
+ 'MYLDFLAGS=${MYLDFLAGS}' 'WARN=' \
+ 'INSTALL_EXEC=install -m 0755' \
+ 'INSTALL_DATA=install -m 0644' \
+ 'STRIP=echo' 'RANLIB=${RANLIB}' \
+ 'AR=${AR} rcu' 'LD=${LD}' \
+ 'LOADLIB=${LOADLIB}' 'DLLIB=${DLLIB}' \
+ 'USERCONF=${USERCONF}' 'EXTRA_LIBS=${EXTRA_LIBS}' \
+ 'INSTALL_ROOT=${prefix}' 'INSTALL_BIN=${bindir}' \
+ 'INSTALL_INC=${includedir}' 'INSTALL_MAN=${mandir}/man1' \
+ 'INSTALL_SHARE=${datadir}/lua'"
+
+do_compile () {
+ oe_runmake all so sobin
+}
+
+do_stage () {
+ oe_libinstall -C lib liblua ${STAGING_LIBDIR}/
+ oe_libinstall -C lib liblualib ${STAGING_LIBDIR}/
+ install -m 0644 include/lua.h include/lualib.h include/lauxlib.h ${STAGING_INCDIR}/
+}
+
+do_install () {
+ oe_runmake \
+ 'INSTALL_ROOT=${D}${prefix}' \
+ 'INSTALL_BIN=${D}${bindir}' \
+ 'INSTALL_INC=${D}${includedir}' \
+ 'INSTALL_MAN=${D}${mandir}/man1' \
+ 'INSTALL_SHARE=${D}${datadir}/lua' \
+ install soinstall
+}
diff --git a/recipes/lua/lua-gtk2/lua-gtk2-0.3_fixbuild.patch b/recipes/lua/lua-gtk2/lua-gtk2-0.3_fixbuild.patch
new file mode 100644
index 0000000000..1115b6ffb6
--- /dev/null
+++ b/recipes/lua/lua-gtk2/lua-gtk2-0.3_fixbuild.patch
@@ -0,0 +1,352 @@
+diff -NbBur lua-gtk2-0.3_orig/configure lua-gtk2-0.3/configure
+--- lua-gtk2-0.3_orig/configure 2005-08-16 19:32:07.000000000 +0200
++++ lua-gtk2-0.3/configure 2006-05-14 02:52:39.000000000 +0200
+@@ -2,25 +2,19 @@
+
+ # examine system
+
+-CFLAGS="$(pkg-config gtk+-2.0 --cflags) $(pkg-config lua50 --cflags) -I build-linux -I src"
++CFLAGS="-g -Wall -DLINUX -Os -fomit-frame-pointer -Wall $(pkg-config gtk+-2.0 --cflags) $(pkg-config lua50 --cflags) -I build-linux -I src"
+ VERSION="0.3"
+-
+-if which gcc-4.0 > /dev/null; then
+- GCC=gcc-4.0
+-elif which gcc > /dev/null; then
+- GCC=gcc
+-else
+- @echo "No GCC found."
+- exit 1
+-fi
+-
+-if true; then
+- CFLAGS2="-DLINUX"
+- LIBS="" # -lgtk-x11-2.0"
+-else
+- CFLAGS2="-DWIN32"
+- LIBS=""
+-fi
++PREFIX="/usr/local"
++GCC=arm-linux-gcc
++HGCC=gcc
++
++#if true; then
++# CFLAGS2="-DLINUX"
++# LIBS="" # -lgtk-x11-2.0"
++#else
++# CFLAGS2="-DWIN32"
++# LIBS=""
++#fi
+
+
+ # build makefile
+@@ -28,13 +22,14 @@
+ cat > Makefile <<EOF
+ # automatically generated makefile
+
+-# CFLAGS :=-DLINUX -Os -fomit-frame-pointer -Wall $CFLAGS
++#CFLAGS := \-DLINUX -Os -fomit-frame-pointer -Wall $CFLAGS
+ # CFLAGS :=-DLINUX -O2 -fomit-frame-pointer -Wall $CFLAGS
+-CFLAGS :=$CFLAGS2 -g -Wall $CFLAGS
++CFLAGS =$CFLAGS
+ HASH :=hash2
+ ODIR :=build-linux/
+ VERSION :=$VERSION
+ CC :=$GCC
++HGCC :=$HGCC
+
+ all: \${ODIR}libluagtk2.so \${ODIR}main
+
+@@ -46,6 +41,8 @@
+ @\${CC} -shared -o \$@ $^ /usr/lib/libffi.a $LIBS
+
+ \${ODIR}generate: \${ODIR}generate.o \${ODIR}\${HASH}.o
++ @echo \$@
++ @\${HGCC} -Wall -c -g -o \$@ $^
+
+ \${ODIR}main.o: src/main.c
+ @echo \$@
+@@ -99,9 +96,9 @@
+ rm -f \${ODIR}file2c \${ODIR}override.luac \${ODIR}main
+
+ install: all
+- mkdir -p ~/.lua50
+- cp gtk2.lua ~/.lua50
+- ln -sf \$(PWD)/build-linux/libluagtk2.so ~/.lua50
++ install -d \$(DESTDIR)/\$(PREFIX)/lib/lua50
++ install gtk2.lua \$(DESTDIR)/\$(PREFIX)/lib/lua50
++ install \$(PWD)/build-linux/libluagtk2.so \$(DESTDIR)/\$(PREFIX)/lib/lua50
+
+ tar:
+ (cd ..; ln -s lua-gtk2 lua-gtk2-\${VERSION}; tar czvhf lua-gtk2-\${VERSION}.tar.gz \\
+diff -NbBur lua-gtk2-0.3_orig/configure_orig lua-gtk2-0.3/configure_orig
+--- lua-gtk2-0.3_orig/configure_orig 1970-01-01 01:00:00.000000000 +0100
++++ lua-gtk2-0.3/configure_orig 2006-05-13 18:22:03.000000000 +0200
+@@ -0,0 +1,114 @@
++#! /bin/sh
++
++# examine system
++
++CFLAGS="$(pkg-config gtk+-2.0 --cflags) $(pkg-config lua50 --cflags) -I build-linux -I src"
++VERSION="0.3"
++
++if which gcc-4.0 > /dev/null; then
++ GCC=gcc-4.0
++elif which gcc > /dev/null; then
++ GCC=gcc
++else
++ @echo "No GCC found."
++ exit 1
++fi
++
++if true; then
++ CFLAGS2="-DLINUX"
++ LIBS="" # -lgtk-x11-2.0"
++else
++ CFLAGS2="-DWIN32"
++ LIBS=""
++fi
++
++
++# build makefile
++
++cat > Makefile <<EOF
++# automatically generated makefile
++
++# CFLAGS :=-DLINUX -Os -fomit-frame-pointer -Wall $CFLAGS
++# CFLAGS :=-DLINUX -O2 -fomit-frame-pointer -Wall $CFLAGS
++CFLAGS :=$CFLAGS2 -g -Wall $CFLAGS
++HASH :=hash2
++ODIR :=build-linux/
++VERSION :=$VERSION
++CC :=$GCC
++
++all: \${ODIR}libluagtk2.so \${ODIR}main
++
++Makefile: configure
++ ./configure
++
++\${ODIR}libluagtk2.so: \${ODIR}libluagtk2.o \${ODIR}\${HASH}.o \${ODIR}hash.o \${ODIR}_funclist.o \${ODIR}_structlist.o \${ODIR}_enumlist.o \${ODIR}_override.o
++ @echo \$@
++ @\${CC} -shared -o \$@ $^ /usr/lib/libffi.a $LIBS
++
++\${ODIR}generate: \${ODIR}generate.o \${ODIR}\${HASH}.o
++
++\${ODIR}main.o: src/main.c
++ @echo \$@
++ @\${CC} -Wall -c -g -o \$@ $^ -I /usr/include/lua50
++
++\${ODIR}main: \${ODIR}main.o
++ @echo \$@
++ @\${CC} -o \$@ $^ -llua50 -llualib50
++
++\${ODIR}libluagtk2.o: src/libluagtk2.c \${ODIR}_typelist.c src/structinfo.h src/hash.h
++
++\${ODIR}_funclist.c: data/gtkdata.funcs \${ODIR}generate
++ @echo \$@
++ @\${ODIR}generate -s 4096 -o \$@ -p funclist_ -d $<
++
++\${ODIR}_structlist.c: data/gtkdata.structs.c
++ cp -f \$< \$@
++
++\${ODIR}_typelist.c: data/gtkdata.types.c
++ cp -f \$< \$@
++
++\${ODIR}_enumlist.c: data/gtkdata.enums src/extra_enum
++ @echo \$@
++ @cat $^ | \${ODIR}generate -s 1201 -o \$@ -p enumlist_ -d -f -
++
++\${ODIR}_override.c: \${ODIR}override.luac \${ODIR}file2c
++ @echo \$@
++ @\${ODIR}file2c < \$^ > \$@
++
++data/gtkdata.structs.c:
++ (cd data; ../script/gen-list.pl)
++
++build-linux/%.o: build-linux/%.c
++ @echo \$@
++ @\${CC} \${CFLAGS} -c -o \$@ \$<
++
++build-linux/%.o: src/%.c
++ @echo \$@
++ @\${CC} \${CFLAGS} -c -o \$@ \$<
++
++build-linux/%.s: src/%.c
++ @echo \$@
++ @\${CC} \${CFLAGS} -S -o \$@ \$<
++
++build-linux/%.luac: src/%.lua
++ @echo \$@
++ @luac -s -o \$@ \$<
++
++clean:
++ rm -f \${ODIR}libluagtk2.so \${ODIR}generate \${ODIR}_*.c \${ODIR}*.o
++ rm -f \${ODIR}file2c \${ODIR}override.luac \${ODIR}main
++
++install: all
++ mkdir -p ~/.lua50
++ cp gtk2.lua ~/.lua50
++ ln -sf \$(PWD)/build-linux/libluagtk2.so ~/.lua50
++
++tar:
++ (cd ..; ln -s lua-gtk2 lua-gtk2-\${VERSION}; tar czvhf lua-gtk2-\${VERSION}.tar.gz \\
++ lua-gtk2-\${VERSION} --exclude old --exclude "build-*" --exclude foreign --exclude lua50 \\
++ --exclude test-dll; rm lua-gtk2-\${VERSION})
++
++EOF
++
++mkdir -p build-linux build-win32
++
+diff -NbBur lua-gtk2-0.3_orig/gtk2.lua lua-gtk2-0.3/gtk2.lua
+--- lua-gtk2-0.3_orig/gtk2.lua 2005-08-16 19:26:14.000000000 +0200
++++ lua-gtk2-0.3/gtk2.lua 1970-01-01 01:00:00.000000000 +0100
+@@ -1,16 +0,0 @@
+-
+--- if compiled in, _gtk is set.
+-if _gtk == nil then
+-
+- local init, err = loadlib(os.getenv("HOME") .. "/.lua50/libluagtk2.so",
+- "luaopen_gtk2")
+- if err then
+- print(err)
+- return
+- end
+- gtk = init()
+-
+-else
+- gtk = _gtk
+-end
+-
+diff -NbBur lua-gtk2-0.3_orig/gtk2.lua.in lua-gtk2-0.3/gtk2.lua.in
+--- lua-gtk2-0.3_orig/gtk2.lua.in 1970-01-01 01:00:00.000000000 +0100
++++ lua-gtk2-0.3/gtk2.lua.in 2006-05-15 01:20:24.000000000 +0200
+@@ -0,0 +1,16 @@
++
++-- if compiled in, _gtk is set.
++if _gtk == nil then
++
++ local init, err = loadlib("PREFIX/lib/lua50/libluagtk2.so",
++ "luaopen_gtk2")
++ if err then
++ print(err)
++ return
++ end
++ gtk = init()
++
++else
++ gtk = _gtk
++end
++
+diff -NbBur lua-gtk2-0.3_orig/Makefile lua-gtk2-0.3/Makefile
+--- lua-gtk2-0.3_orig/Makefile 2005-08-16 19:32:08.000000000 +0200
++++ lua-gtk2-0.3/Makefile 2006-05-16 03:09:41.000000000 +0200
+@@ -1,31 +1,46 @@
+ # automatically generated makefile
+
+-# CFLAGS :=-DLINUX -Os -fomit-frame-pointer -Wall -DXTHREADS -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/X11R6/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include//lua50 -I build-linux -I src
+-# CFLAGS :=-DLINUX -O2 -fomit-frame-pointer -Wall -DXTHREADS -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/X11R6/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include//lua50 -I build-linux -I src
+-CFLAGS :=-DLINUX -g -Wall -DXTHREADS -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/X11R6/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include//lua50 -I build-linux -I src
++PACKAGE_CFLAGS =-g -Wall -DLINUX -Os -fomit-frame-pointer -Wall -DXTHREADS -DXUSE_MTSAFE_API `pkg-config --cflags gtk+-2.0`
+ HASH :=hash2
+ ODIR :=build-linux/
+ VERSION :=0.3
+-CC :=gcc-4.0
++CC :=arm-linux-gcc
++HGCC :=gcc
++PREFIX := /usr/local
++LIBDIR := $(PREFIX)/lib/
+
+-all: ${ODIR}libluagtk2.so ${ODIR}main
++all: ${ODIR}libluagtk2.so ${ODIR}main gtk2.lua
+
+-Makefile: configure
+- ./configure
++%.lua %.lua.in:
++ sed 's:PREFIX:$(PREFIX):' < '$@.in' > $@
+
+ ${ODIR}libluagtk2.so: ${ODIR}libluagtk2.o ${ODIR}${HASH}.o ${ODIR}hash.o ${ODIR}_funclist.o ${ODIR}_structlist.o ${ODIR}_enumlist.o ${ODIR}_override.o
+ @echo $@
+- @${CC} -shared -o $@ $^ /usr/lib/libffi.a
++ @${CC} -shared -o $@ $^ ${LIBDIR}/libffi.a
+
+-${ODIR}generate: ${ODIR}generate.o ${ODIR}${HASH}.o
++${ODIR}file2c:
++ @echo $@
++ @${HGCC} -o $@ src/file2c.c
++
++${ODIR}generate.o:
++ @echo $@
++ @${HGCC} -c -o $@ src/generate.c
++
++${ODIR}${HASH}_host.o:
++ @echo $@
++ @${HGCC} -c -o $@ src/${HASH}.c
++
++${ODIR}generate: ${ODIR}generate.o ${ODIR}${HASH}_host.o
++ @echo $@
++ @${HGCC} -Wall -g -o $@ $^
+
+ ${ODIR}main.o: src/main.c
+ @echo $@
+- @${CC} -Wall -c -g -o $@ $^ -I /usr/include/lua50
++ @${HGCC} $(CFLAGS) -Wall -c -g -o $@ $^ -I /usr/include/lua50
+
+ ${ODIR}main: ${ODIR}main.o
+ @echo $@
+- @${CC} -o $@ $^ -llua50 -llualib50
++ @${HGCC} $(CFLAGS) $(PACKAGE_CFLAGS) -o $@ $^ -llua -llualib
+
+ ${ODIR}libluagtk2.o: src/libluagtk2.c ${ODIR}_typelist.c src/structinfo.h src/hash.h
+
+@@ -52,15 +67,15 @@
+
+ build-linux/%.o: build-linux/%.c
+ @echo $@
+- @${CC} ${CFLAGS} -c -o $@ $<
++ @${CC} $(PACKAGE_CFLAGS) $(CFLAGS) -c -o $@ $<
+
+ build-linux/%.o: src/%.c
+ @echo $@
+- @${CC} ${CFLAGS} -c -o $@ $<
++ @${CC} $(PACKAGE_CFLAGS) $(CFLAGS) -c -o $@ $<
+
+ build-linux/%.s: src/%.c
+ @echo $@
+- @${CC} ${CFLAGS} -S -o $@ $<
++ @${CC} $(PACKAGE_CFLAGS) $(CFLAGS) -S -o $@ $<
+
+ build-linux/%.luac: src/%.lua
+ @echo $@
+@@ -68,12 +83,13 @@
+
+ clean:
+ rm -f ${ODIR}libluagtk2.so ${ODIR}generate ${ODIR}_*.c ${ODIR}*.o
+- rm -f ${ODIR}file2c ${ODIR}override.luac ${ODIR}main
++ rm -f ${ODIR}file2c ${ODIR}override.luac ${ODIR}main gtk2.lua
+
+ install: all
+- mkdir -p ~/.lua50
+- cp gtk2.lua ~/.lua50
+- ln -sf $(PWD)/build-linux/libluagtk2.so ~/.lua50
++ install -d $(DESTDIR)/$(PREFIX)/share/lua
++ install gtk2.lua $(DESTDIR)/$(PREFIX)/share/lua
++ install -d $(DESTDIR)/$(PREFIX)/lib/lua50
++ install $(PWD)/build-linux/libluagtk2.so $(DESTDIR)/$(PREFIX)/lib/lua50
+
+ tar:
+ (cd ..; ln -s lua-gtk2 lua-gtk2-${VERSION}; tar czvhf lua-gtk2-${VERSION}.tar.gz \
+diff -NbBur lua-gtk2-0.3_orig/src/libluagtk2.c lua-gtk2-0.3/src/libluagtk2.c
+--- lua-gtk2-0.3_orig/src/libluagtk2.c 2005-08-16 18:22:00.000000000 +0200
++++ lua-gtk2-0.3/src/libluagtk2.c 2006-05-15 01:31:09.000000000 +0200
+@@ -27,9 +27,9 @@
+
+ static const char *dll_list[] = {
+ #ifdef LINUX
+- "/usr/lib/libgtk-x11-2.0.so",
+- "/usr/lib/libgdk-x11-2.0.so",
+- "/usr/lib/libpango-1.0.so",
++ "/usr/lib/libgtk-x11-2.0.so.0",
++ "/usr/lib/libgdk-x11-2.0.so.0",
++ "/usr/lib/libpango-1.0.so.0",
+ #endif
+ #ifdef WIN32
+ "C:/GTK/bin/libgtk-win32-2.0-0.dll",
diff --git a/recipes/lua/lua-gtk2_0.3.bb b/recipes/lua/lua-gtk2_0.3.bb
new file mode 100644
index 0000000000..083e9a6ca1
--- /dev/null
+++ b/recipes/lua/lua-gtk2_0.3.bb
@@ -0,0 +1,23 @@
+DESCRIPTION = "GTK bindings for LUA"
+SECTION = "libs"
+PRIORITY = "optional"
+LICENSE = "GPLv2"
+DEPENDS = "gtk+ lua-native perl-native readline libffi"
+RDEPENDS = "lua"
+
+inherit gpe
+
+SRC_URI = "http://luaforge.net/frs/download.php/989/${P}.tar.gz \
+ file://lua-gtk2-0.3_fixbuild.patch;patch=1"
+
+FILES_${PN} = "${datadir}/lua ${libdir}/lua50"
+
+CFLAGS_append = " -I '${S}/build-linux' -I src -DLINUX -I${STAGING_INCDIR} -L${STAGING_LIBDIR} -L${STAGING_LIBDIR_NATIVE}"
+
+do_compile () {
+ oe_runmake PREFIX='${prefix}' HGCC='${BUILD_CC}' LIBDIR='${STAGING_LIBDIR}' ODIR='build-linux/' CFLAGS='${CFLAGS}'
+}
+
+do_configure_append () {
+ cd ${S} && mkdir build-linux
+}
diff --git a/recipes/lua/lua-native_5.0.2.bb b/recipes/lua/lua-native_5.0.2.bb
new file mode 100644
index 0000000000..bf70f84ac0
--- /dev/null
+++ b/recipes/lua/lua-native_5.0.2.bb
@@ -0,0 +1,15 @@
+require lua.inc
+
+PR = "r2"
+DEPENDS += "readline-native"
+SRC_URI = "http://www.lua.org/ftp/lua-${PV}.tar.gz \
+ file://debian.patch;patch=1 \
+ file://make.patch;patch=1 \
+ file://advanced-readline.patch;patch=1"
+# http://lua-users.org/files/wiki_insecure/power_patches/5.0/advanced-readline.patch;patch=1"
+S = "${WORKDIR}/lua-${PV}"
+FILESPATH = "${FILE_DIRNAME}/lua-${PV}:${FILE_DIRNAME}/lua:${FILE_DIRNAME}/files"
+
+inherit native
+require lua-build.inc
+
diff --git a/recipes/lua/lua.inc b/recipes/lua/lua.inc
new file mode 100644
index 0000000000..994295b729
--- /dev/null
+++ b/recipes/lua/lua.inc
@@ -0,0 +1,25 @@
+DESCRIPTION = "Lua is a powerful light-weight programming language designed \
+for extending applications."
+LICENSE = "MIT"
+HOMEPAGE = "http://www.lua.org/"
+
+PACKAGES = "liblua-dbg liblualib-dbg ${PN}-dbg \
+liblua-dev liblua liblualib-dev liblualib ${PN}-doc ${PN}"
+
+FILES_${PN}-dbg += "${bindir}/.debug ${libdir}/.debug/liblua.so.* ${libdir}/.debug/liblualib.so.*"
+
+FILES_${PN} = "${bindir}"
+FILES_${PN}-doc = "${mandir}"
+
+FILES_liblua = "${libdir}/liblua.so.*"
+FILES_liblua-dev = "${libdir}/liblua.so ${libdir}/liblua.a \
+ ${includedir}/lua.h"
+FILES_liblualib = "${libdir}/liblualib.so.*"
+FILES_liblualib-dev = "${libdir}/liblualib.so ${libdir}/liblualib.a \
+ ${includedir}/lualib.h ${includedir}/lauxlib.h"
+SECTION_${PN} = "interpreters"
+SECTION_${PN}-doc = "doc"
+SECTION_liblua = "libs"
+SECTION_liblua-dev = "devel"
+SECTION_liblualib = "libs"
+SECTION_liblualib-dev = "devel"
diff --git a/recipes/lua/lua5.1/lua5.1.pc b/recipes/lua/lua5.1/lua5.1.pc
new file mode 100644
index 0000000000..df8eb15c0f
--- /dev/null
+++ b/recipes/lua/lua5.1/lua5.1.pc
@@ -0,0 +1,11 @@
+prefix=/usr
+libdir=${prefix}/lib
+includedir=${prefix}/include
+
+Name: Lua
+Description: Lua language engine
+Version: 5.1.3
+Requires:
+Libs: -L${libdir} -llua5.1
+Libs.private: -lm
+Cflags: -I${includedir}/lua5.1
diff --git a/recipes/lua/lua5.1/makefile.patch b/recipes/lua/lua5.1/makefile.patch
new file mode 100644
index 0000000000..569a94421b
--- /dev/null
+++ b/recipes/lua/lua5.1/makefile.patch
@@ -0,0 +1,22 @@
+--- lua-5.1.3.orig/Makefile 2008-08-18 17:59:06.000000000 +0200
++++ lua-5.1.3/Makefile 2008-08-18 17:59:15.000000000 +0200
+@@ -38,7 +38,7 @@
+ # 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_LIB= liblua5.1.a
+ TO_MAN= lua.1 luac.1
+
+ # Lua version and release.
+--- lua-5.1.3.orig/src/Makefile 2008-08-18 17:54:30.000000000 +0200
++++ lua-5.1.3/src/Makefile 2008-08-18 17:54:39.000000000 +0200
+@@ -22,7 +22,7 @@
+
+ PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
+
+-LUA_A= liblua.a
++LUA_A= liblua5.1.a
+ 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
diff --git a/recipes/lua/lua5.1_5.1.4.bb b/recipes/lua/lua5.1_5.1.4.bb
new file mode 100644
index 0000000000..b9d26518b2
--- /dev/null
+++ b/recipes/lua/lua5.1_5.1.4.bb
@@ -0,0 +1,37 @@
+DESCRIPTION = "Lua is a powerful light-weight programming language designed \
+for extending applications."
+LICENSE = "MIT"
+HOMEPAGE = "http://www.lua.org/"
+
+DEPENDS += "readline"
+PR = "r0"
+SRC_URI = "http://www.lua.org/ftp/lua-${PV}.tar.gz \
+ file://makefile.patch;patch=1 \
+ file://lua5.1.pc"
+S = "${WORKDIR}/lua-${PV}"
+
+inherit binconfig
+
+EXTRA_OEMAKE = "'CC=${CC}' 'MYCFLAGS=${CFLAGS}' 'MYLDFLAGS=${LDFLAGS}'"
+
+do_compile () {
+ oe_runmake linux
+}
+
+do_stage () {
+ oe_libinstall -C src liblua5.1 ${STAGING_LIBDIR}/
+ install -d ${STAGING_INCDIR}/lua5.1
+ install -m 0644 src/lua.h src/luaconf.h src/lualib.h src/lauxlib.h ${STAGING_INCDIR}/lua5.1
+ install -m 0644 ${WORKDIR}/lua5.1.pc ${STAGING_LIBDIR}/pkgconfig/
+}
+
+do_install () {
+ oe_runmake \
+ 'INSTALL_TOP=${D}${prefix}' \
+ 'INSTALL_BIN=${D}${bindir}' \
+ 'INSTALL_INC=${D}${includedir}/lua5.1' \
+ 'INSTALL_MAN=${D}${mandir}/man1' \
+ 'INSTALL_SHARE=${D}${datadir}/lua' \
+ install
+}
+
diff --git a/recipes/lua/lua_5.0.2.bb b/recipes/lua/lua_5.0.2.bb
new file mode 100644
index 0000000000..bb989c04d9
--- /dev/null
+++ b/recipes/lua/lua_5.0.2.bb
@@ -0,0 +1,14 @@
+require lua.inc
+
+DEPENDS += "readline"
+PR = "r4"
+SRC_URI = "http://www.lua.org/ftp/lua-${PV}.tar.gz \
+ file://debian.patch;patch=1 \
+ file://make.patch;patch=1 \
+ file://advanced-readline.patch;patch=1"
+# http://lua-users.org/files/wiki_insecure/power_patches/5.0/advanced-readline.patch;patch=1"
+S = "${WORKDIR}/lua-${PV}"
+FILESPATH = "${FILE_DIRNAME}/lua-${PV}:${FILE_DIRNAME}/lua:${FILE_DIRNAME}/files"
+
+require lua-build.inc
+inherit binconfig