git » licenses.git » main » tree

[main] / PKGBUILD

# Maintainer: David Runge <dvzrv@archlinux.org>
# Contributor: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Dan McGee <dan@archlinux.org>

_upstream_name=license-list-data
_upstream_version=3.24.0
pkgname=licenses
pkgver=20240728
pkgrel=1
pkgdesc="A set of common license files"
arch=(any)
license=(LicenseRef-None)
url="https://www.archlinux.org/"
makedepends=(
  jq
)
source=(
  $_upstream_name-$_upstream_version.tar.gz::https://github.com/spdx/$_upstream_name/archive/refs/tags/v$_upstream_version.tar.gz
)
sha512sums=('6eb81424e1b3173dbd8e17859b2e15dfe1c2af8f4da59b7dad0729c038a4cbdba95c34c2c546285fcdbbd41562e39575e6a6ebb9463b70121e0a12b99d1307e7')
b2sums=('b3b7e1d1b3610b079b133bd2d2682b9c8042a164a9cad8e43ee4f6fc3e6abe313285ea8b7ddce08789a574588691f6b1b67c3440a0d8526f5168d7ec8ca8cf41')

prepare() {
  local license
  touch known_spdx_license_exceptions.txt known_spdx_license_identifiers.txt

  # create list of known, non-deprecated SPDX license identifiers
  for license in $(jq -r '.licenses[] | select(.isDeprecatedLicenseId == false) | .licenseId' $_upstream_name-$_upstream_version/json/licenses.json); do
    printf "%s\n" "$license" >> known_spdx_license_identifiers.txt
  done

  # create list of known SPDX exception identifiers
  for license in $(jq -r '.exceptions[] | .licenseExceptionId' $_upstream_name-$_upstream_version/json/exceptions.json); do
    printf "%s\n" "$license" >> known_spdx_license_exceptions.txt
  done
}

package() {
  local license
  local standard_licenses=(
    AGPL-3.0-only
    AGPL-3.0-or-later
    Apache-2.0
    Artistic-1.0-Perl
    Artistic-2.0
    BSL-1.0
    CC0-1.0
    CC-BY-1.0
    CC-BY-2.0
    CC-BY-2.5
    CC-BY-3.0-AT
    CC-BY-3.0
    CC-BY-3.0-US
    CC-BY-4.0
    CC-BY-NC-1.0
    CC-BY-NC-2.0
    CC-BY-NC-2.5
    CC-BY-NC-3.0
    CC-BY-NC-4.0
    CC-BY-NC-ND-1.0
    CC-BY-NC-ND-2.0
    CC-BY-NC-ND-2.5
    CC-BY-NC-ND-3.0-IGO
    CC-BY-NC-ND-3.0
    CC-BY-NC-ND-4.0
    CC-BY-NC-SA-1.0
    CC-BY-NC-SA-2.0
    CC-BY-NC-SA-2.5
    CC-BY-NC-SA-3.0
    CC-BY-NC-SA-4.0
    CC-BY-ND-1.0
    CC-BY-ND-2.0
    CC-BY-ND-2.5
    CC-BY-ND-3.0
    CC-BY-ND-4.0
    CC-BY-SA-1.0
    CC-BY-SA-2.0
    CC-BY-SA-2.0-UK
    CC-BY-SA-2.1-JP
    CC-BY-SA-2.5
    CC-BY-SA-3.0-AT
    CC-BY-SA-3.0
    CC-BY-SA-4.0
    CC-PDDC
    CDDL-1.0
    CDDL-1.1
    CPL-1.0
    EPL-1.0
    EPL-2.0
    FSFAP
    GFDL-1.1-invariants-only
    GFDL-1.1-invariants-or-later
    GFDL-1.1-no-invariants-only
    GFDL-1.1-no-invariants-or-later
    GFDL-1.1-only
    GFDL-1.1-or-later
    GFDL-1.2-invariants-only
    GFDL-1.2-invariants-or-later
    GFDL-1.2-no-invariants-only
    GFDL-1.2-no-invariants-or-later
    GFDL-1.2-only
    GFDL-1.2-or-later
    GFDL-1.3-invariants-only
    GFDL-1.3-invariants-or-later
    GFDL-1.3-no-invariants-only
    GFDL-1.3-no-invariants-or-later
    GFDL-1.3-only
    GFDL-1.3-or-later
    GPL-1.0-only
    GPL-1.0-or-later
    GPL-2.0-only
    GPL-2.0-or-later
    GPL-3.0-only
    GPL-3.0-or-later
    GPL-CC-1.0
    LGPL-2.0-only
    LGPL-2.0-or-later
    LGPL-2.1-only
    LGPL-2.1-or-later
    LGPL-3.0-only
    LGPL-3.0-or-later
    LGPLLR
    LPPL-1.0
    LPPL-1.1
    LPPL-1.2
    LPPL-1.3a
    LPPL-1.3c
    MPL-1.0
    MPL-1.1
    MPL-2.0
    PHP-3.01
    PHP-3.0
    PSF-2.0
    Ruby
    Unlicense
    WTFPL
    W3C
    ZPL-1.1
    ZPL-2.0
    ZPL-2.1
  )
  local standard_exceptions=(
    GPL-3.0-linking-exception
    GPL-3.0-linking-source-exception
    LGPL-3.0-linking-exception
    LLGPL
    Linux-syscall-note
    MPL-2.0-no-copyleft-exception
  )

  for license in "${standard_licenses[@]}"; do
    install -vDm 644 "$_upstream_name-$_upstream_version/text/$license.txt" -t "$pkgdir/usr/share/licenses/spdx/"
  done
  for license in "${standard_exceptions[@]}"; do
    install -vDm 644 "$_upstream_name-$_upstream_version/text/$license.txt" -t "$pkgdir/usr/share/licenses/spdx/exceptions/"
  done

  install -vDm 644 known_spdx_license_identifiers.txt -t "$pkgdir/usr/share/licenses/"
  install -vDm 644 known_spdx_license_exceptions.txt -t "$pkgdir/usr/share/licenses/"
}

# vim: ts=2 sw=2 et: