Taco Hoekwater <[email protected]> writes: > David Kastrup wrote: >> >> Ok, crossed my fingers and got the stuff to compile finally. I can send >> the diff. Does anybody have a quick clue what might cause the following >> on startup: >> >> PANIC: unprotected error in call to Lua API (attempt to index a function >> value) > > You probably have an error in the setup for opening luaexpat in > luastuff.c. Some lua modules define a luaopen_XXX function that can > be called directly, others need a lua_pushcfunction and lua_call, > this has to do with require() vs. dofile().
The following appears to do the trick. At least lxp is known and LuaTeX runs again. No actually functionality tests yet.
>From 3d4b0c2d1b6b81d985340ad40afb03ead3978432 Mon Sep 17 00:00:00 2001 From: David Kastrup <[email protected]> Date: Thu, 5 Mar 2009 13:54:52 +0100 Subject: [PATCH] After unpacking lxp, massage sources for compilation. --- src/libs/luaexpat/config | 18 +++++------------- src/libs/luaexpat/makefile | 22 +--------------------- src/texk/web2c/luatexdir/lua/luastuff.c | 4 ++++ src/texk/web2c/luatexdir/luatex-api.h | 1 + src/texk/web2c/luatexdir/luatexlib.mk | 12 +++++++++++- 5 files changed, 22 insertions(+), 35 deletions(-) diff --git a/src/libs/luaexpat/config b/src/libs/luaexpat/config index 27eaf82..67232f7 100644 --- a/src/libs/luaexpat/config +++ b/src/libs/luaexpat/config @@ -1,24 +1,17 @@ # Installation directories -# System's libraries directory (where binary libraries are installed) -LUA_LIBDIR= /usr/local/lib/lua/5.0 -# System's lua directory (where Lua libraries are installed) -LUA_DIR= /usr/local/share/lua/5.0 # Lua includes directory -LUA_INC= /usr/local/include -# Expat includes directory -EXPAT_INC= /usr/local/include +LUA_INC= ../../libs/lua51 # OS dependent -LIB_OPTION= -shared #for Linux +LIB_OPTION= #-shared #for Linux #LIB_OPTION= -bundle -undefined dynamic_lookup #for MacOS X -LIBNAME= $T.so.$V +LIBNAME= $T.o # Lua version number # (according to Lua 5.1 definition: # first version digit * 100 + second version digit # e.g. Lua 5.0.2 => 500, Lua 5.1 => 501, Lua 5.1.1 => 501) -LUA_VERSION_NUM= 500 -COMPAT_DIR= ../compat/src +LUA_VERSION_NUM= 501 # Compilation parameters CWARNS = -Wall -pedantic \ @@ -31,6 +24,5 @@ CWARNS = -Wall -pedantic \ -Wshadow \ -Wwrite-strings -CFLAGS = $(CWARNS) -ansi -O2 -I$(LUA_INC) \ - -I$(COMPAT_DIR) -I$(EXPAT_INC) +CFLAGS = $(CWARNS) -ansi -O2 -I$(LUA_INC) CC = gcc diff --git a/src/libs/luaexpat/makefile b/src/libs/luaexpat/makefile index 3506548..1f4f6ff 100644 --- a/src/libs/luaexpat/makefile +++ b/src/libs/luaexpat/makefile @@ -4,27 +4,7 @@ CONFIG= ./config include $(CONFIG) -ifeq "$(LUA_VERSION_NUM)" "500" -COMPAT_O= $(COMPAT_DIR)/compat-5.1.o -endif +all: src/lxplib.o -OBJS= src/lxplib.o $(COMPAT_O) -lib: src/$(LIBNAME) - -src/$(LIBNAME) : $(OBJS) - export MACOSX_DEPLOYMENT_TARGET="10.3"; $(CC) -o src/$(LIBNAME) $(LIB_OPTION) $(OBJS) -lexpat - -$(COMPAT_DIR)/compat-5.1.o: $(COMPAT_DIR)/compat-5.1.c - $(CC) -c $(CFLAGS) -o $@ $(COMPAT_DIR)/compat-5.1.c - -install: - mkdir -p $(LUA_LIBDIR) - cp src/$(LIBNAME) $(LUA_LIBDIR) - cd $(LUA_LIBDIR); ln -f -s $(LIBNAME) $T.so - mkdir -p $(LUA_DIR)/$T - cp src/$T/lom.lua $(LUA_DIR)/$T - -clean: - rm -f src/$(LIBNAME) $(OBJS) # $Id: makefile,v 1.33 2006/06/08 20:41:48 tomas Exp $ diff --git a/src/texk/web2c/luatexdir/lua/luastuff.c b/src/texk/web2c/luatexdir/lua/luastuff.c index 5bc478b..c375859 100644 --- a/src/texk/web2c/luatexdir/lua/luastuff.c +++ b/src/texk/web2c/luatexdir/lua/luastuff.c @@ -120,6 +120,10 @@ void luainterpreter(int n) lua_pushstring(L, "zip"); lua_call(L, 1, 0); + lua_pushcfunction(L, luaopen_lxp); + lua_pushstring(L, "lxp"); + lua_call(L, 1, 0); + /* luasockets */ /* socket and mime are a bit tricky to open because * they use a load-time dependency that has to be diff --git a/src/texk/web2c/luatexdir/luatex-api.h b/src/texk/web2c/luatexdir/luatex-api.h index a840e52..18c993c 100644 --- a/src/texk/web2c/luatexdir/luatex-api.h +++ b/src/texk/web2c/luatexdir/luatex-api.h @@ -58,6 +58,7 @@ extern int luaopen_lfs(lua_State * L); extern int luaopen_lpeg(lua_State * L); extern int luaopen_md5(lua_State * L); extern int luaopen_zlib(lua_State * L); +extern int luaopen_lxp(lua_State * L); extern int luaopen_gzip(lua_State * L); extern int luaopen_ff(lua_State * L); extern int luaopen_profiler(lua_State * L); diff --git a/src/texk/web2c/luatexdir/luatexlib.mk b/src/texk/web2c/luatexdir/luatexlib.mk index 53e26f9..c86501e 100644 --- a/src/texk/web2c/luatexdir/luatexlib.mk +++ b/src/texk/web2c/luatexdir/luatexlib.mk @@ -118,6 +118,14 @@ LUAPEGDEP=$(LUAPEGDIR)/lpeg.o $(LUAPEGDEP): $(LUAPEGDIR)/lpeg.c mkdir -p $(LUAPEGDIR) && cd $(LUAPEGDIR) && cp -f $(LUAPEGSRCDIR)/* . && $(CC) $(CFLAGS) -I$(LIBLUADIR) -g -o lpeg.o -c lpeg.c +# luaexpat +LUAEXPATDIR=../../libs/luaexpat +LUAEXPATSRCDIR=$(srcdir)/$(LUAEXPATDIR) +LUAEXPATDEP=$(LUAEXPATDIR)/src/lxplib.o +LUAEXPATINC=-I../../lua51 +$(LUAEXPATDEP): $(LUAEXPATDIR)/src/lxplib.c $(LUAEXPATDIR)/src/lxplib.h + mkdir -p $(LUAEXPATDIR) && cd $(LUAEXPATDIR) && cp -R $(LUAEXPATSRCDIR)/* . && \ + make # luamd5 LUAMDVDIR=../../libs/luamd5 @@ -160,10 +168,12 @@ LIBMPLIBDEP=$(LIBMPDIR)/lmplib.o $(LIBMPDIR)/.libs/libmplib.a luatexlibs = $(luapdflib) $(LDLIBPNG) $(LDZLIB) $(LDLIBXPDF) $(LIBMD5DEP) $(LDLIBOBSD) \ $(LIBLUADEP) $(SLNUNICODEDEP) $(LUAZIPDEP) $(ZZIPLIBDEP) $(LUAFSDEP) $(LUASOCKETDEP) \ - $(LUAPEGDEP) $(LUAMDVDEP) $(LUAZLIBDEP) $(LUAFFDEP) $(LUAPROFDEP) $(LIBMPLIBDEP) + $(LUAEXPATDEP) \ + $(LUAPEGDEP) $(LUAMDVDEP) $(LUAZLIBDEP) $(LUAFFDEP) $(LUAPROFDEP) $(LIBMPLIBDEP) -lexpat luatexlibsdep = $(luapdflib) $(LIBPNGDEP) $(ZLIBDEP) $(LIBXPDFDEP) $(LIBMD5DEP) $(LIBOBSDDEP) \ $(LIBLUADEP) $(SLNUNICODEDEP) $(ZZIPLIBDEP) $(LUAZIPDEP) $(LUAFSDEP) $(LUASOCKETDEP) \ + $(LUAEXPATDEP) \ $(LUAPEGDEP) $(LUAMDVDEP) $(LUAZLIBDEP) $(LUAFFDEP) $(LUAPROFDEP) $(makecpool) ## end of luatexlib.mk - Makefile fragment for libraries used by pdf[ex]tex. -- 1.6.0.2.GIT
-- David Kastrup
_______________________________________________ dev-luatex mailing list [email protected] http://www.ntg.nl/mailman/listinfo/dev-luatex
