-
Notifications
You must be signed in to change notification settings - Fork 8
/
schema.rst
700 lines (560 loc) · 23.7 KB
/
schema.rst
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
Package Schema
==============
Objects
'''''''
.. ----------------------------------------------------------------------------
.. cps:object:: package
The root of a CPS document is a |package| object.
A |package| object describes a single package.
.. ----------------------------------------------------------------------------
.. cps:object:: platform
A |platform| describes the platform
on which a package's components may run.
.. ----------------------------------------------------------------------------
.. cps:object:: requirement
A |requirement| describes the specifics of a package dependency.
.. ----------------------------------------------------------------------------
.. cps:object:: component
A |component| is a consumable part of a package.
Typical components include libraries and executables.
.. ----------------------------------------------------------------------------
.. cps:object:: configuration
A |configuration| holds attributes
that are specific to a particular configuration of a |component|.
Attributes
''''''''''
An optional attribute may have the value |null|.
This shall be equivalent to omitting the attribute.
Attribute names are case sensitive.
.. ----------------------------------------------------------------------------
.. cps:attribute:: c_runtime_vendor
:type: string
:context: platform
Specifies that the package's CABI components
require the specified C standard/runtime library.
Typical (case-insensitive) values include
:string:`"bsd"` (libc),
:string:`"gnu"` (glibc),
:string:`"mingw"` and
:string:`"microsoft"`.
.. ----------------------------------------------------------------------------
.. cps:attribute:: c_runtime_version
:type: string
:context: platform
Specifies the minimum C standard/runtime library version
required by the package's CABI components.
.. ----------------------------------------------------------------------------
.. cps:attribute:: clr_vendor
:type: string
:context: platform
Specifies that the package's CLR (.NET) components
require the specified `Common Language Runtime`_ vendor.
Typical (case-insensitive) values include
:string:`"microsoft"` and
:string:`"mono"`.
.. ----------------------------------------------------------------------------
.. cps:attribute:: clr_version
:type: string
:context: platform
Specifies the minimum `Common Language Runtime`_ version
required to use the package's CLR (.NET) components.
.. ----------------------------------------------------------------------------
.. cps:attribute:: compat_version
:type: string
:context: package
Specifies the oldest version of the package
with which this version is compatible.
This information is used when a consumer requests a specific version.
If the version requested is equal to or newer
than the :attribute:`compat_version`,
the package may be used.
If not specified,
the package is not compatible with previous versions
(i.e. :attribute:`compat_version`
is implicitly equal to :attribute:`version`).
.. ----------------------------------------------------------------------------
.. cps:attribute:: compile_features
:type: list(string)
:context: component configuration
Specifies a list of `Compiler Features`_
that must be enabled or disabled
when compiling code that consumes the component.
.. ----------------------------------------------------------------------------
.. cps:attribute:: compile_flags
:type: list(string)|map(list(string))
:context: component configuration
Specifies a list of additional flags
that must be supplied to the compiler
when compiling code that consumes the component.
Note that compiler flags may not be portable;
use of this attribute is discouraged.
A map may be used instead to give different values
depending on the language of the consuming source file.
Handling of such shall be the same as for `definitions`_.
.. ----------------------------------------------------------------------------
.. cps:attribute:: components
:type: map(component)
:context: package
:overload:
:required:
Specifies the components which the package provides.
Keys are the component names.
.. ----------------------------------------------------------------------------
.. cps:attribute:: components
:type: list(string)
:context: requirement
:overload:
Specifies a list of components
which must be present in the required package
in order for the requirement to be satisfied.
Although the build tool will generally produce an error
if a consumer uses a component
which in turn requires a component that was not found,
early specification via this attribute
may help build tools to diagnose such issues earlier
and/or produce better diagnostics.
This may also be used to specify dependencies
that are not expressed in component level dependencies,
such as a package's requirement
that a dependency includes a certain symbolic component,
or if a dependency is only expressed at run-time.
.. ----------------------------------------------------------------------------
.. cps:attribute:: configuration
:type: string
:context: package
:conditionally-required:
Specifies the name of the configuration
described by a configuration-specific ``.cps``
(see `Configuration Merging`_).
This attribute is required in a configuration-specific ``.cps``,
and shall be ignored otherwise.
.. ----------------------------------------------------------------------------
.. cps:attribute:: configurations
:type: list(string)
:context: package
:overload:
Specifies the configurations that are preferred.
See `Package Configurations`_ for a description
of how configurations are used.
.. ----------------------------------------------------------------------------
.. cps:attribute:: configurations
:type: map(configuration)
:context: component
:overload:
Specifies a set of configuration-specific attributes for a |component|.
Keys are the configuration names.
.. ----------------------------------------------------------------------------
.. cps:attribute:: cpp_runtime_vendor
:type: string
:context: platform
Specifies that the package's CABI components
require the specified C++ standard/runtime library.
Typical (case-insensitive) values include
:string:`"gnu"` (libstdc++),
:string:`"llvm"` (libc++) and
:string:`"microsoft"`.
.. ----------------------------------------------------------------------------
.. cps:attribute:: cpp_runtime_version
:type: string
:context: platform
Specifies the minimum C++ standard/runtime library version
required by the package's CABI components.
.. ----------------------------------------------------------------------------
.. cps:attribute:: cps_path
:type: string
:context: package
Specifies the directory portion location of the ``.cps`` file.
This shall be an "absolute" path which starts with ``@prefix@``.
This provides an additional mechanism
by which the tool may deduce the package's prefix,
since the absolute location of the ``.cps`` file
will be known by the tool.
(See also `Prefix Determination`_.)
.. ----------------------------------------------------------------------------
.. cps:attribute:: cps_version
:type: string
:context: package
:required:
Specifies the version of the CPS
to which this ``.cps`` file conforms.
This may be used by tools to provide backwards compatibility
in case of compatibility-breaking changes in the CPS.
CPS version numbering follows |semver|_.
That is, tools that support CPS version ``<X>.<Y>``
are expected to be able to read files
with :attribute:`cps_version` ``<X>.<Z>``,
even for Z > Y
(with the understanding that, in such cases, the tool
may miss non-critical information that the CPS provided).
.. ----------------------------------------------------------------------------
.. cps:attribute:: default_components
:type: list(string)
:context: package
Specifies a list of components that should be inferred
if a consumer specifies a dependency on a package,
but not a specific component.
.. ----------------------------------------------------------------------------
.. cps:attribute:: definitions
:type: map(map(string))
:context: component configuration
Specifies a collection of compile definitions that must be defined
when compiling code that consumes the component.
Each key in the inner map(s) is the name of a compile definition,
such that e.g. ``-Dkey=value`` is passed to the compiler.
A value may be |null|, indicating a definition with no value
(e.g. ``-Dkey`` is passed to the compiler).
Note that an *empty* string indicates ``-Dkey=``,
which may have a different effect than ``-Dkey``.
The outer map is used to describe
language-specific definitions.
The build tool shall include
only those definitions
whose language matches (case-sensitive)
that of the (lower case) language
of the source file being compiled.
Recognized languages shall include
:string:`"c"`,
:string:`"cpp"`, and
:string:`"fortran"`.
Additionally, the value :string:`"*"` indicates
that the corresponding definitions apply to all languages.
If a definition name is repeated
in both :string:`"*"` and a specific language,
the latter, when applicable to the source being compiled,
shall have precedence.
.. ----------------------------------------------------------------------------
.. cps:attribute:: hints
:type: list(string)
:context: requirement
Specifies a list of paths
where a required dependency might be located.
When given, this will usually provide the location
of the dependency as it was consumed by the package
when the package was built,
so that consumers can easily find (correct) dependencies
if they are in a location that is not searched by default.
.. ----------------------------------------------------------------------------
.. cps:attribute:: includes
:type: list(string)|map(list(string))
:context: component configuration
Specifies a list of directories
which should be added to the include search path
when compiling code that consumes the component.
If a path starts with ``@prefix@``,
the package's install prefix is substituted
(see `Package Searching`_).
This is recommended, as it allows packages to be relocatable.
A map may be used instead to give different values
depending on the language of the consuming source file.
Handling of such shall be the same as for `definitions`_.
.. ----------------------------------------------------------------------------
.. cps:attribute:: isa
:type: string
:context: platform
Specifies that the package's CABI components
require the specified `Instruction Set Architecture`_.
The value is case insensitive
and should follow the output of ``uname -m``.
.. ----------------------------------------------------------------------------
.. cps:attribute:: jvm_vendor
:type: string
:context: platform
Specifies that the package's Java components
require the specified Java_ vendor.
Typical (case-insensitive) values include
:string:`"oracle"` and
:string:`"openjdk"`.
.. ----------------------------------------------------------------------------
.. cps:attribute:: jvm_version
:type: string
:context: platform
Specifies the minimum Java_ Virtual Machine version
required to use the package's Java components.
.. ----------------------------------------------------------------------------
.. cps:attribute:: kernel
:type: string
:context: platform
Specifies the name of the operating system kernel
required by the package's components.
The value is case insensitive
and should follow the output of ``uname -s``.
Typical values include
:string:`"windows"`,
:string:`"cygwin"`,
:string:`"linux"` and
:string:`"darwin"`.
.. ----------------------------------------------------------------------------
.. cps:attribute:: kernel_version
:type: string
:context: platform
Specifies the minimum operating system kernel version
required by the package's components.
.. ----------------------------------------------------------------------------
.. cps:attribute:: link_features
:type: list(string)
:context: component configuration
Specifies a list of `Linker Features`_
that must be enabled or disabled
when linking code that consumes the component.
.. ----------------------------------------------------------------------------
.. cps:attribute:: link_flags
:type: list(string)
:context: component configuration
Specifies a list of additional flags
that must be supplied to the linker
when linking code that consumes the component.
Note that linker flags may not be portable;
use of this attribute is discouraged.
.. ----------------------------------------------------------------------------
.. cps:attribute:: link_languages
:type: list(string)
:context: component configuration
Specifies the ABI language or languages of a static library
(`type`_ :string:`"archive"`).
Officially supported (case-insensitive) values are
:string:`"c"` (no special handling required) and
:string:`"cpp"` (consuming the static library
also requires linking against the C++ standard runtime).
The default is :string:`"c"`.
.. ----------------------------------------------------------------------------
.. cps:attribute:: link_libraries
:type: list(string)
:context: component configuration
Specifies a list of additional libraries that must be linked against
when linking code that consumes the component.
(Note that packages should avoid using this attribute if at all possible.
Use `requires (component)`_ instead whenever possible.)
.. ----------------------------------------------------------------------------
.. cps:attribute:: link_location
:type: string
:context: component configuration
Specifies an alternate location of the component
that should be used when linking against the component.
This attribute typically applies only to :string:`"dylib"` components
on platforms where the library is separated into multiple file components.
For example, on Windows,
this attribute shall give the location of the ``.lib``,
while `location`_ shall give the location of the ``.dll``.
If the path starts with ``@prefix@``,
the package's install prefix is substituted
(see `Package Searching`_).
This is recommended, as it allows packages to be relocatable.
.. ----------------------------------------------------------------------------
.. cps:attribute:: link_requires
:type: list(string)
:context: component configuration
Specifies additional components required by a component
which are needed only at the link stage.
Unlike `requires (component)`_,
only the required components' link dependencies
should be applied transitively;
additional properties such as compile and include attributes
of the required component(s) should be ignored.
.. ----------------------------------------------------------------------------
.. cps:attribute:: location
:type: string
:context: component configuration
:conditionally-required:
Specifies the location of the component.
The exact meaning of this attribute
depends on the component type,
but typically it provides the path
to the component's primary artifact,
such as a ``.so`` or ``.jar``.
(For Windows DLL components,
this should be the location of the ``.dll``.
See also `link_location`_.)
If the path starts with ``@prefix@``,
the package's install prefix is substituted
(see `Package Searching`_).
This is recommended, as it allows packages to be relocatable.
This attribute is required for |component|\ s
that are not of :string:`"interface"` :attribute:`type`.
.. ----------------------------------------------------------------------------
.. cps:attribute:: name
:type: string
:context: package
:required:
Specifies the canonical name of the package.
In order for searching to succeed,
the name of the CPS file
without the ``.cps`` suffix
must exactly match (including case)
either :attribute:`name` as-is,
or :attribute:`name` converted to lower case.
.. ----------------------------------------------------------------------------
.. cps:attribute:: platform
:type: platform
:context: package
Specifies the platform on which a package's components may run.
This allows tools to ignore packages
which target a different platform
than the platform that the consumer targets
(see `Package Searching`_).
Any platform attribute not specified
implies that the package's components
are agnostic to that platform attribute.
If this attribute is not specified,
the package is implied to be platform agnostic.
(This might be the case for a "library"
which consists entirely of C/C++ headers.
Note that JVM/CLR versions are platform attributes,
so packages consisting entirely of Java and/or CLR components
will still typically use this attribute.)
.. ----------------------------------------------------------------------------
.. cps:attribute:: requires
:type: list(string)
:context: component configuration
:overload:
Specifies additional components required by a component.
This is used, for example, to indicate transitive dependencies.
Relative component names are interpreted relative to the current package.
Absolute component names must refer to a package required by this package
(see `requires (package)`_).
Compile and link attributes should be applied transitively,
as if the consuming component also directly consumed the components
required by the component being consumed.
See also `link_requires`_.
.. ----------------------------------------------------------------------------
.. cps:attribute:: requires
:type: map(requirement)
:context: package
:overload:
Specifies additional packages that are required by this package.
Keys are the name of another required package.
Values are a valid |requirement| object or |null|
(equivalent to an empty |requirement| object)
describing the package required.
.. ----------------------------------------------------------------------------
.. cps:attribute:: type
:type: string
:context: component
:required:
Specifies the type of a component.
The component type affects how the component may be used.
Officially supported values are :string:`"executable"`
(any artifact which the target platform can directly execute),
:string:`"archive"` (CABI static library),
:string:`"dylib"` (CABI shared library),
:string:`"module"` (CABI plugin library),
:string:`"jar"` (Java Archive),
:string:`"interface"` and :string:`"symbolic"`.
If the type is not recognized by the parser,
the component shall be ignored.
(Parsers are permitted to support additional types
as a conforming extension.)
A :string:`"dylib"` is meant to be linked at compile time;
the :attribute:`location` specifies the artifact
required for such linking (i.e. the import library on PE platforms).
A :string:`"module"` is meant to be loaded at run time
with :code:`dlopen` or similar;
again, the :attribute:`location` specifies the appropriate artifact.
An :string:`"interface"` component is a special case;
it may have the usual attributes of a component,
but does not have a location.
This can be used to create "virtual" components
that do not have an associated artifact.
A :string:`"symbolic"` component is even more special,
as it has no (required) attributes at all,
and the meaning of any attributes or configurations
assigned to such a component is unspecified.
A :string:`"symbolic"` component is intended
to be used as a form of feature testing;
a package that has a feature that is meaningful to users
but does not otherwise map directly to a component
may use a symbolic component
to indicate availability of the feature to users.
.. ----------------------------------------------------------------------------
.. cps:attribute:: version
:type: string
:context: package
:overload:
Specifies the version of the package.
The format of this string is determined by `version_schema`_.
If not provided, the CPS will not satisfy any request
for a specific version of the package.
.. ----------------------------------------------------------------------------
.. cps:attribute:: version
:type: string
:context: requirement
:overload:
Specifies the required version of a package.
If omitted, any version of the required package is acceptable.
Semantics are the same
as for the :attribute:`version` attribute of a |package|.
.. ----------------------------------------------------------------------------
.. cps:attribute:: version_schema
:type: string
:context: package
Specifies the structure
to which the package's version numbering conforms.
Tools may use this to determine how to perform version comparisons.
Officially supported (case-insensitive) values are
:string:`"simple"` and :string:`"custom"`
(:string:`"rpm"` or :string:`"dpkg"` should be used where applicable,
but may not be supported by all tools).
If a package uses :string:`"custom"`,
version numbers may be compared,
but version ordering is not possible.
The default is :string:`"simple"`.
Needless to say,
changing a package's version scheme between releases
is *very strongly discouraged*.
Note that this attribute determines
only how version numbers are *ordered*.
It does not imply anything
about the compatibility or incompatibility
of various versions of a package.
See also `compat_version`_.
- :string:`simple`
The package's version number
shall match the regular expression
``[0-9]+([.][0-9]+)*([-+].*)?``.
The portion of the version
which precedes the optional ``-`` or ``+``
may be interpreted as a tuple of integers,
in which leading zeros are ignored.
Version numbers are compared according to numerical order,
starting from the first (left-most) number of the tuples.
If two version numbers have different tuple sizes,
the shorter tuple shall be implicitly filled with zeros.
.. deprecated:: 0.9.0
:string:`"semver"` is a deprecated alias for :string:`"simple"`.
Notes
'''''
- Unless otherwise specified,
a relative file path appearing in a CPS
shall be interpreted relative to the ``.cps`` file.
- Unless otherwise specified,
unrecognized attributes shall be ignored.
This makes it easier for tools to add tool-specific extensions.
(It is *strongly* recommended that the names of any such attributes
start with ``x_<tool>_``, where ``<tool>`` is the (lower case) name
of the tool which introduced the extension,
in order to reduce the chance of conflicts
with newer versions of the CPS.)
- The term "CABI", as used throughout,
refers to (typically C/C++/Fortran) code
compiled to the machine's native instruction set
and using the platform's usual format for such binaries
(ELF, PE32, etc.).
.. ... .. ... .. ... .. ... .. ... .. ... .. ... .. ... .. ... .. ... .. ... ..
.. _Common Language Runtime: https://en.wikipedia.org/wiki/Common_Language_Runtime
.. _Instruction Set Architecture: https://en.wikipedia.org/wiki/Instruction_set_architecture
.. _Java: https://en.wikipedia.org/wiki/Java_%28programming_language%29
.. _semver: http://semver.org/
.. ... .. ... .. ... .. ... .. ... .. ... .. ... .. ... .. ... .. ... .. ... ..
.. |semver| replace:: Semantic Versioning
.. |null| replace:: :keyword:`null`
.. |string| replace:: :type:`string`
.. |list| replace:: :type:`list`
.. |string-list| replace:: |list| of |string|
.. |map| replace:: :type:`map` of |string|
.. |language-string-list| replace:: |string-list| :separator:`or` |map| to |string-list|
.. |package| replace:: :object:`package`
.. |platform| replace:: :object:`platform`
.. |requirement| replace:: :object:`requirement`
.. |component| replace:: :object:`component`
.. |configuration| replace:: :object:`configuration`
.. ... .. ... .. ... .. ... .. ... .. ... .. ... .. ... .. ... .. ... .. ... ..
.. kate: hl reStructuredText