diff options
author | zoorat | 2021-12-04 21:45:17 +0600 |
---|---|---|
committer | zoorat | 2021-12-04 21:45:17 +0600 |
commit | ed6246f1c38f3cd75e2a6e64195cbb8498020334 (patch) | |
tree | 0405d53236baab4d72c951f4b20d9b9b2ece7e7f /PKGBUILD | |
download | aur-ed6246f1c38f3cd75e2a6e64195cbb8498020334.tar.gz |
adding webtorrent-bittorrent-tracker v9.18.3 in AUR
Signed-off-by: zoorat <78788887+z00rat@users.noreply.github.com>
Diffstat (limited to 'PKGBUILD')
-rw-r--r-- | PKGBUILD | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..7f078ceb598b --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,55 @@ +# Maintainer: zoorat <zoorat [at] protonmail [dot] com> + +_npmname=bittorrent-tracker +pkgname=webtorrent-$_npmname +pkgver=9.18.3 +pkgrel=1 + +pkgdesc="Simple, robust, BitTorrent tracker (client & server) implementation" +arch=(any) +url="https://github.com/webtorrent/bittorrent-tracker" +license=("MIT") + +depends=("nodejs") +makedepends=("npm" "jq") +provides=("$_npmname") +conflicts=("$_npmname") +options=(strip emptydirs zipman) + +source=("https://registry.npmjs.org/${_npmname}/-/${_npmname}-${pkgver}.tgz" + "https://raw.githubusercontent.com/webtorrent/bittorrent-tracker/master/LICENSE") +noextract=("${_npmname}-${pkgver}.tgz") +b2sums=('af2932d4c4df5b2d6a9ff7bd0c2200d0b7270fd43bc27ccabee6d87fa0a99327d251b4f957b64dbe69453d067ecac3a1cead1a9ba71fb4bddcc10cda256cdfa7' + '3890a8cd095787f6ab383fe3ca0a0bf0999d80a7ea65627bb1a50f1c2690987f53e0619df5745ba47d6ef46d32e03573b5a52330a7c857220e4db96a33203019') + +# Document: https://wiki.archlinux.org/title/Node.js_package_guidelines +package() { + # Install using Using npm + npm install -s -g \ + --cache "${srcdir}/npm-cache" \ + --prefix "${pkgdir}/usr" \ + "${srcdir}/${_npmname}-${pkgver}.tgz" + + # Fix ownership of ALL FILES + find "${pkgdir}/usr" -type d -exec chmod 755 {} + + chown -R root:root "${pkgdir}" + + # Remove references to $pkgdir + find "$pkgdir" -name package.json -print0 | xargs -r -0 sed -i '/_where/d' + + local tmppackage="$(mktemp)" + local pkgjson="$pkgdir/usr/lib/node_modules/$_npmname/package.json" + jq '.|=with_entries(select(.key|test("_.+")|not))' "$pkgjson" >"$tmppackage" + mv "$tmppackage" "$pkgjson" + chmod 644 "$pkgjson" + + find "$pkgdir" -type f -name package.json | while read pkgjson; do + local tmppackage="$(mktemp)" + jq 'del(.man)' "$pkgjson" >"$tmppackage" + mv "$tmppackage" "$pkgjson" + chmod 644 "$pkgjson" + done + + # Install LICENSE file + install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" +} |