From e51b0c693c2dbd7f73e40f865caf490465579d85 Mon Sep 17 00:00:00 2001 From: pedro Date: Thu, 16 Dec 2004 13:38:12 +0000 Subject: [PATCH] network support for the lua language, ok jolan@ --- net/luasocket/Makefile | 44 +++++++++++++++++++ net/luasocket/distinfo | 3 ++ net/luasocket/files/init.lua | 4 ++ net/luasocket/patches/patch-buffer_c | 23 ++++++++++ net/luasocket/patches/patch-etc_lua_lua | 13 ++++++ net/luasocket/patches/patch-makefile_Linux | 49 +++++++++++++++++++++ net/luasocket/pkg/DESCR | 4 ++ net/luasocket/pkg/PFRAG.shared | 3 ++ net/luasocket/pkg/PLIST | 51 ++++++++++++++++++++++ 9 files changed, 194 insertions(+) create mode 100644 net/luasocket/Makefile create mode 100644 net/luasocket/distinfo create mode 100644 net/luasocket/files/init.lua create mode 100644 net/luasocket/patches/patch-buffer_c create mode 100644 net/luasocket/patches/patch-etc_lua_lua create mode 100644 net/luasocket/patches/patch-makefile_Linux create mode 100644 net/luasocket/pkg/DESCR create mode 100644 net/luasocket/pkg/PFRAG.shared create mode 100644 net/luasocket/pkg/PLIST diff --git a/net/luasocket/Makefile b/net/luasocket/Makefile new file mode 100644 index 00000000000..2c8eb697eca --- /dev/null +++ b/net/luasocket/Makefile @@ -0,0 +1,44 @@ +# $OpenBSD: Makefile,v 1.1.1.1 2004/12/16 13:38:12 pedro Exp $ + +NOT_FOR_ARCHS= ${NO_SHARED_ARCHS} + +COMMENT= "network support for the lua language" +DISTNAME= luasocket-2.0-beta2 +PKGNAME= ${DISTNAME:S/0-b/0b/} +CATEGORIES= net +MASTER_SITES= ${HOMEPAGE} + +HOMEPAGE= http://www.tecgraf.puc-rio.br/~diego/luasocket/ + +MAINTAINER= Pedro Martelletto + +# MIT +PERMIT_PACKAGE_CDROM= Yes +PERMIT_PACKAGE_FTP= Yes +PERMIT_DISTFILES_CDROM= Yes +PERMIT_DISTFILES_FTP= Yes + +NO_REGRESS= Yes + +BUILD_DEPENDS= ::lang/lua +RUN_DEPENDS= ${BUILD_DEPENDS} + +MAKE_FILE= makefile.Linux # heh, yeah, linux, sure... + +post-extract: + @sed -e "s:@socketpath@:${PREFIX}/lua/luasocket/?.lua:g" \ + ${FILESDIR}/init.lua > ${WRKSRC}/init.lua + +do-install: + ${INSTALL_DATA_DIR} ${PREFIX}/lua/luasocket + ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/luasocket + ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/luasocket + ${INSTALL_DATA} ${WRKSRC}/luasocket*.so.*.* ${PREFIX}/lib/luasocket.so + ${INSTALL_DATA} ${WRKSRC}/mime*.so* ${PREFIX}/lib/mime.so + ${INSTALL_DATA} ${WRKSRC}/lua/*.lua ${PREFIX}/lua/luasocket + ${INSTALL_DATA} ${WRKSRC}/etc/*.lua ${PREFIX}/lua/luasocket + ${INSTALL_DATA} ${WRKSRC}/manual/* ${PREFIX}/share/doc/luasocket + ${INSTALL_DATA} ${WRKSRC}/examples/* ${PREFIX}/share/examples/luasocket + ${INSTALL_DATA} ${WRKSRC}/init.lua ${PREFIX}/lua/luasocket + +.include diff --git a/net/luasocket/distinfo b/net/luasocket/distinfo new file mode 100644 index 00000000000..2ed21e26696 --- /dev/null +++ b/net/luasocket/distinfo @@ -0,0 +1,3 @@ +MD5 (luasocket-2.0-beta2.tar.gz) = d65c3eba249866716f913ee019c347ba +RMD160 (luasocket-2.0-beta2.tar.gz) = 3cecfd21d92eb7a3a8705295c7a8c3d8118ebbad +SHA1 (luasocket-2.0-beta2.tar.gz) = c27e8b20f3e1119f5d6bbf947ecacfdad27b4330 diff --git a/net/luasocket/files/init.lua b/net/luasocket/files/init.lua new file mode 100644 index 00000000000..91377379014 --- /dev/null +++ b/net/luasocket/files/init.lua @@ -0,0 +1,4 @@ +-- $OpenBSD: init.lua,v 1.1.1.1 2004/12/16 13:38:12 pedro Exp $ +-- luasocket's initialization steps +LUA_PATH = lua_addpath(LUA_PATH, "@socketpath@") +require("lua") diff --git a/net/luasocket/patches/patch-buffer_c b/net/luasocket/patches/patch-buffer_c new file mode 100644 index 00000000000..4e2d603aaec --- /dev/null +++ b/net/luasocket/patches/patch-buffer_c @@ -0,0 +1,23 @@ +$OpenBSD: patch-buffer_c,v 1.1.1.1 2004/12/16 13:38:12 pedro Exp $ +--- buffer.c.orig Mon Jul 26 17:17:35 2004 ++++ buffer.c Tue Aug 10 21:11:45 2004 +@@ -75,7 +75,9 @@ int buf_meth_setstats(lua_State *L, p_bu + \*-------------------------------------------------------------------------*/ + int buf_meth_send(lua_State *L, p_buf buf) { + int top = lua_gettop(L); ++#ifdef LUASOCKET_DEBUG + p_tm tm = tm_markstart(buf->tm); ++#endif + int err = IO_DONE; + size_t size, sent; + const char *data = luaL_checklstring(L, 2, &size); +@@ -108,7 +110,9 @@ int buf_meth_send(lua_State *L, p_buf bu + \*-------------------------------------------------------------------------*/ + int buf_meth_receive(lua_State *L, p_buf buf) { + int err = IO_DONE, top = lua_gettop(L); ++#ifdef LUASOCKET_DEBUG + p_tm tm = tm_markstart(buf->tm); ++#endif + luaL_Buffer b; + size_t size; + const char *part = luaL_optlstring(L, 3, "", &size); diff --git a/net/luasocket/patches/patch-etc_lua_lua b/net/luasocket/patches/patch-etc_lua_lua new file mode 100644 index 00000000000..012e32e7fc5 --- /dev/null +++ b/net/luasocket/patches/patch-etc_lua_lua @@ -0,0 +1,13 @@ +$OpenBSD: patch-etc_lua_lua,v 1.1.1.1 2004/12/16 13:38:12 pedro Exp $ +--- etc/lua.lua.orig Mon Jul 26 17:17:36 2004 ++++ etc/lua.lua Fri Oct 15 00:17:54 2004 +@@ -7,6 +7,9 @@ local function find(lib) + f, e1 = loadfile(n) + if f then break end + end ++ if not f then ++ e1 = string.format("could not load package `%s' from path %s", lib, path) ++ end + return f, e1 + end + diff --git a/net/luasocket/patches/patch-makefile_Linux b/net/luasocket/patches/patch-makefile_Linux new file mode 100644 index 00000000000..399c3a85587 --- /dev/null +++ b/net/luasocket/patches/patch-makefile_Linux @@ -0,0 +1,49 @@ +$OpenBSD: patch-makefile_Linux,v 1.1.1.1 2004/12/16 13:38:12 pedro Exp $ +--- makefile.Linux.orig Mon Jul 26 17:17:35 2004 ++++ makefile.Linux Tue Aug 10 21:16:32 2004 +@@ -3,28 +3,13 @@ MV=1.0 + + LUAC=luac + BIN2C=bin2c +-CC=gcc +-OPT=-O2 +-DEF = -DLUASOCKET_DEBUG #-Dsocklen_t=int + +-LOBJS= \ +- luasocket.o \ +- timeout.o \ +- buffer.o \ +- io.o \ +- auxiliar.o \ +- except.o \ +- select.o \ +- options.o \ +- inet.o \ +- tcp.o \ +- udp.o \ +- usocket.o ++LOBJS= luasocket.o timeout.o buffer.o io.o auxiliar.o except.o select.o\ ++ options.o inet.o tcp.o udp.o usocket.o + +-MOBJS= \ +- mime.o ++MOBJS= mime.o + +-CFLAGS=-I../../include $(PROF) $(OPT) $(DBG) $(DEF) -pedantic -W -Wall ++CFLAGS+= -I$(LOCALBASE)/include + + LDYN=luasocket.so.$(LV) + +@@ -33,10 +18,10 @@ MDYN=mime.so.$(MV) + all: $(LDYN) $(MDYN) + + $(LDYN): $(LOBJS) +- gcc -shared -o $(LDYN) $(LOBJS) ++ $(CC) -shared -o $(LDYN) $(LOBJS) + + $(MDYN): $(MOBJS) +- gcc -shared -o $(MDYN) $(MOBJS) ++ $(CC) -shared -o $(MDYN) $(MOBJS) + + # dependencies + auxiliar.o: auxiliar.c auxiliar.h diff --git a/net/luasocket/pkg/DESCR b/net/luasocket/pkg/DESCR new file mode 100644 index 00000000000..6b7b8d6addf --- /dev/null +++ b/net/luasocket/pkg/DESCR @@ -0,0 +1,4 @@ +LuaSocket is a Lua extension library that is composed by two parts: a C +core that provides support for the TCP and UDP transport layers, and a +set of Lua modules that add support for functionality commonly needed by +applications that deal with the Internet. diff --git a/net/luasocket/pkg/PFRAG.shared b/net/luasocket/pkg/PFRAG.shared new file mode 100644 index 00000000000..1805b0db242 --- /dev/null +++ b/net/luasocket/pkg/PFRAG.shared @@ -0,0 +1,3 @@ +@comment $OpenBSD: PFRAG.shared,v 1.1.1.1 2004/12/16 13:38:12 pedro Exp $ +lib/luasocket.so +lib/mime.so diff --git a/net/luasocket/pkg/PLIST b/net/luasocket/pkg/PLIST new file mode 100644 index 00000000000..028ce5fd2af --- /dev/null +++ b/net/luasocket/pkg/PLIST @@ -0,0 +1,51 @@ +@comment $OpenBSD: PLIST,v 1.1.1.1 2004/12/16 13:38:12 pedro Exp $ +@unexec lua ${SYSCONFDIR}/lua/luapkg.lua del luasocket +lua/ +lua/luasocket/ +lua/luasocket/check-links.lua +lua/luasocket/dict.lua +lua/luasocket/ftp.lua +lua/luasocket/get.lua +lua/luasocket/http.lua +lua/luasocket/init.lua +lua/luasocket/lp.lua +lua/luasocket/ltn12.lua +lua/luasocket/lua.lua +lua/luasocket/mime.lua +lua/luasocket/smtp.lua +lua/luasocket/socket.lua +lua/luasocket/tftp.lua +lua/luasocket/tp.lua +lua/luasocket/url.lua +share/doc/luasocket/ +share/doc/luasocket/dns.html +share/doc/luasocket/ftp.html +share/doc/luasocket/home.html +share/doc/luasocket/http.html +share/doc/luasocket/introduction.html +share/doc/luasocket/ltn12.html +share/doc/luasocket/luasocket.png +share/doc/luasocket/mime.html +share/doc/luasocket/reference.css +share/doc/luasocket/reference.html +share/doc/luasocket/smtp.html +share/doc/luasocket/socket.html +share/doc/luasocket/tcp.html +share/doc/luasocket/udp.html +share/doc/luasocket/url.html +share/examples/luasocket/ +share/examples/luasocket/README +share/examples/luasocket/b64.lua +share/examples/luasocket/cddb.lua +share/examples/luasocket/check-memory.lua +share/examples/luasocket/daytimeclnt.lua +share/examples/luasocket/echoclnt.lua +share/examples/luasocket/echosrvr.lua +share/examples/luasocket/eol.lua +share/examples/luasocket/listener.lua +share/examples/luasocket/lpr.lua +share/examples/luasocket/qp.lua +share/examples/luasocket/talker.lua +share/examples/luasocket/tinyirc.lua +@exec lua ${SYSCONFDIR}/lua/luapkg.lua add luasocket ${PREFIX}/lua/luasocket/init.lua +%%SHARED%%