10 Commits

6 changed files with 49 additions and 66 deletions

View File

@ -13,7 +13,7 @@ jobs:
fail-fast: false
matrix:
luaVersion: [ "5.4", "5.3", "5.2", "5.1", "luajit", "luajit-openresty" ]
platform: [ "ubuntu-22.04", "macos-11", "windows-2022" ]
platform: [ "ubuntu-22.04", "macos-14", "windows-2022" ]
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout
@ -22,11 +22,13 @@ jobs:
if: ${{ startsWith(matrix.platform, 'windows') && !startsWith(matrix.luaVersion, 'luajit') }}
uses: ilammy/msvc-dev-cmd@v1
- name: Setup lua
uses: leso-kn/gh-actions-lua@v11-staging
uses: luarocks/gh-actions-lua@v10
with:
luaVersion: ${{ matrix.luaVersion }}
buildCache: false
- name: Setup luarocks
uses: hishamhm/gh-actions-luarocks@master
# master branch until tagged release has luajit & msvcrt fixes
uses: luarocks/gh-actions-luarocks@master
- name: Make and install
run: |
luarocks make -- luasocket-scm-3.rockspec

View File

@ -37,70 +37,30 @@ Installation">
<!-- installation ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<h2>Installation</h2>
<h2>Installation via luarocks</h2>
<p> Here we describe the standard distribution. If the
standard doesn't meet your needs, we refer you to the Lua
discussion list, where any question about the package scheme
will likely already have been answered. </p>
<h3>Directory structure</h3>
<p> On Unix systems, the standard distribution uses two base
directories, one for system dependent files, and another for system
independent files. Let's call these directories <tt>&lt;CDIR&gt;</tt>
and <tt>&lt;LDIR&gt;</tt>, respectively.
For example, in my laptp, Lua&nbsp;5.1 is configured to
use '<tt>/usr/local/lib/lua/5.1</tt>' for
<tt>&lt;CDIR&gt;</tt> and '<tt>/usr/local/share/lua/5.1</tt>' for
<tt>&lt;LDIR&gt;</tt>. On Windows, <tt>&lt;CDIR&gt;</tt>
usually points to the directory where the Lua executable is
found, and <tt>&lt;LDIR&gt;</tt> points to a
<tt>lua/</tt> directory inside <tt>&lt;CDIR&gt;</tt>. (These
settings can be overridden by environment variables
<tt>LUA_PATH</tt> and <tt>LUA_CPATH</tt>. See the Lua
documentation for details.) Here is the standard LuaSocket
distribution directory structure:</p>
<p>LuaSocket can be easily installed using <a href="https://luarocks.org/" target="_blank">LuaRocks</a>, the Lua package manager.</p>
<h3>Installing via LuaRocks</h3>
<p>Run the following command in your terminal:</p>
<pre class=example>
&lt;LDIR&gt;/ltn12.lua
&lt;LDIR&gt;/socket.lua
&lt;CDIR&gt;/socket/core.dll
&lt;LDIR&gt;/socket/http.lua
&lt;LDIR&gt;/socket/tp.lua
&lt;LDIR&gt;/socket/ftp.lua
&lt;LDIR&gt;/socket/smtp.lua
&lt;LDIR&gt;/socket/url.lua
&lt;LDIR&gt;/mime.lua
&lt;CDIR&gt;/mime/core.dll
luarocks install luasocket
</pre>
<p> Naturally, on Unix systems, <tt>core.dll</tt>
would be replaced by <tt>core.so</tt>.
</p>
<h3>Verification</h3>
<p>To verify that LuaSocket is installed correctly, open Lua and run:</p>
<pre class=example><code>
local socket = require("socket")
print(socket._VERSION)
</code></pre>
<h3>Using LuaSocket</h3>
<p>If you see output like <strong>LuaSocket 3.0</strong>, the installation was successful.</p>
<p> With the above setup, and an interpreter with shared library support,
it should be easy to use LuaSocket. Just fire the interpreter and use the
<tt>require</tt> function to gain access to whatever module you need:</p>
<pre class=example>
Lua 5.2.2 Copyright (C) 1994-2013 Lua.org, PUC-Rio
&gt; socket = require("socket")
&gt; print(socket._VERSION)
--&gt; LuaSocket 3.1.0
</pre>
<p> Each module loads their dependencies automatically, so you only need to
load the modules you directly depend upon: </p>
<pre class=example>
Lua 5.2.2 Copyright (C) 1994-2013 Lua.org, PUC-Rio
&gt; http = require("socket.http")
&gt; print(http.request("http://www.impa.br/~diego/software/luasocket"))
--&gt; homepage gets dumped to terminal
</pre>
<h3>More Information</h3>
<p>For more details, visit the <a href="https://github.com/lunarmodules/luasocket" target="_blank">LuaSocket GitHub repository</a>.</p>
<!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->

