summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander M Pickering <alex@cogarr.net>2026-02-16 20:12:56 -0600
committerAlexander M Pickering <alex@cogarr.net>2026-02-16 20:12:56 -0600
commitf5af62214022da29708ad2b14f1a968d9256e959 (patch)
treeaa0ff724a539beb4a7dd11d9bf81a4bd938c7073
parent1c4b800b1058cf98ad8893c9699129a890f313fd (diff)
downloadluasocket-packaging-f5af62214022da29708ad2b14f1a968d9256e959.tar.gz
luasocket-packaging-f5af62214022da29708ad2b14f1a968d9256e959.tar.bz2
luasocket-packaging-f5af62214022da29708ad2b14f1a968d9256e959.zip
Start working on packaging
-rwxr-xr-xinit15
-rw-r--r--luasocket-scm-3.rockspec137
-rw-r--r--meta.lua58
3 files changed, 205 insertions, 5 deletions
diff --git a/init b/init
index 642d265..82ce7de 100755
--- a/init
+++ b/init
@@ -1 +1,16 @@
1#!/bin/sh -ex 1#!/bin/sh -ex
2
3cp luasocket-packageing/luasocket-scm-3.rockspec luasocket/luasocket-scm-3.rockspec
4cd luasocket
5
6luarocks config variables.CFLAGS " $CFLAGS"
7luarocks make --pack-binary-rock luasocket-scm-3.rockspec
8obj="luasocket-scm-3.$(luarocks config arch).rock"
9cp $obj /root
10cd /root
11if [ -z $(echo $CFLAGS | grep -o -E -- '( |^)-g( |$)') ]; then
12 # And pack the library with upx
13 unzip $obj lib/*
14 upx --no-progress lib/*
15 zip -r "$obj" lib
16fi
diff --git a/luasocket-scm-3.rockspec b/luasocket-scm-3.rockspec
new file mode 100644
index 0000000..e974293
--- /dev/null
+++ b/luasocket-scm-3.rockspec
@@ -0,0 +1,137 @@
1package = "LuaSocket"
2version = "scm-3"
3source = {
4 url = "https://git.lua4.win/luasocket",
5 branch = "master"
6}
7description = {
8 summary = "Network support for the Lua language",
9 detailed = [[
10 LuaSocket is a Lua extension library composed of two parts: a set of C
11 modules that provide support for the TCP and UDP transport layers, and a
12 set of Lua modules that provide functions commonly needed by applications
13 that deal with the Internet.
14
15 This version has been repackage by lua4win.
16 ]],
17 homepage = "https://github.com/lunarmodules/luasocket",
18 license = "MIT"
19}
20dependencies = {
21 "lua >= 5.1"
22}
23
24local function make_plat(plat)
25 local defines = {
26 unix = {
27 "LUASOCKET_DEBUG"
28 },
29 macosx = {
30 "LUASOCKET_DEBUG",
31 "UNIX_HAS_SUN_LEN"
32 },
33 win32 = {
34 "LUASOCKET_DEBUG",
35 "NDEBUG"
36 },
37 mingw32 = {
38 "LUASOCKET_DEBUG",
39 -- "LUASOCKET_INET_PTON",
40 "WINVER=0x0501"
41 }
42 }
43 local modules = {
44 ["socket.core"] = {
45 sources = {
46 "src/luasocket.c"
47 , "src/timeout.c"
48 , "src/buffer.c"
49 , "src/io.c"
50 , "src/auxiliar.c"
51 , "src/options.c"
52 , "src/inet.c"
53 , "src/except.c"
54 , "src/select.c"
55 , "src/tcp.c"
56 , "src/udp.c"
57 , "src/compat.c" },
58 defines = defines[plat],
59 incdir = "/src"
60 },
61 ["mime.core"] = {
62 sources = { "src/mime.c", "src/compat.c" },
63 defines = defines[plat],
64 incdir = "/src"
65 },
66 ["socket.http"] = "src/http.lua",
67 ["socket.url"] = "src/url.lua",
68 ["socket.tp"] = "src/tp.lua",
69 ["socket.ftp"] = "src/ftp.lua",
70 ["socket.headers"] = "src/headers.lua",
71 ["socket.smtp"] = "src/smtp.lua",
72 ltn12 = "src/ltn12.lua",
73 socket = "src/socket.lua",
74 mbox = "src/mbox.lua",
75 mime = "src/mime.lua"
76 }
77 if plat == "unix"
78 or plat == "macosx"
79 or plat == "haiku"
80 then
81 modules["socket.core"].sources[#modules["socket.core"].sources+1] = "src/usocket.c"
82 if plat == "haiku" then
83 modules["socket.core"].libraries = {"network"}
84 end
85 modules["socket.unix"] = {
86 sources = {
87 "src/buffer.c"
88 , "src/compat.c"
89 , "src/auxiliar.c"
90 , "src/options.c"
91 , "src/timeout.c"
92 , "src/io.c"
93 , "src/usocket.c"
94 , "src/unix.c"
95 , "src/unixdgram.c"
96 , "src/unixstream.c" },
97 defines = defines[plat],
98 incdir = "/src"
99 }
100 modules["socket.serial"] = {
101 sources = {
102 "src/buffer.c"
103 , "src/compat.c"
104 , "src/auxiliar.c"
105 , "src/options.c"
106 , "src/timeout.c"
107 , "src/io.c"
108 , "src/usocket.c"
109 , "src/serial.c" },
110 defines = defines[plat],
111 incdir = "/src"
112 }
113 end
114 if plat == "win32"
115 or plat == "mingw32"
116 then
117 modules["socket.core"].sources[#modules["socket.core"].sources+1] = "src/wsocket.c"
118 modules["socket.core"].libraries = { "ws2_32" }
119 modules["socket.core"].libdirs = {}
120 end
121 return { modules = modules }
122end
123
124build = {
125 type = "builtin",
126 platforms = {
127 unix = make_plat("unix"),
128 macosx = make_plat("macosx"),
129 haiku = make_plat("haiku"),
130 win32 = make_plat("win32"),
131 mingw32 = make_plat("mingw32")
132 },
133 copy_directories = {
134 "docs"
135 , "samples"
136 , "test" }
137}
diff --git a/meta.lua b/meta.lua
index 8a67aaa..8d35837 100644
--- a/meta.lua
+++ b/meta.lua
@@ -1,6 +1,54 @@
1return { 1local lua_versions = {
2 ["luasocket"] = { 2 ["51"] = true,
3 requires = {}, 3 ["52"] = true,
4 produces = {}, 4 ["53"] = true,
5 } 5 ["54"] = true,
6} 6}
7
8local optimizations = {
9 tiny = "-Oz",
10 size = "-Os",
11 zero = "-O0",
12 one = "-O1",
13 two = "-O2",
14 three = "-O3",
15 debug = "-Og",
16}
17
18local debug = {
19 release = "",
20 debug = "-g",
21}
22local compilers = {
23 --[[
24 "mingw32",
25 ]]
26 "mingw64",
27 --[[
28 "clang32",
29 "clang64",
30 ]]
31}
32local builds = {}
33
34for version, _, name, optimization, rel, flag, _, image in cartesian(lua_versions, optimizations, debug, compilers) do
35 local buildname = "lusocket-" .. version .. "-" .. image
36 builds[buildname] = {
37 image = "image-luarocks-" .. version .. "-" .. image,
38 requires = {
39 {"git", "lpeg"},
40 {"cicd", "image-luarocks-" .. version .. "-" .. image},
41 {"cicd", "lua" .. table.concat({version, name, rel, image}, "-") .. ":lua" .. version .. ".dll"},
42 },
43 produces = {
44 ["lusocket-3.1.0-1.mingw32-x86_64.rock"] = {"luarocks.sh", "luasocket", image, version, name, rel},
45 },
46 env = {
47 CFLAGS = optimization .. " " .. flag,
48 rockver = version:gsub("(%d)(%d)$", "%1.%2"),
49 version = version,
50 },
51 }
52end
53
54return builds