arch-pkgs/rollup/PKGBUILD

40 lines
1.2 KiB
Text
Raw Normal View History

# Maintainer: Simon Legner <Simon.Legner@gmail.com>
# Contributor: George Rawlinson <george@rawlinson.net.nz>
pkgname=rollup
pkgver=2.39.1
pkgrel=1
pkgdesc="Next-generation ES6 module bundler"
arch=(any)
url="https://rollupjs.org/"
license=('MIT' 'ISC')
depends=('nodejs')
makedepends=('npm' 'jq')
source=("https://registry.npmjs.org/$pkgname/-/$pkgname-$pkgver.tgz")
noextract=("$pkgname-$pkgver.tgz")
b2sums=('373d17524836f0c1df65f7e5e7555f69835ff7a7875a5a73794639c3d99a2e54e9199cc1cf519fd90d7df4688163841eef7d8300e2468d5e2d50955085750b85')
package() {
# install package
npm install -g \
--user root \
--prefix "$pkgdir/usr" \
--cache "$srcdir/npm-cache" \
"$srcdir/$pkgname-$pkgver.tgz"
# install licenses
install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname" \
"$pkgdir/usr/lib/node_modules/rollup/LICENSE.md"
# remove references to ${src,pkg}dir
local tmppackage="$(mktemp)"
local pkgjson="$pkgdir/usr/lib/node_modules/$pkgname/package.json"
jq '.|=with_entries(select(.key|test("_.+")|not))' "$pkgjson" > "$tmppackage"
mv "$tmppackage" "$pkgjson"
chmod 644 "$pkgjson"
# npm gives ownership of ALL FILES to build user
# https://bugs.archlinux.org/task/63396
chown -R root:root "$pkgdir"
}