summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndré Draszik <andre.draszik@jci.com>2020-03-03 17:28:51 +0000
committerKhem Raj <raj.khem@gmail.com>2020-03-03 11:40:40 -0800
commitb3b81507b7289a4d8ce96aedc9fcfb46fb919c1c (patch)
treec50b05c56ce8f73542e25364bec4e679ea136d14
parent754b54699b881459eda3eaf4e2ba893e85b76abf (diff)
downloadmeta-openembedded-b3b81507b7289a4d8ce96aedc9fcfb46fb919c1c.tar.gz
nodejs: allow use of system brotli (and make default)
Use system brotli via PACKAGECONFIG by default. So far, nodejs had been built using its embedded copy of brotli, which we generally try to avoid, for the known reasons (independent updates, cve & license checks, etc). The nodejs patches to enable this have been submitted. brotli is in meta-oe, so enabling this by default should not be a problem. Signed-off-by: André Draszik <andre.draszik@jci.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--meta-oe/recipes-devtools/nodejs/nodejs/0001-build-allow-passing-multiple-libs-to-pkg_config.patch41
-rw-r--r--meta-oe/recipes-devtools/nodejs/nodejs/0002-build-allow-use-of-system-installed-brotli.patch66
-rw-r--r--meta-oe/recipes-devtools/nodejs/nodejs_12.14.1.bb7
3 files changed, 113 insertions, 1 deletions
diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/0001-build-allow-passing-multiple-libs-to-pkg_config.patch b/meta-oe/recipes-devtools/nodejs/nodejs/0001-build-allow-passing-multiple-libs-to-pkg_config.patch
new file mode 100644
index 0000000000..13edf229b3
--- /dev/null
+++ b/meta-oe/recipes-devtools/nodejs/nodejs/0001-build-allow-passing-multiple-libs-to-pkg_config.patch
@@ -0,0 +1,41 @@
1From fdaa0e3bef93c5c72a7258b5f1e30718e7d81f9b Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <git@andred.net>
3Date: Mon, 2 Mar 2020 12:17:09 +0000
4Subject: [PATCH 1/2] build: allow passing multiple libs to pkg_config
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Sometimes it's necessary to pass multiple library names to pkg-config,
10e.g. the brotli shared libraries can be pulled in with
11 pkg-config libbrotlienc libbrotlidec
12
13Update the code to handle both, strings (as used so far), and lists
14of strings.
15
16Signed-off-by: André Draszik <git@andred.net>
17---
18Upstream-Status: Submitted [https://github.com/nodejs/node/pull/32046]
19 configure.py | 6 +++++-
20 1 file changed, 5 insertions(+), 1 deletion(-)
21
22diff --git a/configure.py b/configure.py
23index beb08df088..e3f78f2fed 100755
24--- a/configure.py
25+++ b/configure.py
26@@ -680,7 +680,11 @@ def pkg_config(pkg):
27 retval = ()
28 for flag in ['--libs-only-l', '--cflags-only-I',
29 '--libs-only-L', '--modversion']:
30- args += [flag, pkg]
31+ args += [flag]
32+ if isinstance(pkg, list):
33+ args += pkg
34+ else:
35+ args += [pkg]
36 try:
37 proc = subprocess.Popen(shlex.split(pkg_config) + args,
38 stdout=subprocess.PIPE)
39--
402.25.0
41
diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/0002-build-allow-use-of-system-installed-brotli.patch b/meta-oe/recipes-devtools/nodejs/nodejs/0002-build-allow-use-of-system-installed-brotli.patch
new file mode 100644
index 0000000000..fc038f3aae
--- /dev/null
+++ b/meta-oe/recipes-devtools/nodejs/nodejs/0002-build-allow-use-of-system-installed-brotli.patch
@@ -0,0 +1,66 @@
1From f0f927feee8cb1fb173835d5c3f6beb6bf7d5e54 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <git@andred.net>
3Date: Mon, 2 Mar 2020 12:17:35 +0000
4Subject: [PATCH 2/2] build: allow use of system-installed brotli
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9brotli is available as a shared library since 2016, so it makes sense
10to allow its use as a system-installed version.
11
12Some of the infrastructure was in place already (node.gyp and
13node.gypi), but some bits in the configure script here were missing.
14
15Add them, keeping the default as before, to use the bundled version.
16
17Refs: https://github.com/google/brotli/pull/421
18Signed-off-by: André Draszik <git@andred.net>
19---
20Upstream-Status: Submitted [https://github.com/nodejs/node/pull/32046]
21 configure.py | 22 ++++++++++++++++++++++
22 1 file changed, 22 insertions(+)
23
24diff --git a/configure.py b/configure.py
25index e3f78f2fed..0190e31b41 100755
26--- a/configure.py
27+++ b/configure.py
28@@ -301,6 +301,27 @@ shared_optgroup.add_option('--shared-zlib-libpath',
29 dest='shared_zlib_libpath',
30 help='a directory to search for the shared zlib DLL')
31
32+shared_optgroup.add_option('--shared-brotli',
33+ action='store_true',
34+ dest='shared_brotli',
35+ help='link to a shared brotli DLL instead of static linking')
36+
37+shared_optgroup.add_option('--shared-brotli-includes',
38+ action='store',
39+ dest='shared_brotli_includes',
40+ help='directory containing brotli header files')
41+
42+shared_optgroup.add_option('--shared-brotli-libname',
43+ action='store',
44+ dest='shared_brotli_libname',
45+ default='brotlidec,brotlienc',
46+ help='alternative lib name to link to [default: %default]')
47+
48+shared_optgroup.add_option('--shared-brotli-libpath',
49+ action='store',
50+ dest='shared_brotli_libpath',
51+ help='a directory to search for the shared brotli DLL')
52+
53 shared_optgroup.add_option('--shared-cares',
54 action='store_true',
55 dest='shared_cares',
56@@ -1692,6 +1713,7 @@ configure_napi(output)
57 configure_library('zlib', output)
58 configure_library('http_parser', output)
59 configure_library('libuv', output)
60+configure_library('brotli', output, pkgname=['libbrotlidec', 'libbrotlienc'])
61 configure_library('cares', output, pkgname='libcares')
62 configure_library('nghttp2', output, pkgname='libnghttp2')
63 configure_v8(output)
64--
652.25.0
66
diff --git a/meta-oe/recipes-devtools/nodejs/nodejs_12.14.1.bb b/meta-oe/recipes-devtools/nodejs/nodejs_12.14.1.bb
index 49bb71e282..1ea438c5b0 100644
--- a/meta-oe/recipes-devtools/nodejs/nodejs_12.14.1.bb
+++ b/meta-oe/recipes-devtools/nodejs/nodejs_12.14.1.bb
@@ -20,6 +20,8 @@ SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz \
20 file://0003-Install-both-binaries-and-use-libdir.patch \ 20 file://0003-Install-both-binaries-and-use-libdir.patch \
21 file://0004-v8-don-t-override-ARM-CFLAGS.patch \ 21 file://0004-v8-don-t-override-ARM-CFLAGS.patch \
22 file://big-endian.patch \ 22 file://big-endian.patch \
23 file://0001-build-allow-passing-multiple-libs-to-pkg_config.patch \
24 file://0002-build-allow-use-of-system-installed-brotli.patch \
23 " 25 "
24SRC_URI_append_class-target = " \ 26SRC_URI_append_class-target = " \
25 file://0002-Using-native-binaries.patch \ 27 file://0002-Using-native-binaries.patch \
@@ -51,8 +53,9 @@ ARCHFLAGS_arm = "${@bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', '-
51GYP_DEFINES_append_mipsel = " mips_arch_variant='r1' " 53GYP_DEFINES_append_mipsel = " mips_arch_variant='r1' "
52ARCHFLAGS ?= "" 54ARCHFLAGS ?= ""
53 55
54PACKAGECONFIG ??= "ares icu libuv zlib" 56PACKAGECONFIG ??= "ares brotli icu libuv zlib"
55PACKAGECONFIG[ares] = "--shared-cares,,c-ares" 57PACKAGECONFIG[ares] = "--shared-cares,,c-ares"
58PACKAGECONFIG[brotli] = "--shared-brotli,,brotli"
56PACKAGECONFIG[icu] = "--with-intl=system-icu,--without-intl,icu" 59PACKAGECONFIG[icu] = "--with-intl=system-icu,--without-intl,icu"
57PACKAGECONFIG[libuv] = "--shared-libuv,,libuv" 60PACKAGECONFIG[libuv] = "--shared-libuv,,libuv"
58PACKAGECONFIG[nghttp2] = "--shared-nghttp2,,nghttp2" 61PACKAGECONFIG[nghttp2] = "--shared-nghttp2,,nghttp2"
@@ -81,6 +84,8 @@ python do_unpack() {
81 shutil.rmtree(d.getVar('S') + '/deps/openssl', True) 84 shutil.rmtree(d.getVar('S') + '/deps/openssl', True)
82 if 'ares' in d.getVar('PACKAGECONFIG'): 85 if 'ares' in d.getVar('PACKAGECONFIG'):
83 shutil.rmtree(d.getVar('S') + '/deps/cares', True) 86 shutil.rmtree(d.getVar('S') + '/deps/cares', True)
87 if 'brotli' in d.getVar('PACKAGECONFIG'):
88 shutil.rmtree(d.getVar('S') + '/deps/brotli', True)
84 if 'libuv' in d.getVar('PACKAGECONFIG'): 89 if 'libuv' in d.getVar('PACKAGECONFIG'):
85 shutil.rmtree(d.getVar('S') + '/deps/uv', True) 90 shutil.rmtree(d.getVar('S') + '/deps/uv', True)
86 if 'nghttp2' in d.getVar('PACKAGECONFIG'): 91 if 'nghttp2' in d.getVar('PACKAGECONFIG'):