Skip to content

Instantly share code, notes, and snippets.

@umq umq/devel_luaposix.shar
Last active Dec 16, 2015

Embed
What would you like to do?
FreeBSD ports patch to make lang/lua52 honor Mk/bsd.lua.mk
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# devel/luaposix
# devel/luaposix/files
# devel/luaposix/files/patch-lposix.c
# devel/luaposix/pkg-plist
# devel/luaposix/Makefile
# devel/luaposix/distinfo
# devel/luaposix/pkg-descr
#
echo c - devel/luaposix
mkdir -p devel/luaposix > /dev/null 2>&1
echo c - devel/luaposix/files
mkdir -p devel/luaposix/files > /dev/null 2>&1
echo x - devel/luaposix/files/patch-lposix.c
sed 's/^X//' >devel/luaposix/files/patch-lposix.c << '926042c4c348b135e70327a115ab5b04'
X--- ./lposix.c.orig 2013-03-23 21:43:04.000000000 +0900
X+++ ./lposix.c 2013-04-04 08:57:46.000000000 +0900
X@@ -58,6 +58,8 @@
X #include "lauxlib.h"
X #include "lua52compat.h"
X
X+/* FreeBSD does not have O_DSYNC */
X+#define O_DSYNC O_SYNC
X
X /* The extra indirection to these macros is required so that if the
X arguments are themselves macros, they will get expanded too. */
926042c4c348b135e70327a115ab5b04
echo x - devel/luaposix/pkg-plist
sed 's/^X//' >devel/luaposix/pkg-plist << 'c3b5c65035ed911264cc4d0d16d5fd05'
X@comment $FreeBSD$
c3b5c65035ed911264cc4d0d16d5fd05
echo x - devel/luaposix/Makefile
sed 's/^X//' >devel/luaposix/Makefile << '9954a6163bbff2ebf7936bf46f0d35fc'
X# Created by: Hirohisa Yamaguchi <umq@ueo.co.jp>
X# $FreeBSD$
X
XPORTNAME= luaposix
XPORTVERSION= 5.1.28
XCATEGORIES= devel
XPKGNAMEPREFIX= ${LUA_PKGNAMEPREFIX}
X
XMAINTAINER= umq@ueo.co.jp
XCOMMENT= Lua bindings for POSIX APIs
X
XOPTIONS_DEFINE= DOCS
XLATEST_LINK= ${PORTNAME}
X
XCONFIGURE_ENV= LUA=${LUA_CMD} LUA_INCLUDE=-I${LUA_INCDIR}
XGH_ACCOUNT= luaposix
XGH_COMMIT= 2016931
XGH_TAGNAME= ${GH_COMMIT}
XGNU_CONFIGURE= yes
XUSE_GITHUB= yes
XUSE_LUA= 5.1+
X
XPLIST_FILES= %%LUA_MODLIBDIR%%/curses_c.so \
X %%LUA_MODLIBDIR%%/posix_c.so \
X %%LUA_MODSHAREDIR%%/curses.lua \
X %%LUA_MODSHAREDIR%%/posix.lua
XPORTDOCS= *
XDOCS= curses.html docs/index.html docs/ldoc.css lcurses_c.html
X
X.include <bsd.port.options.mk>
X
Xdo-install:
X @${MKDIR} ${LUA_MODLIBDIR}
X ${INSTALL_LIB} ${WRKSRC}/.libs/curses_c.so ${LUA_MODLIBDIR}/
X ${INSTALL_LIB} ${WRKSRC}/.libs/posix_c.so ${LUA_MODLIBDIR}/
X @${MKDIR} ${LUA_MODSHAREDIR}
X ${INSTALL_SCRIPT} ${WRKSRC}/curses.lua ${LUA_MODSHAREDIR}/
X ${INSTALL_SCRIPT} ${WRKSRC}/posix.lua ${LUA_MODSHAREDIR}/
X.if ${PORT_OPTIONS:MDOCS}
X @${MKDIR} ${DOCSDIR}
X ${INSTALL_DATA} ${DOCS:S,^,${WRKSRC}/,} ${DOCSDIR}/
X.endif
X
X.include <bsd.port.mk>
9954a6163bbff2ebf7936bf46f0d35fc
echo x - devel/luaposix/distinfo
sed 's/^X//' >devel/luaposix/distinfo << '6040edcf90e97b9c677c66a12601972a'
XSHA256 (luaposix-5.1.28.tar.gz) = f6cd5737b06a643f15cbe880d6148c1573891371d7fa97de6941998cd4cf66ba
XSIZE (luaposix-5.1.28.tar.gz) = 536018
6040edcf90e97b9c677c66a12601972a
echo x - devel/luaposix/pkg-descr
sed 's/^X//' >devel/luaposix/pkg-descr << '97c943501bd8eea22936d7ee75cca6af'
Xluaposix is a POSIX binding, including curses, for Lua 5.1 and 5.2;
Xlike most libraries it simply binds to C APIs on the underlying
Xsystem, so it won't work on a non-POSIX system. However, it does try
Xto detect the level of POSIX conformance of the underlying system and
Xbind only available APIs.
X
XWWW: https://github.com/luaposix/luaposix
97c943501bd8eea22936d7ee75cca6af
exit
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# lang/ruby-lua
# lang/ruby-lua/pkg-plist
# lang/ruby-lua/Makefile
# lang/ruby-lua/distinfo
# lang/ruby-lua/pkg-descr
# lang/ruby-lua/files
# lang/ruby-lua/files/patch-ext_lua_lua.c
#
echo c - lang/ruby-lua
mkdir -p lang/ruby-lua > /dev/null 2>&1
echo x - lang/ruby-lua/pkg-plist
sed 's/^X//' >lang/ruby-lua/pkg-plist << 'bb79191b1970d5e75db47da318db8c0d'
X%%RUBY_SITEARCHLIBDIR%%/lua-%%LUA_VER%%.so
X%%PORTDOCS%%%%RUBY_MODDOCDIR%%/README
X%%PORTDOCS%%@dirrm %%RUBY_MODDOCDIR%%
bb79191b1970d5e75db47da318db8c0d
echo x - lang/ruby-lua/Makefile
sed 's/^X//' >lang/ruby-lua/Makefile << 'b78c440428c22ea4f08a45f68fb376e7'
X# Created by: Akinori MUSHA aka knu <knu@idaemons.org>
X# $FreeBSD: head/lang/ruby-lua/Makefile 277024 2011-07-04 01:30:57Z swills $
X
XPORTNAME= lua5
XPORTVERSION= 0.2.2
XPORTEPOCH= 1
XCATEGORIES= lang ruby
XMASTER_SITES= http://www.moonwolf.com/ruby/archive/
XPKGNAMEPREFIX= ${RUBY_PKGNAMEPREFIX}
XDISTNAME= rub-${PORTNAME}-${PORTVERSION}
XDIST_SUBDIR= ruby
X
XMAINTAINER= ruby@FreeBSD.org
XCOMMENT= A Ruby extension to make Lua script language as a class
X
XOPTIONS_DEFINE= DOCS
XLATEST_LINK= ruby-${PORTNAME}
X
XUSE_LUA= 5.0
XUSE_RUBY= yes
XUSE_RUBY_SETUP= yes
XRUBY_SETUP= install.rb
XCONFIGURE_ARGS= -- --with-lua-include=${LUA_INCDIR} --with-lua-lib=${LUA_LIBDIR}
X
X.include <bsd.port.options.mk>
X
Xpost-patch:
X @${REINPLACE_CMD} -e 's|\(create_makefile("lua\)")|\1-${LUA_VER}")|' \
X ${WRKSRC}/ext/lua/extconf.rb
X
Xpost-install:
X.if ${PORT_OPTIONS:MDOCS}
X ${MKDIR} ${RUBY_MODDOCDIR}
X ${INSTALL_DATA} ${WRKSRC}/README ${RUBY_MODDOCDIR}
X.endif
X
X.include <bsd.port.mk>
b78c440428c22ea4f08a45f68fb376e7
echo x - lang/ruby-lua/distinfo
sed 's/^X//' >lang/ruby-lua/distinfo << 'a057460dc5943c833c3522d43e0055d7'
XSHA256 (ruby/rub-lua5-0.2.2.tar.gz) = 4861fa75b990620443604cea9dbb605e05d27b9cc136a66bb5eaf051cdf96ea5
XSIZE (ruby/rub-lua5-0.2.2.tar.gz) = 11267
a057460dc5943c833c3522d43e0055d7
echo x - lang/ruby-lua/pkg-descr
sed 's/^X//' >lang/ruby-lua/pkg-descr << '8677adc5ff4541b332efc0eff2b21868'
XRuby-Lua -- an embebed scripting language for ruby programs
X
XThis is a first attempt to make Lua script language as a class for
Xruby, it's very basic right now.
X
XAuthor: Domingo Alvarez <domingo@dad-it.com>,
X MoonWolf <moonwolf@moonwolf.com>
XWWW: http://raa.ruby-lang.org/list.rhtml?name=rub-lua5
8677adc5ff4541b332efc0eff2b21868
echo c - lang/ruby-lua/files
mkdir -p lang/ruby-lua/files > /dev/null 2>&1
echo x - lang/ruby-lua/files/patch-ext_lua_lua.c
sed 's/^X//' >lang/ruby-lua/files/patch-ext_lua_lua.c << '3d5d76f90ab7a892a1dbbcbd20acffe8'
X--- ./ext/lua/lua.c.orig 2003-06-07 18:36:30.000000000 +0900
X+++ ./ext/lua/lua.c 2013-04-06 22:03:24.000000000 +0900
X@@ -13,6 +13,23 @@
X
X #endif
X
X+#ifndef RUBY_19
X+#ifndef RFLOAT_VALUE
X+#define RFLOAT_VALUE(v) (RFLOAT(v)->value)
X+#endif
X+#ifndef RARRAY_LEN
X+#define RARRAY_LEN(v) (RARRAY(v)->len)
X+#endif
X+#ifndef RARRAY_PTR
X+#define RARRAY_PTR(v) (RARRAY(v)->ptr)
X+#endif
X+#endif
X+#ifndef RSTRING_PTR
X+#define RSTRING_PTR(s) (RSTRING(s))
X+#endif
X+#ifndef RSTRING_LEN
X+#define RSTRING_LEN(s) (RSTRING(s))
X+#endif
X
X int FLAGS[] = {
X 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
X@@ -69,9 +86,9 @@
X lua_State *L;
X int i, len, stack = 1024;
X if(rb_scan_args(argc,argv,"*",&args) >= 1){
X- len = RARRAY(args)->len;
X+ len = RARRAY_LEN(args);
X i = 0;
X- arg = RARRAY(args)->ptr[i];
X+ arg = RARRAY_PTR(args)[i];
X /* first argument if it's a number is the stack value */
X
X if(TYPE(arg) == T_FIXNUM){
X@@ -81,13 +98,13 @@
X L = lua_open();
X /* we expect strings describing libraries to enable*/
X for(;i < len; i++){
X- arg = RARRAY(args)->ptr[i];
X+ arg = RARRAY_PTR(args)[i];
X Check_Type(arg, T_STRING);
X- if(strcmp(STR2CSTR(arg), "baselib") == 0) lua_baselibopen(L);
X- if(strcmp(STR2CSTR(arg), "strlib") == 0) lua_strlibopen(L);
X- if(strcmp(STR2CSTR(arg), "mathlib") == 0) lua_mathlibopen(L);
X- if(strcmp(STR2CSTR(arg), "iolib") == 0) lua_iolibopen(L);
X- if(strcmp(STR2CSTR(arg), "dblib") == 0) lua_dblibopen(L);
X+ if(strcmp(StringValuePtr(arg), "baselib") == 0) lua_baselibopen(L);
X+ if(strcmp(StringValuePtr(arg), "strlib") == 0) lua_strlibopen(L);
X+ if(strcmp(StringValuePtr(arg), "mathlib") == 0) lua_mathlibopen(L);
X+ if(strcmp(StringValuePtr(arg), "iolib") == 0) lua_iolibopen(L);
X+ if(strcmp(StringValuePtr(arg), "dblib") == 0) lua_dblibopen(L);
X }
X } else {
X L = lua_open();
X@@ -123,9 +140,9 @@
X lua_State *L;
X Data_Get_Struct(self, lua_State, L);
X Check_Type(arg, T_STRING);
X- if (lua_dobuffer(L, RSTRING(arg)->ptr, RSTRING(arg)->len, NULL)){
X- lua_dobuffer(L, RSTRING(arg)->ptr, RSTRING(arg)->len, RSTRING(arg)->ptr);
X- rb_warn("%s", RSTRING(arg)->ptr);
X+ if (lua_dobuffer(L, RSTRING_PTR(arg), RSTRING_LEN(arg), NULL)){
X+ lua_dobuffer(L, RSTRING_PTR(arg), RSTRING_LEN(arg), RSTRING_PTR(arg));
X+ rb_warn("%s", RSTRING_PTR(arg));
X }
X return arg;
X }
X@@ -179,7 +196,7 @@
X Data_Get_Struct(self, lua_State, L);
X Check_Type(arg, T_STRING);
X debug_stack("before rbLua_get");
X- lua_getglobal(L, STR2CSTR(arg));
X+ lua_getglobal(L, StringValuePtr(arg));
X v = get_lua_var(L);
X lua_pop(L,1); /* remove global from stack */
X debug_stack("after rbLua_get");
X@@ -203,7 +220,7 @@
X lua_pushboolean(L,0);
X break;
X case T_STRING:
X- lua_pushlstring(L, RSTRING(vvalue)->ptr, RSTRING(vvalue)->len);
X+ lua_pushlstring(L, RSTRING_PTR(vvalue), RSTRING_LEN(vvalue));
X break;;
X case T_FIXNUM:
X lua_pushnumber(L,FIX2INT(vvalue));
X@@ -212,26 +229,26 @@
X lua_pushnumber(L,NUM2DBL(vvalue));
X break;;
X case T_FLOAT:
X- lua_pushnumber(L,(lua_Number)RFLOAT(vvalue)->value);
X+ lua_pushnumber(L,(lua_Number)RFLOAT_VALUE(vvalue));
X break;;
X case T_ARRAY:
X lua_newtable(L);
X tbl = lua_gettop(L);
X- len = RARRAY(vvalue)->len;
X+ len = RARRAY_LEN(vvalue);
X lua_pushstring(L, "n");
X lua_pushnumber(L,len);
X lua_settable(L, -3);
X for (i = 0; i < len; i++) {
X- push_lua_table_value(L,RARRAY(vvalue)->ptr[i]);
X+ push_lua_table_value(L,RARRAY_PTR(vvalue)[i]);
X lua_rawseti(L,tbl,i + 1);
X }
X break;;
X case T_HASH:
X lua_newtable(L);
X keys = rb_funcall(vvalue, keys_id, 0);
X- for (i=0; i<=(RARRAY(keys)->len)-1; i++){
X+ for (i=0; i<=(RARRAY_LEN(keys))-1; i++){
X VALUE key;
X- key = *(RARRAY(keys)->ptr+i);
X+ key = *(RARRAY_PTR(keys)+i);
X set_lua_table_value(L,key, rb_hash_aref(vvalue,key));
X }
X break;
X@@ -245,7 +262,7 @@
X
X static void set_lua_table_value(lua_State *L, VALUE vname, VALUE vvalue){
X debug_stack("before set_lua_table");
X- lua_pushlstring(L, RSTRING(vname)->ptr, RSTRING(vname)->len);
X+ lua_pushlstring(L, RSTRING_PTR(vname), RSTRING_LEN(vname));
X push_lua_table_value(L,vvalue);
X lua_settable(L, -3);
X debug_stack("after set_lua_table");
X@@ -254,7 +271,7 @@
X
X static VALUE set_lua_var(lua_State *L, VALUE vname, VALUE vvalue){
X debug_stack("before set_lua_var");
X- lua_pushlstring(L, RSTRING(vname)->ptr, RSTRING(vname)->len);
X+ lua_pushlstring(L, RSTRING_PTR(vname), RSTRING_LEN(vname));
X push_lua_table_value(L,vvalue);
X lua_settable(L, LUA_GLOBALSINDEX);
X debug_stack("after set_lua_var");
X@@ -277,7 +294,7 @@
X Data_Get_Struct(self, lua_State, L);
X debug_stack("before rbLua_set");
X lua_pushlightuserdata(L,(void*)vvalue); /* saves ruby object */
X- lua_setglobal(L,STR2CSTR(vname));
X+ lua_setglobal(L,StringValuePtr(vname));
X debug_stack("after rbLua_set");
X return(vvalue);
X }
X@@ -303,7 +320,7 @@
X lua_pop(L,n);
X n = lua_gettop(L);
X /* the result */
X- push_lua_table_value(L, rb_funcall2(obj_id,method,RARRAY(args)->len,RARRAY(args)->ptr));
X+ push_lua_table_value(L, rb_funcall2(obj_id,method,RARRAY_LEN(args),RARRAY_PTR(args)));
X /*push_lua_table_value(L, args);*/ /* the result */
X debug_stack("after call_ruby_function");
X return(lua_gettop(L) - n); /* number of results */
X@@ -316,17 +333,17 @@
X lua_State *L;
X Data_Get_Struct(self, lua_State, L);
X debug_stack("before rbLua_setFunc");
X- len = RARRAY(args)->len;
X+ len = RARRAY_LEN(args);
X i = 0;
X- func_name = RARRAY(args)->ptr[i++];
X+ func_name = RARRAY_PTR(args)[i++];
X Check_Type(func_name, T_STRING); /* function name to set */
X- obj_id = RARRAY(args)->ptr[i++];
X- method = rb_intern(STR2CSTR(RARRAY(args)->ptr[i++]));
X+ obj_id = RARRAY_PTR(args)[i++];
X+ method = rb_intern(StringValuePtr(RARRAY_PTR(args)[i++]));
X lua_pushlightuserdata(L,(void*)obj_id); /* saves ruby object */
X lua_pushlightuserdata(L,(void*)method); /* saves ruby object */
X
X lua_pushcclosure (L, call_ruby_function, 2);
X- lua_setglobal(L,STR2CSTR(func_name));
X+ lua_setglobal(L,StringValuePtr(func_name));
X debug_stack("after rbLua_setFunc");
X return(Qnil);
X }
X@@ -338,10 +355,10 @@
X Data_Get_Struct(self, lua_State, L);
X debug_stack("before rbLua_call");
X if(rb_scan_args(argc,argv,"1*",&func,&args) >= 1){
X- lua_getglobal(L,STR2CSTR(func));
X- len = RARRAY(args)->len;
X+ lua_getglobal(L,StringValuePtr(func));
X+ len = RARRAY_LEN(args);
X for (i = 0; i < len; i++) {
X- push_lua_table_value(L,RARRAY(args)->ptr[i]);
X+ push_lua_table_value(L,RARRAY_PTR(args)[i]);
X }
X lua_call(L,len,1);
X ret = get_lua_var(L);
3d5d76f90ab7a892a1dbbcbd20acffe8
exit
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# lang/tolua52
# lang/tolua52/pkg-plist
# lang/tolua52/Makefile
# lang/tolua52/distinfo
# lang/tolua52/pkg-descr
#
echo c - lang/tolua52
mkdir -p lang/tolua52 > /dev/null 2>&1
echo x - lang/tolua52/pkg-plist
sed 's/^X//' >lang/tolua52/pkg-plist << 'd94d0f5f4d782bd5b7ebb63b29c921ab'
X%%LUA_BINDIR%%/tolua
Xbin/tolua-%%LUA_VER%%
X%%LUA_LIBDIR%%/libtolua.a
X%%LUA_INCDIR%%/tolua.h
d94d0f5f4d782bd5b7ebb63b29c921ab
echo x - lang/tolua52/Makefile
sed 's/^X//' >lang/tolua52/Makefile << 'b12b517230e7c526c41212fa19c4e65c'
X# Created by: Edwin Groothuis <edwin@mavetju.org>
X# $FreeBSD: head/lang/tolua/Makefile 300896 2012-07-14 13:54:48Z beat $
X
XPORTNAME= tolua
XPORTVERSION= 5.2.0
XCATEGORIES= lang
XMASTER_SITES= ftp://ftp.tecgraf.puc-rio.br/pub/users/celes/tolua/ \
X http://www.tecgraf.puc-rio.br/~celes/tolua/
X
XMAINTAINER= edwin@mavetju.org
XCOMMENT= toLua: accessing C/C++ code from Lua
X
XUSE_GMAKE= yes
XUSE_LUA= 5.2
X
Xpost-patch:
X @${REINPLACE_CMD} -e 's|make|$${MAKE}|' ${WRKSRC}/${MAKEFILE}
X @${REINPLACE_CMD} -Ee \
X 's|^(CC=).*|\1 ${CC}|; \
X s|^(CCPP =).*|\1 ${CXX}|; \
X s|^(LUA=).*|\1 ${LOCALBASE}|; \
X s|^(LUA(INC\|LIB)=).*|\1 $${LUA_\2DIR}|; \
X s|^(CPPFLAGS)(=.*)|\1+\2 -lstdc++|; \
X s|^(CFLAGS)(=.*)|\1+\2|;' \
X ${WRKSRC}/config
X
Xdo-install:
X ${INSTALL_PROGRAM} ${WRKSRC}/bin/tolua ${LUA_BINDIR}
X ${LN} -sf ${LUA_SUBDIR}/tolua ${PREFIX}/bin/tolua-${LUA_VER}
X ${INSTALL_DATA} ${WRKSRC}/include/tolua.h ${LUA_INCDIR}
X ${INSTALL_DATA} ${WRKSRC}/lib/libtolua.a ${LUA_LIBDIR}
X
X.include <bsd.port.pre.mk>
X
XNOT_FOR_ARCHS= powerpc
X.if ${ARCH} == "sparc64" && ${OSVERSION} > 900000
XBROKEN= Does not install on sparc64-9
X.endif
X
X.include <bsd.port.post.mk>
b12b517230e7c526c41212fa19c4e65c
echo x - lang/tolua52/distinfo
sed 's/^X//' >lang/tolua52/distinfo << '9fb721bb13f17e16e74db3afc631e66a'
XSHA256 (tolua-5.2.0.tar.gz) = f3d3836e9d2f11177fb3230ebb4c1ad8be74eb87fa95ce03a79d10df45ef89c3
XSIZE (tolua-5.2.0.tar.gz) = 79025
9fb721bb13f17e16e74db3afc631e66a
echo x - lang/tolua52/pkg-descr
sed 's/^X//' >lang/tolua52/pkg-descr << 'b30ba892217e6040fc957b36d4b97dfb'
XtoLua is a tool that greatly simplifies the integration of C/C++
Xcode with Lua. Based on a "cleaned" header file, toLua automatically
Xgenerates the binding code to access C/C++ features from Lua. Using
XLua-5.0 API and tag method facilities, the current version automatically
Xmaps C/C++ constants, external variables, functions, namespace,
Xclasses, and methods to Lua. It also provides facilities to create
XLua modules.
X
XAuthor: Waldemar Celes <celes@tecgraf.puc-rio.br>
XWWW: http://www.tecgraf.puc-rio.br/~celes/tolua/
b30ba892217e6040fc957b36d4b97dfb
exit
M Mk/bsd.lua.mk
M devel/lua-alien/Makefile
M devel/lua-alien/distinfo
M devel/lua-gettext/Makefile
A devel/lua-gettext/files/extrapatch-lua_gettext.c
M devel/lua-pty/Makefile
A devel/lua-pty/files/extrapatch-pty.c
M lang/lua52/Makefile
M lang/lua52/pkg-plist
M net/luasocket/Makefile
A net/luasocket/files/extrapatch-compat52
Index: Mk/bsd.lua.mk
===================================================================
--- Mk/bsd.lua.mk (revision 318926)
+++ Mk/bsd.lua.mk (working copy)
@@ -33,13 +33,14 @@
# type.
# The available components are:
# lua - The Lua library.
-# tolua - The tolua library (for 4.0-5.1).
+# tolua - The tolua library (for 4.0-5.2).
# toluaxx - The tolua++ library (for 5.0-5.1).
# ruby - The Ruby bindings for Lua (for 4.0-5.0).
# Other components (modules):
# 5.0 - app, compat51, dfui, filename, gettext,
# posix, pty, socket.
# 5.1 - alien, filename, gettext, posix, pty, socket.
+# 5.2 - alien, filename, gettext, posix, pty, socket.
# The available dependency types are:
# build - Requires component for building.
# lib - Requires component for building and running.
@@ -153,7 +154,7 @@
alien app compat51 dfui filename gettext posix \
pty socket
_LUA_DEP_TYPES_ALL= build lib run
-_LUA_VERS_ALL= 4.0 5.0 5.1
+_LUA_VERS_ALL= 4.0 5.0 5.1 5.2
_LUA_PLIST_ALL= LUA_VER LUA_VER_SH LUA_VER_STR LUA_PREFIX LUA_SUBDIR
_LUA_PLIST_DIR_ALL= LUA_BINDIR LUA_INCDIR LUA_LIBDIR \
LUA_MODLIBDIR LUA_MODSHAREDIR
@@ -201,6 +202,18 @@
_LUA_PORT_tolua_5.1= lang/tolua
_LUA_PORT_toluaxx_5.1= lang/tolua++
+_LUA_PORT_lua_5.2= lang/lua52
+_LUA_DEPTYPE_lua_5.2= lib
+_LUA_SHVER_lua_5.2= 1
+
+_LUA_PORT_alien_5.2= devel/lua-alien
+_LUA_PORT_filename_5.2= devel/lua-filename
+_LUA_PORT_gettext_5.1= devel/lua-gettext
+_LUA_PORT_posix_5.2= lang/luaposix
+_LUA_PORT_pty_5.2= devel/lua-pty
+_LUA_PORT_socket_5.2= net/luasocket
+_LUA_PORT_tolua_5.2= lang/tolua52
+
. for comp in ${_LUA_COMPS_ALL}
_LUA_COMP= ${comp}
. for ver in ${_LUA_VERS_ALL}
@@ -208,7 +221,7 @@
# are here only to allow autodetection of installed versions.
. if ${_LUA_COMP} == "lua"
_LUA_LIB_${comp}_${ver}= lua-${ver}.${_LUA_SHVER_${comp}_${ver}}
-_LUA_SHVER_${comp}_${ver}= ${ver:C/[[:digit:]]\.([[:digit:]])/\1/}
+_LUA_SHVER_${comp}_${ver}?= ${ver:C/[[:digit:]]\.([[:digit:]])/\1/}
_LUA_FILE_${comp}_${ver}= ${LOCALBASE}/lib/lua${ver:S/.//g}/liblua.a
. elif ${_LUA_COMP} == "tolua"
_LUA_FILE_${comp}_${ver}= ${LOCALBASE}/lib/lua${ver:S/.//g}/libtolua.a
@@ -443,7 +456,7 @@
# Version.
LUA_VER?= ${_LUA_VER}
-LUA_VER_SH?= ${LUA_VER:C/[[:digit:]]\.([[:digit:]])/\1/}
+LUA_VER_SH?= ${_LUA_SHVER_lua_${LUA_VER}}
LUA_VER_STR?= ${LUA_VER:S/.//g}
# Package name.
Index: devel/lua-alien/Makefile
===================================================================
--- devel/lua-alien/Makefile (revision 318926)
+++ devel/lua-alien/Makefile (working copy)
@@ -1,16 +1,9 @@
-# New ports collection makefile for: lua-alien
-# Date created: 24 Aug 2010
-# Whom: Anonymous
-#
# $FreeBSD$
-#
PORTNAME= alien
PORTVERSION= 0.5.1
CATEGORIES= devel
-MASTER_SITES= http://nodeload.github.com/mascarenhas/alien/tarball/
PKGNAMEPREFIX= ${LUA_PKGNAMEPREFIX}
-DISTFILES= ${DISTVERSION}
DIST_SUBDIR= lua-${PORTNAME}
MAINTAINER= ports@FreeBSD.org
@@ -20,17 +13,21 @@
LIB_DEPENDS= ffi:${PORTSDIR}/devel/libffi
-USE_LUA= 5.1
+OPTIONS_DEFINE= DOCS EXAMPLES DATA
+OPTIONS_DEFAULT=EXAMPLES DATA
+LATEST_LINK= lua-${PORTNAME}
-WRKSRC= ${WRKDIR}/${GITHUB_USER}-${PORTNAME}-${GITHUB_SRC_SUFX}
+USE_GITHUB= yes
+USE_LUA= 5.1+
+
CFLAGS+= -I${LOCALBASE}/include -I${LUA_INCDIR} \
-DBSD -fPIC
LDFLAGS+= -L${LOCALBASE}/lib -L${LUA_LIBDIR} -llua -shared
MAKE_ENV+= LIB_OPTION="${LDFLAGS}" LIB_EXT=".so" LUA="${LUA_CMD}"
TESTS_EXCLUDE= tests/alien tests/alien.lua
-GITHUB_USER= mascarenhas
-GITHUB_SRC_SUFX=e667d5d
+GH_ACCOUNT= mascarenhas
+GH_COMMIT= e667d5d
.if ${CFLAGS:M-fstack-prot*}
MAKE_ENV+= __MAKE_CONF= # inherit CFLAGS only once
@@ -43,6 +40,7 @@
${p:C/:.*//:U}DIR= ${PREFIX}/${${p:C/:.*//:U}DIR_REL}
.endfor
+.include <bsd.port.options.mk>
post-extract: .SILENT
${RM} -rf ${WRKSRC}/libffi
${FIND} ${WRKSRC} -type f -name .git-darcs-dir -delete
@@ -61,17 +59,17 @@
${LUA_MODLIBDIR}/${PORTNAME}
.endfor
${INSTALL_DATA} ${WRKSRC}/src/alien.lua ${LUA_MODSHAREDIR}
-.if !defined(NOPORTDATA)
+.if ${PORT_OPTIONS:MDATA}
${MKDIR} ${DATADIR}
${INSTALL_SCRIPT} ${WRKSRC}/src/constants ${DATADIR}
${TAR} cf - -C${WRKSRC} ${TESTS_EXCLUDE:S,^,--exclude ,} tests \
| ${TAR} xof - -C${DATADIR}
.endif
-.if !defined(NOPORTDOCS)
+.if ${PORT_OPTIONS:MDOCS}
${MKDIR} ${DOCSDIR}
${TAR} cf - -C${WRKSRC}/doc . | ${TAR} xof - -C${DOCSDIR}
.endif
-.if !defined(NOPORTEXAMPLES)
+.if ${PORT_OPTIONS:MEXAMPLES}
${MKDIR} ${EXAMPLESDIR}
${TAR} cf - -C${WRKSRC}/samples . | ${TAR} xof - -C${EXAMPLESDIR}
.endif
Index: devel/lua-alien/distinfo
===================================================================
--- devel/lua-alien/distinfo (revision 318926)
+++ devel/lua-alien/distinfo (working copy)
@@ -1,2 +1,2 @@
-SHA256 (lua-alien/0.5.1) = 5dadc6067f2495da2b78d0ba1fb27d8e33117c138dc76ae4cb500c9b9cd1a26b
-SIZE (lua-alien/0.5.1) = 775968
+SHA256 (lua-alien/alien-0.5.1.tar.gz) = 5dadc6067f2495da2b78d0ba1fb27d8e33117c138dc76ae4cb500c9b9cd1a26b
+SIZE (lua-alien/alien-0.5.1.tar.gz) = 775968
Index: devel/lua-gettext/Makefile
===================================================================
--- devel/lua-gettext/Makefile (revision 318926)
+++ devel/lua-gettext/Makefile (working copy)
@@ -1,22 +1,19 @@
-# New ports collection makefile for: lua50-gettext
-# Date created: 31 May 2006
-# Whom: Andrew Turner <andrew+ports@fubar.geek.nz>
-#
+# Created by: Andrew Turner <andrew+ports@fubar.geek.nz>
# $FreeBSD$
-#
PORTNAME= gettext
PORTVERSION= 1.5
PORTREVISION= 2
CATEGORIES= devel
MASTER_SITES= ${MASTER_SITE_LOCAL}
-MASTER_SITE_SUBDIR= philip
+MASTER_SITE_SUBDIR= philip
PKGNAMEPREFIX= ${LUA_PKGNAMEPREFIX}
DISTFILES= lua_gettext.c?rev=${CVER} gettext.lua?rev=${LVER}
MAINTAINER= ports@FreeBSD.org
COMMENT= Gettext binding for Lua 5
+LATEST_LINK= lua-${PORTNAME}
USE_LUA?= 5.1
USES= gettext
@@ -26,6 +23,10 @@
PLIST_FILES= %%LUA_MODSHAREDIR%%/gettext.lua \
%%LUA_MODLIBDIR%%/lgettext.so
+.if ${USE_LUA} == 5.2
+EXTRA_PATCHES+= ${PATCHDIR}/extrapatch-lua_gettext.c
+.endif
+
do-extract:
${MKDIR} ${WRKSRC}
.for file in ${DISTFILES}
Index: devel/lua-gettext/files/extrapatch-lua_gettext.c
===================================================================
--- devel/lua-gettext/files/extrapatch-lua_gettext.c (revision 0)
+++ devel/lua-gettext/files/extrapatch-lua_gettext.c (working copy)
@@ -0,0 +1,21 @@
+--- ./lua_gettext.c.orig 2013-04-06 12:56:53.000000000 +0900
++++ ./lua_gettext.c 2013-04-06 12:58:02.000000000 +0900
+@@ -70,7 +70,7 @@
+
+ /**** Binding Tables ****/
+
+-const luaL_reg gettext_methods[] = {
++const luaL_Reg gettext_methods[] = {
+ {"init", lua_gettext_init },
+ {"set_package", lua_gettext_set_package },
+ {"set_locale_dir", lua_gettext_set_locale_dir },
+@@ -85,7 +85,8 @@
+ LUA_API int
+ luaopen_lgettext(lua_State *L)
+ {
+- luaL_openlib(L, "GetText", gettext_methods, 0);
++ luaL_newlib(L, gettext_methods);
++ lua_setglobal(L, "GetText");
+
+ return(1);
+ }
Index: devel/lua-pty/Makefile
===================================================================
--- devel/lua-pty/Makefile (revision 318926)
+++ devel/lua-pty/Makefile (working copy)
@@ -1,22 +1,19 @@
-# New ports collection makefile for: lua50-pty
-# Date created: 17 April 2006
-# Whom: Andrew Turner <andrew+ports@fubar.geek.nz>
-#
+# Created by: Andrew Turner <andrew+ports@fubar.geek.nz>
# $FreeBSD$
-#
PORTNAME= pty
PORTVERSION= 1.25
CATEGORIES= devel
MASTER_SITES= ${MASTER_SITE_LOCAL} \
http://files.luaforge.net/releases/compat/Compat-5.1/Compat-5.1release5/:compat
-MASTER_SITE_SUBDIR= philip
+MASTER_SITE_SUBDIR= philip
PKGNAMEPREFIX= ${LUA_PKGNAMEPREFIX}
DISTFILES= pty.lua?rev=1.2 pty.c?rev=1.25
MAINTAINER= ports@FreeBSD.org
COMMENT= Pty (pseudo-terminal) bindings for Lua 5
+LATEST_LINK= lua-${PORTNAME}
USE_LUA?= 5.1
.if ${USE_LUA} == 5.0
@@ -25,6 +22,8 @@
COMPAT_SRC= `(cd ${PORTSDIR}/devel/lua50-compat51 && ${MAKE} -V WRKSRC)`
MAKE_ENV= COMPATDIR="${COMPAT_SRC}"
DISTFILES+= compat-5.1r5.tar.gz:compat
+.elif ${USE_LUA} == 5.2
+EXTRA_PATCHES+= ${PATCHDIR}/extrapatch-pty.c
.endif
PLIST_FILES= %%LUA_MODSHAREDIR%%/pty.lua \
Index: devel/lua-pty/files/extrapatch-pty.c
===================================================================
--- devel/lua-pty/files/extrapatch-pty.c (revision 0)
+++ devel/lua-pty/files/extrapatch-pty.c (working copy)
@@ -0,0 +1,97 @@
+--- pty.c.orig 2013-04-06 12:30:45.000000000 +0900
++++ pty.c 2013-04-06 12:34:38.000000000 +0900
+@@ -76,6 +76,28 @@ struct lua_pty {
+
+ LUA_API int luaopen_lpty(lua_State *);
+
++/* StepMania Lua additions */
++/* unsure where this came from (glenn?) */
++LUALIB_API int
++luaL_pushtype (lua_State *L, int narg)
++{
++ if (!luaL_callmeta(L, narg, "__type"))
++ lua_pushstring(L, luaL_typename(L, narg));
++
++ return 1;
++}
++
++/* this was removed in Lua 5.2 */
++LUALIB_API int
++luaL_typerror (lua_State *L, int narg, const char *tname)
++{
++ const char *msg;
++ luaL_pushtype(L, narg);
++ msg = lua_pushfstring(L, "%s expected, got %s",
++ tname, lua_tostring(L, -1));
++ return luaL_argerror(L, narg, msg);
++}
++
+ /*** UTILTIES ***/
+
+ /*
+@@ -103,12 +103,10 @@ lua_set_instance_handler(lua_State *L,
+ {
+ int metatable_idx, methods_idx;
+
+- lua_pushstring(L, table_name); /* name of our 'class' table */
+- lua_gettable(L, LUA_GLOBALSINDEX); /* get it from globals */
++ lua_getglobal(L, table_name); /* get our 'class' table from globals */
+ methods_idx = lua_gettop(L); /* Find its position on the stack */
+
+- lua_pushstring(L, metatable_name); /* name of our metatable */
+- lua_gettable(L, LUA_GLOBALSINDEX); /* get it from globals */
++ lua_getglobal(L, metatable_name); /* get our metatable from globals */
+ metatable_idx = lua_gettop(L); /* Find its position on the stack */
+
+ /*
+@@ -134,8 +132,7 @@ lua_check_pty(lua_State *L, int ch_index
+ {
+ luaL_checktype(L, ch_index, LUA_TUSERDATA);
+ lua_getmetatable(L, ch_index);
+- lua_pushliteral(L, "PtyMeta");
+- lua_rawget(L, LUA_GLOBALSINDEX);
++ lua_getglobal(L, "PtyMeta");
+ if (!lua_rawequal(L, -1, -2))
+ luaL_typerror(L, ch_index, "Pty");
+ lua_pop(L, 2);
+@@ -146,8 +143,7 @@ static struct lua_pty *
+ lua_push_pty(lua_State *L, struct lua_pty *x)
+ {
+ lua_boxpointer(L, x);
+- lua_pushliteral(L, "PtyMeta");
+- lua_gettable(L, LUA_GLOBALSINDEX);
++ lua_getglobal(L, "PtyMeta");
+ lua_setmetatable(L, -2);
+ return(x);
+ }
+@@ -348,7 +344,7 @@ lua_pty_signal(lua_State *L)
+
+ /**** Binding Tables ****/
+
+-const luaL_reg pty_methods[] = {
++const luaL_Reg pty_methods[] = {
+ {"open", lua_pty_open },
+ {"readline", lua_pty_readline },
+ {"write", lua_pty_write },
+@@ -358,7 +354,7 @@ const luaL_reg pty_methods[] = {
+ {0, 0}
+ };
+
+-const luaL_reg pty_meta_methods[] = {
++const luaL_Reg pty_meta_methods[] = {
+ {"__gc", lua_pty_close },
+ {0, 0}
+ };
+@@ -370,8 +366,10 @@ luaopen_lpty(lua_State *L)
+ {
+ int methods_idx;
+
+- luaL_openlib(L, "Pty", pty_methods, 0); /* fill methods table */
+- luaL_openlib(L, "PtyMeta", pty_meta_methods, 0); /* fill metatable */
++ luaL_newlib(L, pty_methods); /* fill methods table */
++ lua_setglobal(L, "Pty");
++ luaL_newlib(L, pty_meta_methods); /* fill metatable */
++ lua_setglobal(L, "PtyMeta");
+ lua_pop(L, 1);
+
+ lua_set_instance_handler(L, "Pty", "PtyMeta");
Index: lang/lua52/Makefile
===================================================================
--- lang/lua52/Makefile (revision 318926)
+++ lang/lua52/Makefile (working copy)
@@ -11,18 +11,10 @@
LICENSE= MIT
-#USE_LUA= 5.2
-LUA_VER= 5.2
-LUA_VER_SH= 1
-LUA_VER_STR= 52
-LUA_SUBDIR= lua${LUA_VER_STR}
-LUA_PREFIX= ${PREFIX}
-LUA_BINDIR= ${LUA_PREFIX}/bin/${LUA_SUBDIR}
-LUA_INCDIR= ${LUA_PREFIX}/include/${LUA_SUBDIR}
-LUA_LIBDIR= ${LUA_PREFIX}/lib/${LUA_SUBDIR}
-LUA_MODLIBDIR= ${LUA_PREFIX}/lib/lua/${LUA_VER}
-LUA_MODSHAREDIR= ${LUA_PREFIX}/share/lua/${LUA_VER}
+PORTSCOUT= limit:^5\.2
+USE_LUA= 5.2
+LUA_COMPS= #
ALL_TARGET= freebsd
USE_LDCONFIG= yes
MAKE_JOBS_SAFE= yes
@@ -35,6 +27,7 @@
MAN1= lua-${LUA_VER}.1 luac-${LUA_VER}.1
DOCSDIR= ${PREFIX}/share/doc/${LUA_SUBDIR}
LATEST_LINK= ${LUA_SUBDIR}
+PORTDOCS= *
.include <bsd.port.pre.mk>
@@ -64,11 +57,13 @@
${LN} -sf ${LUA_LIBDIR}/liblua-${LUA_VER}.so.${LUA_VER_SH} ${LUA_LIBDIR}/liblua.so
${LN} -sf ${LUA_SUBDIR}/liblua-${LUA_VER}.so.${LUA_VER_SH} ${PREFIX}/lib
${LN} -sf liblua-${LUA_VER}.so.${LUA_VER_SH} ${PREFIX}/lib/liblua-${LUA_VER}.so
-
# Documentation.
.if ${PORT_OPTIONS:MDOCS}
${MKDIR} ${DOCSDIR}
cd ${WRKSRC}/doc && ${INSTALL_DATA} *.html *.gif *.css *.png ${DOCSDIR}
.endif
+# Module directories.
+ ${MKDIR} ${LUA_MODLIBDIR}
+ ${MKDIR} ${LUA_MODSHAREDIR}
.include <bsd.port.post.mk>
Index: lang/lua52/pkg-plist
===================================================================
--- lang/lua52/pkg-plist (revision 318926)
+++ lang/lua52/pkg-plist (working copy)
@@ -1,29 +1,23 @@
-bin/lua-5.2
-bin/lua52/lua
-bin/lua52/luac
-bin/luac-5.2
-include/lua52/lauxlib.h
-include/lua52/lua.h
-include/lua52/lua.hpp
-include/lua52/luaconf.h
-include/lua52/lualib.h
-lib/liblua-5.2.so
-lib/liblua-5.2.so.1
-lib/lua52/liblua-5.2.so.1
-lib/lua52/liblua.a
-lib/lua52/liblua.so
-%%PORTDOCS%%%%DOCSDIR%%/contents.html
-%%PORTDOCS%%%%DOCSDIR%%/logo.gif
-%%PORTDOCS%%%%DOCSDIR%%/lua.css
-%%PORTDOCS%%%%DOCSDIR%%/manual.css
-%%PORTDOCS%%%%DOCSDIR%%/manual.html
-%%PORTDOCS%%%%DOCSDIR%%/osi-certified-72x60.png
-%%PORTDOCS%%%%DOCSDIR%%/readme.html
-%%PORTDOCS%%@dirrm %%DOCSDIR%%
-@dirrm bin/lua52
-@dirrm include/lua52
-@dirrm lib/lua52
-@dirrmtry lib/lua/5.2
+bin/lua-%%LUA_VER%%
+%%LUA_BINDIR%%/lua
+%%LUA_BINDIR%%/luac
+bin/luac-%%LUA_VER%%
+%%LUA_INCDIR%%/lauxlib.h
+%%LUA_INCDIR%%/lua.h
+%%LUA_INCDIR%%/lua.hpp
+%%LUA_INCDIR%%/luaconf.h
+%%LUA_INCDIR%%/lualib.h
+lib/liblua-%%LUA_VER%%.so
+lib/liblua-%%LUA_VER%%.so.%%LUA_VER_SH%%
+%%LUA_LIBDIR%%/liblua-%%LUA_VER%%.so.%%LUA_VER_SH%%
+%%LUA_LIBDIR%%/liblua.a
+%%LUA_LIBDIR%%/liblua.so
+@dirrmtry %%DATADIR%%/%%LUA_VER%%
+@dirrmtry %%DATADIR%%
+@dirrm %%LUA_LIBDIR%%
+@dirrmtry lib/lua/%%LUA_VER%%
@dirrmtry lib/lua
-@dirrmtry share/lua/5.2
-@dirrmtry share/lua
+@dirrm %%LUA_INCDIR%%
+@dirrm %%LUA_BINDIR%%
+@exec mkdir -p %D/%%DATADIR%%/%%LUA_VER%%
+@exec mkdir -p %D/lib/lua/%%LUA_VER%%
Index: net/luasocket/Makefile
===================================================================
--- net/luasocket/Makefile (revision 318926)
+++ net/luasocket/Makefile (working copy)
@@ -1,22 +1,21 @@
-# New ports collection makefile for: luasocket
-# Date created: 17 December 2002
-# Whom: Jan Hornyak <pav@oook.cz>
-#
+# Created by: Jan Hornyak <pav@oook.cz>
# $FreeBSD$
-#
PORTNAME= luasocket
PORTVERSION= 2.0.2
PORTREVISION= 1
CATEGORIES= net
-MASTER_SITES= http://luaforge.net/frs/download.php/2664/
+MASTER_SITES= http://files.luaforge.net/releases/${PORTNAME}/${PORTNAME}/${PORTNAME}-${PORTVERSION}/
PKGNAMEPREFIX= ${LUA_PKGNAMEPREFIX}
MAINTAINER= apache@FreeBSD.org
COMMENT= IPv4 Sockets support for the Lua language
+OPTIONS_DEFINE= DOCS
+LATEST_LINK= luasocket
+
USE_GMAKE= yes
-USE_LUA?= 5.1
+USE_LUA= 5.0+
LUA_COMPS= lua
.if ${USE_LUA} == 5.0
@@ -26,13 +25,16 @@
COMPAT_SRC= `(cd ${PORTSDIR}/devel/lua50-compat51 && ${MAKE} -V WRKSRC)`
MAKE_ENV= COMPATDIR="${COMPAT_SRC}" \
COMPAT_OBJ="${COMPAT_SRC}/compat-5.1.o"
+.elif ${USE_LUA} == 5.2
+EXTRA_PATCHES= ${PATCHDIR}/extrapatch-compat52
.endif
+.include <bsd.port.options.mk>
post-extract:
@${MV} ${WRKSRC}/makefile ${WRKSRC}/Makefile
post-install:
-.if !defined(NOPORTDOCS)
+.if ${PORT_OPTIONS:MDOCS}
@${MKDIR} ${DOCSDIR}
@${INSTALL_DATA} ${WRKSRC}/doc/* ${DOCSDIR}
.endif
Index: net/luasocket/files/extrapatch-compat52
===================================================================
--- net/luasocket/files/extrapatch-compat52 (revision 0)
+++ net/luasocket/files/extrapatch-compat52 (working copy)
@@ -0,0 +1,424 @@
+diff -pru src.orig/auxiliar.c src/auxiliar.c
+--- src.orig/auxiliar.c 2007-10-15 13:21:05.000000000 +0900
++++ src/auxiliar.c 2013-04-04 18:15:58.000000000 +0900
+@@ -24,7 +24,7 @@ int auxiliar_open(lua_State *L) {
+ * Creates a new class with given methods
+ * Methods whose names start with __ are passed directly to the metatable.
+ \*-------------------------------------------------------------------------*/
+-void auxiliar_newclass(lua_State *L, const char *classname, luaL_reg *func) {
++void auxiliar_newclass(lua_State *L, const char *classname, luaL_Reg *func) {
+ luaL_newmetatable(L, classname); /* mt */
+ /* create __index table to place methods */
+ lua_pushstring(L, "__index"); /* mt,"__index" */
+@@ -147,3 +147,11 @@ void *auxiliar_getgroupudata(lua_State *
+ void *auxiliar_getclassudata(lua_State *L, const char *classname, int objidx) {
+ return luaL_checkudata(L, objidx, classname);
+ }
++
++#if LUA_VERSION_NUM > 501
++LUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname) {
++ const char *msg = lua_pushfstring(L, "%s expected, got %s",
++ tname, luaL_typename(L, narg));
++ return luaL_argerror(L, narg, msg);
++}
++#endif /* LUA_VERSION_NUM > 501 */
+diff -pru src.orig/auxiliar.h src/auxiliar.h
+--- src.orig/auxiliar.h 2007-10-15 13:21:05.000000000 +0900
++++ src/auxiliar.h 2013-04-04 18:16:21.000000000 +0900
+@@ -35,7 +35,7 @@
+ #include "lauxlib.h"
+
+ int auxiliar_open(lua_State *L);
+-void auxiliar_newclass(lua_State *L, const char *classname, luaL_reg *func);
++void auxiliar_newclass(lua_State *L, const char *classname, luaL_Reg *func);
+ void auxiliar_add2group(lua_State *L, const char *classname, const char *group);
+ void auxiliar_setclass(lua_State *L, const char *classname, int objidx);
+ void *auxiliar_checkclass(lua_State *L, const char *classname, int objidx);
+@@ -45,4 +45,9 @@ void *auxiliar_getgroupudata(lua_State *
+ int auxiliar_checkboolean(lua_State *L, int objidx);
+ int auxiliar_tostring(lua_State *L);
+
++#if LUA_VERSION_NUM > 501
++/* temporary for compatibility */
++LUALIB_API int (luaL_typerror) (lua_State *L, int narg, const char *tname);
++#endif /* LUA_VERSION_NUM > 501 */
++
+ #endif /* AUXILIAR_H */
+diff -pru src.orig/buffer.c src/buffer.c
+--- src.orig/buffer.c 2013-04-04 17:48:53.000000000 +0900
++++ src/buffer.c 2013-04-04 17:57:05.000000000 +0900
+@@ -225,7 +225,7 @@ static int recvline(p_buffer buf, luaL_B
+ pos = 0;
+ while (pos < count && data[pos] != '\n') {
+ /* we ignore all \r's */
+- if (data[pos] != '\r') luaL_putchar(b, data[pos]);
++ if (data[pos] != '\r') luaL_addchar(b, data[pos]);
+ pos++;
+ }
+ if (pos < count) { /* found '\n' */
+diff -pru src.orig/except.c src/except.c
+--- src.orig/except.c 2007-10-15 13:21:05.000000000 +0900
++++ src/except.c 2013-04-04 18:04:13.000000000 +0900
+@@ -21,7 +21,7 @@ static int finalize(lua_State *L);
+ static int do_nothing(lua_State *L);
+
+ /* except functions */
+-static luaL_reg func[] = {
++static luaL_Reg func[] = {
+ {"newtry", global_newtry},
+ {"protect", global_protect},
+ {NULL, NULL}
+@@ -94,6 +94,10 @@ static int global_protect(lua_State *L)
+ * Init module
+ \*-------------------------------------------------------------------------*/
+ int except_open(lua_State *L) {
++#if LUA_VERSION_NUM > 501
++ luaL_newlib(L, func);
++#else /* LUA_VERSION_NUM > 501 */
+ luaL_openlib(L, NULL, func, 0);
++#endif /* LUA_VERSION_NUM > 501 */
+ return 0;
+ }
+diff -pru src.orig/inet.c src/inet.c
+--- src.orig/inet.c 2007-10-15 13:21:05.000000000 +0900
++++ src/inet.c 2013-04-04 18:05:07.000000000 +0900
+@@ -21,7 +21,7 @@ static void inet_pushresolved(lua_State
+ static int inet_global_gethostname(lua_State *L);
+
+ /* DNS functions */
+-static luaL_reg func[] = {
++static luaL_Reg func[] = {
+ { "toip", inet_global_toip },
+ { "tohostname", inet_global_tohostname },
+ { "gethostname", inet_global_gethostname},
+@@ -38,7 +38,11 @@ int inet_open(lua_State *L)
+ {
+ lua_pushstring(L, "dns");
+ lua_newtable(L);
++#if LUA_VERSION_NUM > 501
++ luaL_newlib(L, func);
++#else /* LUA_VERSION_NUM > 501 */
+ luaL_openlib(L, NULL, func, 0);
++#endif /* LUA_VERSION_NUM > 501 */
+ lua_settable(L, -3);
+ return 0;
+ }
+diff -pru src.orig/luasocket.c src/luasocket.c
+--- src.orig/luasocket.c 2013-04-04 17:48:53.000000000 +0900
++++ src/luasocket.c 2013-04-04 18:08:36.000000000 +0900
+@@ -47,7 +47,7 @@ static int base_open(lua_State *L);
+ /*-------------------------------------------------------------------------*\
+ * Modules and functions
+ \*-------------------------------------------------------------------------*/
+-static const luaL_reg mod[] = {
++static const luaL_Reg mod[] = {
+ {"auxiliar", auxiliar_open},
+ {"except", except_open},
+ {"timeout", timeout_open},
+@@ -59,7 +59,7 @@ static const luaL_reg mod[] = {
+ {NULL, NULL}
+ };
+
+-static luaL_reg func[] = {
++static luaL_Reg func[] = {
+ {"skip", global_skip},
+ {"__unload", global_unload},
+ {NULL, NULL}
+@@ -89,7 +89,12 @@ static int global_unload(lua_State *L) {
+ static int base_open(lua_State *L) {
+ if (socket_open()) {
+ /* export functions (and leave namespace table on top of stack) */
++#if LUA_VERSION_NUM > 501
++ luaL_newlib(L, func);
++ lua_setglobal(L, "socket");
++#else /* LUA_VERSION_NUM > 501 */
+ luaL_openlib(L, "socket", func, 0);
++#endif /* LUA_VERSION_NUM > 501 */
+ #ifdef LUASOCKET_DEBUG
+ lua_pushstring(L, "_DEBUG");
+ lua_pushboolean(L, 1);
+diff -pru src.orig/mime.c src/mime.c
+--- src.orig/mime.c 2007-10-15 13:21:05.000000000 +0900
++++ src/mime.c 2013-04-04 18:08:31.000000000 +0900
+@@ -48,7 +48,7 @@ static size_t qpencode(UC c, UC *input,
+ static size_t qppad(UC *input, size_t size, luaL_Buffer *buffer);
+
+ /* code support functions */
+-static luaL_reg func[] = {
++static luaL_Reg func[] = {
+ { "dot", mime_global_dot },
+ { "b64", mime_global_b64 },
+ { "eol", mime_global_eol },
+@@ -83,7 +83,12 @@ static UC b64unbase[256];
+ \*-------------------------------------------------------------------------*/
+ MIME_API int luaopen_mime_core(lua_State *L)
+ {
++#if LUA_VERSION_NUM > 501
++ luaL_newlib(L, func);
++ lua_setglobal(L, "mime");
++#else /* LUA_VERSION_NUM > 501 */
+ luaL_openlib(L, "mime", func, 0);
++#endif /* LUA_VERSION_NUM > 501 */
+ /* make version string available to scripts */
+ lua_pushstring(L, "_VERSION");
+ lua_pushstring(L, MIME_VERSION);
+@@ -135,7 +140,7 @@ static int mime_global_wrp(lua_State *L)
+ left = length;
+ luaL_addstring(&buffer, CRLF);
+ }
+- luaL_putchar(&buffer, *input);
++ luaL_addchar(&buffer, *input);
+ left--;
+ break;
+ }
+@@ -368,9 +373,9 @@ static void qpsetup(UC *qpclass, UC *qpu
+ \*-------------------------------------------------------------------------*/
+ static void qpquote(UC c, luaL_Buffer *buffer)
+ {
+- luaL_putchar(buffer, '=');
+- luaL_putchar(buffer, qpbase[c >> 4]);
+- luaL_putchar(buffer, qpbase[c & 0x0F]);
++ luaL_addchar(buffer, '=');
++ luaL_addchar(buffer, qpbase[c >> 4]);
++ luaL_addchar(buffer, qpbase[c & 0x0F]);
+ }
+
+ /*-------------------------------------------------------------------------*\
+@@ -400,7 +405,7 @@ static size_t qpencode(UC c, UC *input,
+ qpquote(input[0], buffer);
+ luaL_addstring(buffer, marker);
+ return 0;
+- } else luaL_putchar(buffer, input[0]);
++ } else luaL_addchar(buffer, input[0]);
+ break;
+ /* might have to be quoted always */
+ case QP_QUOTED:
+@@ -408,7 +413,7 @@ static size_t qpencode(UC c, UC *input,
+ break;
+ /* might never have to be quoted */
+ default:
+- luaL_putchar(buffer, input[0]);
++ luaL_addchar(buffer, input[0]);
+ break;
+ }
+ input[0] = input[1]; input[1] = input[2];
+@@ -424,7 +429,7 @@ static size_t qppad(UC *input, size_t si
+ {
+ size_t i;
+ for (i = 0; i < size; i++) {
+- if (qpclass[input[i]] == QP_PLAIN) luaL_putchar(buffer, input[i]);
++ if (qpclass[input[i]] == QP_PLAIN) luaL_addchar(buffer, input[i]);
+ else qpquote(input[i], buffer);
+ }
+ if (size > 0) luaL_addstring(buffer, EQCRLF);
+@@ -494,7 +499,7 @@ static size_t qpdecode(UC c, UC *input,
+ c = qpunbase[input[1]]; d = qpunbase[input[2]];
+ /* if it is an invalid, do not decode */
+ if (c > 15 || d > 15) luaL_addlstring(buffer, (char *)input, 3);
+- else luaL_putchar(buffer, (c << 4) + d);
++ else luaL_addchar(buffer, (c << 4) + d);
+ return 0;
+ case '\r':
+ if (size < 2) return size;
+@@ -502,7 +507,7 @@ static size_t qpdecode(UC c, UC *input,
+ return 0;
+ default:
+ if (input[0] == '\t' || (input[0] > 31 && input[0] < 127))
+- luaL_putchar(buffer, input[0]);
++ luaL_addchar(buffer, input[0]);
+ return 0;
+ }
+ }
+@@ -587,7 +592,7 @@ static int mime_global_qpwrp(lua_State *
+ left = length;
+ luaL_addstring(&buffer, EQCRLF);
+ }
+- luaL_putchar(&buffer, *input);
++ luaL_addchar(&buffer, *input);
+ left--;
+ break;
+ default:
+@@ -595,7 +600,7 @@ static int mime_global_qpwrp(lua_State *
+ left = length;
+ luaL_addstring(&buffer, EQCRLF);
+ }
+- luaL_putchar(&buffer, *input);
++ luaL_addchar(&buffer, *input);
+ left--;
+ break;
+ }
+@@ -630,7 +635,7 @@ static int eolprocess(int c, int last, c
+ return c;
+ }
+ } else {
+- luaL_putchar(buffer, c);
++ luaL_addchar(buffer, c);
+ return 0;
+ }
+ }
+@@ -670,7 +675,7 @@ static int mime_global_eol(lua_State *L)
+ \*-------------------------------------------------------------------------*/
+ static size_t dot(int c, size_t state, luaL_Buffer *buffer)
+ {
+- luaL_putchar(buffer, c);
++ luaL_addchar(buffer, c);
+ switch (c) {
+ case '\r':
+ return 1;
+@@ -678,7 +683,7 @@ static size_t dot(int c, size_t state, l
+ return (state == 1)? 2: 0;
+ case '.':
+ if (state == 2)
+- luaL_putchar(buffer, '.');
++ luaL_addchar(buffer, '.');
+ default:
+ return 0;
+ }
+diff -pru src.orig/select.c src/select.c
+--- src.orig/select.c 2007-10-15 13:21:05.000000000 +0900
++++ src/select.c 2013-04-04 18:05:26.000000000 +0900
+@@ -27,7 +27,7 @@ static void make_assoc(lua_State *L, int
+ static int global_select(lua_State *L);
+
+ /* functions in library namespace */
+-static luaL_reg func[] = {
++static luaL_Reg func[] = {
+ {"select", global_select},
+ {NULL, NULL}
+ };
+@@ -39,7 +39,11 @@ static luaL_reg func[] = {
+ * Initializes module
+ \*-------------------------------------------------------------------------*/
+ int select_open(lua_State *L) {
++#if LUA_VERSION_NUM > 501
++ luaL_newlib(L, func);
++#else /* LUA_VERSION_NUM > 501 */
+ luaL_openlib(L, NULL, func, 0);
++#endif /* LUA_VERSION_NUM > 501 */
+ return 0;
+ }
+
+diff -pru src.orig/tcp.c src/tcp.c
+--- src.orig/tcp.c 2013-04-04 17:48:53.000000000 +0900
++++ src/tcp.c 2013-04-04 18:05:49.000000000 +0900
+@@ -38,7 +38,7 @@ static int meth_setfd(lua_State *L);
+ static int meth_dirty(lua_State *L);
+
+ /* tcp object methods */
+-static luaL_reg tcp[] = {
++static luaL_Reg tcp[] = {
+ {"__gc", meth_close},
+ {"__tostring", auxiliar_tostring},
+ {"accept", meth_accept},
+@@ -73,7 +73,7 @@ static t_opt opt[] = {
+ };
+
+ /* functions in library namespace */
+-static luaL_reg func[] = {
++static luaL_Reg func[] = {
+ {"tcp", global_create},
+ {NULL, NULL}
+ };
+@@ -92,7 +92,11 @@ int tcp_open(lua_State *L)
+ auxiliar_add2group(L, "tcp{client}", "tcp{any}");
+ auxiliar_add2group(L, "tcp{server}", "tcp{any}");
+ /* define library functions */
++#if LUA_VERSION_NUM > 501
++ luaL_newlib(L, func);
++#else /* LUA_VERSION_NUM > 501 */
+ luaL_openlib(L, NULL, func, 0);
++#endif /* LUA_VERSION_NUM > 501 */
+ return 0;
+ }
+
+diff -pru src.orig/timeout.c src/timeout.c
+--- src.orig/timeout.c 2007-10-15 13:21:05.000000000 +0900
++++ src/timeout.c 2013-04-04 18:06:05.000000000 +0900
+@@ -33,7 +33,7 @@
+ static int timeout_lua_gettime(lua_State *L);
+ static int timeout_lua_sleep(lua_State *L);
+
+-static luaL_reg func[] = {
++static luaL_Reg func[] = {
+ { "gettime", timeout_lua_gettime },
+ { "sleep", timeout_lua_sleep },
+ { NULL, NULL }
+@@ -144,7 +144,11 @@ double timeout_gettime(void) {
+ * Initializes module
+ \*-------------------------------------------------------------------------*/
+ int timeout_open(lua_State *L) {
++#if LUA_VERSION_NUM > 501
++ luaL_newlib(L, func);
++#else /* LUA_VERSION_NUM > 501 */
+ luaL_openlib(L, NULL, func, 0);
++#endif /* LUA_VERSION_NUM > 501 */
+ return 0;
+ }
+
+diff -pru src.orig/udp.c src/udp.c
+--- src.orig/udp.c 2007-10-15 13:21:05.000000000 +0900
++++ src/udp.c 2013-04-04 18:06:20.000000000 +0900
+@@ -43,7 +43,7 @@ static int meth_setfd(lua_State *L);
+ static int meth_dirty(lua_State *L);
+
+ /* udp object methods */
+-static luaL_reg udp[] = {
++static luaL_Reg udp[] = {
+ {"__gc", meth_close},
+ {"__tostring", auxiliar_tostring},
+ {"close", meth_close},
+@@ -76,7 +76,7 @@ static t_opt opt[] = {
+ };
+
+ /* functions in library namespace */
+-static luaL_reg func[] = {
++static luaL_Reg func[] = {
+ {"udp", global_create},
+ {NULL, NULL}
+ };
+@@ -95,7 +95,11 @@ int udp_open(lua_State *L)
+ auxiliar_add2group(L, "udp{connected}", "select{able}");
+ auxiliar_add2group(L, "udp{unconnected}", "select{able}");
+ /* define library functions */
++#if LUA_VERSION_NUM > 501
++ luaL_newlib(L, func);
++#else /* LUA_VERSION_NUM > 501 */
+ luaL_openlib(L, NULL, func, 0);
++#endif /* LUA_VERSION_NUM > 501 */
+ return 0;
+ }
+
+diff -pru src.orig/unix.c src/unix.c
+--- src.orig/unix.c 2013-04-04 17:48:53.000000000 +0900
++++ src/unix.c 2013-04-04 18:08:59.000000000 +0900
+@@ -39,7 +39,7 @@ static const char *unix_tryconnect(p_uni
+ static const char *unix_trybind(p_unix un, const char *path);
+
+ /* unix object methods */
+-static luaL_reg un[] = {
++static luaL_Reg un[] = {
+ {"__gc", meth_close},
+ {"__tostring", auxiliar_tostring},
+ {"accept", meth_accept},
+@@ -71,7 +71,7 @@ static t_opt opt[] = {
+ };
+
+ /* our socket creation function */
+-static luaL_reg func[] = {
++static luaL_Reg func[] = {
+ {"unix", global_create},
+ {NULL, NULL}
+ };
+@@ -90,7 +90,12 @@ int luaopen_socket_unix(lua_State *L) {
+ auxiliar_add2group(L, "unix{client}", "unix{any}");
+ auxiliar_add2group(L, "unix{server}", "unix{any}");
+ /* make sure the function ends up in the package table */
++#if LUA_VERSION_NUM > 501
++ luaL_newlib(L, func);
++ lua_setglobal(L, "socket");
++#else /* LUA_VERSION_NUM > 501 */
+ luaL_openlib(L, "socket", func, 0);
++#endif /* LUA_VERSION_NUM > 501 */
+ /* return the function instead of the 'socket' table */
+ lua_pushstring(L, "unix");
+ lua_gettable(L, -2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.