1
0
mirror of https://github.com/bertptrs/aur.git synced 2025-12-27 05:20:32 +01:00
Files
aur/PKGBUILD

33 lines
1.1 KiB
Bash

# Maintainer: Bert Peters <bert@bertptrs.nl>
_npmname=node-pre-gyp
pkgname=nodejs-node-pre-gyp
pkgver=0.12.0
pkgrel=2
pkgdesc="Node.js tool for easy binary deployment of C++ addons "
arch=('any')
url="https://github.com/mapbox/node-pre-gyp"
license=('BSD')
depends=('nodejs')
makedepends=('npm' 'jq')
source=("$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz")
noextract=("$pkgname-$pkgver.tar.gz")
sha256sums=('6d3207e85c68539da11ea5f10fb730cdaf9170ed855158957df00b5a8d692c67')
package() {
npm install -g --user root --prefix "$pkgdir/usr" "$pkgname-$pkgver.tar.gz"
# Remove references to $pkgdir
find "$pkgdir" -type f -name package.json -print0 | xargs -0 sed -i "/_where/d"
# Remove references to $srcdir
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"
# Install LICENSE in a more findable spot.
install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname" \
"$pkgdir/usr/lib/node_modules/$_npmname/LICENSE"
}