Commit 28306e94 authored by Jérémy Lal's avatar Jérémy Lal

Pull request #15256 for building shared nghttp2

parent 22384707
From 6a9b3087bbfaee37a56b175e142a98c82ec61959 Mon Sep 17 00:00:00 2001
From: Jeroen Roovers <jer@airfi.aero>
Date: Fri, 8 Sep 2017 06:53:31 +0200
Subject: [PATCH] http2: Allow using a shared nghttp2 library
As nice as it is to bundle several libraries for builders' convenience,
it also exposes builders to several kinds of security problems (until
you release a new version with the bundled libraries updated) and it
duplicates the number of versions of a library present on systems. For
instance, with libcurl/curl installed and built against nghttp2, having
a bundled (and older) version of libnghttp2 statically linked into
/usr/bin/node duplicates the other version already present in /usr/lib*.
---
configure | 22 ++++++++++++++++++++++
node.gyp | 28 +++++++++++++++++++++-------
node.gypi | 4 ++++
3 files changed, 47 insertions(+), 7 deletions(-)
--- a/configure
+++ b/configure
@@ -182,6 +182,27 @@
dest='shared_http_parser_libpath',
help='a directory to search for the shared http_parser DLL')
+shared_optgroup.add_option('--shared-nghttp2',
+ action='store_true',
+ dest='shared_nghttp2',
+ help='link to a shared nghttp2 DLL instead of static linking')
+
+shared_optgroup.add_option('--shared-nghttp2-includes',
+ action='store',
+ dest='shared_nghttp2_includes',
+ help='directory containing nghttp2 header files')
+
+shared_optgroup.add_option('--shared-nghttp2-libname',
+ action='store',
+ dest='shared_nghttp2_libname',
+ default='nghttp2',
+ help='alternative lib name to link to [default: %default]')
+
+shared_optgroup.add_option('--shared-nghttp2-libpath',
+ action='store',
+ dest='shared_nghttp2_libpath',
+ help='a directory to search for the shared nghttp2 DLL')
+
shared_optgroup.add_option('--shared-libuv',
action='store_true',
dest='shared_libuv',
@@ -1360,6 +1381,7 @@
configure_node(output)
configure_library('zlib', output)
configure_library('http_parser', output)
+configure_library('nghttp2', output)
configure_library('libuv', output)
configure_library('libcares', output)
# stay backwards compatible with shared cares builds
--- a/node.gyp
+++ b/node.gyp
@@ -14,6 +14,7 @@
'node_module_version%': '',
'node_shared_zlib%': 'false',
'node_shared_http_parser%': 'false',
+ 'node_shared_nghttp2%': 'false',
'node_shared_cares%': 'false',
'node_shared_libuv%': 'false',
'node_use_openssl%': 'true',
@@ -149,8 +150,15 @@
'type': '<(node_target_type)',
'dependencies': [
- 'node_js2c#host',
- 'deps/nghttp2/nghttp2.gyp:nghttp2'
+ 'node_js2c#host'
+ ],
+
+ 'conditions': [
+ [ 'node_shared_nghttp2=="false"', {
+ 'dependencies': [
+ 'deps/nghttp2/nghttp2.gyp:nghttp2'
+ ]
+ }]
],
'includes': [
@@ -161,8 +169,7 @@
'src',
'tools/msvs/genfiles',
'deps/uv/src/ares',
- '<(SHARED_INTERMEDIATE_DIR)', # for node_natives.h
- 'deps/nghttp2/lib/includes'
+ '<(SHARED_INTERMEDIATE_DIR)' # for node_natives.h
],
'sources': [
@@ -275,9 +282,7 @@
'NODE_PLATFORM="<(OS)"',
'NODE_WANT_INTERNALS=1',
# Warn when using deprecated V8 APIs.
- 'V8_DEPRECATION_WARNINGS=1',
- # We're using the nghttp2 static lib
- 'NGHTTP2_STATICLIB'
+ 'V8_DEPRECATION_WARNINGS=1'
],
},
{
@@ -687,6 +692,15 @@
'deps/http_parser/http_parser.gyp:http_parser'
]
}],
+ [ 'node_shared_nghttp2=="false"', {
+ 'dependencies': [
+ 'deps/nghttp2/nghttp2.gyp:nghttp2'
+ ],
+ 'defines': [
+ # We're using the nghttp2 static lib
+ 'NGHTTP2_STATICLIB'
+ ]
+ }],
[ 'node_shared_libuv=="false"', {
'dependencies': [
'deps/uv/uv.gyp:libuv'
--- a/node.gypi
+++ b/node.gypi
@@ -251,6 +251,10 @@
'dependencies': [ 'deps/http_parser/http_parser.gyp:http_parser' ],
}],
+ [ 'node_shared_nghttp2=="false"', {
+ 'dependencies': [ 'deps/nghttp2/nghttp2.gyp:nghttp2' ],
+ }],
+
[ 'node_shared_cares=="false"', {
'dependencies': [ 'deps/cares/cares.gyp:cares' ],
}],
......@@ -7,3 +7,4 @@ shared_can_build_without_gyp.patch
2017_mips_configure_fpu.patch
test_ci_buildd.patch
doctool-yaml.patch
6a9b3087bbfaee37a56b175e142a98c82ec61959.patch
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment