[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] GSL Shell 2.0 beta1 release
- From: Francesco Abbate <francesco.bbt@...>
- Date: Fri, 4 Nov 2011 00:45:51 +0100
2011/11/3 Michal Kottman <k0mpjut0r@gmail.com>:
> Thanks for the pointer, I have finally been able to make it work on
> Mac OS X Lion (64bit) - I added -pagezero_size 10000 -image_base
> 100000000 to the linker flags.
>
> Attached is a diff that made it work for me (I also tweaked the
> include directories for agg, but they are not included, as they are in
> my home folder :). I think it requires more testing for 32-bit builds.
Hi Michal,
that's great, I've included your patch in the branch
"luajit-safe-build", thanks a lot for your help.
Actually the luajit-safe-build branch includes other modifications
that rationalizes some build options and minimize the modifications
made in the luajit directory.
The aim is to take into account the remark of Mike but at the same
time I need to customize the build options of LuaJIT in order to:
- introduce the short function syntax based on the option LUA_BUILD
- change the package path to differentiate gsl-shell from Lua (based
on LUA_BUILD),
allow to choose the installation directory and enable the use of templates
Now the modifications to the LuaJIT makefile and luaconf.h are limited
to the strict necessary and everything looks quite correct to me.
For Mike: I'm sending a diff between the LuaJIT directory included in
GSL Shell and the luajit original source code from the git HEAD. I
would greatly appreciate if you could give a look to the patch and
tell me if now seems fine.
For Michal: please test the luajit-safe-build branch if you can. It
includes your patch plus the other changes I was talking about.
Thanks to all for the help!
Francesco
diff -U 4 -x '*.o' -x '*~' -r luajit2/src/lj_parse.c /home/francesco/src/luajit-2.0/src/lj_parse.c
--- luajit2/src/lj_parse.c 2011-10-29 17:47:40.000000000 +0200
+++ /home/francesco/src/luajit-2.0/src/lj_parse.c 2011-07-24 10:02:51.000000000 +0200
@@ -1602,17 +1602,16 @@
}
}
/* Parse function parameters. */
-static BCReg parse_params_ext(LexState *ls, int needself,
- int start_token, int end_token)
+static BCReg parse_params(LexState *ls, int needself)
{
FuncState *fs = ls->fs;
BCReg nparams = 0;
- lex_check(ls, start_token);
+ lex_check(ls, '(');
if (needself)
var_new_lit(ls, nparams++, "self");
- if (ls->token != end_token) {
+ if (ls->token != ')') {
do {
if (ls->token == TK_name) {
var_new(ls, nparams++, lex_str(ls));
} else if (ls->token == TK_dots) {
@@ -1626,17 +1625,12 @@
}
var_add(ls, nparams);
lua_assert(fs->nactvar == nparams);
bcreg_reserve(fs, nparams);
- lex_check(ls, end_token);
+ lex_check(ls, ')');
return nparams;
}
-static BCReg parse_params(LexState *ls, int needself)
-{
- return parse_params_ext(ls, needself, '(', ')');
-}
-
/* Forward declaration. */
static void parse_chunk(LexState *ls);
/* Parse body of a function. */
@@ -1669,47 +1663,8 @@
}
lj_lex_next(ls);
}
-#ifdef GSH_SHORT_FSYNTAX
-static void parse_simple_body (LexState *ls, ExpDesc *fne, int line) {
- FuncState fs, *pfs = ls->fs;
- BCReg kidx;
- BCLine lastline;
- GCproto *pt;
- ptrdiff_t oldbase = pfs->bcbase - ls->bcstack;
- BCIns ins;
- ExpDesc e;
-
- fs_init(ls, &fs);
- fs.linedefined = line;
- fs.numparams = (uint8_t)parse_params_ext(ls, 0, '|', '|');
- fs.bcbase = pfs->bcbase + pfs->pc;
- fs.bclim = pfs->bclim - pfs->pc;
- bcemit_AD(&fs, BC_FUNCF, 0, 0); /* Placeholder. */
-
- fs.flags |= PROTO_HAS_RETURN;
- expr(ls, &e);
- ins = BCINS_AD(BC_RET1, expr_toanyreg(&fs, &e), 2);
- if (fs.flags & PROTO_CHILD)
- bcemit_AJ(&fs, BC_UCLO, 0, 0); /* May need to close upvalues first. */
- bcemit_INS(&fs, ins);
-
- lastline = ls->linenumber;
- pt = fs_finish(ls, lastline);
- pfs->bcbase = ls->bcstack + oldbase; /* May have been reallocated. */
- pfs->bclim = (BCPos)(ls->sizebcstack - oldbase);
- /* Store new prototype in the constant array of the parent. */
- kidx = const_gc(pfs, obj2gco(pt), LJ_TPROTO);
- expr_init(fne, VRELOCABLE, bcemit_AD(pfs, BC_FNEW, 0, kidx));
- if (!(pfs->flags & PROTO_CHILD)) {
- if (pfs->flags & PROTO_HAS_RETURN)
- pfs->flags |= PROTO_FIXUP_RETURN;
- pfs->flags |= PROTO_CHILD;
- }
-}
-#endif
-
/* Parse expression list. Last expression is left open. */
static BCReg expr_list(LexState *ls, ExpDesc *v)
{
BCReg n = 1;
@@ -1843,14 +1798,8 @@
case TK_function:
lj_lex_next(ls);
parse_body(ls, v, 0, ls->linenumber);
return;
-#ifdef GSH_SHORT_FSYNTAX
- case '|': {
- parse_simple_body(ls, v, ls->linenumber);
- return;
- }
-#endif
default:
expr_primary(ls, v);
return;
}
diff -U 4 -x '*.o' -x '*~' -r luajit2/src/luaconf.h /home/francesco/src/luajit-2.0/src/luaconf.h
--- luajit2/src/luaconf.h 2011-11-03 23:24:24.000000000 +0100
+++ /home/francesco/src/luajit-2.0/src/luaconf.h 2011-08-12 22:32:23.000000000 +0200
@@ -8,40 +8,36 @@
#include <limits.h>
#include <stddef.h>
-#define QUOTE_(x) #x
-#define QUOTE(x) QUOTE_(x)
-
/* Default path for loading Lua and C modules with require(). */
#if defined(_WIN32)
/*
** In Windows, any exclamation mark ('!') in the path is replaced by the
** path of the directory of the executable file of the current process.
*/
-#define LUA_LDIR "!\\" QUOTE(PACKAGE_NAME) "\\"
+#define LUA_LDIR "!\\lua\\"
#define LUA_CDIR "!\\"
#define LUA_PATH_DEFAULT \
- ".\\?.lua;" ".\\templates\\?.lua.in;" LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" LUA_LDIR"templates\\?.lua.in"
+ ".\\?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;"
#define LUA_CPATH_DEFAULT \
".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
#else
-#define LUA_ROOT QUOTE(SYSTEM_DIR) "/"
-#define LUA_VERSION_DIR QUOTE(PACKAGE_NAME) "/" QUOTE(PACKAGE_VERSION)
-#define LUA_LDIR LUA_ROOT "share/" LUA_VERSION_DIR "/"
-#define LUA_CDIR LUA_ROOT "lib/" LUA_VERSION_DIR "/"
+#define LUA_ROOT "/usr/local/"
+#define LUA_LDIR LUA_ROOT "share/lua/5.1/"
+#define LUA_CDIR LUA_ROOT "lib/lua/5.1/"
#ifdef LUA_XROOT
#define LUA_JDIR LUA_XROOT "share/luajit-2.0.0-beta8/"
#define LUA_XPATH \
- ";" LUA_XROOT "share/" LUA_VERSION_DIR "/?.lua;" LUA_XROOT "share/" LUA_VERSION_DIR "/?/init.lua"
-#define LUA_XCPATH LUA_XROOT "lib/" LUA_VERSION_DIR "/?.so;"
+ ";" LUA_XROOT "share/lua/5.1/?.lua;" LUA_XROOT "share/lua/5.1/?/init.lua"
+#define LUA_XCPATH LUA_XROOT "lib/lua/5.1/?.so;"
#else
#define LUA_JDIR LUA_ROOT "share/luajit-2.0.0-beta8/"
#define LUA_XPATH
#define LUA_XCPATH
#endif
#define LUA_PATH_DEFAULT \
- "./?.lua;" "./templates/?.lua.in;" LUA_JDIR"?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" LUA_LDIR"templates/?.lua.in" LUA_XPATH
+ "./?.lua;" LUA_JDIR"?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua" LUA_XPATH
#define LUA_CPATH_DEFAULT \
"./?.so;" LUA_CDIR"?.so;" LUA_XCPATH LUA_CDIR"loadall.so"
#endif
Only in luajit2/src: luajit
diff -U 4 -x '*.o' -x '*~' -r luajit2/src/Makefile /home/francesco/src/luajit-2.0/src/Makefile
--- luajit2/src/Makefile 2011-11-03 23:23:10.000000000 +0100
+++ /home/francesco/src/luajit-2.0/src/Makefile 2011-10-27 13:38:42.000000000 +0200
@@ -71,12 +71,12 @@
# The default build mode is mixed mode on POSIX. On Windows this is the same
# as dynamic mode.
#
# Mixed mode creates a static + dynamic library and a statically linked luajit.
-#BUILDMODE= mixed
+BUILDMODE= mixed
#
# Static mode creates a static library and a statically linked luajit.
-BUILDMODE= static
+#BUILDMODE= static
#
# Dynamic mode creates a dynamic library and a dynamically linked luajit.
# Note: this executable will only run when the library is installed!
#BUILDMODE= dynamic
@@ -159,18 +159,8 @@
##############################################################################
# You probably don't need to change anything below this line!
##############################################################################
-include ../../makeconfig
-
-ifeq ($(strip $(LUA_BUILD)), no)
- XCFLAGS += -DGSH_SHORT_FSYNTAX -DGSL_SHELL -DPACKAGE_NAME=gsl-shell -DPACKAGE_VERSION=2.0
-else
- XCFLAGS += -DPACKAGE_NAME=lua -DPACKAGE_VERSION=5.1
-endif
-
-XCFLAGS += -DSYSTEM_DIR=$(PREFIX)
-
##############################################################################
# Flags and options for host and target.
##############################################################################
@@ -281,8 +271,11 @@
ifneq (,$(findstring CYGWIN,$(TARGET_SYS)))
HOST_SYS= Windows
endif
endif
+ifeq (Windows,$(HOST_SYS))
+ HOST_RM= del
+endif
TARGET_SYS= $(HOST_SYS)
ifeq (Windows,$(TARGET_SYS))
TARGET_STRIP+= --strip-unneeded