Skip to content

http2: Allow using a shared nghttp2 library #14920

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 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
Expand Up @@ -182,6 +182,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',
Expand Down Expand Up @@ -1360,6 +1381,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
Expand Down
28 changes: 21 additions & 7 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -151,8 +152,15 @@
'type': '<(node_target_type)',

'dependencies': [
'node_js2c#host',
'deps/nghttp2/nghttp2.gyp:nghttp2'
'node_js2c#host'
],

'conditions': [
Copy link
Contributor

Choose a reason for hiding this comment

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

AFAICT this needs to move to node.gypi

Copy link
Author

Choose a reason for hiding this comment

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

Isn't *.gypi generated by the configure script?

Copy link
Contributor

Choose a reason for hiding this comment

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

Only config.gypi is runtime generated, node.gypi is human generated. AFAICT this is the relevant section

node/node.gypi

Lines 246 to 260 in ffed7b6

[ 'node_shared_zlib=="false"', {
'dependencies': [ 'deps/zlib/zlib.gyp:zlib' ],
}],
[ 'node_shared_http_parser=="false"', {
'dependencies': [ 'deps/http_parser/http_parser.gyp:http_parser' ],
}],
[ 'node_shared_cares=="false"', {
'dependencies': [ 'deps/cares/cares.gyp:cares' ],
}],
[ 'node_shared_libuv=="false"', {
'dependencies': [ 'deps/uv/uv.gyp:libuv' ],
}],

[ 'node_shared_nghttp2=="false"', {
'dependencies': [
'deps/nghttp2/nghttp2.gyp:nghttp2'
]
}]
],

'includes': [
Expand All @@ -163,8 +171,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': [
Expand Down Expand Up @@ -277,9 +284,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'
Copy link
Contributor

Choose a reason for hiding this comment

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

You might need the condition for this target as well.

'V8_DEPRECATION_WARNINGS=1'
],
},
{
Expand Down Expand Up @@ -691,6 +696,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'
Expand Down