4 Commits

4 changed files with 45 additions and 69 deletions

View File

@ -25,8 +25,10 @@ jobs:
uses: luarocks/gh-actions-lua@v10 uses: luarocks/gh-actions-lua@v10
with: with:
luaVersion: ${{ matrix.luaVersion }} luaVersion: ${{ matrix.luaVersion }}
buildCache: false
- name: Setup luarocks - name: Setup luarocks
uses: luarocks/gh-actions-luarocks@v5 # master branch until tagged release has luajit & msvcrt fixes
uses: luarocks/gh-actions-luarocks@master
- name: Make and install - name: Make and install
run: | run: |
luarocks make -- luasocket-scm-3.rockspec luarocks make -- luasocket-scm-3.rockspec

View File

@ -37,81 +37,30 @@ Installation">
<!-- 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 <p>LuaSocket can be easily installed using <a href="https://luarocks.org/" target="_blank">LuaRocks</a>, the Lua package manager.</p>
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>
<h3>Installing via LuaRocks</h3>
<p>Run the following command in your terminal:</p>
<pre class=example> <pre class=example>
&lt;LDIR&gt;/ltn12.lua luarocks install luasocket
&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
</pre> </pre>
<p> Naturally, on Unix systems, <tt>core.dll</tt> <h3>Verification</h3>
would be replaced by <tt>core.so</tt>. <p>To verify that LuaSocket is installed correctly, open Lua and run:</p>
</p> <pre class=example><code>
local socket = require("socket")
print(socket._VERSION)
</code></pre>
<p> <p>If you see output like <strong>LuaSocket 3.0</strong>, the installation was successful.</p>
Alternatively, you can build and install LuaSocket using vcpkg dependency manager:
<pre class=example> <h3>More Information</h3>
./vcpkg install luasocket <p>For more details, visit the <a href="https://github.com/lunarmodules/luasocket" target="_blank">LuaSocket GitHub repository</a>.</p>
</pre>
The luasocket port in vcpkg is kept up to date by microsoft team members and community contributors.
If the version is out of date, please create an issue or pull request on the vcpkg repository.
</p>
<h3>Using LuaSocket</h3>
<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>
<!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> <!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->

View File

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

View File

@ -74,6 +74,13 @@ LUAPREFIX_mingw?=/usr
CDIR_mingw?=lua/$(LUAV) CDIR_mingw?=lua/$(LUAV)
LDIR_mingw?=lua/$(LUAV)/lua 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: # LUAINC_win32:
# LUALIB_win32: # LUALIB_win32:
@ -153,7 +160,7 @@ print:
#------ #------
# Supported platforms # Supported platforms
# #
PLATS= macosx linux win32 win64 mingw solaris PLATS= macosx linux win32 win64 mingw solaris ucrt64
#------ #------
# Compiler and linker settings # Compiler and linker settings
@ -219,6 +226,21 @@ LDFLAGS_mingw= $(LUALIB) -shared -Wl,-s -lws2_32 -o
LD_mingw=gcc LD_mingw=gcc
SOCKET_mingw=wsocket.o 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 # Compiler and linker settings
@ -384,6 +406,9 @@ linux:
mingw: mingw:
$(MAKE) all PLAT=mingw $(MAKE) all PLAT=mingw
ucrt64:
$(MAKE) all PLAT=ucrt64
solaris: solaris:
$(MAKE) all-unix PLAT=solaris $(MAKE) all-unix PLAT=solaris