diff options
| -rw-r--r-- | .github/workflows/build.yml | 4 | ||||
| -rw-r--r-- | docs/installation.html | 70 | ||||
| -rw-r--r-- | makefile | 2 | ||||
| -rw-r--r-- | src/makefile | 27 | ||||
| -rw-r--r-- | src/udp.h | 2 |
5 files changed, 47 insertions, 58 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c079a49..229fcbf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml | |||
| @@ -25,8 +25,10 @@ jobs: | |||
| 25 | uses: luarocks/gh-actions-lua@v10 | 25 | uses: luarocks/gh-actions-lua@v10 |
| 26 | with: | 26 | with: |
| 27 | luaVersion: ${{ matrix.luaVersion }} | 27 | luaVersion: ${{ matrix.luaVersion }} |
| 28 | buildCache: false | ||
| 28 | - name: Setup ‘luarocks’ | 29 | - name: Setup ‘luarocks’ |
| 29 | uses: luarocks/gh-actions-luarocks@v5 | 30 | # master branch until tagged release has luajit & msvcrt fixes |
| 31 | uses: luarocks/gh-actions-luarocks@master | ||
| 30 | - name: Make and install | 32 | - name: Make and install |
| 31 | run: | | 33 | run: | |
| 32 | luarocks make -- luasocket-scm-3.rockspec | 34 | luarocks make -- luasocket-scm-3.rockspec |
diff --git a/docs/installation.html b/docs/installation.html index 25c0bba..b56f50f 100644 --- a/docs/installation.html +++ b/docs/installation.html | |||
| @@ -37,70 +37,30 @@ Installation"> | |||
| 37 | 37 | ||
| 38 | <!-- installation ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 38 | <!-- installation ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
| 39 | 39 | ||
| 40 | <h2>Installation</h2> | 40 | <h2>Installation via luarocks</h2> |
| 41 | |||
| 42 | <p> Here we describe the standard distribution. If the | ||
| 43 | standard doesn't meet your needs, we refer you to the Lua | ||
| 44 | discussion list, where any question about the package scheme | ||
| 45 | will likely already have been answered. </p> | ||
| 46 | |||
| 47 | <h3>Directory structure</h3> | ||
| 48 | |||
| 49 | <p> On Unix systems, the standard distribution uses two base | ||
| 50 | directories, one for system dependent files, and another for system | ||
| 51 | independent files. Let's call these directories <tt><CDIR></tt> | ||
| 52 | and <tt><LDIR></tt>, respectively. | ||
| 53 | For example, in my laptp, Lua 5.1 is configured to | ||
| 54 | use '<tt>/usr/local/lib/lua/5.1</tt>' for | ||
| 55 | <tt><CDIR></tt> and '<tt>/usr/local/share/lua/5.1</tt>' for | ||
| 56 | <tt><LDIR></tt>. On Windows, <tt><CDIR></tt> | ||
| 57 | usually points to the directory where the Lua executable is | ||
| 58 | found, and <tt><LDIR></tt> points to a | ||
| 59 | <tt>lua/</tt> directory inside <tt><CDIR></tt>. (These | ||
| 60 | settings can be overridden by environment variables | ||
| 61 | <tt>LUA_PATH</tt> and <tt>LUA_CPATH</tt>. See the Lua | ||
| 62 | documentation for details.) Here is the standard LuaSocket | ||
| 63 | distribution directory structure:</p> | ||
| 64 | 41 | ||
| 65 | <pre class=example> | ||
| 66 | <LDIR>/ltn12.lua | ||
| 67 | <LDIR>/socket.lua | ||
| 68 | <CDIR>/socket/core.dll | ||
| 69 | <LDIR>/socket/http.lua | ||
| 70 | <LDIR>/socket/tp.lua | ||
| 71 | <LDIR>/socket/ftp.lua | ||
| 72 | <LDIR>/socket/smtp.lua | ||
| 73 | <LDIR>/socket/url.lua | ||
| 74 | <LDIR>/mime.lua | ||
| 75 | <CDIR>/mime/core.dll | ||
| 76 | </pre> | ||
| 77 | 42 | ||
| 78 | <p> Naturally, on Unix systems, <tt>core.dll</tt> | ||
| 79 | would be replaced by <tt>core.so</tt>. | ||
| 80 | </p> | ||
| 81 | 43 | ||
| 82 | <h3>Using LuaSocket</h3> | 44 | <p>LuaSocket can be easily installed using <a href="https://luarocks.org/" target="_blank">LuaRocks</a>, the Lua package manager.</p> |
| 83 | 45 | ||
| 84 | <p> With the above setup, and an interpreter with shared library support, | 46 | <h3>Installing via LuaRocks</h3> |
| 85 | it should be easy to use LuaSocket. Just fire the interpreter and use the | ||
| 86 | <tt>require</tt> function to gain access to whatever module you need:</p> | ||
| 87 | 47 | ||
| 48 | <p>Run the following command in your terminal:</p> | ||
| 88 | <pre class=example> | 49 | <pre class=example> |
| 89 | Lua 5.2.2 Copyright (C) 1994-2013 Lua.org, PUC-Rio | 50 | luarocks install luasocket |
| 90 | > socket = require("socket") | ||
| 91 | > print(socket._VERSION) | ||
| 92 | --> LuaSocket 3.1.0 | ||
| 93 | </pre> | 51 | </pre> |
| 94 | 52 | ||
| 95 | <p> Each module loads their dependencies automatically, so you only need to | 53 | <h3>Verification</h3> |
| 96 | load the modules you directly depend upon: </p> | 54 | <p>To verify that LuaSocket is installed correctly, open Lua and run:</p> |
| 55 | <pre class=example><code> | ||
| 56 | local socket = require("socket") | ||
| 57 | print(socket._VERSION) | ||
| 58 | </code></pre> | ||
| 97 | 59 | ||
| 98 | <pre class=example> | 60 | <p>If you see output like <strong>LuaSocket 3.0</strong>, the installation was successful.</p> |
| 99 | Lua 5.2.2 Copyright (C) 1994-2013 Lua.org, PUC-Rio | 61 | |
| 100 | > http = require("socket.http") | 62 | <h3>More Information</h3> |
| 101 | > print(http.request("http://www.impa.br/~diego/software/luasocket")) | 63 | <p>For more details, visit the <a href="https://github.com/lunarmodules/luasocket" target="_blank">LuaSocket GitHub repository</a>.</p> |
| 102 | --> homepage gets dumped to terminal | ||
| 103 | </pre> | ||
| 104 | 64 | ||
| 105 | <!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 65 | <!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
| 106 | 66 | ||
| @@ -10,7 +10,7 @@ | |||
| 10 | # print print the build settings | 10 | # print print the build settings |
| 11 | 11 | ||
| 12 | PLAT?= linux | 12 | PLAT?= linux |
| 13 | PLATS= macosx linux win32 win64 mingw freebsd solaris | 13 | PLATS= macosx linux win32 win64 mingw freebsd solaris ucrt64 |
| 14 | 14 | ||
| 15 | all: $(PLAT) | 15 | all: $(PLAT) |
| 16 | 16 | ||
diff --git a/src/makefile b/src/makefile index 25b293c..868f98c 100644 --- a/src/makefile +++ b/src/makefile | |||
| @@ -74,6 +74,13 @@ LUAPREFIX_mingw?=/usr | |||
| 74 | CDIR_mingw?=lua/$(LUAV) | 74 | CDIR_mingw?=lua/$(LUAV) |
| 75 | LDIR_mingw?=lua/$(LUAV)/lua | 75 | LDIR_mingw?=lua/$(LUAV)/lua |
| 76 | 76 | ||
| 77 | # where lua headers are found for ucrt64 builds | ||
| 78 | # LUAINC_ucrt64: | ||
| 79 | LUAINC_ucrt64?=/ucrt64/include | ||
| 80 | LUALIB_ucrt64?=/ucrt64/bin/lua$(subst .,,$(LUAV)).dll | ||
| 81 | LUAPREFIX_ucrt64?=/ucrt64 | ||
| 82 | CDIR_ucrt64?=lib/lua/$(LUAV) | ||
| 83 | LDIR_ucrt64?=share/lua/$(LUAV) | ||
| 77 | 84 | ||
| 78 | # LUAINC_win32: | 85 | # LUAINC_win32: |
| 79 | # LUALIB_win32: | 86 | # LUALIB_win32: |
| @@ -153,7 +160,7 @@ print: | |||
| 153 | #------ | 160 | #------ |
| 154 | # Supported platforms | 161 | # Supported platforms |
| 155 | # | 162 | # |
| 156 | PLATS= macosx linux win32 win64 mingw solaris | 163 | PLATS= macosx linux win32 win64 mingw solaris ucrt64 |
| 157 | 164 | ||
| 158 | #------ | 165 | #------ |
| 159 | # Compiler and linker settings | 166 | # Compiler and linker settings |
| @@ -219,6 +226,21 @@ LDFLAGS_mingw= $(LUALIB) -shared -Wl,-s -lws2_32 -o | |||
| 219 | LD_mingw=gcc | 226 | LD_mingw=gcc |
| 220 | SOCKET_mingw=wsocket.o | 227 | SOCKET_mingw=wsocket.o |
| 221 | 228 | ||
| 229 | #------ | ||
| 230 | # Compiler and linker settings | ||
| 231 | # for ucrt64 | ||
| 232 | SO_ucrt64=dll | ||
| 233 | O_ucrt64=o | ||
| 234 | CC_ucrt64=gcc | ||
| 235 | DEF_ucrt64= -DLUASOCKET_$(DEBUG) \ | ||
| 236 | -DWINVER=0x0501 | ||
| 237 | CFLAGS_ucrt64= -I$(LUAINC) $(DEF) -Wall -O2 -fno-common | ||
| 238 | # \ | ||
| 239 | -fvisibility=hidden | ||
| 240 | LDFLAGS_ucrt64= $(LUALIB) -shared -Wl,-s -lws2_32 -o | ||
| 241 | LD_ucrt64=gcc | ||
| 242 | SOCKET_ucrt64=wsocket.o | ||
| 243 | |||
| 222 | 244 | ||
| 223 | #------ | 245 | #------ |
| 224 | # Compiler and linker settings | 246 | # Compiler and linker settings |
| @@ -384,6 +406,9 @@ linux: | |||
| 384 | mingw: | 406 | mingw: |
| 385 | $(MAKE) all PLAT=mingw | 407 | $(MAKE) all PLAT=mingw |
| 386 | 408 | ||
| 409 | ucrt64: | ||
| 410 | $(MAKE) all PLAT=ucrt64 | ||
| 411 | |||
| 387 | solaris: | 412 | solaris: |
| 388 | $(MAKE) all-unix PLAT=solaris | 413 | $(MAKE) all-unix PLAT=solaris |
| 389 | 414 | ||
| @@ -17,7 +17,9 @@ | |||
| 17 | #include "timeout.h" | 17 | #include "timeout.h" |
| 18 | #include "socket.h" | 18 | #include "socket.h" |
| 19 | 19 | ||
| 20 | #ifndef UDP_DATAGRAMSIZE | ||
| 20 | #define UDP_DATAGRAMSIZE 8192 | 21 | #define UDP_DATAGRAMSIZE 8192 |
| 22 | #endif | ||
| 21 | 23 | ||
| 22 | typedef struct t_udp_ { | 24 | typedef struct t_udp_ { |
| 23 | t_socket sock; | 25 | t_socket sock; |
