PKGBUILD 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. # Maintainer: David P. <megver83@parabola.nu>
  2. # Maintainer (arch): David Runge <dvzrv@archlinux.org>
  3. # Contributor: Levente Polyak <anthraxx[at]archlinux[dot]org>
  4. # Contributor: Dan McGee <dan@archlinux.org>
  5. # Contributor: bill-auger <bill-auger@programmer.net>
  6. # Parabola changes and rationale:
  7. # libre:
  8. # - Patch the licenses list to mark more licenses as FSDG-compliant
  9. # - Do not install (potentially) non-free licenses
  10. # - Comment doubtful but possibly free licenses from standard_licenses
  11. # technical:
  12. # - retain the legacy license file locations as symlinks
  13. # this is most important currently for libretools <=20240707
  14. _upstream_name=license-list-data
  15. _upstream_version=3.24.0
  16. pkgname=licenses
  17. pkgver=20240728
  18. pkgrel=1
  19. pkgrel+=.parabola1
  20. pkgdesc="A set of common license files"
  21. arch=(any)
  22. license=(LicenseRef-None)
  23. url=https://www.parabola.nu/
  24. makedepends=(
  25. jq
  26. )
  27. source=(
  28. $_upstream_name-$_upstream_version.tar.gz::https://github.com/spdx/$_upstream_name/archive/refs/tags/v$_upstream_version.tar.gz
  29. )
  30. sha512sums=('6eb81424e1b3173dbd8e17859b2e15dfe1c2af8f4da59b7dad0729c038a4cbdba95c34c2c546285fcdbbd41562e39575e6a6ebb9463b70121e0a12b99d1307e7')
  31. b2sums=('b3b7e1d1b3610b079b133bd2d2682b9c8042a164a9cad8e43ee4f6fc3e6abe313285ea8b7ddce08789a574588691f6b1b67c3440a0d8526f5168d7ec8ca8cf41')
  32. # parabola
  33. source+=(known_libre_license_exceptions
  34. mark-unspecified-isFsfLibre-licenses.patch)
  35. sha512sums+=('c92e9d038633d6f90a43b3be6f1adfd98e899ebea0237cd579822e9e0a032c02956fdf12361da5baac039c50159664f987a84799e3aa4d28b74a531d8036018d'
  36. '3745d20df91d1c2b1e2a161f594da4c7d62598cb5faa4518c9626221955f90cb3f62ca40f59d22dc3a9f5c2f64b296cb1bca63d2a2dbe16be748c8ee3e0131b3')
  37. b2sums+=('8ef3ce46e490a0d45f55dab84252c7dc0bee43cbb16685ff5b063dfd700a9413387929ced195a99798c78b70a2db385cdbe0635bc84ffa261f3861fc7ba17674'
  38. 'b124b04eb881b73afcb721465d1844e1e5ef6bfd24da7371b5b767284582872e2ec9efe782e374b3e1b0318ef74124150434478932fd26467ccae4d6e60b6802')
  39. prepare() {
  40. local license
  41. touch known_spdx_license_exceptions.txt known_spdx_license_identifiers.txt
  42. # create list of known, non-deprecated SPDX license identifiers
  43. for license in $(jq -r '.licenses[] | select(.isDeprecatedLicenseId == false) | .licenseId' $_upstream_name-$_upstream_version/json/licenses.json); do
  44. printf "%s\n" "$license" >> known_spdx_license_identifiers.txt
  45. done
  46. # create list of known SPDX exception identifiers
  47. for license in $(jq -r '.exceptions[] | .licenseExceptionId' $_upstream_name-$_upstream_version/json/exceptions.json); do
  48. printf "%s\n" "$license" >> known_spdx_license_exceptions.txt
  49. done
  50. ## parabola patching ##
  51. # Set 'isFsfLibre' for some more known FSDG-compatible licenses in json/licenses.json.
  52. # The 'scrape-GNU-licenses.py' script can be used as a guide for maintaining this patch.
  53. # NOTE: SPDX 'FSFAP' is the 'GNU All-Permissive License (GNUAllPermissive)'
  54. # The following licenses were removed from the initial patch
  55. # because they are not present on the GNU License List.
  56. # We should find a reference for these.
  57. # * LGPLLR
  58. # * libpng-2.0
  59. # * libselinux-1.0
  60. # * libtiff
  61. # * libutil-David-Nugent
  62. echo "applying mark-unspecified-isFsfLibre-licenses.patch"
  63. patch -Np1 -i $srcdir/mark-unspecified-isFsfLibre-licenses.patch -d $_upstream_name-$_upstream_version
  64. # remove from the identifiers list, SPDX license identifiers of non-FSDG-fit licenses
  65. for license in $(jq -r '.licenses[] | select(.isDeprecatedLicenseId == false) | select(.isFsfLibre != true) | .licenseId' $_upstream_name-$_upstream_version/json/licenses.json); do
  66. sed -i "/^${license}$/d" ./known_spdx_license_identifiers.txt
  67. done
  68. # append to the identifiers list, SPDX license identifiers of other known FSDG-fit licenses
  69. for license in $(jq -r '.licenses[] | select(.isDeprecatedLicenseId == false) | select(.isFsfLibre == true) | .licenseId' $_upstream_name-$_upstream_version/json/licenses.json); do
  70. grep -Eq ^${license}$ ./known_spdx_license_identifiers.txt ||
  71. printf "%s\n" "$license" >> known_spdx_license_identifiers.txt
  72. done
  73. # remove from the exceptions list, SPDX license identifiers of non-FSDG-fit licenses
  74. for license in $(jq -r '.exceptions[] | .licenseExceptionId' $_upstream_name-$_upstream_version/json/exceptions.json); do
  75. grep -Eq ^${license}$ ./known_libre_license_exceptions ||
  76. sed -i "/^${license}$/d" ./known_spdx_license_exceptions.txt
  77. done
  78. }
  79. package() {
  80. local license
  81. local standard_licenses=(
  82. AGPL-3.0-only
  83. AGPL-3.0-or-later
  84. Apache-2.0
  85. Artistic-1.0-Perl
  86. Artistic-2.0
  87. BSL-1.0
  88. CC0-1.0
  89. CC-BY-1.0
  90. CC-BY-2.0
  91. CC-BY-2.5
  92. CC-BY-3.0-AT
  93. CC-BY-3.0
  94. CC-BY-3.0-US
  95. CC-BY-4.0
  96. CC-BY-NC-1.0
  97. CC-BY-NC-2.0
  98. CC-BY-NC-2.5
  99. CC-BY-NC-3.0
  100. CC-BY-NC-4.0
  101. CC-BY-NC-ND-1.0
  102. CC-BY-NC-ND-2.0
  103. CC-BY-NC-ND-2.5
  104. CC-BY-NC-ND-3.0-IGO
  105. CC-BY-NC-ND-3.0
  106. CC-BY-NC-ND-4.0
  107. CC-BY-NC-SA-1.0
  108. CC-BY-NC-SA-2.0
  109. CC-BY-NC-SA-2.5
  110. CC-BY-NC-SA-3.0
  111. CC-BY-NC-SA-4.0
  112. CC-BY-ND-1.0
  113. CC-BY-ND-2.0
  114. CC-BY-ND-2.5
  115. CC-BY-ND-3.0
  116. CC-BY-ND-4.0
  117. CC-BY-SA-1.0
  118. CC-BY-SA-2.0
  119. CC-BY-SA-2.0-UK
  120. CC-BY-SA-2.1-JP
  121. CC-BY-SA-2.5
  122. CC-BY-SA-3.0-AT
  123. CC-BY-SA-3.0
  124. CC-BY-SA-4.0
  125. CC-PDDC
  126. CDDL-1.0
  127. CDDL-1.1
  128. CPL-1.0
  129. EPL-1.0
  130. EPL-2.0
  131. FSFAP
  132. GFDL-1.1-invariants-only
  133. GFDL-1.1-invariants-or-later
  134. GFDL-1.1-no-invariants-only
  135. GFDL-1.1-no-invariants-or-later
  136. GFDL-1.1-only
  137. GFDL-1.1-or-later
  138. GFDL-1.2-invariants-only
  139. GFDL-1.2-invariants-or-later
  140. GFDL-1.2-no-invariants-only
  141. GFDL-1.2-no-invariants-or-later
  142. GFDL-1.2-only
  143. GFDL-1.2-or-later
  144. GFDL-1.3-invariants-only
  145. GFDL-1.3-invariants-or-later
  146. GFDL-1.3-no-invariants-only
  147. GFDL-1.3-no-invariants-or-later
  148. GFDL-1.3-only
  149. GFDL-1.3-or-later
  150. GPL-1.0-only
  151. GPL-1.0-or-later
  152. GPL-2.0-only
  153. GPL-2.0-or-later
  154. GPL-3.0-only
  155. GPL-3.0-or-later
  156. GPL-CC-1.0
  157. LGPL-2.0-only
  158. LGPL-2.0-or-later
  159. LGPL-2.1-only
  160. LGPL-2.1-or-later
  161. LGPL-3.0-only
  162. LGPL-3.0-or-later
  163. LGPLLR
  164. LPPL-1.0
  165. LPPL-1.1
  166. LPPL-1.2
  167. LPPL-1.3a
  168. LPPL-1.3c
  169. MPL-1.0
  170. MPL-1.1
  171. MPL-2.0
  172. PHP-3.01
  173. PHP-3.0
  174. PSF-2.0
  175. Ruby
  176. Unlicense
  177. WTFPL
  178. W3C
  179. ZPL-1.1
  180. ZPL-2.0
  181. ZPL-2.1
  182. )
  183. standard_licenses=( ${standard_licenses[*]/CC-BY-NC-*/} ) # non-free
  184. standard_licenses=( ${standard_licenses[*]/CC-BY-ND-*/} ) # non-free
  185. standard_licenses=( ${standard_licenses[*]/LPPL-1.0/} ) # non-free
  186. standard_licenses=( ${standard_licenses[*]/LPPL-1.1/} ) # non-free
  187. for i in "${!standard_licenses[@]}"; do
  188. [[ -n "${standard_licenses[$i]}" ]] || unset "standard_licenses[$i]"
  189. done
  190. local standard_exceptions=(
  191. GPL-3.0-linking-exception
  192. GPL-3.0-linking-source-exception
  193. LGPL-3.0-linking-exception
  194. LLGPL
  195. Linux-syscall-note
  196. MPL-2.0-no-copyleft-exception
  197. )
  198. for license in "${standard_licenses[@]}"; do
  199. install -vDm 644 "$_upstream_name-$_upstream_version/text/$license.txt" -t "$pkgdir/usr/share/licenses/spdx/"
  200. done
  201. for license in "${standard_exceptions[@]}"; do
  202. install -vDm 644 "$_upstream_name-$_upstream_version/text/$license.txt" -t "$pkgdir/usr/share/licenses/spdx/exceptions/"
  203. done
  204. install -vDm 644 known_spdx_license_identifiers.txt -t "$pkgdir/usr/share/licenses/"
  205. install -vDm 644 known_spdx_license_exceptions.txt -t "$pkgdir/usr/share/licenses/"
  206. # legacy support
  207. local known_licenses
  208. local legacy_dir="${pkgdir}"/usr/share/licenses/common
  209. mapfile -t known_licenses < known_spdx_license_identifiers.txt
  210. for license in "${known_licenses[@]}"; do
  211. install -dm755 "${legacy_dir}"/${license}
  212. ln -s ../../spdx/${license}.txt "${legacy_dir}"/${license}/${license}.txt
  213. done
  214. }