Skip to content

http2: Allow using a shared nghttp2 library #15256

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions configure
Original file line number Diff line number Diff line change
@@ -193,6 +193,27 @@ shared_optgroup.add_option('--shared-http-parser-libpath',
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',
@@ -1373,6 +1394,7 @@ flavor = GetFlavor(flavor_params)
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
28 changes: 21 additions & 7 deletions node.gyp
Original file line number Diff line number Diff line change
@@ -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',
@@ -159,8 +160,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'
]
}]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary? It's covered by the conditional around line 712, right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't write the conditionals for v8_enable_inspector==1, but I assumed that the author requires all bundled libraries in that case, so requiring the bundled nghttp2 as with the other bundled libraries seemed proper.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sorry, I mean line 254 in node.gypi.

],

'includes': [
@@ -171,8 +179,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': [
@@ -289,9 +296,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'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you undo this change?

],
},
{
@@ -704,6 +709,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'
]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove the define? That's taken care of now that #15487 has been merged.

}],
[ 'node_shared_libuv=="false"', {
'dependencies': [
'deps/uv/uv.gyp:libuv'
4 changes: 4 additions & 0 deletions node.gypi
Original file line number Diff line number Diff line change
@@ -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' ],
}],