summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7a60bdb513059ff77818217e4f25eddbe0065c18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
_npmname=gamecomp
_npmscope=@camoto
pkgname=${_npmname}js # All lowercase
pkgver=latest
pkgrel=1
pkgdesc="Apply and remove compression and encryption algorithms used by DOS games"
arch=(any)
url="http://github.com/Malvineous/gamecompjs"
license=()
depends=('nodejs' )
makedepends=('npm')
optdepends=()

pkgver() {
	# Grab the latest version from npmjs.org
	npm view "${_npmscope}/${_npmname}@latest" version
}

package() {
	npm install -g --user root --prefix "${pkgdir}/usr" "${_npmscope}/${_npmname}@${pkgver}"

	# Non-deterministic race in npm gives 777 permissions to random directories.
	# See https://github.com/npm/cli/issues/1103 for details.
	find "${pkgdir}/usr" -type d -exec chmod 755 {} +

	# npm gives ownership of ALL FILES to build user
	# https://bugs.archlinux.org/task/63396
	chown -R root:root "${pkgdir}"

	# Remove references to srcdir/pkgdir
	find "$pkgdir" -name package.json -print0 | xargs -r -0 sed -i '/_where/d'
}