openocd: src: replace the GPL with eCos exception 2.0 license tag
[fw/openocd] / LICENSES / license-rules.txt
1 # SPDX-License-Identifier: GPL-2.0-or-later OR GFDL-1.2-no-invariants-or-later
2
3 OpenOCD licensing rules
4 =======================
5
6 The OpenOCD source code is provided under the terms of the GNU General
7 Public License version 2 or later (GPL-2.0-or-later), as provided in
8 LICENSES/preferred/GPL-2.0.
9
10 The OpenOCD documentation is provided under the terms of the GNU Free
11 Documentation License version 1.2 or later without Invariant Sections
12 (GFDL-1.2-no-invariants-or-later).
13
14 Few stand-alone applications coexist in the same code tree of OpenOCD
15 and are provided under the terms of the GNU General Public License
16 version 3 (GPL-3.0), as provided in LICENSES/stand-alone/GPL-3.0.
17
18 This documentation file provides a description of how each source file
19 should be annotated to make its license clear and unambiguous.
20 It doesn't replace the OpenOCD's license.
21
22 The license described in the COPYING file applies to the OpenOCD source
23 as a whole, though individual source files can have a different license
24 which is required to be compatible with the GPL-2.0:
25
26     GPL-1.0-or-later  : GNU General Public License v1.0 or later
27     GPL-2.0-or-later  : GNU General Public License v2.0 or later
28     LGPL-2.0          : GNU Library General Public License v2 only
29     LGPL-2.0-or-later : GNU Library General Public License v2 or later
30     LGPL-2.1          : GNU Lesser General Public License v2.1 only
31     LGPL-2.1-or-later : GNU Lesser General Public License v2.1 or later
32
33 Aside from that, individual files can be provided under a dual license,
34 e.g. one of the compatible GPL variants and alternatively under a
35 permissive license like BSD, MIT etc.
36
37 The common way of expressing the license of a source file is to add the
38 matching boilerplate text into the top comment of the file. Due to
39 formatting, typos etc. these "boilerplates" are hard to validate for
40 tools which are used in the context of license compliance.
41
42 An alternative to boilerplate text is the use of Software Package Data
43 Exchange (SPDX) license identifiers in each source file. SPDX license
44 identifiers are machine parsable and precise shorthands for the license
45 under which the content of the file is contributed. SPDX license
46 identifiers are managed by the SPDX Workgroup at the Linux Foundation and
47 have been agreed on by partners throughout the industry, tool vendors, and
48 legal teams. For further information see https://spdx.org/
49
50 OpenOCD requires the precise SPDX identifier in all source files.
51 The valid identifiers used in OpenOCD are explained in the section
52 `License identifiers` and have been retrieved from the official SPDX
53 license list at https://spdx.org/licenses/ along with the license texts.
54
55 License identifier syntax
56 -------------------------
57
58 1. Placement:
59
60    The SPDX license identifier in OpenOCD files shall be added at the
61    first possible line in a file which can contain a comment. For the
62    majority of files this is the first line, except for scripts which
63    require the '#!PATH_TO_INTERPRETER' in the first line. For those
64    scripts the SPDX identifier goes into the second line.
65
66 2. Style:
67
68    The SPDX license identifier is added in form of a comment. The comment
69    style depends on the file type::
70
71       C source:  // SPDX-License-Identifier: <SPDX License Expression>
72       C header:  /* SPDX-License-Identifier: <SPDX License Expression> */
73       ASM:       /* SPDX-License-Identifier: <SPDX License Expression> */
74       makefiles: # SPDX-License-Identifier: <SPDX License Expression>
75       scripts:   # SPDX-License-Identifier: <SPDX License Expression>
76       texinfo:   @c SPDX-License-Identifier: <SPDX License Expression>
77       text:      # SPDX-License-Identifier: <SPDX License Expression>
78
79    If a specific tool cannot handle the standard comment style, then the
80    appropriate comment mechanism which the tool accepts shall be used. This
81    is the reason for having the "/\* \*/" style comment in C header
82    files. There was build breakage observed with generated .lds files where
83    'ld' failed to parse the C++ comment. This has been fixed by now, but
84    there are still older assembler tools which cannot handle C++ style
85    comments.
86
87 3. Syntax:
88
89    A <SPDX License Expression> is either an SPDX short form license
90    identifier found on the SPDX License List, or the combination of two
91    SPDX short form license identifiers separated by "WITH" when a license
92    exception applies. When multiple licenses apply, an expression consists
93    of keywords "AND", "OR" separating sub-expressions and surrounded by
94    "(", ")" .
95
96    License identifiers for licenses like [L]GPL with the 'or later' option
97    are constructed by using a "-or-later":
98
99       // SPDX-License-Identifier: GPL-2.0-or-later
100       // SPDX-License-Identifier: LGPL-2.1-or-later
101
102    WITH should be used when there is a modifier to a license needed.
103    Exceptions can only be used with particular License identifiers. The
104    valid License identifiers are listed in the tags of the exception text
105    file.
106
107    OR should be used if the file is dual licensed and only one license is
108    to be selected. For example, some source files are available under dual
109    licenses:
110
111       // SPDX-License-Identifier: GPL-2.0-or-later OR BSD-1-Clause
112       // SPDX-License-Identifier: GPL-2.0-or-later OR BSD-2-Clause
113       // SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause
114
115    AND should be used if the file has multiple licenses whose terms all
116    apply to use the file. For example, if code is inherited from another
117    project and permission has been given to put it in OpenOCD, but the
118    original license terms need to remain in effect::
119
120       // SPDX-License-Identifier: GPL-2.0-or-later AND MIT
121
122 License identifiers
123 -------------------
124
125 The licenses currently used, as well as the licenses for code added to
126 OpenOCD, can be broken down into:
127
128 1. `Preferred licenses`:
129
130    Whenever possible these licenses should be used as they are known to be
131    fully compatible and widely used. These licenses are available from the
132    directory:
133
134       LICENSES/preferred/
135
136    in the OpenOCD source tree.
137
138    The files in this directory contain the full license text and
139    `Metatags`. The file names are identical to the SPDX license
140    identifier which shall be used for the license in source files.
141
142    Examples:
143
144       LICENSES/preferred/GPL-2.0
145
146    Contains the GPL version 2 license text and the required metatags.
147
148    `Metatags`:
149
150    The following meta tags must be available in a license file:
151
152    - Valid-License-Identifier:
153
154      One or more lines which declare which License Identifiers are valid
155      inside the project to reference this particular license text. Usually
156      this is a single valid identifier, but e.g. for licenses with the 'or
157      later' options two identifiers are valid.
158
159    - SPDX-URL:
160
161      The URL of the SPDX page which contains additional information related
162      to the license.
163
164    - Usage-Guidance:
165
166      Freeform text for usage advice. The text must include correct examples
167      for the SPDX license identifiers as they should be put into source
168      files according to the `License identifier syntax` guidelines.
169
170    - License-Text:
171
172      All text after this tag is treated as the original license text
173
174    File format examples::
175
176       Valid-License-Identifier: GPL-2.0
177       Valid-License-Identifier: GPL-2.0-only
178       Valid-License-Identifier: GPL-2.0-or-later
179       SPDX-URL: https://spdx.org/licenses/GPL-2.0.html
180       Usage-Guide:
181         To use this license in source code, put one of the following SPDX
182         tag/value pairs into a comment according to the placement
183         guidelines in the licensing rules documentation.
184         For 'GNU General Public License (GPL) version 2 only' use:
185           SPDX-License-Identifier: GPL-2.0
186         or
187           SPDX-License-Identifier: GPL-2.0-only
188         For 'GNU General Public License (GPL) version 2 or any later version' use:
189           SPDX-License-Identifier: GPL-2.0-or-later
190       License-Text:
191         Full license text
192
193 2. Exceptions:
194
195    Some licenses can be amended with exceptions which grant certain rights
196    which the original license does not.  These exceptions are available
197    from the directory::
198
199       LICENSES/exceptions/
200
201    in the OpenOCD source tree.  The files in this directory contain the full
202    exception text and the required `Exception Metatags`_.
203
204    Examples::
205
206       LICENSES/exceptions/eCos-exception-2.0
207
208    Exception Metatags:
209
210    The following meta tags must be available in an exception file:
211
212    - SPDX-Exception-Identifier:
213
214      One exception identifier which can be used with SPDX license
215      identifiers.
216
217    - SPDX-URL:
218
219      The URL of the SPDX page which contains additional information related
220      to the exception.
221
222    - SPDX-Licenses:
223
224      A comma separated list of SPDX license identifiers for which the
225      exception can be used.
226
227    - Usage-Guidance:
228
229      Freeform text for usage advice. The text must be followed by correct
230      examples for the SPDX license identifiers as they should be put into
231      source files according to the `License identifier syntax`_ guidelines.
232
233    - Exception-Text:
234
235      All text after this tag is treated as the original exception text
236
237    File format examples::
238
239       SPDX-Exception-Identifier: eCos-exception-2.0
240       SPDX-URL: https://spdx.org/licenses/eCos-exception-2.0.html
241       SPDX-Licenses: GPL-2.0-only, GPL-2.0-or-later
242       Usage-Guide:
243         This exception is used together with one of the above SPDX-Licenses.
244         To use this exception add it with the keyword WITH to one of the
245         identifiers in the SPDX-Licenses tag:
246           SPDX-License-Identifier: <SPDX-License> WITH eCos-exception-2.0
247       License-Text:
248         Full license text
249
250 3. Stand-alone licenses:
251
252    These licenses should only be used for stand-alone applications that are
253    distributed with OpenOCD but are not included in the OpenOCD binary.
254    These licenses are available from the directory:
255
256      LICENSES/stand-alone/
257
258    in the OpenOCD source tree.
259
260    Examples:
261
262      SPDX-License-Identifier: GPL-3.0
263
264 The format and requirements of the license files in the other sub-directories
265 of directory
266
267    LICENSES
268
269 have to follow the same format and requirements of the `Preferred licenses`.
270
271 All SPDX license identifiers and exceptions must have a corresponding file
272 in the LICENSES subdirectories. This is required to allow tool
273 verification (e.g. checkpatch.pl) and to have the licenses ready to read
274 and extract right from the source, which is recommended by various FOSS
275 organizations, e.g. the `FSFE REUSE initiative <https://reuse.software/>`.