-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathcompat.yaml-cpp.lua
More file actions
151 lines (143 loc) · 7.14 KB
/
Copy pathcompat.yaml-cpp.lua
File metadata and controls
151 lines (143 loc) · 7.14 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
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
-- compat.yaml-cpp — yaml-cpp, a YAML 1.2 parser and emitter for C++.
--
-- Shape A (C++ source compat): no configure step, no generated config header,
-- no submodules, no platform code in the library itself, so one source list
-- covers linux/macosx/windows and both versions.
--
-- TWO VERSIONS, ONE SOURCE LIST. 0.9.0 adds exactly one translation unit
-- (src/fptostring.cpp, shortest round-trip float formatting over the vendored
-- src/contrib/dragonbox.h) and one public header (yaml-cpp/fptostring.h); the
-- `*/src/*.cpp` glob picks it up where it exists. The two tags are spelled
-- differently upstream (`0.8.0` vs `yaml-cpp-0.9.0`), so the archive wrap dirs
-- differ too (`yaml-cpp-0.8.0/` vs `yaml-cpp-yaml-cpp-0.9.0/`); the leading `*`
-- absorbs both.
--
-- Sources are upstream's CMake target exactly: `src/*.cpp` plus, with
-- YAML_CPP_BUILD_CONTRIB at its default ON, `src/contrib/*.cpp` (the
-- GraphBuilder API declared in the public yaml-cpp/contrib/graphbuilder.h).
-- The src/ headers are all reached by same-directory quoted includes, so the
-- private `src` include root upstream adds is not needed.
--
-- Upstream defect, left as upstream has it: GraphBuilderInterface's destructor
-- is declared pure virtual and defined nowhere, so a class derived from it
-- links only if its user defines `~GraphBuilderInterface()`. Supplying it here
-- would give every consumer who already writes it a duplicate symbol.
--
-- YAML_CPP_STATIC_DEFINE. Upstream's CMake makes it a PUBLIC definition of a
-- static build, and include/yaml-cpp/dll.h is the only header that reads it.
-- Without it, on the MSVC ABI (this index's windows leg defines _MSC_VER),
-- every YAML_CPP_API declaration becomes __declspec(dllimport) and a consumer
-- of these statically linked objects fails with `__declspec(dllimport)`
-- undefined symbols; on ELF it is only the difference between
-- visibility("default") and nothing, so Linux never notices. A descriptor's
-- `defines` reach only this package's own TUs, so the define is delivered to
-- consumers by a same-named shim that every public header already funnels
-- through, and tests/examples/yaml-cpp asserts it arrived.
--
-- openkal: nothing here is conditional on it. yaml-cpp needs only the C++
-- standard library, and its one compiler-specific branch (dragonbox.h's
-- <intrin.h> under _MSC_VER) is taken only where _MSC_VER is defined.
-- tests/openkal/members.toml measures tests/examples/yaml-cpp.
package = {
spec = "1",
namespace = "compat",
name = "yaml-cpp",
description = "yaml-cpp — YAML 1.2 parser and emitter for C++ (static)",
licenses = {"MIT"},
repo = "https://github.com/jbeder/yaml-cpp",
type = "package",
xpm = {
linux = {
["0.8.0"] = {
url = {
GLOBAL = "https://github.com/jbeder/yaml-cpp/archive/refs/tags/0.8.0.tar.gz",
CN = "https://gitcode.com/mcpp-res/yaml-cpp/releases/download/0.8.0/yaml-cpp-0.8.0.tar.gz",
},
sha256 = "fbe74bbdcee21d656715688706da3c8becfd946d92cd44705cc6098bb23b3a16",
},
["0.9.0"] = {
url = {
GLOBAL = "https://github.com/jbeder/yaml-cpp/archive/refs/tags/yaml-cpp-0.9.0.tar.gz",
CN = "https://gitcode.com/mcpp-res/yaml-cpp/releases/download/0.9.0/yaml-cpp-0.9.0.tar.gz",
},
sha256 = "25cb043240f828a8c51beb830569634bc7ac603978e0f69d6b63558dadefd49a",
},
},
macosx = {
["0.8.0"] = {
url = {
GLOBAL = "https://github.com/jbeder/yaml-cpp/archive/refs/tags/0.8.0.tar.gz",
CN = "https://gitcode.com/mcpp-res/yaml-cpp/releases/download/0.8.0/yaml-cpp-0.8.0.tar.gz",
},
sha256 = "fbe74bbdcee21d656715688706da3c8becfd946d92cd44705cc6098bb23b3a16",
},
["0.9.0"] = {
url = {
GLOBAL = "https://github.com/jbeder/yaml-cpp/archive/refs/tags/yaml-cpp-0.9.0.tar.gz",
CN = "https://gitcode.com/mcpp-res/yaml-cpp/releases/download/0.9.0/yaml-cpp-0.9.0.tar.gz",
},
sha256 = "25cb043240f828a8c51beb830569634bc7ac603978e0f69d6b63558dadefd49a",
},
},
windows = {
["0.8.0"] = {
url = {
GLOBAL = "https://github.com/jbeder/yaml-cpp/archive/refs/tags/0.8.0.tar.gz",
CN = "https://gitcode.com/mcpp-res/yaml-cpp/releases/download/0.8.0/yaml-cpp-0.8.0.tar.gz",
},
sha256 = "fbe74bbdcee21d656715688706da3c8becfd946d92cd44705cc6098bb23b3a16",
},
["0.9.0"] = {
url = {
GLOBAL = "https://github.com/jbeder/yaml-cpp/archive/refs/tags/yaml-cpp-0.9.0.tar.gz",
CN = "https://gitcode.com/mcpp-res/yaml-cpp/releases/download/0.9.0/yaml-cpp-0.9.0.tar.gz",
},
sha256 = "25cb043240f828a8c51beb830569634bc7ac603978e0f69d6b63558dadefd49a",
},
},
},
mcpp = {
language = "c++23",
import_std = false,
-- Consumers write `#include <yaml-cpp/yaml.h>`. ORDER MATTERS:
-- mcpp_generated FIRST, so the dll.h shim below is found before
-- upstream's, which it then reaches with #include_next.
include_dirs = { "mcpp_generated", "*/include" },
generated_files = {
-- Delivers YAML_CPP_STATIC_DEFINE to every TU that opens a
-- yaml-cpp header, which no descriptor key can do. See the header
-- note.
["mcpp_generated/yaml-cpp/dll.h"] = [==[
// mcpp-index shim: yaml-cpp is built as objects here, not as a shared library,
// so every declaration must be plain rather than dllimport/visibility-default.
// Upstream reads YAML_CPP_STATIC_DEFINE in this header and nowhere else, and
// every public yaml-cpp header reaches this one.
#ifndef MCPP_COMPAT_YAML_CPP_STATIC_SHIM
#define MCPP_COMPAT_YAML_CPP_STATIC_SHIM
#ifndef YAML_CPP_STATIC_DEFINE
# define YAML_CPP_STATIC_DEFINE
#endif
#include_next <yaml-cpp/dll.h>
#endif
]==],
},
sources = {
"*/src/*.cpp",
"*/src/contrib/*.cpp",
},
targets = { ["yaml-cpp"] = { kind = "lib" } },
deps = { },
-- Belt and braces for this package's OWN TUs; the shim above is what
-- reaches everyone else's.
defines = { "YAML_CPP_STATIC_DEFINE" },
-- 0.8.0's src/emitterutils.cpp names uint16_t/uint32_t unqualified
-- and includes neither <cstdint> nor <stdint.h> (0.9.0 added it). It
-- compiles here only because C++20 and later make libstdc++'s
-- <ostream> reach <format> -> bits/unicode.h -> <cstdint>. Measured
-- with gcc 15.1.0 over glibc 2.44: -std=c++17 fails with "'uint16_t'
-- was not declared in this scope", c++20/c++23 compile. The package
-- builds as c++23, so it holds today, but on a transitive include; this
-- makes it hold on purpose. Harmless for 0.9.0.
cxxflags = { "-include", "cstdint" },
},
}