aboutsummaryrefslogtreecommitdiffstats
path: root/community/nodejs-current
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2016-11-27 13:23:57 +0100
committerJakub Jirutka <jakub@jirutka.cz>2016-11-27 14:10:03 +0100
commit308944d90df71c773c958a1c5ff4ebdb240526a3 (patch)
tree88f1668824f4f80c5d21c31e954d9f847144c1d9 /community/nodejs-current
parent7d73d222fd7122c6881d333ea7d07fc500596495 (diff)
downloadaports-308944d90df71c773c958a1c5ff4ebdb240526a3.tar.bz2
aports-308944d90df71c773c958a1c5ff4ebdb240526a3.tar.xz
main/nodejs: rename to nodejs-current and move to community
Odd-numbered versions, like this one (v7), are supported by upstream only for 9 months. When a new odd-numbered major release is cut, the previous even-numbered major version transitions to the Long Term Support plan (LTS). Packages in Alpine stable must be supported for 2 years, so we should keep only LTS version in the stable. Therefore this package is renamed to nodejs-current and moved to the community repository. The nodejs-lts package is going to be renamed to nodejs. See https://github.com/nodejs/LTS#lts-schedule
Diffstat (limited to 'community/nodejs-current')
-rw-r--r--community/nodejs-current/APKBUILD69
-rw-r--r--community/nodejs-current/dont-run-gyp-files-for-bundled-deps.patch21
-rw-r--r--community/nodejs-current/use-system-ca-certs.patch63
3 files changed, 153 insertions, 0 deletions
diff --git a/community/nodejs-current/APKBUILD b/community/nodejs-current/APKBUILD
new file mode 100644
index 0000000000..93acc75c3e
--- /dev/null
+++ b/community/nodejs-current/APKBUILD
@@ -0,0 +1,69 @@
+# 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.2.0
+pkgrel=0
+pkgdesc="JavaScript runtime built on V8 engine - current stable version"
+url="http://nodejs.org/"
+arch="all"
+license="MIT"
+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"
+replaces="nodejs 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 CA certificates.
+ rm -f src/node_root_certs.h
+
+ # 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 \
+ || 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
+}
+
+md5sums="ea2dd2de3e93b601f576bf24c1ab56ec node-v7.2.0.tar.gz
+a785f2e6018cdace456b0ab518474453 use-system-ca-certs.patch
+5b1b27a33063602990f5495d3b01b587 dont-run-gyp-files-for-bundled-deps.patch"
+sha256sums="c3f53a5d8cea145e25706bb21cdac62f1b3314db35785bcf468558a29cfc352f node-v7.2.0.tar.gz
+e0384006b04fef35c2c5e65d0cde6aae7efbc314d38c3c9ade0ae599f2b77bc2 use-system-ca-certs.patch
+6886ee83f76eb68dc948da844e548f060caf360ca039bb2c1ee7ea0cd2d8dbf3 dont-run-gyp-files-for-bundled-deps.patch"
+sha512sums="80a3eab891894064a7669ea08659eb2f675076476e5436b0a1b78f83ea0ebfcfd226dfe1847b5368a07a1f1bbe3038d3011013b3cbe8d8ed093ec7caa29c9603 node-v7.2.0.tar.gz
+877669ed466606bc6afd67083d82b365a969b6626f4248a7f41249958a96e7bb6a6c656715c7b80e763bb53c6cf5789e604e15e05ff74f58e5441acc560350af use-system-ca-certs.patch
+ba95f21b1e80717ef63941854e7ed412f64a91da068c0dbf0d6d9697333ee266c9f4cd7bf1a01111eeb28aa66adefd8a58cfb3e82debb84b43e35e9dc914dd36 dont-run-gyp-files-for-bundled-deps.patch"
diff --git a/community/nodejs-current/dont-run-gyp-files-for-bundled-deps.patch b/community/nodejs-current/dont-run-gyp-files-for-bundled-deps.patch
new file mode 100644
index 0000000000..ba521dc4fc
--- /dev/null
+++ b/community/nodejs-current/dont-run-gyp-files-for-bundled-deps.patch
@@ -0,0 +1,21 @@
+From: Jakub Jirutka <jakub@jirutka.cz>
+Date: Sat, 26 Nov 2016 01:32:00 +0200
+Subject: Disable running gyp files for bundled deps
+
+Author: Stephen Gallagher <sgallagh@redhat.com>
+
+Modified 2016-11-26 by Jakub Jirutka <jakub@jirutka.cz> to update for
+Node.js 7.2.0
+
+--- a/Makefile
++++ b/Makefile
+@@ -72,8 +72,7 @@
+ $(MAKE) -C out BUILDTYPE=Debug V=$(V)
+ ln -fs out/Debug/$(NODE_EXE) $@
+
+-out/Makefile: common.gypi deps/uv/uv.gyp deps/http_parser/http_parser.gyp \
+- deps/zlib/zlib.gyp deps/v8/gypfiles/toolchain.gypi \
++out/Makefile: common.gypi deps/v8/gypfiles/toolchain.gypi \
+ deps/v8/gypfiles/features.gypi deps/v8/src/v8.gyp node.gyp \
+ config.gypi
+ $(PYTHON) tools/gyp_node.py -f make
diff --git a/community/nodejs-current/use-system-ca-certs.patch b/community/nodejs-current/use-system-ca-certs.patch
new file mode 100644
index 0000000000..6e46c74b40
--- /dev/null
+++ b/community/nodejs-current/use-system-ca-certs.patch
@@ -0,0 +1,63 @@
+From: Jakub Jirutka <jakub@jirutka.cz>
+Date: Sat, 26 Nov 2016 21:18:00 +0200
+Subject: Use system-provided CA certificates instead of bundled ones
+
+--- a/src/node_crypto.cc
++++ b/src/node_crypto.cc
+@@ -116,8 +116,8 @@
+
+ static Mutex* mutexes;
+
+-const char* const root_certs[] = {
+-#include "node_root_certs.h" // NOLINT(build/include_order)
++const char* root_certs[] = {
++ NULL
+ };
+
+ X509_STORE* root_cert_store;
+@@ -688,25 +688,33 @@
+
+
+ static X509_STORE* NewRootCertStore() {
++ X509_STORE* store = X509_STORE_new();
++
+ if (!root_certs_vector) {
+ root_certs_vector = new std::vector<X509*>;
+
+- for (size_t i = 0; i < arraysize(root_certs); i++) {
+- BIO* bp = NodeBIO::NewFixed(root_certs[i], strlen(root_certs[i]));
+- X509 *x509 = PEM_read_bio_X509(bp, nullptr, CryptoPemCallback, nullptr);
+- BIO_free(bp);
+-
+- if (x509 == nullptr) {
+- // Parse errors from the built-in roots are fatal.
+- ABORT();
+- return nullptr;
+- }
++ BIO* bio = BIO_new(BIO_s_file());
++ if (bio == nullptr) {
++ abort();
++ return nullptr;
++ }
++
++ if (BIO_read_filename(bio, "/etc/ssl/certs/ca-certificates.crt") == 1) {
++ STACK_OF(X509_INFO)* certs = PEM_X509_INFO_read_bio(bio, nullptr, nullptr, nullptr);
+
+- root_certs_vector->push_back(x509);
++ for (int i = 0; i < sk_X509_INFO_num(certs); i++) {
++ X509* cert = sk_X509_INFO_value(certs, i)->x509;
++
++ if (cert) {
++ X509_up_ref(cert);
++ root_certs_vector->push_back(cert);
++ }
++ }
++ sk_X509_INFO_pop_free(certs, X509_INFO_free);
+ }
++ BIO_free_all(bio);
+ }
+
+- X509_STORE* store = X509_STORE_new();
+ for (auto& cert : *root_certs_vector) {
+ X509_up_ref(cert);
+ X509_STORE_add_cert(store, cert);