luasocket-scm-0.rockspec 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. package = "LuaSocket"
  2. version = "scm-0"
  3. source = {
  4. url = "https://github.com/diegonehab/luasocket/archive/master.zip",
  5. dir = "luasocket-master",
  6. }
  7. description = {
  8. summary = "Network support for the Lua language",
  9. detailed = [[
  10. LuaSocket is a Lua extension library that is composed by two parts: a C core
  11. that provides support for the TCP and UDP transport layers, and a set of Lua
  12. modules that add support for functionality commonly needed by applications
  13. that deal with the Internet.
  14. ]],
  15. homepage = "http://luaforge.net/projects/luasocket/",
  16. license = "MIT"
  17. }
  18. dependencies = {
  19. "lua >= 5.1"
  20. }
  21. local function make_plat(plat)
  22. local defines = {
  23. unix = {
  24. "LUASOCKET_DEBUG",
  25. "LUASOCKET_API=__attribute__((visibility(\"default\")))",
  26. "UNIX_API=__attribute__((visibility(\"default\")))",
  27. "MIME_API=__attribute__((visibility(\"default\")))"
  28. },
  29. macosx = {
  30. "LUASOCKET_DEBUG",
  31. "UNIX_HAS_SUN_LEN",
  32. "LUASOCKET_API=__attribute__((visibility(\"default\")))",
  33. "UNIX_API=__attribute__((visibility(\"default\")))",
  34. "MIME_API=__attribute__((visibility(\"default\")))"
  35. },
  36. win32 = {
  37. "LUASOCKET_DEBUG",
  38. "NDEBUG",
  39. "LUASOCKET_API=__declspec(dllexport)",
  40. "MIME_API=__declspec(dllexport)"
  41. },
  42. mingw32 = {
  43. "LUASOCKET_DEBUG",
  44. "LUASOCKET_INET_PTON",
  45. "WINVER=0x0501",
  46. "LUASOCKET_API=__declspec(dllexport)",
  47. "MIME_API=__declspec(dllexport)"
  48. }
  49. }
  50. local modules = {
  51. ["socket.core"] = {
  52. 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" },
  53. defines = defines[plat],
  54. incdir = "/src"
  55. },
  56. ["mime.core"] = {
  57. sources = { "src/mime.c", "src/compat.c" },
  58. defines = defines[plat],
  59. incdir = "/src"
  60. },
  61. ["socket.http"] = "src/http.lua",
  62. ["socket.url"] = "src/url.lua",
  63. ["socket.tp"] = "src/tp.lua",
  64. ["socket.ftp"] = "src/ftp.lua",
  65. ["socket.headers"] = "src/headers.lua",
  66. ["socket.smtp"] = "src/smtp.lua",
  67. ltn12 = "src/ltn12.lua",
  68. socket = "src/socket.lua",
  69. mime = "src/mime.lua"
  70. }
  71. if plat == "unix" or plat == "macosx" or plat == "haiku" then
  72. modules["socket.core"].sources[#modules["socket.core"].sources+1] = "src/usocket.c"
  73. if plat == "haiku" then
  74. modules["socket.core"].libraries = {"network"}
  75. end
  76. modules["socket.unix"] = {
  77. sources = { "src/buffer.c", "src/auxiliar.c", "src/options.c", "src/timeout.c", "src/io.c", "src/usocket.c", "src/unix.c" },
  78. defines = defines[plat],
  79. incdir = "/src"
  80. }
  81. modules["socket.serial"] = {
  82. sources = { "src/buffer.c", "src/auxiliar.c", "src/options.c", "src/timeout.c", "src/io.c", "src/usocket.c", "src/serial.c" },
  83. defines = defines[plat],
  84. incdir = "/src"
  85. }
  86. end
  87. if plat == "win32" or plat == "mingw32" then
  88. modules["socket.core"].sources[#modules["socket.core"].sources+1] = "src/wsocket.c"
  89. modules["socket.core"].libraries = { "ws2_32" }
  90. end
  91. return { modules = modules }
  92. end
  93. build = {
  94. type = "builtin",
  95. platforms = {
  96. unix = make_plat("unix"),
  97. macosx = make_plat("macosx"),
  98. haiku = make_plat("haiku"),
  99. win32 = make_plat("win32"),
  100. mingw32 = make_plat("mingw32")
  101. },
  102. copy_directories = { "doc", "samples", "etc", "test" }
  103. }