Ticket #32590: lua.diff
File lua.diff, 13.4 KB (added by andremm@…, 13 years ago) |
---|
-
Portfile
diff -Nurr lua.orig/Portfile lua/Portfile
old new 1 # $Id: Portfile 82708 2011-08-18 20:17:40Z ryandesign@macports.org $1 # -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 2 2 3 3 PortSystem 1.0 4 4 5 5 name lua 6 conflicts lua5 07 set compat_version 5. 18 version ${compat_version}. 49 revision 46 conflicts lua51 7 set compat_version 5.2 8 version ${compat_version}.0 9 revision 0 10 10 categories lang 11 11 license MIT 12 12 platforms darwin … … 21 21 master_sites ${homepage}/ftp/ 22 22 23 23 checksums ${distfiles} \ 24 sha1 2b11c8e60306efb7f0734b747588f57995493db7 \ 25 rmd160 c867c8364295d3e4fb4e4d8ebb27fa2b2312cdef 24 md5 f1ea831f397214bae8a265995ab1a93e \ 25 sha1 08f84c355cdd646f617f09cebea48bd832415829 \ 26 rmd160 6153bddd57493490b72e700cc99135432bf653f0 26 27 27 28 depends_lib port:readline 28 29 build.target macosx … … 30 31 test.run yes 31 32 test.env DYLD_LIBRARY_PATH=./lib 32 33 33 patchfiles patch-lua-5.1.4-3 \ 34 patch-Makefile.diff \ 34 patchfiles patch-Makefile.diff \ 35 35 patch-src_Makefile.diff 36 36 37 37 post-patch { 38 38 reinplace "s|/usr/local|${prefix}|g" ${worksrcpath}/Makefile ${worksrcpath}/src/luaconf.h 39 39 reinplace "s|/man/man1|/share/man/man1|g" ${worksrcpath}/Makefile 40 40 41 # reinplace %VERSION% and %COMPAT_VERSION% after applying patch-dlopen.diff41 # reinplace %VERSION% and %COMPAT_VERSION% 42 42 reinplace "s|%VERSION%|${version}|g" ${worksrcpath}/Makefile ${worksrcpath}/src/Makefile 43 43 reinplace "s|%COMPAT_VERSION%|${compat_version}|g" ${worksrcpath}/Makefile ${worksrcpath}/src/Makefile 44 44 45 45 # reinplace %PREFIX% to fix @executable_path, cf. ticket no. 28726 46 46 reinplace "s|%PREFIX%|${prefix}|g" ${worksrcpath}/src/Makefile 47 48 # for the pkgconfig file49 reinplace "s|/usr/local|${prefix}|g" ${worksrcpath}/etc/lua.pc50 47 } 51 48 52 49 configure { … … 60 57 destroot.target install INSTALL_TOP=${destroot}${prefix} 61 58 post-destroot { 62 59 xinstall -d -m 0755 ${destroot}${prefix}/share/doc/${name} 63 xinstall -m 0644 -W ${worksrcpath} COPYRIGHT HISTORYREADME ${destroot}${prefix}/share/doc/${name}60 xinstall -m 0644 -W ${worksrcpath} README ${destroot}${prefix}/share/doc/${name} 64 61 xinstall -d -m 0755 ${destroot}${prefix}/share/doc/${name}/html 65 62 foreach html [glob ${worksrcpath}/doc/*.html ${worksrcpath}/doc/*.gif] { 66 63 xinstall -m 0644 ${html} ${destroot}${prefix}/share/doc/${name}/html 67 64 } 68 xinstall -d -m 0755 ${destroot}${prefix}/share/doc/${name}/test 69 foreach test [glob ${worksrcpath}/test/README ${worksrcpath}/test/*.lua] { 70 xinstall -m 0644 ${test} ${destroot}${prefix}/share/doc/${name}/test 71 } 72 xinstall -d -m 0755 ${destroot}${prefix}/lib/pkgconfig 73 xinstall -m 0644 ${worksrcpath}/etc/lua.pc ${destroot}${prefix}/lib/pkgconfig/lua.pc 65 xinstall -m 0644 ${filespath}/lua.pc ${destroot}${prefix}/lib/pkgconfig 74 66 } 75 67 76 68 livecheck.type regex -
files/lua.pc
diff -Nurr lua.orig/files/lua.pc lua/files/lua.pc
old new 1 # lua.pc -- pkg-config data for Lua 2 3 # vars from install Makefile 4 5 # grep '^V=' ../Makefile 6 V= 5.2 7 # grep '^R=' ../Makefile 8 R= 5.2.0 9 10 # grep '^INSTALL_.*=' ../Makefile | sed 's/INSTALL_TOP/prefix/' 11 prefix= /opt/local 12 INSTALL_BIN= ${prefix}/bin 13 INSTALL_INC= ${prefix}/include 14 INSTALL_LIB= ${prefix}/lib 15 INSTALL_MAN= ${prefix}/man/man1 16 INSTALL_LMOD= ${prefix}/share/lua/${V} 17 INSTALL_CMOD= ${prefix}/lib/lua/${V} 18 19 # canonical vars 20 exec_prefix=${prefix} 21 libdir=${exec_prefix}/lib 22 includedir=${prefix}/include 23 24 Name: Lua 25 Description: An Extensible Extension Language 26 Version: ${R} 27 Requires: 28 Libs: -L${libdir} -llua -lm 29 Cflags: -I${includedir} 30 31 # (end of lua.pc) -
files/patch-Makefile.diff
diff -Nurr lua.orig/files/patch-Makefile.diff lua/files/patch-Makefile.diff
old new 1 --- Makefile.orig 2011- 03-27 16:49:40.000000000 +02002 +++ Makefile 2011- 03-27 16:52:46.000000000 +02003 @@ -4 3,7 +43,7 @@1 --- Makefile.orig 2011-12-18 22:04:50.000000000 -0200 2 +++ Makefile 2011-12-18 22:16:26.000000000 -0200 3 @@ -41,7 +41,7 @@ 4 4 # What to install. 5 5 TO_BIN= lua luac 6 TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp6 TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp 7 7 -TO_LIB= liblua.a 8 8 +TO_LIB= liblua.a liblua.dylib 9 9 TO_MAN= lua.1 luac.1 10 10 11 11 # Lua version and release. 12 @@ -6 4,6 +64,8 @@12 @@ -63,6 +63,8 @@ 13 13 cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC) 14 14 cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB) 15 15 cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN) 16 16 + cd $(INSTALL_LIB) && ln -s liblua.dylib liblua.%VERSION%.dylib 17 17 + cd $(INSTALL_LIB) && ln -s liblua.dylib liblua.%COMPAT_VERSION%.dylib 18 18 19 ranlib:20 cd src && cd $(INSTALL_ LIB) && $(RANLIB) $(TO_LIB)19 uninstall: 20 cd src && cd $(INSTALL_BIN) && $(RM) $(TO_BIN) -
files/patch-lua-5.1.4-3
diff -Nurr lua.orig/files/patch-lua-5.1.4-3 lua/files/patch-lua-5.1.4-3
old new 1 # patch-lua-5.1.4-3 created 2011-03-16T19:06:31-03002 # apply to a pristine copy of Lua 5.1.4 with:3 # wget http://www.lua.org/ftp/lua-5.1.4.tar.gz4 # tar zxf lua-5.1.4.tar.gz5 # cd lua-5.1.4/src6 # wget http://www.lua.org/ftp/patch-lua-5.1.4-37 # patch < patch-lua-5.1.4-38 # use curl -O -R if you don't have wget9 10 --- src/lcode.c 2007/12/28 15:32:23 2.25.1.311 +++ src/lcode.c 2011/01/31 14:53:16 2.25.1.512 @@ -1,5 +1,5 @@13 /*14 -** $Id: lcode.c,v 2.25.1.3 2007/12/28 15:32:23 roberto Exp $15 +** $Id: lcode.c,v 2.25.1.5 2011/01/31 14:53:16 roberto Exp $16 ** Code generator for Lua17 ** See Copyright Notice in lua.h18 */19 @@ -544,10 +544,6 @@20 pc = NO_JUMP; /* always true; do nothing */21 break;22 }23 - case VFALSE: {24 - pc = luaK_jump(fs); /* always jump */25 - break;26 - }27 case VJMP: {28 invertjump(fs, e);29 pc = e->u.s.info;30 @@ -572,10 +568,6 @@31 pc = NO_JUMP; /* always false; do nothing */32 break;33 }34 - case VTRUE: {35 - pc = luaK_jump(fs); /* always jump */36 - break;37 - }38 case VJMP: {39 pc = e->u.s.info;40 break;41 --- src/ldblib.c 2008/01/21 13:11:21 1.104.1.342 +++ src/ldblib.c 2009/08/04 18:50:18 1.104.1.443 @@ -1,5 +1,5 @@44 /*45 -** $Id: ldblib.c,v 1.104.1.3 2008/01/21 13:11:21 roberto Exp $46 +** $Id: ldblib.c,v 1.104.1.4 2009/08/04 18:50:18 roberto Exp $47 ** Interface from Lua to its debug API48 ** See Copyright Notice in lua.h49 */50 @@ -45,6 +45,7 @@51 52 53 static int db_getfenv (lua_State *L) {54 + luaL_checkany(L, 1);55 lua_getfenv(L, 1);56 return 1;57 }58 --- src/liolib.c 2008/01/18 17:47:43 2.73.1.359 +++ src/liolib.c 2010/05/14 15:33:51 2.73.1.460 @@ -1,5 +1,5 @@61 /*62 -** $Id: liolib.c,v 2.73.1.3 2008/01/18 17:47:43 roberto Exp $63 +** $Id: liolib.c,v 2.73.1.4 2010/05/14 15:33:51 roberto Exp $64 ** Standard I/O (and system) library65 ** See Copyright Notice in lua.h66 */67 @@ -276,7 +276,10 @@68 lua_pushnumber(L, d);69 return 1;70 }71 - else return 0; /* read fails */72 + else {73 + lua_pushnil(L); /* "result" to be removed */74 + return 0; /* read fails */75 + }76 }77 78 79 --- src/llex.c 2007/12/27 13:02:25 2.20.1.180 +++ src/llex.c 2009/11/23 14:58:22 2.20.1.281 @@ -1,5 +1,5 @@82 /*83 -** $Id: llex.c,v 2.20.1.1 2007/12/27 13:02:25 roberto Exp $84 +** $Id: llex.c,v 2.20.1.2 2009/11/23 14:58:22 roberto Exp $85 ** Lexical Analyzer86 ** See Copyright Notice in lua.h87 */88 @@ -118,8 +118,10 @@89 lua_State *L = ls->L;90 TString *ts = luaS_newlstr(L, str, l);91 TValue *o = luaH_setstr(L, ls->fs->h, ts); /* entry for `str' */92 - if (ttisnil(o))93 + if (ttisnil(o)) {94 setbvalue(o, 1); /* make sure `str' will not be collected */95 + luaC_checkGC(L);96 + }97 return ts;98 }99 100 --- src/loadlib.c 2008/08/06 13:29:28 1.52.1.3101 +++ src/loadlib.c 2009/09/09 13:17:16 1.52.1.4102 @@ -1,5 +1,5 @@103 /*104 -** $Id: loadlib.c,v 1.52.1.3 2008/08/06 13:29:28 roberto Exp $105 +** $Id: loadlib.c,v 1.52.1.4 2009/09/09 13:17:16 roberto Exp $106 ** Dynamic library loader for Lua107 ** See Copyright Notice in lua.h108 **109 @@ -639,7 +639,7 @@110 lua_pushvalue(L, -1);111 lua_replace(L, LUA_ENVIRONINDEX);112 /* create `loaders' table */113 - lua_createtable(L, 0, sizeof(loaders)/sizeof(loaders[0]) - 1);114 + lua_createtable(L, sizeof(loaders)/sizeof(loaders[0]) - 1, 0);115 /* fill it with pre-defined loaders */116 for (i=0; loaders[i] != NULL; i++) {117 lua_pushcfunction(L, loaders[i]);118 --- src/lstrlib.c 2008/07/11 17:27:21 1.132.1.4119 +++ src/lstrlib.c 2010/05/14 15:34:19 1.132.1.5120 @@ -1,5 +1,5 @@121 /*122 -** $Id: lstrlib.c,v 1.132.1.4 2008/07/11 17:27:21 roberto Exp $123 +** $Id: lstrlib.c,v 1.132.1.5 2010/05/14 15:34:19 roberto Exp $124 ** Standard library for string operations and pattern-matching125 ** See Copyright Notice in lua.h126 */127 @@ -754,6 +754,7 @@128 129 130 static int str_format (lua_State *L) {131 + int top = lua_gettop(L);132 int arg = 1;133 size_t sfl;134 const char *strfrmt = luaL_checklstring(L, arg, &sfl);135 @@ -768,7 +769,8 @@136 else { /* format item */137 char form[MAX_FORMAT]; /* to store the format (`%...') */138 char buff[MAX_ITEM]; /* to store the formatted item */139 - arg++;140 + if (++arg > top)141 + luaL_argerror(L, arg, "no value");142 strfrmt = scanformat(L, strfrmt, form);143 switch (*strfrmt++) {144 case 'c': {145 --- src/lvm.c 2007/12/28 15:32:23 2.63.1.3146 +++ src/lvm.c 2009/07/01 21:10:33 2.63.1.4147 @@ -1,5 +1,5 @@148 /*149 -** $Id: lvm.c,v 2.63.1.3 2007/12/28 15:32:23 roberto Exp $150 +** $Id: lvm.c,v 2.63.1.4 2009/07/01 21:10:33 roberto Exp $151 ** Lua virtual machine152 ** See Copyright Notice in lua.h153 */154 @@ -133,6 +133,7 @@155 156 void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) {157 int loop;158 + TValue temp;159 for (loop = 0; loop < MAXTAGLOOP; loop++) {160 const TValue *tm;161 if (ttistable(t)) { /* `t' is a table? */162 @@ -152,7 +153,9 @@163 callTM(L, tm, t, key, val);164 return;165 }166 - t = tm; /* else repeat with `tm' */167 + /* else repeat with `tm' */168 + setobj(L, &temp, tm); /* avoid pointing inside table (may rehash) */169 + t = &temp;170 }171 luaG_runerror(L, "loop in settable");172 } -
files/patch-src_Makefile.diff
diff -Nurr lua.orig/files/patch-src_Makefile.diff lua/files/patch-src_Makefile.diff
old new 1 --- src/Makefile.orig 2011- 03-27 16:49:54.000000000 +02002 +++ src/Makefile 2011- 03-27 16:55:30.000000000 +02003 @@ -2 3,6 +23,7 @@1 --- src/Makefile.orig 2011-12-18 22:27:37.000000000 -0200 2 +++ src/Makefile 2011-12-18 22:32:25.000000000 -0200 3 @@ -29,6 +29,7 @@ 4 4 PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris 5 5 6 6 LUA_A= liblua.a 7 7 +LUA_DYLIB= liblua.dylib 8 CORE_O= lapi.o lcode.o l debug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \9 l object.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o\10 l undump.o lvm.o lzio.o11 @@ - 36,8 +37,8 @@12 LUAC_O= luac.o print.o8 CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \ 9 lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \ 10 ltm.o lundump.o lvm.o lzio.o 11 @@ -43,8 +44,8 @@ 12 LUAC_O= luac.o 13 13 14 ALL_O= $( CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O)14 ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O) 15 15 -ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) 16 16 -ALL_A= $(LUA_A) 17 17 +ALL_T= $(LUA_DYLIB) $(LUA_A) $(LUA_T) $(LUAC_T) 18 18 +ALL_A= $(LUA_DYLIB) $(LUA_A) 19 19 20 # Targets start here. 20 21 default: $(PLAT) 21 22 @@ -48,14 +49,20 @@ 22 @@ -56,14 +57,20 @@ 23 23 a: $(ALL_A) 24 24 25 $(LUA_A): $( CORE_O) $(LIB_O)25 $(LUA_A): $(BASE_O) 26 26 + @echo "Building static library" 27 27 $(AR) $@ $? 28 28 $(RANLIB) $@ … … 30 30 +$(LUA_DYLIB): $(CORE_O) $(LIB_O) 31 31 + @echo "Building dylib" 32 32 + $(CC) -o $@ $(MYLDFLAGS) -dynamiclib -install_name %PREFIX%/lib/liblua.dylib \ 33 + 33 + -compatibility_version %COMPAT_VERSION% -current_version %VERSION% $^ 34 34 + 35 35 $(LUA_T): $(LUA_O) $(LUA_A) 36 - $(CC) -o $@ $( MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)36 - $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) 37 37 + $(CC) -o $@ -L. $(MYLDFLAGS) $(MYCFLAGS) $(MYLIBS) -llua lua.c 38 38 39 39 $(LUAC_T): $(LUAC_O) $(LUA_A) 40 - $(CC) -o $@ $( MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)40 - $(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS) 41 41 + $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_DYLIB) $(LIBS) 42 42 43 43 clean: 44 44 $(RM) $(ALL_T) $(ALL_O) 45 @@ - 99,7 +106,7 @@46 $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory-lncurses"45 @@ -106,7 +113,7 @@ 46 $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline -lncurses" 47 47 48 48 macosx: 49 - $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-lreadline"49 - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" SYSLIBS="-lreadline" 50 50 + $(MAKE) all MYCFLAGS="-fno-common -DLUA_USE_LINUX" MYLIBS="-lreadline" 51 # use this on Mac OS X 10.3-52 # $(MAKE) all MYCFLAGS=-DLUA_USE_MACOSX53 51 52 mingw: 53 $(MAKE) "LUA_A=lua52.dll" "LUA_T=lua.exe" \