Hello,

On 2023/01/04 21:13:29 -0700, Ashlen <euryd...@riseup.net> wrote:
> Updated a couple of things.
> 
> - Use '&&' instead of ';' so that sed only executes after a successful cd.
> 
> - Needed to patch version string in src/luasocket.h, I guess I left that out 
> for
>   some reason.
> 
> - Add TEST_DEPENDS so that make test only works if net/luasocket is installed.
> 
> Is this OK? Any feedback?

thanks for looking at luasocket.

The diff looks mostly OK to me, a few considerations:

 - Fails to package with lua != 5.1; need to set LUAV=5.X for it to
   work (try `FLAVOR=lua52 make package')


 - Maybe we can drop the buffer_* -> ls_buffer_* rename?  FreeBSD had
   similar patches and they dropped them with the update to 3.0.0[0].
   Unfortunately the commit message doesn't explain why.

   A quick compare of `nm /usr/local/lib/lighttpd/mod_magnet.so' with
   the exported symbols from buffer.c show no overlap, but I haven't
   run-tested.

   Anyway, patches are better than sed.  You get to see how the
   sources are being changed and makes easier to spot unwanted
   replacements.


 - `make test' can be simplified by symlinking ${MODLUA_BIN} in
   ${WRKDIR}/bin/lua (which is in the $PATH for ports build.)  The
   test is dummy however, it just loads the library and prints to
   standard output.  The client and server tests are much more
   interesting, but needs to run the server first and then the client;
   difficult to do from a Makefile without some help.

   It would be nice to upstream a patch to change that `lua hello.lua'
   to `${LUA} hello.lua' so that we can override the executable.  it
   would be even better if upstream provided a script to test the
   server/client interaction.


 - I wouldn't patch just to fix the version number, but won't object
   it either since it's already done :)

   Maybe you want to send them upstream too?


 - While here we can also add a lua54 flavor.

I've also taken the liberty to tweak a bit the Makefile, dropping
things no more needed and making it a bit easier to read (IMHO).

This needs some further testing.  Packages that depends on luasockets
are

 - devel/luacopas                no test suite
 - devel/luaevent                test run OK
 - net/jitsi/prosody-plugins     no test suite
 - net/prosody                   no test suite
 - security/luasec               no test suite
 - www/luakit                    with simple runtesting seems fine

I can manage to test it with net/prosody on -RELEASE but will take a
while.

[0]: 
https://cgit.freebsd.org/ports/commit/net/luasocket/files/patch-fnames?id=e4d3bcb751a6a43c3e1f676e0bdb25ebcbb32dc4


Index: Makefile
===================================================================
RCS file: /home/cvs/ports/net/luasocket/Makefile,v
retrieving revision 1.37
diff -u -p -r1.37 Makefile
--- Makefile    11 Mar 2022 19:46:18 -0000      1.37
+++ Makefile    6 Jan 2023 11:47:58 -0000
@@ -1,49 +1,42 @@
 COMMENT=       network support for the lua language
-V=             3.0-rc1
-GH_ACCOUNT=    diegonehab
+
+V=             3.1.0
+GH_ACCOUNT=    lunarmodules
 GH_PROJECT=    luasocket
 GH_TAGNAME=    v$V
-REVISION=      1
-PKGNAME=       ${DISTNAME:S/-rc/rc/}
+
 CATEGORIES=    net
 
-HOMEPAGE=      http://w3.impa.br/~diego/software/luasocket/
+HOMEPAGE=      https://lunarmodules.github.io/luasocket/index.html
 
 # MIT
 PERMIT_PACKAGE=        Yes
 
 MODULES=       lang/lua
 
-FLAVORS=       lua52 lua53
+FLAVORS=       lua52 lua53 lua54
 FLAVOR?=
 
-NO_TEST=       Yes
-
-USE_GMAKE=     Yes
-
 MAKE_FILE=     makefile
 
+CFLAGS+=       -fPIC
+CPPFLAGS+=     -DPIC -DUNIX_HAS_SUN_LEN -DLUA_COMPAT_APIINTCASTS
 MAKE_FLAGS=    CC_linux=${CC} \
                LD_linux=${CC} \
-               CFLAGS_linux="${CFLAGS} -I${MODLUA_INCL_DIR} -fPIC \
-                             -DPIC -DUNIX_HAS_SUN_LEN \
-                             -DLUA_COMPAT_APIINTCASTS" \
-               LDFLAGS_linux="${LDFLAGS} -shared -fPIC -o "
-
-do-install:
-       ${INSTALL_DATA_DIR} ${MODLUA_DATADIR}/socket ${MODLUA_DATADIR}/mime
-       ${INSTALL_DATA_DIR} ${MODLUA_LIBDIR}/socket ${MODLUA_LIBDIR}/mime
+               CFLAGS_linux="${CFLAGS} ${CPPFLAGS} -I${MODLUA_INCL_DIR}" \
+               LDFLAGS_linux="${LDFLAGS} -shared -fPIC -o " \
+               LUAV=${MODLUA_VERSION}
+
+INSTALL_TARGET=        install-unix
+
+TEST_DEPENDS=  ${PKGPATH},${FLAVOR}=$V
+
+post-install:
        ${INSTALL_DATA_DIR} ${MODLUA_DOCDIR} ${MODLUA_EXAMPLEDIR}
-       ${INSTALL_DATA} ${WRKSRC}/src/socket.so ${MODLUA_LIBDIR}/socket/core.so
-       ${INSTALL_DATA} ${WRKSRC}/src/unix.so ${MODLUA_LIBDIR}/socket/unix.so
-       ${INSTALL_DATA} ${WRKSRC}/src/mime.so ${MODLUA_LIBDIR}/mime/core.so
-.for l in ltn12 socket mime
-       ${INSTALL_DATA} ${WRKSRC}/src/$l.lua ${MODLUA_DATADIR}
-.endfor
-.for l in http url tp ftp headers smtp
-       ${INSTALL_DATA} ${WRKSRC}/src/$l.lua ${MODLUA_DATADIR}/socket
-.endfor
-       ${INSTALL_DATA} ${WRKSRC}/doc/* ${MODLUA_DOCDIR}
+       ${INSTALL_DATA} ${WRKSRC}/docs/* ${MODLUA_DOCDIR}
        ${INSTALL_DATA} ${WRKSRC}/samples/* ${MODLUA_EXAMPLEDIR}
+
+pre-test:
+       ln -sf ${MODLUA_BIN} ${WRKDIR}/bin/lua
 
 .include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /home/cvs/ports/net/luasocket/distinfo,v
retrieving revision 1.9
diff -u -p -r1.9 distinfo
--- distinfo    25 Nov 2013 15:27:56 -0000      1.9
+++ distinfo    5 Jan 2023 10:40:51 -0000
@@ -1,2 +1,2 @@
-SHA256 (luasocket-3.0-rc1.tar.gz) = 
i2fZtbVF4baUdT2re9bNvCTCkPKyG6HhTHezKBfqEkk=
-SIZE (luasocket-3.0-rc1.tar.gz) = 328598
+SHA256 (luasocket-3.1.0.tar.gz) = vwM6655ivKqNAH32jBGclmQY6Mnvfk8tfpa93sqcym4=
+SIZE (luasocket-3.1.0.tar.gz) = 336542
Index: patches/patch-docs_installation_html
===================================================================
RCS file: patches/patch-docs_installation_html
diff -N patches/patch-docs_installation_html
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-docs_installation_html        5 Jan 2023 10:40:51 -0000
@@ -0,0 +1,12 @@
+Index: docs/installation.html
+--- docs/installation.html.orig
++++ docs/installation.html
+@@ -89,7 +89,7 @@ it should be easy to use LuaSocket. Just fire the inte
+ Lua 5.2.2  Copyright (C) 1994-2013 Lua.org, PUC-Rio
+ &gt; socket = require("socket")
+ &gt; print(socket._VERSION)
+---&gt; LuaSocket 3.0.0
++--&gt; LuaSocket 3.1.0
+ </pre>
+ 
+ <p> Each module loads their dependencies automatically, so you only need to
Index: patches/patch-makefile_dist
===================================================================
RCS file: patches/patch-makefile_dist
diff -N patches/patch-makefile_dist
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-makefile_dist 5 Jan 2023 10:40:51 -0000
@@ -0,0 +1,12 @@
+Index: makefile.dist
+--- makefile.dist.orig
++++ makefile.dist
+@@ -1,7 +1,7 @@
+ #--------------------------------------------------------------------------
+ # Distribution makefile
+ #--------------------------------------------------------------------------
+-DIST = luasocket-3.0.0
++DIST = luasocket-3.1.0
+ 
+ TEST = \
+       test/README \
Index: patches/patch-src_buffer_c
===================================================================
RCS file: patches/patch-src_buffer_c
diff -N patches/patch-src_buffer_c
--- patches/patch-src_buffer_c  11 Mar 2022 19:46:18 -0000      1.5
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,83 +0,0 @@
---- src/buffer.c.orig  Fri Nov 15 10:51:53 2013
-+++ src/buffer.c       Fri Nov 15 10:54:02 2013
-@@ -31,7 +31,7 @@ static int sendraw(p_buffer buf, const char *data, siz
- /*-------------------------------------------------------------------------*\
- * Initializes module
- \*-------------------------------------------------------------------------*/
--int buffer_open(lua_State *L) {
-+int ls_buffer_open(lua_State *L) {
-     (void) L;
-     return 0;
- }
-@@ -39,7 +39,7 @@ int buffer_open(lua_State *L) {
- /*-------------------------------------------------------------------------*\
- * Initializes C structure 
- \*-------------------------------------------------------------------------*/
--void buffer_init(p_buffer buf, p_io io, p_timeout tm) {
-+void ls_buffer_init(p_buffer buf, p_io io, p_timeout tm) {
-     buf->first = buf->last = 0;
-     buf->io = io;
-     buf->tm = tm;
-@@ -50,7 +50,7 @@ void buffer_init(p_buffer buf, p_io io, p_timeout tm) 
- /*-------------------------------------------------------------------------*\
- * object:getstats() interface
- \*-------------------------------------------------------------------------*/
--int buffer_meth_getstats(lua_State *L, p_buffer buf) {
-+int ls_buffer_meth_getstats(lua_State *L, p_buffer buf) {
-     lua_pushnumber(L, (lua_Number) buf->received);
-     lua_pushnumber(L, (lua_Number) buf->sent);
-     lua_pushnumber(L, timeout_gettime() - buf->birthday);
-@@ -60,7 +60,7 @@ int buffer_meth_getstats(lua_State *L, p_buffer buf) {
- /*-------------------------------------------------------------------------*\
- * object:setstats() interface
- \*-------------------------------------------------------------------------*/
--int buffer_meth_setstats(lua_State *L, p_buffer buf) {
-+int ls_buffer_meth_setstats(lua_State *L, p_buffer buf) {
-     buf->received = (long) luaL_optnumber(L, 2, (lua_Number) buf->received); 
-     buf->sent = (long) luaL_optnumber(L, 3, (lua_Number) buf->sent); 
-     if (lua_isnumber(L, 4)) buf->birthday = timeout_gettime() - 
lua_tonumber(L, 4);
-@@ -71,7 +71,7 @@ int buffer_meth_setstats(lua_State *L, p_buffer buf) {
- /*-------------------------------------------------------------------------*\
- * object:send() interface
- \*-------------------------------------------------------------------------*/
--int buffer_meth_send(lua_State *L, p_buffer buf) {
-+int ls_buffer_meth_send(lua_State *L, p_buffer buf) {
-     int top = lua_gettop(L);
-     int err = IO_DONE;
-     size_t size = 0, sent = 0;
-@@ -106,7 +106,7 @@ int buffer_meth_send(lua_State *L, p_buffer buf) {
- /*-------------------------------------------------------------------------*\
- * object:receive() interface
- \*-------------------------------------------------------------------------*/
--int buffer_meth_receive(lua_State *L, p_buffer buf) {
-+int ls_buffer_meth_receive(lua_State *L, p_buffer buf) {
-     int err = IO_DONE, top = lua_gettop(L);
-     luaL_Buffer b;
-     size_t size;
-@@ -157,7 +157,7 @@ int buffer_meth_receive(lua_State *L, p_buffer buf) {
- /*-------------------------------------------------------------------------*\
- * Determines if there is any data in the read buffer
- \*-------------------------------------------------------------------------*/
--int buffer_isempty(p_buffer buf) {
-+int ls_buffer_isempty(p_buffer buf) {
-     return buf->first >= buf->last;
- }
- 
-@@ -252,7 +252,7 @@ static int recvline(p_buffer buf, luaL_Buffer *b) {
- static void buffer_skip(p_buffer buf, size_t count) {
-     buf->received += count;
-     buf->first += count;
--    if (buffer_isempty(buf)) 
-+    if (ls_buffer_isempty(buf)) 
-         buf->first = buf->last = 0;
- }
- 
-@@ -264,7 +264,7 @@ static int buffer_get(p_buffer buf, const char **data,
-     int err = IO_DONE;
-     p_io io = buf->io;
-     p_timeout tm = buf->tm;
--    if (buffer_isempty(buf)) {
-+    if (ls_buffer_isempty(buf)) {
-         size_t got;
-         err = io->recv(io->ctx, buf->data, BUF_SIZE, &got, tm);
-         buf->first = 0;
Index: patches/patch-src_buffer_h
===================================================================
RCS file: patches/patch-src_buffer_h
diff -N patches/patch-src_buffer_h
--- patches/patch-src_buffer_h  11 Mar 2022 19:46:18 -0000      1.3
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,22 +0,0 @@
---- src/buffer.h.orig  Fri Jun 14 13:27:32 2013
-+++ src/buffer.h       Fri Nov 15 10:48:31 2013
-@@ -34,12 +34,12 @@ typedef struct t_buffer_ {
- } t_buffer;
- typedef t_buffer *p_buffer;
- 
--int buffer_open(lua_State *L);
--void buffer_init(p_buffer buf, p_io io, p_timeout tm);
--int buffer_meth_send(lua_State *L, p_buffer buf);
--int buffer_meth_receive(lua_State *L, p_buffer buf);
--int buffer_meth_getstats(lua_State *L, p_buffer buf);
--int buffer_meth_setstats(lua_State *L, p_buffer buf);
--int buffer_isempty(p_buffer buf);
-+int ls_buffer_open(lua_State *L);
-+void ls_buffer_init(p_buffer buf, p_io io, p_timeout tm);
-+int ls_buffer_meth_send(lua_State *L, p_buffer buf);
-+int ls_buffer_meth_receive(lua_State *L, p_buffer buf);
-+int ls_buffer_meth_getstats(lua_State *L, p_buffer buf);
-+int ls_buffer_meth_setstats(lua_State *L, p_buffer buf);
-+int ls_buffer_isempty(p_buffer buf);
- 
- #endif /* BUF_H */
Index: patches/patch-src_luasocket_c
===================================================================
RCS file: patches/patch-src_luasocket_c
diff -N patches/patch-src_luasocket_c
--- patches/patch-src_luasocket_c       11 Mar 2022 19:46:18 -0000      1.4
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,11 +0,0 @@
---- src/luasocket.c.orig       Fri Jun 14 13:27:32 2013
-+++ src/luasocket.c    Fri Nov 15 10:48:31 2013
-@@ -46,7 +46,7 @@ static const luaL_Reg mod[] = {
-     {"auxiliar", auxiliar_open},
-     {"except", except_open},
-     {"timeout", timeout_open},
--    {"buffer", buffer_open},
-+    {"buffer", ls_buffer_open},
-     {"inet", inet_open},
-     {"tcp", tcp_open},
-     {"udp", udp_open},
Index: patches/patch-src_luasocket_h
===================================================================
RCS file: patches/patch-src_luasocket_h
diff -N patches/patch-src_luasocket_h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_luasocket_h       5 Jan 2023 10:40:51 -0000
@@ -0,0 +1,12 @@
+Index: src/luasocket.h
+--- src/luasocket.h.orig
++++ src/luasocket.h
+@@ -10,7 +10,7 @@
+ /*-------------------------------------------------------------------------* \
+ * Current socket library version
+ \*-------------------------------------------------------------------------*/
+-#define LUASOCKET_VERSION    "LuaSocket 3.0.0"
++#define LUASOCKET_VERSION    "LuaSocket 3.1.0"
+ #define LUASOCKET_COPYRIGHT  "Copyright (C) 1999-2013 Diego Nehab"
+ 
+ /*-------------------------------------------------------------------------*\
Index: patches/patch-src_makefile
===================================================================
RCS file: /home/cvs/ports/net/luasocket/patches/patch-src_makefile,v
retrieving revision 1.6
diff -u -p -r1.6 patch-src_makefile
--- patches/patch-src_makefile  11 Mar 2022 19:46:18 -0000      1.6
+++ patches/patch-src_makefile  5 Jan 2023 10:40:51 -0000
@@ -1,50 +1,12 @@
---- src/makefile.orig  Fri Jun 14 13:27:32 2013
-+++ src/makefile       Mon Nov 25 17:05:50 2013
-@@ -144,15 +144,15 @@ SOCKET_macosx=usocket.o
- # for Linux
- SO_linux=so
- O_linux=o
--CC_linux=gcc
-+CC_linux?=gcc
- DEF_linux=-DLUASOCKET_$(DEBUG) -DLUA_$(COMPAT)_MODULE \
-       -DLUASOCKET_API='__attribute__((visibility("default")))' \
-       -DUNIX_API='__attribute__((visibility("default")))' \
-       -DMIME_API='__attribute__((visibility("default")))'
--CFLAGS_linux= -I$(LUAINC) $(DEF) -pedantic -Wall -Wshadow -Wextra \
-+CFLAGS_linux?= -I$(LUAINC) $(DEF) -pedantic -Wall -Wshadow -Wextra \
-       -Wimplicit -O2 -ggdb3 -fpic -fvisibility=hidden
--LDFLAGS_linux=-O -shared -fpic -o 
--LD_linux=gcc
-+LDFLAGS_linux?=-O -shared -fpic -o 
-+LD_linux?=gcc
- SOCKET_linux=usocket.o
- 
- #------
-@@ -202,12 +202,12 @@ SOCKET_win32=wsocket.obj
+Index: src/makefile
+--- src/makefile.orig
++++ src/makefile
+@@ -272,7 +272,7 @@ SOCKET_win64=wsocket.obj
  #
  SO=$(SO_$(PLAT))
  O=$(O_$(PLAT))
--SOCKET_V=3.0-rc1
--MIME_V=1.0.3
--SOCKET_SO=socket.$(SO).$(SOCKET_V)
--MIME_SO=mime.$(SO).$(MIME_V)
--UNIX_SO=unix.$(SO)
--SERIAL_SO=serial.$(SO)
-+SOCKET_V=3.0
-+MIME_V=1.0
-+SOCKET_SO=socket.so
-+MIME_SO=mime.so
-+UNIX_SO=unix.so
-+SERIAL_SO=serial.so
- SOCKET=$(SOCKET_$(PLAT))
- 
- #------
-@@ -307,7 +307,7 @@ none:
-       @echo "where PLATFORM is one of these:"
-       @echo "   $(PLATS)"
- 
--all: $(SOCKET_SO) $(MIME_SO)
-+all: $(SOCKET_SO) $(MIME_SO) $(UNIX_SO)
- 
- $(SOCKET_SO): $(SOCKET_OBJS)
-       $(LD) $(SOCKET_OBJS) $(LDFLAGS)$@
+-SOCKET_V=3.0.0
++SOCKET_V=3.1.0
+ MIME_V=1.0.3
+ SOCKET_SO=socket-$(SOCKET_V).$(SO)
+ MIME_SO=mime-$(MIME_V).$(SO)
Index: patches/patch-src_mime_c
===================================================================
RCS file: patches/patch-src_mime_c
diff -N patches/patch-src_mime_c
--- patches/patch-src_mime_c    11 Mar 2022 19:46:18 -0000      1.3
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,11 +0,0 @@
---- src/mime.c.orig    Fri Jun 14 13:27:32 2013
-+++ src/mime.c Fri Nov 15 10:48:31 2013
-@@ -8,7 +8,7 @@
- #include "lauxlib.h"
- 
- #if !defined(LUA_VERSION_NUM) || (LUA_VERSION_NUM < 501)
--#include "compat-5.1.h"
-+#include <luacompat.h>
- #endif
- 
- #include "mime.h"
Index: patches/patch-src_serial_c
===================================================================
RCS file: patches/patch-src_serial_c
diff -N patches/patch-src_serial_c
--- patches/patch-src_serial_c  11 Mar 2022 19:46:18 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,54 +0,0 @@
---- src/serial.c.orig  Fri Jun 14 13:27:32 2013
-+++ src/serial.c       Fri Nov 15 11:22:38 2013
-@@ -6,6 +6,7 @@
- 
- #include "lua.h"
- #include "lauxlib.h"
-+#include "luasocket.h"
- 
- #include "auxiliar.h"
- #include "socket.h"
-@@ -90,22 +91,22 @@ LUASOCKET_API int luaopen_socket_serial(lua_State *L) 
- \*-------------------------------------------------------------------------*/
- static int meth_send(lua_State *L) {
-     p_unix un = (p_unix) auxiliar_checkclass(L, "serial{client}", 1);
--    return buffer_meth_send(L, &un->buf);
-+    return ls_buffer_meth_send(L, &un->buf);
- }
- 
- static int meth_receive(lua_State *L) {
-     p_unix un = (p_unix) auxiliar_checkclass(L, "serial{client}", 1);
--    return buffer_meth_receive(L, &un->buf);
-+    return ls_buffer_meth_receive(L, &un->buf);
- }
- 
- static int meth_getstats(lua_State *L) {
-     p_unix un = (p_unix) auxiliar_checkclass(L, "serial{client}", 1);
--    return buffer_meth_getstats(L, &un->buf);
-+    return ls_buffer_meth_getstats(L, &un->buf);
- }
- 
- static int meth_setstats(lua_State *L) {
-     p_unix un = (p_unix) auxiliar_checkclass(L, "serial{client}", 1);
--    return buffer_meth_setstats(L, &un->buf);
-+    return ls_buffer_meth_setstats(L, &un->buf);
- }
- 
- /*-------------------------------------------------------------------------*\
-@@ -126,7 +127,7 @@ static int meth_setfd(lua_State *L) {
- 
- static int meth_dirty(lua_State *L) {
-     p_unix un = (p_unix) auxiliar_checkgroup(L, "serial{any}", 1);
--    lua_pushboolean(L, !buffer_isempty(&un->buf));
-+    lua_pushboolean(L, !ls_buffer_isempty(&un->buf));
-     return 1;
- }
- 
-@@ -183,6 +184,6 @@ static int global_create(lua_State *L) {
-     io_init(&un->io, (p_send) socket_write, (p_recv) socket_read, 
-             (p_error) socket_ioerror, &un->sock);
-     timeout_init(&un->tm, -1, -1);
--    buffer_init(&un->buf, &un->io, &un->tm);
-+    ls_buffer_init(&un->buf, &un->io, &un->tm);
-     return 1;
- }
Index: patches/patch-src_tcp_c
===================================================================
RCS file: patches/patch-src_tcp_c
diff -N patches/patch-src_tcp_c
--- patches/patch-src_tcp_c     11 Mar 2022 19:46:18 -0000      1.3
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,65 +0,0 @@
---- src/tcp.c.orig     Fri Nov 15 10:55:01 2013
-+++ src/tcp.c  Fri Nov 15 10:56:14 2013
-@@ -124,22 +124,22 @@ int tcp_open(lua_State *L)
- \*-------------------------------------------------------------------------*/
- static int meth_send(lua_State *L) {
-     p_tcp tcp = (p_tcp) auxiliar_checkclass(L, "tcp{client}", 1);
--    return buffer_meth_send(L, &tcp->buf);
-+    return ls_buffer_meth_send(L, &tcp->buf);
- }
- 
- static int meth_receive(lua_State *L) {
-     p_tcp tcp = (p_tcp) auxiliar_checkclass(L, "tcp{client}", 1);
--    return buffer_meth_receive(L, &tcp->buf);
-+    return ls_buffer_meth_receive(L, &tcp->buf);
- }
- 
- static int meth_getstats(lua_State *L) {
-     p_tcp tcp = (p_tcp) auxiliar_checkclass(L, "tcp{client}", 1);
--    return buffer_meth_getstats(L, &tcp->buf);
-+    return ls_buffer_meth_getstats(L, &tcp->buf);
- }
- 
- static int meth_setstats(lua_State *L) {
-     p_tcp tcp = (p_tcp) auxiliar_checkclass(L, "tcp{client}", 1);
--    return buffer_meth_setstats(L, &tcp->buf);
-+    return ls_buffer_meth_setstats(L, &tcp->buf);
- }
- 
- /*-------------------------------------------------------------------------*\
-@@ -178,7 +178,7 @@ static int meth_setfd(lua_State *L)
- static int meth_dirty(lua_State *L)
- {
-     p_tcp tcp = (p_tcp) auxiliar_checkgroup(L, "tcp{any}", 1);
--    lua_pushboolean(L, !buffer_isempty(&tcp->buf));
-+    lua_pushboolean(L, !ls_buffer_isempty(&tcp->buf));
-     return 1;
- }
- 
-@@ -203,7 +203,7 @@ static int meth_accept(lua_State *L)
-         io_init(&clnt->io, (p_send) socket_send, (p_recv) socket_recv,
-                 (p_error) socket_ioerror, &clnt->sock);
-         timeout_init(&clnt->tm, -1, -1);
--        buffer_init(&clnt->buf, &clnt->io, &clnt->tm);
-+        ls_buffer_init(&clnt->buf, &clnt->io, &clnt->tm);
-         clnt->family = server->family;
-         return 1;
-     } else {
-@@ -375,7 +375,7 @@ static int tcp_create(lua_State *L, int family) {
-         io_init(&tcp->io, (p_send) socket_send, (p_recv) socket_recv,
-                 (p_error) socket_ioerror, &tcp->sock);
-         timeout_init(&tcp->tm, -1, -1);
--        buffer_init(&tcp->buf, &tcp->io, &tcp->tm);
-+        ls_buffer_init(&tcp->buf, &tcp->io, &tcp->tm);
-         tcp->family = family;
-         return 1;
-     } else {
-@@ -454,7 +454,7 @@ static int global_connect(lua_State *L) {
-     io_init(&tcp->io, (p_send) socket_send, (p_recv) socket_recv,
-             (p_error) socket_ioerror, &tcp->sock);
-     timeout_init(&tcp->tm, -1, -1);
--    buffer_init(&tcp->buf, &tcp->io, &tcp->tm);
-+    ls_buffer_init(&tcp->buf, &tcp->io, &tcp->tm);
-     tcp->sock = SOCKET_INVALID;
-     tcp->family = PF_UNSPEC;
-     /* allow user to pick local address and port */
Index: patches/patch-src_unix_c
===================================================================
RCS file: patches/patch-src_unix_c
diff -N patches/patch-src_unix_c
--- patches/patch-src_unix_c    11 Mar 2022 19:46:18 -0000      1.3
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,56 +0,0 @@
---- src/unix.c.orig    Fri Nov 15 10:56:41 2013
-+++ src/unix.c Fri Nov 15 10:57:41 2013
-@@ -109,22 +109,22 @@ int luaopen_socket_unix(lua_State *L) {
- \*-------------------------------------------------------------------------*/
- static int meth_send(lua_State *L) {
-     p_unix un = (p_unix) auxiliar_checkclass(L, "unix{client}", 1);
--    return buffer_meth_send(L, &un->buf);
-+    return ls_buffer_meth_send(L, &un->buf);
- }
- 
- static int meth_receive(lua_State *L) {
-     p_unix un = (p_unix) auxiliar_checkclass(L, "unix{client}", 1);
--    return buffer_meth_receive(L, &un->buf);
-+    return ls_buffer_meth_receive(L, &un->buf);
- }
- 
- static int meth_getstats(lua_State *L) {
-     p_unix un = (p_unix) auxiliar_checkclass(L, "unix{client}", 1);
--    return buffer_meth_getstats(L, &un->buf);
-+    return ls_buffer_meth_getstats(L, &un->buf);
- }
- 
- static int meth_setstats(lua_State *L) {
-     p_unix un = (p_unix) auxiliar_checkclass(L, "unix{client}", 1);
--    return buffer_meth_setstats(L, &un->buf);
-+    return ls_buffer_meth_setstats(L, &un->buf);
- }
- 
- /*-------------------------------------------------------------------------*\
-@@ -153,7 +153,7 @@ static int meth_setfd(lua_State *L) {
- 
- static int meth_dirty(lua_State *L) {
-     p_unix un = (p_unix) auxiliar_checkgroup(L, "unix{any}", 1);
--    lua_pushboolean(L, !buffer_isempty(&un->buf));
-+    lua_pushboolean(L, !ls_buffer_isempty(&un->buf));
-     return 1;
- }
- 
-@@ -176,7 +176,7 @@ static int meth_accept(lua_State *L) {
-         io_init(&clnt->io, (p_send)socket_send, (p_recv)socket_recv, 
-                 (p_error) socket_ioerror, &clnt->sock);
-         timeout_init(&clnt->tm, -1, -1);
--        buffer_init(&clnt->buf, &clnt->io, &clnt->tm);
-+        ls_buffer_init(&clnt->buf, &clnt->io, &clnt->tm);
-         return 1;
-     } else {
-         lua_pushnil(L); 
-@@ -336,7 +336,7 @@ static int global_create(lua_State *L) {
-         io_init(&un->io, (p_send) socket_send, (p_recv) socket_recv, 
-                 (p_error) socket_ioerror, &un->sock);
-         timeout_init(&un->tm, -1, -1);
--        buffer_init(&un->buf, &un->io, &un->tm);
-+        ls_buffer_init(&un->buf, &un->io, &un->tm);
-         return 1;
-     } else {
-         lua_pushnil(L);
Index: pkg/PLIST
===================================================================
RCS file: /home/cvs/ports/net/luasocket/pkg/PLIST,v
retrieving revision 1.11
diff -u -p -r1.11 PLIST
--- pkg/PLIST   11 Mar 2022 19:46:19 -0000      1.11
+++ pkg/PLIST   6 Jan 2023 11:48:16 -0000
@@ -1,8 +1,9 @@
 lib/lua/${MODLUA_VERSION}/mime/
-lib/lua/${MODLUA_VERSION}/mime/core.so
+@so lib/lua/${MODLUA_VERSION}/mime/core.so
 lib/lua/${MODLUA_VERSION}/socket/
-lib/lua/${MODLUA_VERSION}/socket/core.so
-lib/lua/${MODLUA_VERSION}/socket/unix.so
+@so lib/lua/${MODLUA_VERSION}/socket/core.so
+@so lib/lua/${MODLUA_VERSION}/socket/serial.so
+@so lib/lua/${MODLUA_VERSION}/socket/unix.so
 share/doc/${FULLPKGNAME}/
 share/doc/${FULLPKGNAME}/dns.html
 share/doc/${FULLPKGNAME}/ftp.html
@@ -34,7 +35,6 @@ share/examples/${FULLPKGNAME}/mcsend.lua
 share/examples/${FULLPKGNAME}/talker.lua
 share/examples/${FULLPKGNAME}/tinyirc.lua
 share/lua/${MODLUA_VERSION}/ltn12.lua
-share/lua/${MODLUA_VERSION}/mime/
 share/lua/${MODLUA_VERSION}/mime.lua
 share/lua/${MODLUA_VERSION}/socket/
 share/lua/${MODLUA_VERSION}/socket.lua

Reply via email to