-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathcompat.hiredis.lua
More file actions
104 lines (97 loc) · 4.73 KB
/
Copy pathcompat.hiredis.lua
File metadata and controls
104 lines (97 loc) · 4.73 KB
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
-- compat.hiredis — hiredis 1.2.0, minimal C client for Redis.
--
-- Shape A (C-source compat), same as compat.cjson / compat.zlib: the seven
-- .c files upstream's own CMake compiles into libhiredis, listed verbatim.
-- ssl.c (hiredis_ssl, needs OpenSSL) and test.c stay out.
--
-- INCLUDE LAYOUT. Upstream's INSTALL layout is `<includedir>/hiredis/hiredis.h`
-- and redis-plus-plus's sources spell `#include <hiredis/hiredis.h>`, but the
-- release tarball keeps every header FLAT at the root. mcpp include_dirs are
-- plain globs with no rename, so this package ships two thin wrapper headers
-- through generated_files that re-include the real flat headers with the
-- ANGLE-bracket form (which skips the wrapper's own directory):
-- mcpp_generated/include/hiredis/hiredis.h -> #include <hiredis.h>
-- mcpp_generated/include/hiredis/async.h -> #include <async.h>
-- Same trick as compat.opengl's mcpp_generated/include/GL/gl.h and
-- compat.glx-headers' mcpp_generated/include/X11/Xpoll.h. The real headers'
-- internal `#include "read.h"` etc. are relative, so they resolve next to the
-- real file inside the wrap dir.
--
-- VERSION. 1.2.0 is the classic, widely-shipped release (Debian 12 / Ubuntu
-- 24.04 stable carry 1.2.0; it was vcpkg's long-standing default). Every
-- hiredis 1.x release shares this exact source list and layout, so adding
-- 1.3.x/1.4.x later is just one more xpm row — the mcpp block never changes.
--
-- No CN mirror yet: `url` is a plain string (upstream GitHub release only),
-- the documented fallback when there is no mcpp-res write access
-- (docs/cn-mirror.md; precedent: compat.spdlog).
package = {
spec = "1",
namespace = "compat",
name = "hiredis",
description = "Minimalistic C client for Redis (static, upstream 7-TU source build)",
licenses = {"BSD-3-Clause"},
repo = "https://github.com/redis/hiredis",
type = "package",
xpm = {
linux = {
["1.2.0"] = {
url = "https://github.com/redis/hiredis/archive/refs/tags/v1.2.0.tar.gz",
sha256 = "82ad632d31ee05da13b537c124f819eb88e18851d9cb0c30ae0552084811588c",
},
},
macosx = {
["1.2.0"] = {
url = "https://github.com/redis/hiredis/archive/refs/tags/v1.2.0.tar.gz",
sha256 = "82ad632d31ee05da13b537c124f819eb88e18851d9cb0c30ae0552084811588c",
},
},
windows = {
["1.2.0"] = {
url = "https://github.com/redis/hiredis/archive/refs/tags/v1.2.0.tar.gz",
sha256 = "82ad632d31ee05da13b537c124f819eb88e18851d9cb0c30ae0552084811588c",
},
},
},
mcpp = {
language = "c++23",
import_std = false,
c_standard = "c99", -- hiredis requires C99
-- `*` is the wrap-dir root (where the flat headers live; consumers and
-- the wrappers below resolve `<hiredis.h>` through it), and
-- `mcpp_generated/include` carries the `hiredis/`-prefixed wrappers.
include_dirs = { "*", "mcpp_generated/include" },
-- Upstream CMakeLists' `hiredis_sources`, verbatim — identical across
-- every 1.x release.
sources = {
"*/alloc.c",
"*/async.c",
"*/hiredis.c",
"*/net.c",
"*/read.c",
"*/sds.c",
"*/sockcompat.c",
},
targets = { ["hiredis"] = { kind = "lib" } },
deps = {},
-- Thin `hiredis/`-prefixed wrappers over the flat tarball headers, so
-- consumers write `#include <hiredis/hiredis.h>` exactly like
-- upstream's installed layout. Angle brackets are deliberate: they
-- skip the wrapper's own directory and land on the real headers via
-- the `*` include dir (the flat `"..."` form would self-include).
generated_files = {
["mcpp_generated/include/hiredis/hiredis.h"] = "#pragma once\n#include <hiredis.h>\n",
["mcpp_generated/include/hiredis/async.h"] = "#pragma once\n#include <async.h>\n",
-- redis-plus-plus's async build (event_loop.cpp) includes
-- <hiredis/adapters/libuv.h>; the real header uses relative
-- "../hiredis.h" / "../async.h", which resolve next to it in the
-- wrap dir. Same thin-wrapper trick as the two above.
["mcpp_generated/include/hiredis/adapters/libuv.h"] = "#pragma once\n#include <adapters/libuv.h>\n",
},
windows = {
-- Upstream CMake adds these on WIN32 (same pattern as compat.c-ares).
cflags = { "-D_CRT_SECURE_NO_WARNINGS", "-DWIN32_LEAN_AND_MEAN" },
ldflags = { "-lws2_32", "-lcrypt32" }, -- propagated to consumers
},
},
}