desktop/npm/PKGBUILD
2016-02-26 13:52:19 +01:00

46 lines
1.3 KiB
Bash

pkgname=npm
pkgver=3.8.0
pkgrel=1
pkgdesc='A package manager for javascript'
arch=('any')
url='https://www.npmjs.com/'
license=('custom:Artistic')
depends=('nodejs')
provides=('nodejs-node-gyp')
makedepends=('procps-ng')
optdepends=('python2: for node-gyp')
options=('!emptydirs')
source=("https://github.com/${pkgname}/${pkgname}/archive/v${pkgver}.tar.gz")
sha256sums=('2c0e376a57d899bf3ec2e4377fcec9bae452a79dafd073c30b0349abd7b245dc')
build() {
cd ${pkgname}-${pkgver}
make
}
package() {
cd ${pkgname}-${pkgver}
make NPMOPTS="--prefix=\"$pkgdir/usr\"" install
# Why 777? :/
chmod -R u=rwX,go=rX "$pkgdir"
# Fix files owned by nobody:
chown -R root "$pkgdir/usr/lib/node_modules"
# Fix wrong symlinks
for _dir in man1 man5 man7; do
rm -f "$pkgdir"/usr/share/man/$_dir/*
cd "$pkgdir"/usr/lib/node_modules/npm/man/$_dir
for _file in *; do
ln -s /usr/lib/node_modules/npm/man/$_dir/$_file "$pkgdir"/usr/share/man/$_dir/
done
done
# Provide node-gyp executable
cp "$pkgdir"/usr/lib/node_modules/npm/bin/node-gyp-bin/node-gyp "$pkgdir"/usr/bin/node-gyp
sed -i 's|"`dirname "$0"`/../../|"`dirname "$0"`/../lib/node_modules/npm/|' "$pkgdir"/usr/bin/node-gyp
install -Dm644 "$srcdir/${pkgname}-${pkgver}/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}