View File

@ -149,8 +149,8 @@ wild-card address).
<!-- gettimeout +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<p class="name" id="gettimeout">
connected:<b>settimeout(</b>value<b>)</b><br>
unconnected:<b>settimeout(</b>value<b>)</b>
connected:<b>gettimeout()</b><br>
unconnected:<b>gettimeout()</b>
</p>
<p class="description">

View File

@ -10,7 +10,7 @@
# print print the build settings
PLAT?= linux
PLATS= macosx linux win32 win64 mingw freebsd solaris
PLATS= macosx linux win32 win64 mingw freebsd solaris ucrt64
all: $(PLAT)

View File

@ -230,10 +230,6 @@ end
local function adjustheaders(reqt)
-- default headers
local host = reqt.host
--ipv6 host address must be in []
if host:find(":", 1, true) then
host = "["..host.."]"
end
local port = tostring(reqt.port)
if port ~= tostring(SCHEMES[reqt.scheme].port) then
host = host .. ':' .. port end

View File

@ -74,6 +74,13 @@ LUAPREFIX_mingw?=/usr
CDIR_mingw?=lua/$(LUAV)
LDIR_mingw?=lua/$(LUAV)/lua
# where lua headers are found for ucrt64 builds
# LUAINC_ucrt64:
LUAINC_ucrt64?=/ucrt64/include
LUALIB_ucrt64?=/ucrt64/bin/lua$(subst .,,$(LUAV)).dll
LUAPREFIX_ucrt64?=/ucrt64
CDIR_ucrt64?=lib/lua/$(LUAV)
LDIR_ucrt64?=share/lua/$(LUAV)
# LUAINC_win32:
# LUALIB_win32:
@ -153,7 +160,7 @@ print:
#------
# Supported platforms
#
PLATS= macosx linux win32 win64 mingw solaris
PLATS= macosx linux win32 win64 mingw solaris ucrt64
#------
# Compiler and linker settings
@ -219,6 +226,21 @@ LDFLAGS_mingw= $(LUALIB) -shared -Wl,-s -lws2_32 -o
LD_mingw=gcc
SOCKET_mingw=wsocket.o
#------
# Compiler and linker settings
# for ucrt64
SO_ucrt64=dll
O_ucrt64=o
CC_ucrt64=gcc
DEF_ucrt64= -DLUASOCKET_$(DEBUG) \
-DWINVER=0x0501
CFLAGS_ucrt64= -I$(LUAINC) $(DEF) -Wall -O2 -fno-common
# \
-fvisibility=hidden
LDFLAGS_ucrt64= $(LUALIB) -shared -Wl,-s -lws2_32 -o
LD_ucrt64=gcc
SOCKET_ucrt64=wsocket.o
#------
# Compiler and linker settings
@ -384,6 +406,9 @@ linux:
mingw:
$(MAKE) all PLAT=mingw
ucrt64:
$(MAKE) all PLAT=ucrt64
solaris:
$(MAKE) all-unix PLAT=solaris