desktop/npm/PKGBUILD
2018-04-28 13:28:53 +01:00

45 lines
1.4 KiB
Bash

pkgname=npm
pkgver=6.0.0
pkgrel=1
pkgdesc='A package manager for javascript'
arch=('any')
url='https://www.npmjs.com/'
license=('custom:Artistic')
depends=('nodejs' 'node-gyp' 'semver')
makedepends=('procps-ng' 'marked-man')
options=('!emptydirs')
source=("$pkgname-$pkgver::https://github.com/${pkgname}/${pkgname}/archive/v${pkgver}.tar.gz")
sha256sums=('b965a4a6a32acd60f0b549187057b795032ab33c5dfb366c7e9b8d89c81dbd60')
prepare() {
cd ${pkgname}-${pkgver}
ln -sf /usr/bin/marked{,-man} node_modules/.bin/
}
build() {
cd ${pkgname}-${pkgver}
make
}
package() {
cd ${pkgname}-${pkgver}
make NPMOPTS="--prefix=\"$pkgdir/usr\"" install
# Non-deterministic race in npm gives 777 permissions to random directories.
# See https://github.com/npm/npm/issues/9359 for details.
chmod -R u=rwX,go=rX "$pkgdir"
# Experimental dedup
_npmdir="$pkgdir"/usr/lib/node_modules/$pkgname
rm -r "$_npmdir"/node_modules/{,.bin/}semver
rm -r "$_npmdir"/node_modules/{,.bin/}node-gyp
sed -i '/node-gyp.js/c\ exec /usr/bin/node-gyp "$@"' \
"$_npmdir"/node_modules/npm-lifecycle/node-gyp-bin/node-gyp \
"$_npmdir"/bin/node-gyp-bin/node-gyp
install -dm755 "$pkgdir"/usr/share/bash-completion/completions
node "$srcdir"/npm-$pkgver/bin/npm-cli.js completion > "$pkgdir"/usr/share/bash-completion/completions/npm
install -Dm644 "$srcdir/${pkgname}-${pkgver}/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}