collect-licenses.sh 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/usr/bin/env bash
  2. # Writes the licence texts of every third-party component (THIRD_PARTY.md) into one folder, for the packages:
  3. # Apache-2.0 §4(a) (ARA SDK, Basic Pitch), MIT, BSD, LGPL and the GPLv3 option of Steinberg's SDKs want the licence text
  4. # with the binary, not only a pointer to the source tree. Round 190nk (0.1.30).
  5. #
  6. # scripts/collect-licenses.sh <folder> write <folder> (created; e.g. the package's licenses/)
  7. #
  8. # Source: every LICENSE / LICENCE / COPYING / NOTICE / ThirdPartyNotices / GNU-GPL file under third_party/ (named after its
  9. # path: third_party/ara/ARA_API/LICENSE.txt -> ara-ARA_API-LICENSE.txt), the Open Sans font licence (resources/fonts/OFL.txt)
  10. # and resources/licenses/* (licence texts that a component names but does not carry, e.g. GPL-3.0.txt for the VST 3 and
  11. # ASIO SDKs' GPLv3 option). LYNX SHARE's own licence (AGPL-3.0, also the licence LYNX uses JUCE under) is LICENSE next to
  12. # the program. Plain bash + coreutils: runs in the Linux container, on macOS and in Git Bash.
  13. set -euo pipefail
  14. OUT="${1:?usage: scripts/collect-licenses.sh <folder>}"
  15. OUT="$(mkdir -p "$OUT" && cd "$OUT" && pwd)"
  16. cd "$(dirname "$0")/.."
  17. n=0
  18. while IFS= read -r f; do
  19. rel="${f#third_party/}"
  20. name="${rel//\//-}"
  21. case "$name" in *.txt|*.md) ;; *) name="$name.txt" ;; esac # (opens in Notepad / TextEdit)
  22. cp "$f" "$OUT/$name"; n=$((n + 1))
  23. done < <(find third_party -maxdepth 4 -type f \( -iname 'LICEN[CS]E*' -o -iname 'COPYING*' -o -iname 'NOTICE*' \
  24. -o -iname 'ThirdPartyNotices*' -o -iname 'GNU-GPL*' \) | LC_ALL=C sort)
  25. cp resources/fonts/OFL.txt "$OUT/open-sans-OFL.txt"; n=$((n + 1))
  26. for f in resources/licenses/*; do cp "$f" "$OUT/"; n=$((n + 1)); done
  27. cat > "$OUT/README.txt" <<'TXT'
  28. Licence texts of the third-party components in LYNX SHARE.
  29. THIRD_PARTY.md (next to the program) lists every component, what it is used for, its licence and any change LYNX made.
  30. Each file here is named after the component's folder in LYNX SHARE's source (https://github.com/Ka1-S/LYNX-SHARE,
  31. folder third_party/), for example ara-ARA_API-LICENSE.txt is the ARA SDK's Apache License 2.0 and ara-NOTICE.txt its
  32. NOTICE; onnxruntime-ThirdPartyNotices.txt is Microsoft's notice file for ONNX Runtime 1.23.2. GPL-3.0.txt is the
  33. licence of the GPLv3 option under which LYNX uses Steinberg's VST 3 and ASIO SDKs. LYNX SHARE itself, and JUCE as LYNX
  34. uses it, are under the GNU Affero General Public License v3 (LICENSE next to the program).
  35. TXT
  36. echo "collect-licenses: $n licence files in $OUT"