APKBUILD 3.8 KB
Newer Older
1
# Contributor: Jose-Luis Rivas <ghostbar@riseup.net>
2
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
3
# Contributor: Dave Esaias <dave@containership.io>
4
# Contributor: Tadahisa Kamijo <kamijin@live.jp>
5
# Contributor: Eivind Uggedal <eu@eju.no>
6
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
7 8
#
# secfixes:
9 10
#   10.15.3-r0:
#     - CVE-2019-5737
11 12 13 14 15 16
#   10.14.0-r0:
#     - CVE-2018-12121
#     - CVE-2018-12122
#     - CVE-2018-12123
#     - CVE-2018-0735
#     - CVE-2018-0734
17 18
#   8.11.4-r0:
#     - CVE-2018-12115
19 20 21 22
#   8.11.3-r0:
#     - CVE-2018-7167
#     - CVE-2018-7161
#     - CVE-2018-1000168
23 24 25 26
#   8.11.0-r0:
#     - CVE-2018-7158
#     - CVE-2018-7159
#     - CVE-2018-7160
27 28 29 30 31 32 33
#   8.9.3-r0:
#     - CVE-2017-15896
#     - CVE-2017-15897
#   6.11.5-r0:
#     - CVE-2017-14919
#   6.11.1-r0:
#     - CVE-2017-1000381
34
#
35 36 37
pkgname=nodejs
# Note: Update only to even-numbered versions (e.g. 6.y.z, 8.y.z)!
# Odd-numbered versions are supported only for 9 months by upstream.
38
pkgver=10.16.2
39
pkgrel=0
40
pkgdesc="JavaScript runtime built on V8 engine - LTS version"
41
url="https://nodejs.org/"
42
arch="all !mips64 !mips64el"
43
license="MIT"
44
depends="ca-certificates"
45
depends_dev="libuv"
46
# gold is needed for mksnapshot
47
makedepends="$depends_dev python2 openssl-dev zlib-dev libuv-dev linux-headers
48
	paxmark binutils-gold http-parser-dev ca-certificates c-ares-dev"
49
subpackages="$pkgname-dev $pkgname-doc npm::noarch"
50 51
provides="nodejs-lts=$pkgver"  # for backward compatibility
replaces="nodejs-current nodejs-lts"  # nodejs-lts for backward compatibility
52
source="https://nodejs.org/dist/v$pkgver/node-v$pkgver.tar.gz
53 54 55
	dont-run-gyp-files-for-bundled-deps.patch
	link-with-libatomic-on-mips32.patch
	"
56
builddir="$srcdir/node-v$pkgver"
57

58
prepare() {
59
	default_prepare
60

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

65
build() {
66
	cd "$builddir"
67

68 69 70 71
	case "$CARCH" in
	mips*) _carchflags="--with-mips-arch-variant=r1 --with-mips-float-abi=soft";;
	esac

72
	./configure --prefix=/usr \
73
		$_carchflags \
74 75 76
		--shared-zlib \
		--shared-libuv \
		--shared-openssl \
77
		--shared-http-parser \
78
		--shared-cares \
79
		--openssl-use-def-ca-store
80

81 82 83 84
	# We need run mksnapshot at build time so paxmark it early.
	make -C out mksnapshot BUILDTYPE=Release
	paxmark -m out/Release/mksnapshot
	make
85 86 87 88 89 90 91 92 93 94 95

	# 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')"
96 97 98
}

package() {
99
	cd "$builddir"
100

101
	make DESTDIR="$pkgdir" install
102 103

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

106
	cp -pr "$pkgdir"/usr/lib/node_modules/npm/man "$pkgdir"/usr/share
107
	local d; for d in doc html man; do
108
		rm -r "$pkgdir"/usr/lib/node_modules/npm/$d
109 110
	done
}
111

112 113
dev() {
	provides="nodejs-lts-dev=$pkgver"  # for backward compatibility
114
	default_dev
115 116
}

117 118 119
npm() {
	pkgdesc="A package manager for JavaScript"
	depends="$pkgname"
120 121 122
	# for backward compatibility
	provides="nodejs-npm=$pkgver-r$pkgrel nodejs-current-npm=$pkgver-r$pkgrel"
	replaces="nodejs-npm nodejs-current-npm $pkgname"
123 124

	mkdir -p "$subpkgdir"/usr/bin
125
	mv "$pkgdir"/usr/bin/np[mx] "$subpkgdir"/usr/bin/
126 127 128 129 130

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

131
sha512sums="a7674dcbefe03d2c25cb3410218b0c5eef6e32ef8f1081d70b6dd6eb3b042dd471a6b12ac7a375b207a8dcf008ca2b7594aa223f454b5a14614f2024788b3c2b  node-v10.16.2.tar.gz
132
9d09a88074bf0093f35c5b610e73ebf4c5381df2a2b29feb69da1af0b18776a683b13f1276375bbcfc60936cc27769539e1f01b4ba94b22cad2d5f4daae14c46  dont-run-gyp-files-for-bundled-deps.patch
133
4fd3f10bd82d1e851ed000169c2635c001a4a051283edf96f1efb2260e2d395199dd5843f79f1cff8f2c0c65462c44241c508ea67835dfbd9880d9196fae290a  link-with-libatomic-on-mips32.patch"