aboutsummaryrefslogtreecommitdiffstats
path: root/community/nodejs-current/APKBUILD
blob: 22aafde3587086620a41a64e6e2c0637a173ce45 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jose-Luis Rivas <ghostbar@riseup.net>
pkgname=nodejs-current
# The current stable version, i.e. non-LTS.
pkgver=7.7.4
pkgrel=0
pkgdesc="JavaScript runtime built on V8 engine - current stable version"
url="http://nodejs.org/"
arch="all"
license="MIT"
depends="ca-certificates"
depends_dev="libuv"
# gold is needed for mksnapshot
makedepends="$depends_dev python2 openssl-dev zlib-dev libuv-dev linux-headers
	paxmark binutils-gold http-parser-dev ca-certificates"
subpackages="$pkgname-dev $pkgname-doc $pkgname-npm::noarch"
provides="nodejs"
replaces="nodejs nodejs-lts"  # nodejs-lts for backward compatibility
source="https://nodejs.org/dist/v$pkgver/node-v$pkgver.tar.gz
	dont-run-gyp-files-for-bundled-deps.patch
	ppc-fix-musl-mcontext.patch"
builddir="$srcdir/node-v$pkgver"

prepare() {
	default_prepare || return 1

	# Remove bundled dependencies that we're not using.
	rm -rf deps/http_parser deps/openssl deps/uv deps/zlib
}

build() {
	cd "$builddir"

	./configure --prefix=/usr \
		--shared-zlib \
		--shared-libuv \
		--shared-openssl \
		--shared-http-parser \
		--openssl-use-def-ca-store \
		|| return 1

	# we need run mksnapshot at build time so paxmark it early
	make -C out mksnapshot BUILDTYPE=Release \
		&& paxmark -m out/Release/mksnapshot \
		&& make || return 1
}

package() {
	cd "$builddir"

	make DESTDIR="$pkgdir" install || return 1
	# paxmark so JIT works
	paxmark -m "$pkgdir"/usr/bin/node || return 1

	cp -pr "$pkgdir"/usr/lib/node_modules/npm/man "$pkgdir"/usr/share || return 1
	local d; for d in doc html man; do
		rm -r "$pkgdir"/usr/lib/node_modules/npm/$d || return 1
	done
}

npm() {
	pkgdesc="A package manager for JavaScript"
	depends="$pkgname"
	provides="nodejs-npm"
	replaces="nodejs-npm $pkgname"  # $pkgname for backward compatibility

	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/npm "$subpkgdir"/usr/bin/ || return 1

	mkdir -p "$subpkgdir"/usr/lib/node_modules
	mv "$pkgdir"/usr/lib/node_modules/npm "$subpkgdir"/usr/lib/node_modules/
}

sha512sums="2bd09784001354e187227f727e11c871c0f36e0caf18a5c1c1a374938a536ac6601a3240055d9ac659eeeac0b461aaa91bf05b49b27901d17afc22740b7f29ab  node-v7.7.4.tar.gz
ba95f21b1e80717ef63941854e7ed412f64a91da068c0dbf0d6d9697333ee266c9f4cd7bf1a01111eeb28aa66adefd8a58cfb3e82debb84b43e35e9dc914dd36  dont-run-gyp-files-for-bundled-deps.patch
a128c76c6e5cc4d0c168bef1d02f10d1ce6be9ae98d92d4284c75e0f39bdf02355c1ac37996b749c1fda95bdffc273b0a10546f9ebfc5f02b8bc2cf5ac79981b  ppc-fix-musl-mcontext.patch"