Ticket #32590: lua.diff

File lua.diff, 13.4 KB (added by andremm@…, 12 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
    22
    33PortSystem          1.0
    44
    55name                lua
    6 conflicts           lua50
    7 set compat_version  5.1
    8 version             ${compat_version}.4
    9 revision            4
     6conflicts           lua51
     7set compat_version  5.2
     8version             ${compat_version}.0
     9revision            0
    1010categories          lang
    1111license             MIT
    1212platforms           darwin
     
    2121master_sites        ${homepage}/ftp/
    2222
    2323checksums           ${distfiles} \
    24                     sha1    2b11c8e60306efb7f0734b747588f57995493db7 \
    25                     rmd160  c867c8364295d3e4fb4e4d8ebb27fa2b2312cdef
     24                    md5     f1ea831f397214bae8a265995ab1a93e \
     25                    sha1    08f84c355cdd646f617f09cebea48bd832415829 \
     26                    rmd160  6153bddd57493490b72e700cc99135432bf653f0
    2627
    2728depends_lib         port:readline
    2829build.target        macosx
     
    3031test.run            yes
    3132test.env            DYLD_LIBRARY_PATH=./lib
    3233
    33 patchfiles          patch-lua-5.1.4-3 \
    34                     patch-Makefile.diff \
     34patchfiles          patch-Makefile.diff \
    3535                    patch-src_Makefile.diff
    3636
    3737post-patch {
    3838    reinplace "s|/usr/local|${prefix}|g" ${worksrcpath}/Makefile ${worksrcpath}/src/luaconf.h
    3939    reinplace "s|/man/man1|/share/man/man1|g" ${worksrcpath}/Makefile
    4040
    41     # reinplace %VERSION% and %COMPAT_VERSION% after applying patch-dlopen.diff
     41    # reinplace %VERSION% and %COMPAT_VERSION%
    4242    reinplace "s|%VERSION%|${version}|g" ${worksrcpath}/Makefile ${worksrcpath}/src/Makefile
    4343    reinplace "s|%COMPAT_VERSION%|${compat_version}|g" ${worksrcpath}/Makefile ${worksrcpath}/src/Makefile
    44    
     44
    4545    # reinplace %PREFIX% to fix @executable_path, cf. ticket no. 28726
    4646    reinplace "s|%PREFIX%|${prefix}|g" ${worksrcpath}/src/Makefile
    47 
    48     # for the pkgconfig file
    49     reinplace "s|/usr/local|${prefix}|g" ${worksrcpath}/etc/lua.pc
    5047}
    5148
    5249configure {
     
    6057destroot.target install INSTALL_TOP=${destroot}${prefix}
    6158post-destroot {
    6259    xinstall -d -m 0755 ${destroot}${prefix}/share/doc/${name}
    63     xinstall -m 0644 -W ${worksrcpath} COPYRIGHT HISTORY README ${destroot}${prefix}/share/doc/${name}
     60    xinstall -m 0644 -W ${worksrcpath} README ${destroot}${prefix}/share/doc/${name}
    6461    xinstall -d -m 0755 ${destroot}${prefix}/share/doc/${name}/html
    6562    foreach html [glob ${worksrcpath}/doc/*.html ${worksrcpath}/doc/*.gif] {
    6663        xinstall -m 0644 ${html} ${destroot}${prefix}/share/doc/${name}/html
    6764    }
    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
    7466}
    7567
    7668livecheck.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
     6V= 5.2
     7# grep '^R=' ../Makefile
     8R= 5.2.0
     9
     10# grep '^INSTALL_.*=' ../Makefile | sed 's/INSTALL_TOP/prefix/'
     11prefix= /opt/local
     12INSTALL_BIN= ${prefix}/bin
     13INSTALL_INC= ${prefix}/include
     14INSTALL_LIB= ${prefix}/lib
     15INSTALL_MAN= ${prefix}/man/man1
     16INSTALL_LMOD= ${prefix}/share/lua/${V}
     17INSTALL_CMOD= ${prefix}/lib/lua/${V}
     18
     19# canonical vars
     20exec_prefix=${prefix}
     21libdir=${exec_prefix}/lib
     22includedir=${prefix}/include
     23
     24Name: Lua
     25Description: An Extensible Extension Language
     26Version: ${R}
     27Requires:
     28Libs: -L${libdir} -llua -lm
     29Cflags: -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 +0200
    2 +++ Makefile    2011-03-27 16:52:46.000000000 +0200
    3 @@ -43,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 @@
    44 # What to install.
    55 TO_BIN= lua luac
    6  TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
     6 TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp
    77-TO_LIB= liblua.a
    88+TO_LIB= liblua.a liblua.dylib
    99 TO_MAN= lua.1 luac.1
    1010 
    1111 # Lua version and release.
    12 @@ -64,6 +64,8 @@
     12@@ -63,6 +63,8 @@
    1313        cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
    1414        cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
    1515        cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
    1616+       cd $(INSTALL_LIB) && ln -s liblua.dylib liblua.%VERSION%.dylib
    1717+       cd $(INSTALL_LIB) && ln -s liblua.dylib liblua.%COMPAT_VERSION%.dylib
    1818 
    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-0300
    2 # apply to a pristine copy of Lua 5.1.4 with:
    3 #       wget http://www.lua.org/ftp/lua-5.1.4.tar.gz
    4 #       tar zxf lua-5.1.4.tar.gz
    5 #       cd lua-5.1.4/src
    6 #       wget http://www.lua.org/ftp/patch-lua-5.1.4-3
    7 #       patch < patch-lua-5.1.4-3
    8 # use curl -O -R if you don't have wget
    9 
    10 --- src/lcode.c 2007/12/28 15:32:23     2.25.1.3
    11 +++ src/lcode.c 2011/01/31 14:53:16     2.25.1.5
    12 @@ -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 Lua
    17  ** See Copyright Notice in lua.h
    18  */
    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.3
    42 +++ src/ldblib.c        2009/08/04 18:50:18     1.104.1.4
    43 @@ -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 API
    48  ** See Copyright Notice in lua.h
    49  */
    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.3
    59 +++ src/liolib.c        2010/05/14 15:33:51     2.73.1.4
    60 @@ -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) library
    65  ** See Copyright Notice in lua.h
    66  */
    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.1
    80 +++ src/llex.c  2009/11/23 14:58:22     2.20.1.2
    81 @@ -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 Analyzer
    86  ** See Copyright Notice in lua.h
    87  */
    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.3
    101 +++ src/loadlib.c       2009/09/09 13:17:16     1.52.1.4
    102 @@ -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 Lua
    107  ** See Copyright Notice in lua.h
    108  **
    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.4
    119 +++ src/lstrlib.c       2010/05/14 15:34:19     1.132.1.5
    120 @@ -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-matching
    125  ** See Copyright Notice in lua.h
    126  */
    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.3
    146 +++ src/lvm.c   2009/07/01 21:10:33     2.63.1.4
    147 @@ -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 machine
    152  ** See Copyright Notice in lua.h
    153  */
    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 +0200
    2 +++ src/Makefile        2011-03-27 16:55:30.000000000 +0200
    3 @@ -23,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 @@
    44 PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
    55 
    66 LUA_A= liblua.a
    77+LUA_DYLIB=     liblua.dylib
    8  CORE_O=        lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \
    9         lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o \
    10         lundump.o lvm.o lzio.o
    11 @@ -36,8 +37,8 @@
    12  LUAC_O=        luac.o print.o
     8 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
    1313 
    14  ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O)
     14 ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
    1515-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
    1616-ALL_A= $(LUA_A)
    1717+ALL_T= $(LUA_DYLIB) $(LUA_A) $(LUA_T) $(LUAC_T)
    1818+ALL_A= $(LUA_DYLIB) $(LUA_A)
    1919 
     20 # Targets start here.
    2021 default: $(PLAT)
    21  
    22 @@ -48,14 +49,20 @@
     22@@ -56,14 +57,20 @@
    2323 a:     $(ALL_A)
    2424 
    25  $(LUA_A): $(CORE_O) $(LIB_O)
     25 $(LUA_A): $(BASE_O)
    2626+       @echo "Building static library"
    2727        $(AR) $@ $?
    2828        $(RANLIB) $@
     
    3030+$(LUA_DYLIB): $(CORE_O) $(LIB_O)
    3131+       @echo "Building dylib"
    3232+       $(CC) -o $@ $(MYLDFLAGS) -dynamiclib -install_name %PREFIX%/lib/liblua.dylib \
    33 +               -compatibility_version %COMPAT_VERSION% -current_version %VERSION% $^
     33+       -compatibility_version %COMPAT_VERSION% -current_version %VERSION% $^
    3434+
    3535 $(LUA_T): $(LUA_O) $(LUA_A)
    36 -       $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
     36-       $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
    3737+       $(CC) -o $@ -L. $(MYLDFLAGS) $(MYCFLAGS) $(MYLIBS) -llua lua.c
    3838 
    3939 $(LUAC_T): $(LUAC_O) $(LUA_A)
    40 -       $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
     40-       $(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
    4141+       $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_DYLIB) $(LIBS)
    4242 
    4343 clean:
    4444        $(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"
    4747 
    4848 macosx:
    49 -       $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-lreadline"
     49-       $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" SYSLIBS="-lreadline"
    5050+       $(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_MACOSX
    5351 
     52 mingw:
     53        $(MAKE) "LUA_A=lua52.dll" "LUA_T=lua.exe" \