aboutsummaryrefslogtreecommitdiff
path: root/luasocket-scm-3.rockspec
blob: 475f5944bcb854d6d7c2edf7434fa4ca281f8e6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
package = "LuaSocket"
version = "scm-3"
source = {
  url = "git+https://github.com/lunarmodules/luasocket.git",
  branch = "master"
}
description = {
  summary = "Network support for the Lua language",
  detailed = [[
      LuaSocket is a Lua extension library composed of two parts: a set of C
      modules that provide support for the TCP and UDP transport layers, and a
      set of Lua modules that provide functions commonly needed by applications
      that deal with the Internet.
   ]],
  homepage = "https://github.com/lunarmodules/luasocket",
  license = "MIT"
}
dependencies = {
  "lua >= 5.1"
}

local function make_plat(plat)
  local defines = {
    unix = {
      "LUASOCKET_DEBUG"
    },
    macosx = {
      "LUASOCKET_DEBUG",
      "UNIX_HAS_SUN_LEN"
    },
    win32 = {
      "LUASOCKET_DEBUG",
      "NDEBUG"
    },
    mingw32 = {
      "LUASOCKET_DEBUG",
      -- "LUASOCKET_INET_PTON",
      "WINVER=0x0501"
    }
  }
  local modules = {
    ["socket.core"] = {
      sources = {
        "src/luasocket.c"
        , "src/timeout.c"
        , "src/buffer.c"
        , "src/io.c"
        , "src/auxiliar.c"
        , "src/options.c"
        , "src/inet.c"
        , "src/except.c"
        , "src/select.c"
        , "src/tcp.c"
        , "src/udp.c"
        , "src/compat.c" },
      defines = defines[plat],
      incdir = "/src"
    },
    ["mime.core"] = {
      sources = { "src/mime.c", "src/compat.c" },
      defines = defines[plat],
      incdir = "/src"
    },
    ["socket.http"]    = "src/http.lua",
    ["socket.url"]     = "src/url.lua",
    ["socket.tp"]      = "src/tp.lua",
    ["socket.ftp"]     = "src/ftp.lua",
    ["socket.headers"] = "src/headers.lua",
    ["socket.smtp"]    = "src/smtp.lua",
    ltn12              = "src/ltn12.lua",
    socket             = "src/socket.lua",
    mbox               = "src/mbox.lua",
    mime               = "src/mime.lua"
  }
  if plat == "unix"
    or plat == "macosx"
    or plat == "haiku"
  then
    modules["socket.core"].sources[#modules["socket.core"].sources+1] = "src/usocket.c"
    if plat == "haiku" then
      modules["socket.core"].libraries = {"network"}
    end
    modules["socket.unix"] = {
      sources = {
        "src/buffer.c"
        , "src/compat.c"
        , "src/auxiliar.c"
        , "src/options.c"
        , "src/timeout.c"
        , "src/io.c"
        , "src/usocket.c"
        , "src/unix.c"
        , "src/unixdgram.c"
        , "src/unixstream.c" },
      defines = defines[plat],
      incdir = "/src"
    }
    modules["socket.serial"] = {
      sources = {
        "src/buffer.c"
        , "src/compat.c"
        , "src/auxiliar.c"
        , "src/options.c"
        , "src/timeout.c"
        , "src/io.c"
        , "src/usocket.c"
        , "src/serial.c" },
      defines = defines[plat],
      incdir = "/src"
    }
  end
  if  plat == "win32"
    or plat == "mingw32"
  then
    modules["socket.core"].sources[#modules["socket.core"].sources+1] = "src/wsocket.c"
    modules["socket.core"].libraries = { "ws2_32" }
    modules["socket.core"].libdirs = {}
  end
  return { modules = modules }
end

build = {
  type = "builtin",
  platforms = {
    unix = make_plat("unix"),
    macosx = make_plat("macosx"),
    haiku = make_plat("haiku"),
    win32 = make_plat("win32"),
    mingw32 = make_plat("mingw32")
  },
  copy_directories = {
    "docs"
    , "samples"
    , "test" }
}