Thu, 28 Mar 2024 23:30:21 +0100
simplify how transforms work
0 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" | |
3 | xmlns="http://unixwork.de/uwproj" | |
4 | targetNamespace="http://unixwork.de/uwproj" | |
5 | elementFormDefault="qualified" | |
6 | version="0.1" | |
7 | > | |
8 | <xs:element name="project" type="ProjectType"/> | |
9 | ||
10 | <xs:complexType name="ProjectType"> | |
1 | 11 | <xs:annotation> |
12 | <xs:documentation> | |
13 | The root element of an uwproj project. | |
14 | Consists of an optional <code>config</code> element | |
15 | and an arbitrary number of <code>dependency</code> | |
16 | and <code>target</code> elements. | |
17 | </xs:documentation> | |
18 | </xs:annotation> | |
0 | 19 | <xs:sequence> |
20 | <xs:element name="config" type="ConfigType" minOccurs="0"/> | |
21 | <xs:element name="dependency" type="DependencyType" minOccurs="0" maxOccurs="unbounded"/> | |
22 | <xs:element name="target" type="TargetType" minOccurs="0" maxOccurs="unbounded"/> | |
23 | </xs:sequence> | |
24 | </xs:complexType> | |
25 | ||
26 | <xs:complexType name="ConfigType"> | |
1 | 27 | <xs:annotation> |
28 | <xs:documentation> | |
29 | The configuration section. | |
30 | Consists of an arbitrary number of <code>var</code> elements. | |
31 | </xs:documentation> | |
32 | </xs:annotation> | |
0 | 33 | <xs:sequence> |
34 | <xs:element name="var" type="ConfigVarType" minOccurs="0" maxOccurs="unbounded"/> | |
35 | </xs:sequence> | |
36 | </xs:complexType> | |
37 | ||
38 | <xs:complexType name="ConfigVarType"> | |
1 | 39 | <xs:annotation> |
40 | <xs:documentation> | |
41 | The definition of a configuration variable. | |
42 | <p> | |
43 | Configuration variables are supposed to be used in the configure script and are also | |
44 | written to the resulting config file (in contrast to make variables, which are only | |
45 | written to the config file). | |
46 | The <code>name</code> attribute is mandatory, the value is defined by the text body of the element. | |
47 | The optional Boolean <code>exec</code> attribute (false by default) controls, whether the entire | |
48 | definition is automatically executed under command substitution. | |
49 | </p> | |
50 | </xs:documentation> | |
51 | </xs:annotation> | |
0 | 52 | <xs:simpleContent> |
53 | <xs:extension base="xs:string"> | |
54 | <xs:attribute name="name" type="xs:string" use="required"/> | |
55 | <xs:attribute name="exec" type="xs:boolean" default="false"/> | |
56 | </xs:extension> | |
57 | </xs:simpleContent> | |
58 | </xs:complexType> | |
59 | ||
60 | <xs:complexType name="PkgConfigType"> | |
1 | 61 | <xs:annotation> |
62 | <xs:documentation> | |
63 | Instructs configure to invoke <code>pkg-config</code>, if present on the system, to determine | |
64 | compiler and linker flags. The text body of this element defines the package name to search. | |
65 | To constrain the allowed versions, use the attributes <code>atleast, exact, max</code>. | |
66 | </xs:documentation> | |
67 | </xs:annotation> | |
0 | 68 | <xs:simpleContent> |
69 | <xs:extension base="xs:string"> | |
70 | <xs:attribute name="atleast" type="xs:string"/> | |
71 | <xs:attribute name="exact" type="xs:string"/> | |
72 | <xs:attribute name="max" type="xs:string"/> | |
73 | </xs:extension> | |
74 | </xs:simpleContent> | |
75 | </xs:complexType> | |
76 | ||
77 | <xs:simpleType name="LangType"> | |
1 | 78 | <xs:annotation> |
79 | <xs:documentation> | |
80 | Requests a compiler for the specified language. Allowed values are | |
81 | c, cpp. | |
82 | </xs:documentation> | |
83 | </xs:annotation> | |
0 | 84 | <xs:restriction base="xs:string"> |
85 | <xs:enumeration value="c"/> | |
86 | <xs:enumeration value="cpp"/> | |
87 | </xs:restriction> | |
88 | </xs:simpleType> | |
89 | ||
90 | <xs:complexType name="DependencyType"> | |
1 | 91 | <xs:annotation> |
92 | <xs:documentation> | |
93 | Declares a dependency. | |
94 | <p> | |
95 | If the optional <code>name</code> attribute is omitted, the dependency is global | |
96 | and must be satisfied, otherwise configuration shall fail. | |
97 | A <em>named dependency</em> can be referenced by a target (or is implicitly referenced | |
98 | by the default target, if no targets are specified). | |
99 | Multiple declarations for the same named dependency may exist, in which case each declaration | |
100 | is checked one after another, until one block is satisfied. The result of the first satisfied | |
101 | dependency declaration is supposed to be applied to the config file. | |
102 | </p> | |
103 | <p> | |
104 | The optional <code>platform</code> attribute may specify a <em>single</em> platform identifier and | |
105 | the optional <code>not</code> attribute may specify a comma-separated list of platform identifiers. | |
106 | The configure script shall skip this dependency declaration if the detected platform is not | |
107 | matching the filter specification of these attributes. | |
108 | </p> | |
109 | </xs:documentation> | |
110 | </xs:annotation> | |
0 | 111 | <xs:choice minOccurs="0" maxOccurs="unbounded"> |
112 | <xs:element name="lang" type="LangType"/> | |
113 | <xs:element name="cflags" type="FlagsType"/> | |
114 | <xs:element name="cxxflags" type="FlagsType"/> | |
115 | <xs:element name="ldflags" type="FlagsType"/> | |
116 | <xs:element name="pkgconfig" type="PkgConfigType"/> | |
1 | 117 | <xs:element name="test" type="xs:string"> |
118 | <xs:annotation> | |
119 | <xs:documentation> | |
120 | Specifies a custom command that shall be executed to test whether this dependency is satisfied. | |
121 | </xs:documentation> | |
122 | </xs:annotation> | |
123 | </xs:element> | |
124 | <xs:element name="make" type="MakeVarType"/> | |
0 | 125 | </xs:choice> |
126 | <xs:attribute name="name" type="xs:string"/> | |
127 | <xs:attribute name="platform" type="xs:string"/> | |
128 | <xs:attribute name="not" type="xs:string"/> | |
129 | </xs:complexType> | |
130 | ||
131 | <xs:complexType name="FlagsType"> | |
1 | 132 | <xs:annotation> |
133 | <xs:documentation> | |
134 | Instructs configure to append the contents of the element's body to the respective flags variable. | |
135 | If the optional <code>exec</code> flag is set to <code>true</code>, the contents are supposed to be | |
136 | executed under command substitution <em>at configuration time</em> before they are applied. | |
137 | </xs:documentation> | |
138 | </xs:annotation> | |
0 | 139 | <xs:simpleContent> |
140 | <xs:extension base="xs:string"> | |
141 | <xs:attribute name="exec" type="xs:boolean" default="false"/> | |
142 | </xs:extension> | |
143 | </xs:simpleContent> | |
144 | </xs:complexType> | |
145 | ||
146 | <xs:complexType name="TargetType"> | |
1 | 147 | <xs:annotation> |
148 | <xs:documentation> | |
149 | Declares a build target that is supposed to be configured. | |
150 | <p> | |
151 | If no build target is declared explicitly, an implicit default | |
152 | target is generated, which has the <code>alldependencies</code> | |
153 | flag set. | |
154 | </p> | |
155 | <p> | |
156 | The optional <code>name</code> attribute is also used to generate a prefix | |
157 | for the compiler and linker flags variables. | |
158 | Furthermore, a target may consist of an arbitrary number of <code>feature</code>, | |
159 | <code>option</code>, and <code>define</code> elements. | |
160 | Named dependencies can be listed (separated by comma) in the <code>dependencies</code> | |
161 | element. If this target shall use <em>all</em> available named dependencies, the empty | |
162 | element <code>alldependencies</code> can be used as a shortcut. | |
163 | </p> | |
164 | </xs:documentation> | |
165 | </xs:annotation> | |
0 | 166 | <xs:choice minOccurs="0" maxOccurs="unbounded"> |
167 | <xs:element name="feature" type="FeatureType"/> | |
168 | <xs:element name="option" type="OptionType"/> | |
169 | <xs:element name="define" type="DefineType"/> | |
170 | <xs:element name="dependencies" type="DependenciesType"/> | |
171 | <xs:element name="alldependencies"> | |
172 | <xs:complexType/> | |
173 | </xs:element> | |
174 | </xs:choice> | |
175 | <xs:attribute name="name" type="xs:string"/> | |
176 | </xs:complexType> | |
177 | ||
178 | <xs:complexType name="FeatureType"> | |
1 | 179 | <xs:annotation> |
180 | <xs:documentation> | |
181 | Declares an optional feature, that can be enabled during configuration, if all | |
182 | <code>dependencies</code> are satisfied. | |
183 | If a feature is enabled, all <code>define</code> and <code>make</code> definitions are | |
184 | supposed to be applied to the config file. | |
185 | In case the optional <code>default</code> attribute is set to true, the feature is enabled by default | |
186 | and is supposed to be automatically disabled (without error) when the dependencies are not satisfied. | |
187 | The name that is supposed to be used for the --enable and --disable arguments can be optionally | |
188 | specified with the <code>arg</code> attribute. Otherwise, the <code>name</code> is used by default. | |
189 | </xs:documentation> | |
190 | </xs:annotation> | |
0 | 191 | <xs:choice minOccurs="0" maxOccurs="unbounded"> |
192 | <xs:group ref="TargetDataGroup"/> | |
193 | </xs:choice> | |
194 | <xs:attribute name="name" type="xs:string" use="required"/> | |
195 | <xs:attribute name="arg" type="xs:string"/> | |
196 | <xs:attribute name="default" type="xs:boolean" default="false"/> | |
197 | </xs:complexType> | |
198 | ||
199 | <xs:complexType name="OptionType"> | |
1 | 200 | <xs:annotation> |
201 | <xs:documentation> | |
202 | Declares a configuration option. | |
203 | The option argument name is specified with the <code>arg</code> attribute. | |
204 | Then, the children of this element specify possible <code>values</code> by defining the conditions | |
205 | (in terms of dependencies) and effects (in terms of defines and make variables) of each value. | |
206 | Finally, a set of <code>default</code>s is specified which supposed to automagically select the most | |
207 | appropriate value for a specific platform under the available dependencies (in case the option is not | |
208 | explicitly specified by using the command line argument). | |
209 | </xs:documentation> | |
210 | </xs:annotation> | |
0 | 211 | <xs:sequence> |
212 | <xs:element name="value" type="OptionValueType" minOccurs="0" maxOccurs="unbounded"/> | |
213 | <xs:element name="default" type="OptionDefaultType" minOccurs="0" maxOccurs="unbounded"/> | |
214 | </xs:sequence> | |
1 | 215 | <xs:attribute name="arg" type="xs:string" use="required"/> |
0 | 216 | </xs:complexType> |
217 | ||
218 | <xs:complexType name="OptionValueType"> | |
1 | 219 | <xs:annotation> |
220 | <xs:documentation> | |
221 | Declares a possible value for the option (in the <code>str</code> attribute) and | |
222 | the conditions (<code>dependencies</code>) and effects, the value has. | |
223 | </xs:documentation> | |
224 | </xs:annotation> | |
0 | 225 | <xs:choice minOccurs="0" maxOccurs="unbounded"> |
226 | <xs:group ref="TargetDataGroup"/> | |
227 | </xs:choice> | |
228 | <xs:attribute name="str" type="xs:string" use="required"/> | |
229 | </xs:complexType> | |
230 | ||
231 | <xs:complexType name="OptionDefaultType"> | |
1 | 232 | <xs:annotation> |
233 | <xs:documentation> | |
234 | Specifies a default value for this option. Multiple default values can be specified, in which case | |
235 | they are checked one after another for availability. With the optional <code>platform</code> attribute, | |
236 | the default value can be constrained to a <em>single</em> specific platform and is supposed to be | |
237 | skipped by configure, when this platform is not detected. | |
238 | </xs:documentation> | |
239 | </xs:annotation> | |
0 | 240 | <xs:attribute name="value" type="xs:string" use="required"/> |
241 | <xs:attribute name="platform" type="xs:string"/> | |
242 | </xs:complexType> | |
243 | ||
244 | <xs:group name="TargetDataGroup"> | |
245 | <xs:choice> | |
246 | <xs:element name="define" type="DefineType" minOccurs="0" maxOccurs="unbounded"/> | |
247 | <xs:element name="dependencies" type="DependenciesType" minOccurs="0" maxOccurs="unbounded"/> | |
1 | 248 | <xs:element name="make" type="MakeVarType" minOccurs="0" maxOccurs="unbounded"/> |
0 | 249 | </xs:choice> |
250 | </xs:group> | |
251 | ||
252 | <xs:complexType name="DefineType"> | |
1 | 253 | <xs:annotation> |
254 | <xs:documentation> | |
255 | Specifies C/C++ pre-processor definitions that are supposed to | |
256 | be appended to the compiler flags, if supported. | |
257 | (Note: for example, Fortran also supports C/C++ style pre-processor definitions under | |
258 | certain circumstances) | |
259 | </xs:documentation> | |
260 | </xs:annotation> | |
0 | 261 | <xs:attribute name="name" type="xs:string" use="required"/> |
262 | <xs:attribute name="value" type="xs:string"/> | |
263 | </xs:complexType> | |
264 | ||
265 | <xs:simpleType name="DependenciesType"> | |
1 | 266 | <xs:annotation> |
267 | <xs:documentation>A comma-separated list of named dependencies.</xs:documentation> | |
268 | </xs:annotation> | |
269 | <xs:restriction base="xs:string"/> | |
270 | </xs:simpleType> | |
271 | ||
272 | <xs:simpleType name="MakeVarType"> | |
273 | <xs:annotation> | |
274 | <xs:documentation> | |
275 | The text contents in the body of this element are supposed to be appended literally | |
276 | to the config file without prior processing. | |
277 | </xs:documentation> | |
278 | </xs:annotation> | |
0 | 279 | <xs:restriction base="xs:string"/> |
280 | </xs:simpleType> | |
281 | </xs:schema> |