Package init
This commit is contained in:
commit
74e7c13539
65
lua-socket.spec
Normal file
65
lua-socket.spec
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
Name: lua-socket
|
||||||
|
Version: 3.0
|
||||||
|
Release: 0.19
|
||||||
|
Summary: Network support for the Lua language
|
||||||
|
License: MIT
|
||||||
|
URL: https://www.tecgraf.puc-rio.br/~diego/professional/luasocket/
|
||||||
|
Source0: https://github.com/diegonehab/luasocket/archive/v3.0-rc1.tar.gz
|
||||||
|
|
||||||
|
Patch0: luasocket-optflags.patch
|
||||||
|
Patch1: luasocket-no-global-vars.patch
|
||||||
|
Patch2: luasocket-3.0-settimeout.patch
|
||||||
|
|
||||||
|
BuildRequires: gcc lua lua-devel /usr/bin/iconv
|
||||||
|
Requires: lua >= 5.3
|
||||||
|
|
||||||
|
%description
|
||||||
|
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.
|
||||||
|
|
||||||
|
%package devel
|
||||||
|
Summary: Development files for %{name}
|
||||||
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
|
||||||
|
%description devel
|
||||||
|
Header files and libraries for building an extension library for the
|
||||||
|
Lua using %{name}
|
||||||
|
|
||||||
|
%package_help
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -n luasocket-3.0-rc1 -p1
|
||||||
|
|
||||||
|
%build
|
||||||
|
%make_build LUAV=5.3 OPTFLAGS="%{optflags} -fPIC" LDFLAGS="%{?__global_ldflags} -shared -o " linux
|
||||||
|
/usr/bin/iconv -f ISO8859-1 -t UTF8 LICENSE >LICENSE.UTF8
|
||||||
|
mv -f LICENSE.UTF8 LICENSE
|
||||||
|
|
||||||
|
%install
|
||||||
|
make install-unix OPTFLAGS="%{optflags}" INSTALL_TOP=$RPM_BUILD_ROOT \
|
||||||
|
INSTALL_TOP_CDIR=$RPM_BUILD_ROOT%{_libdir}/lua/5.3 \
|
||||||
|
INSTALL_TOP_LDIR=$RPM_BUILD_ROOT%{_datadir}/lua/5.3
|
||||||
|
|
||||||
|
install -d $RPM_BUILD_ROOT%{_includedir}/luasocket
|
||||||
|
install -p src/*.h $RPM_BUILD_ROOT%{_includedir}/luasocket
|
||||||
|
|
||||||
|
%files
|
||||||
|
%defattr(-,root,root)
|
||||||
|
%{!?_licensedir:%global license %%doc}
|
||||||
|
%license LICENSE
|
||||||
|
%{_libdir}/lua/5.3/*
|
||||||
|
%{_datadir}/lua/5.3/*
|
||||||
|
|
||||||
|
%files devel
|
||||||
|
%defattr(-,root,root)
|
||||||
|
%{_includedir}/luasocket
|
||||||
|
|
||||||
|
%files help
|
||||||
|
%defattr(-,root,root)
|
||||||
|
%doc README doc/*
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Mon Sep 16 2019 openEuler Buildteam <buildteam@openeuler.org> - 3.0-0.19
|
||||||
|
- Package init
|
||||||
53
luasocket-3.0-settimeout.patch
Normal file
53
luasocket-3.0-settimeout.patch
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
From 396e9e5ee67dd3169aef6ef734d1f5e6f0ec76a9 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Diego Nehab <diego@impa.br>
|
||||||
|
Date: Mon, 9 Sep 2013 14:23:00 -0300
|
||||||
|
Subject: [PATCH] Fixed timeout bug introduced by commit e81a6ff
|
||||||
|
|
||||||
|
---
|
||||||
|
src/buffer.c | 12 ++++--------
|
||||||
|
1 file changed, 4 insertions(+), 8 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/buffer.c b/src/buffer.c
|
||||||
|
index 4ef4e8e..423d804 100644
|
||||||
|
--- a/src/buffer.c
|
||||||
|
+++ b/src/buffer.c
|
||||||
|
@@ -78,9 +78,7 @@ int buffer_meth_send(lua_State *L, p_buffer buf) {
|
||||||
|
const char *data = luaL_checklstring(L, 2, &size);
|
||||||
|
long start = (long) luaL_optnumber(L, 3, 1);
|
||||||
|
long end = (long) luaL_optnumber(L, 4, -1);
|
||||||
|
-#ifdef LUASOCKET_DEBUG
|
||||||
|
- p_timeout tm = timeout_markstart(buf->tm);
|
||||||
|
-#endif
|
||||||
|
+ timeout_markstart(buf->tm);
|
||||||
|
if (start < 0) start = (long) (size+start+1);
|
||||||
|
if (end < 0) end = (long) (size+end+1);
|
||||||
|
if (start < 1) start = (long) 1;
|
||||||
|
@@ -98,7 +96,7 @@ int buffer_meth_send(lua_State *L, p_buffer buf) {
|
||||||
|
}
|
||||||
|
#ifdef LUASOCKET_DEBUG
|
||||||
|
/* push time elapsed during operation as the last return value */
|
||||||
|
- lua_pushnumber(L, timeout_gettime() - timeout_getstart(tm));
|
||||||
|
+ lua_pushnumber(L, timeout_gettime() - timeout_getstart(buf->tm));
|
||||||
|
#endif
|
||||||
|
return lua_gettop(L) - top;
|
||||||
|
}
|
||||||
|
@@ -111,9 +109,7 @@ int buffer_meth_receive(lua_State *L, p_buffer buf) {
|
||||||
|
luaL_Buffer b;
|
||||||
|
size_t size;
|
||||||
|
const char *part = luaL_optlstring(L, 3, "", &size);
|
||||||
|
-#ifdef LUASOCKET_DEBUG
|
||||||
|
- p_timeout tm = timeout_markstart(buf->tm);
|
||||||
|
-#endif
|
||||||
|
+ timeout_markstart(buf->tm);
|
||||||
|
/* initialize buffer with optional extra prefix
|
||||||
|
* (useful for concatenating previous partial results) */
|
||||||
|
luaL_buffinit(L, &b);
|
||||||
|
@@ -149,7 +145,7 @@ int buffer_meth_receive(lua_State *L, p_buffer buf) {
|
||||||
|
}
|
||||||
|
#ifdef LUASOCKET_DEBUG
|
||||||
|
/* push time elapsed during operation as the last return value */
|
||||||
|
- lua_pushnumber(L, timeout_gettime() - timeout_getstart(tm));
|
||||||
|
+ lua_pushnumber(L, timeout_gettime() - timeout_getstart(buf->tm));
|
||||||
|
#endif
|
||||||
|
return lua_gettop(L) - top;
|
||||||
|
}
|
||||||
31
luasocket-no-global-vars.patch
Normal file
31
luasocket-no-global-vars.patch
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
diff --git a/src/http.lua b/src/http.lua
|
||||||
|
index ac4b2d6..f83dcc5 100644
|
||||||
|
--- a/src/http.lua
|
||||||
|
+++ b/src/http.lua
|
||||||
|
@@ -22,7 +22,7 @@ local _M = socket.http
|
||||||
|
-- Program constants
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
-- connection timeout in seconds
|
||||||
|
-TIMEOUT = 60
|
||||||
|
+_M.TIMEOUT = 60
|
||||||
|
-- default port for document retrieval
|
||||||
|
_M.PORT = 80
|
||||||
|
-- user agent field sent in request
|
||||||
|
@@ -186,7 +186,7 @@ end
|
||||||
|
local function adjusturi(reqt)
|
||||||
|
local u = reqt
|
||||||
|
-- if there is a proxy, we need the full url. otherwise, just a part.
|
||||||
|
- if not reqt.proxy and not PROXY then
|
||||||
|
+ if not reqt.proxy and not _M.PROXY then
|
||||||
|
u = {
|
||||||
|
path = socket.try(reqt.path, "invalid path 'nil'"),
|
||||||
|
params = reqt.params,
|
||||||
|
@@ -198,7 +198,7 @@ local function adjusturi(reqt)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function adjustproxy(reqt)
|
||||||
|
- local proxy = reqt.proxy or PROXY
|
||||||
|
+ local proxy = reqt.proxy or _M.PROXY
|
||||||
|
if proxy then
|
||||||
|
proxy = url.parse(proxy)
|
||||||
|
return proxy.host, proxy.port or 3128
|
||||||
60
luasocket-optflags.patch
Normal file
60
luasocket-optflags.patch
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
--- a/src/makefile
|
||||||
|
+++ b/src/makefile
|
||||||
|
@@ -53,7 +53,7 @@ CDIR_linux?=lib/lua/$(LUAV)
|
||||||
|
LDIR_linux?=share/lua/$(LUAV)
|
||||||
|
|
||||||
|
# where lua headers are found for mingw builds
|
||||||
|
-# LUAINC_mingw:
|
||||||
|
+# LUAINC_mingw:
|
||||||
|
# /opt/local/include
|
||||||
|
LUAINC_mingw_base?=/usr/include
|
||||||
|
LUAINC_mingw?=$(LUAINC_mingw_base)/lua/$(LUAV)
|
||||||
|
@@ -135,7 +135,7 @@ DEF_macosx= -DLUASOCKET_$(DEBUG) -DUNIX_
|
||||||
|
-DMIME_API='__attribute__((visibility("default")))'
|
||||||
|
CFLAGS_macosx= -I$(LUAINC) $(DEF) -pedantic -Wall -O2 -fno-common \
|
||||||
|
-fvisibility=hidden
|
||||||
|
-LDFLAGS_macosx= -bundle -undefined dynamic_lookup -o
|
||||||
|
+LDFLAGS_macosx= -bundle -undefined dynamic_lookup -o
|
||||||
|
LD_macosx= export MACOSX_DEPLOYMENT_TARGET="10.3"; gcc
|
||||||
|
SOCKET_macosx=usocket.o
|
||||||
|
|
||||||
|
@@ -149,9 +149,9 @@ DEF_linux=-DLUASOCKET_$(DEBUG) -DLUA_$(C
|
||||||
|
-DLUASOCKET_API='__attribute__((visibility("default")))' \
|
||||||
|
-DUNIX_API='__attribute__((visibility("default")))' \
|
||||||
|
-DMIME_API='__attribute__((visibility("default")))'
|
||||||
|
-CFLAGS_linux= -I$(LUAINC) $(DEF) -pedantic -Wall -Wshadow -Wextra \
|
||||||
|
- -Wimplicit -O2 -ggdb3 -fpic -fvisibility=hidden
|
||||||
|
-LDFLAGS_linux=-O -shared -fpic -o
|
||||||
|
+CFLAGS_linux= -I$(LUAINC) $(DEF) $(OPTFLAGS) \
|
||||||
|
+ -fvisibility=hidden
|
||||||
|
+LDFLAGS_linux=$(OPTFLAGS) -shared -o
|
||||||
|
LD_linux=gcc
|
||||||
|
SOCKET_linux=usocket.o
|
||||||
|
|
||||||
|
@@ -166,7 +166,7 @@ DEF_mingw= -DLUASOCKET_INET_PTON -DLUASO
|
||||||
|
-DMIME_API='__declspec(dllexport)'
|
||||||
|
CFLAGS_mingw= -I$(LUAINC) $(DEF) -pedantic -Wall -O2 -fno-common \
|
||||||
|
-fvisibility=hidden
|
||||||
|
-LDFLAGS_mingw= $(LUALIB) -shared -Wl,-s -lws2_32 -o
|
||||||
|
+LDFLAGS_mingw= $(LUALIB) -shared -Wl,-s -lws2_32 -o
|
||||||
|
LD_mingw=gcc
|
||||||
|
SOCKET_mingw=wsocket.o
|
||||||
|
|
||||||
|
@@ -181,7 +181,7 @@ DEF_win32= //D "WIN32" //D "NDEBUG" //D
|
||||||
|
//D "LUASOCKET_API=__declspec(dllexport)" //D "_CRT_SECURE_NO_WARNINGS" \
|
||||||
|
//D "_WINDLL" //D "LUA_$(COMPAT)_MODULE" \
|
||||||
|
//D "MIME_API=__declspec(dllexport)" \
|
||||||
|
- //D "LUASOCKET_$(DEBUG)"
|
||||||
|
+ //D "LUASOCKET_$(DEBUG)"
|
||||||
|
CFLAGS_win32=//I "$(LUAINC)" $(DEF) //O2 //Ot //MD //W3 //nologo
|
||||||
|
LDFLAGS_win32= //nologo //link //NOLOGO //DLL //INCREMENTAL:NO \
|
||||||
|
//MANIFEST //MANIFESTFILE:"intermediate.manifest" \
|
||||||
|
@@ -323,7 +323,7 @@ $(UNIX_SO): $(UNIX_OBJS)
|
||||||
|
$(SERIAL_SO): $(SERIAL_OBJS)
|
||||||
|
$(LD) $(SERIAL_OBJS) $(LDFLAGS)$@
|
||||||
|
|
||||||
|
-install:
|
||||||
|
+install:
|
||||||
|
$(INSTALL_DIR) $(INSTALL_TOP_LDIR)
|
||||||
|
$(INSTALL_DATA) $(TO_TOP_LDIR) $(INSTALL_TOP_LDIR)
|
||||||
|
$(INSTALL_DIR) $(INSTALL_SOCKET_LDIR)
|
||||||
BIN
v3.0-rc1.tar.gz
Normal file
BIN
v3.0-rc1.tar.gz
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user