You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

219 lines
8.7 KiB

  1. # SPDX-License-Identifier: GPL-2.0-or-later OR GFDL-1.2-no-invariants-or-later
  2. OpenOCD licensing rules
  3. =======================
  4. The OpenOCD source code is provided under the terms of the GNU General
  5. Public License version 2 or later (GPL-2.0-or-later), as provided in
  6. LICENSES/preferred/GPL-2.0.
  7. The OpenOCD documentation is provided under the terms of the GNU Free
  8. Documentation License version 1.2 or later without Invariant Sections
  9. (GFDL-1.2-no-invariants-or-later).
  10. Few stand-alone applications coexist in the same code tree of OpenOCD
  11. and are provided under the terms of the GNU General Public License
  12. version 3 (GPL-3.0), as provided in LICENSES/stand-alone/GPL-3.0.
  13. This documentation file provides a description of how each source file
  14. should be annotated to make its license clear and unambiguous.
  15. It doesn't replace the OpenOCD's license.
  16. The license described in the COPYING file applies to the OpenOCD source
  17. as a whole, though individual source files can have a different license
  18. which is required to be compatible with the GPL-2.0:
  19. GPL-1.0-or-later : GNU General Public License v1.0 or later
  20. GPL-2.0-or-later : GNU General Public License v2.0 or later
  21. LGPL-2.0 : GNU Library General Public License v2 only
  22. LGPL-2.0-or-later : GNU Library General Public License v2 or later
  23. LGPL-2.1 : GNU Lesser General Public License v2.1 only
  24. LGPL-2.1-or-later : GNU Lesser General Public License v2.1 or later
  25. Aside from that, individual files can be provided under a dual license,
  26. e.g. one of the compatible GPL variants and alternatively under a
  27. permissive license like BSD, MIT etc.
  28. The common way of expressing the license of a source file is to add the
  29. matching boilerplate text into the top comment of the file. Due to
  30. formatting, typos etc. these "boilerplates" are hard to validate for
  31. tools which are used in the context of license compliance.
  32. An alternative to boilerplate text is the use of Software Package Data
  33. Exchange (SPDX) license identifiers in each source file. SPDX license
  34. identifiers are machine parsable and precise shorthands for the license
  35. under which the content of the file is contributed. SPDX license
  36. identifiers are managed by the SPDX Workgroup at the Linux Foundation and
  37. have been agreed on by partners throughout the industry, tool vendors, and
  38. legal teams. For further information see
  39. OpenOCD requires the precise SPDX identifier in all source files.
  40. The valid identifiers used in OpenOCD are explained in the section
  41. `License identifiers` and have been retrieved from the official SPDX
  42. license list at along with the license texts.
  43. License identifier syntax
  44. -------------------------
  45. 1. Placement:
  46. The SPDX license identifier in OpenOCD files shall be added at the
  47. first possible line in a file which can contain a comment. For the
  48. majority of files this is the first line, except for scripts which
  49. require the '#!PATH_TO_INTERPRETER' in the first line. For those
  50. scripts the SPDX identifier goes into the second line.
  51. 2. Style:
  52. The SPDX license identifier is added in form of a comment. The comment
  53. style depends on the file type::
  54. C source: // SPDX-License-Identifier: <SPDX License Expression>
  55. C header: /* SPDX-License-Identifier: <SPDX License Expression> */
  56. ASM: /* SPDX-License-Identifier: <SPDX License Expression> */
  57. makefiles: # SPDX-License-Identifier: <SPDX License Expression>
  58. scripts: # SPDX-License-Identifier: <SPDX License Expression>
  59. texinfo: @c SPDX-License-Identifier: <SPDX License Expression>
  60. text: # SPDX-License-Identifier: <SPDX License Expression>
  61. If a specific tool cannot handle the standard comment style, then the
  62. appropriate comment mechanism which the tool accepts shall be used. This
  63. is the reason for having the "/\* \*/" style comment in C header
  64. files. There was build breakage observed with generated .lds files where
  65. 'ld' failed to parse the C++ comment. This has been fixed by now, but
  66. there are still older assembler tools which cannot handle C++ style
  68. 3. Syntax:
  69. A <SPDX License Expression> is either an SPDX short form license
  70. identifier found on the SPDX License List, or the combination of two
  71. SPDX short form license identifiers separated by "WITH" when a license
  72. exception applies. When multiple licenses apply, an expression consists
  73. of keywords "AND", "OR" separating sub-expressions and surrounded by
  74. "(", ")" .
  75. License identifiers for licenses like [L]GPL with the 'or later' option
  76. are constructed by using a "-or-later":
  77. // SPDX-License-Identifier: GPL-2.0-or-later
  78. // SPDX-License-Identifier: LGPL-2.1-or-later
  79. WITH should be used when there is a modifier to a license needed.
  80. Exceptions can only be used with particular License identifiers. The
  81. valid License identifiers are listed in the tags of the exception text
  82. file.
  83. OR should be used if the file is dual licensed and only one license is
  84. to be selected. For example, some source files are available under dual
  85. licenses:
  86. // SPDX-License-Identifier: GPL-2.0-or-later OR BSD-1-Clause
  87. // SPDX-License-Identifier: GPL-2.0-or-later OR BSD-2-Clause
  88. // SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause
  89. AND should be used if the file has multiple licenses whose terms all
  90. apply to use the file. For example, if code is inherited from another
  91. project and permission has been given to put it in OpenOCD, but the
  92. original license terms need to remain in effect::
  93. // SPDX-License-Identifier: GPL-2.0-or-later AND MIT
  94. License identifiers
  95. -------------------
  96. The licenses currently used, as well as the licenses for code added to
  97. OpenOCD, can be broken down into:
  98. 1. `Preferred licenses`:
  99. Whenever possible these licenses should be used as they are known to be
  100. fully compatible and widely used. These licenses are available from the
  101. directory:
  102. LICENSES/preferred/
  103. in the OpenOCD source tree.
  104. The files in this directory contain the full license text and
  105. `Metatags`. The file names are identical to the SPDX license
  106. identifier which shall be used for the license in source files.
  107. Examples:
  108. LICENSES/preferred/GPL-2.0
  109. Contains the GPL version 2 license text and the required metatags.
  110. `Metatags`:
  111. The following meta tags must be available in a license file:
  112. - Valid-License-Identifier:
  113. One or more lines which declare which License Identifiers are valid
  114. inside the project to reference this particular license text. Usually
  115. this is a single valid identifier, but e.g. for licenses with the 'or
  116. later' options two identifiers are valid.
  117. - SPDX-URL:
  118. The URL of the SPDX page which contains additional information related
  119. to the license.
  120. - Usage-Guidance:
  121. Freeform text for usage advice. The text must include correct examples
  122. for the SPDX license identifiers as they should be put into source
  123. files according to the `License identifier syntax` guidelines.
  124. - License-Text:
  125. All text after this tag is treated as the original license text
  126. File format examples::
  127. Valid-License-Identifier: GPL-2.0
  128. Valid-License-Identifier: GPL-2.0-only
  129. Valid-License-Identifier: GPL-2.0-or-later
  130. SPDX-URL:
  131. Usage-Guide:
  132. To use this license in source code, put one of the following SPDX
  133. tag/value pairs into a comment according to the placement
  134. guidelines in the licensing rules documentation.
  135. For 'GNU General Public License (GPL) version 2 only' use:
  136. SPDX-License-Identifier: GPL-2.0
  137. or
  138. SPDX-License-Identifier: GPL-2.0-only
  139. For 'GNU General Public License (GPL) version 2 or any later version' use:
  140. SPDX-License-Identifier: GPL-2.0-or-later
  141. License-Text:
  142. Full license text
  143. 2. Stand-alone licenses:
  144. These licenses should only be used for stand-alone applications that are
  145. distributed with OpenOCD but are not included in the OpenOCD binary.
  146. These licenses are available from the directory:
  147. LICENSES/stand-alone/
  148. in the OpenOCD source tree.
  149. Examples:
  150. SPDX-License-Identifier: GPL-3.0
  151. The format and requirements of the license files in the other sub-directories
  152. of directory
  154. have to follow the same format and requirements of the `Preferred licenses`.
  155. All SPDX license identifiers and exceptions must have a corresponding file
  156. in the LICENSES subdirectories. This is required to allow tool
  157. verification (e.g. and to have the licenses ready to read
  158. and extract right from the source, which is recommended by various FOSS
  159. organizations, e.g. the `FSFE REUSE initiative <>`.