aboutsummaryrefslogtreecommitdiffstats
path: root/main/nodejs/APKBUILD
blob: e5c47b82581299eaf86c72e3c13329081be78fb9 (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
83
84
85
86
87
88
89
90
# Contributor: William Pitcock <nenolod@dereferenced.org>
# Contributor: Jose-Luis Rivas <ghostbar@riseup.net>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Contributor: Dave Esaias <dave@containership.io>
# Contributor: Tadahisa Kamijo <kamijin@live.jp>
# Maintainer: Eivind Uggedal <eivind@uggedal.com>
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.
pkgver=6.10.0
pkgrel=0
pkgdesc="JavaScript runtime built on V8 engine - LTS 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-lts=$pkgver"  # for backward compatibility
replaces="nodejs-current nodejs-lts"  # nodejs-lts for backward compatibility
source="https://nodejs.org/dist/v$pkgver/node-v$pkgver.tar.gz
	use-system-ca-certs.patch
	dont-run-gyp-files-for-bundled-deps.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
}

dev() {
	provides="nodejs-lts-dev=$pkgver"  # for backward compatibility

	default_dev || return 1

	# Remove some junk.
	rm -r "$subpkgdir"/usr/lib/node_modules
	rmdir -p "$subpkgdir"/usr/lib || :
}

npm() {
	pkgdesc="A package manager for JavaScript"
	depends="$pkgname"
	replaces="nodejs-current-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="79d3d0854dea1a733175eaa9c5ba0d697d0c57cbcaf2920457eca2d77cc5edadcff8b9eef047156183d05b933582af1b7ef0e64071a9be1c79903af3e7437a92  node-v6.10.0.tar.gz
316a09f697e244c48d4dcf26ca2bb7e2441fc01ed61ad6b987e24741f93cfcf29f2e6de736ab9e4c014355cd14dd63ae7de1f8c28b5274e3225b1b3412db11d4  use-system-ca-certs.patch
a8be538158b7c96341a407acba30450ddc5c3ad764e7efe728d1ceff64efc3067b177855b9ef91b54400be6a02600d83da4c21a07ae9d7dc0774f92b2006ea8b  dont-run-gyp-files-for-bundled-deps.patch"