aboutsummaryrefslogtreecommitdiffstats
path: root/community/nodejs-current/APKBUILD
blob: 7d39556c0376920379cac4f20f84e7acd96fb10d (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
77
78
79
80
81
82
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jose-Luis Rivas <ghostbar@riseup.net>
#
# secfixes:
#   9.10.0-r0:
#     - CVE-2018-7158
#     - CVE-2018-7159
#     - CVE-2018-7160
#   9.2.1-r0:
#     - CVE-2017-15896
#     - CVE-2017-15897
#
pkgname=nodejs-current
# The current stable version, i.e. non-LTS.
pkgver=9.11.1
pkgrel=3
pkgdesc="JavaScript runtime built on V8 engine - current stable version"
url="https://nodejs.org/"
arch="all"
license="MIT"
depends="ca-certificates"
depends_dev="libuv"
# gold is needed for mksnapshot
makedepends="$depends_dev python2 openssl1.0-dev zlib-dev libuv-dev linux-headers
	paxmark binutils-gold http-parser-dev ca-certificates c-ares-dev"
subpackages="$pkgname-dev $pkgname-doc"
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"
builddir="$srcdir/node-v$pkgver"

prepare() {
	default_prepare

	# 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 \
		--shared-cares \
		--openssl-use-def-ca-store

	# we need run mksnapshot at build time so paxmark it early.
	make -C out mksnapshot BUILDTYPE=Release
	paxmark -m out/Release/mksnapshot
	make

	# paxmark so JIT works
	paxmark -m out/Release/node
}

# TODO Run provided test suite.
check() {
	cd "$builddir"/out/Release

	./node -e 'console.log("Hello, world!")'
	./node -e "require('assert').equal(process.versions.node, '$pkgver')"
}

package() {
	cd "$builddir"

	make DESTDIR="$pkgdir" install

	# It's strange, but it really needs to be paxmarked again...
	paxmark -m "$pkgdir"/usr/bin/node

	# Remove npm, it's provided by main/nodejs package.
	rm -r "$pkgdir"/usr/lib/node_modules
	rm "$pkgdir"/usr/bin/npm "$pkgdir"/usr/bin/npx
}

sha512sums="6bdd0afa3bdcc633075bbaf1c3a9b8c1a914a881da2dc942ff1477a2b000930a8777c0498db5edcb1eeaa7f13cff942ab88bf0764e296d49e0d1a9a677a52bb0  node-v9.11.1.tar.gz
ba95f21b1e80717ef63941854e7ed412f64a91da068c0dbf0d6d9697333ee266c9f4cd7bf1a01111eeb28aa66adefd8a58cfb3e82debb84b43e35e9dc914dd36  dont-run-gyp-files-for-bundled-deps.patch"