Skip to content

Commit bfd78b6

Browse files
sgallagherbnoordhuis
authored andcommitted
build: allow linking against system http_parser
1 parent fddb5dc commit bfd78b6

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

configure

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,26 @@ parser.add_option("--shared-zlib-libname",
131131
dest="shared_zlib_libname",
132132
help="Alternative lib name to link to (default: 'z')")
133133

134+
parser.add_option("--shared-http-parser",
135+
action="store_true",
136+
dest="shared_http_parser",
137+
help="Link to a shared http_parser DLL instead of static linking")
138+
139+
parser.add_option("--shared-http-parser-includes",
140+
action="store",
141+
dest="shared_http_parser_includes",
142+
help="Directory containing http_parser header files")
143+
144+
parser.add_option("--shared-http-parser-libpath",
145+
action="store",
146+
dest="shared_http_parser_libpath",
147+
help="A directory to search for the shared http_parser DLL")
148+
149+
parser.add_option("--shared-http-parser-libname",
150+
action="store",
151+
dest="shared_http_parser_libname",
152+
help="Alternative lib name to link to (default: 'http_parser')")
153+
134154
parser.add_option("--with-dtrace",
135155
action="store_true",
136156
dest="with_dtrace",
@@ -422,6 +442,20 @@ def configure_libz(o):
422442
o['include_dirs'] += [options.shared_zlib_includes]
423443

424444

445+
def configure_http_parser(o):
446+
o['variables']['node_shared_http_parser'] = b(options.shared_http_parser)
447+
448+
# assume shared http_parser if one of these is set?
449+
if options.shared_http_parser_libpath:
450+
o['libraries'] += ['-L%s' % options.shared_http_parser_libpath]
451+
if options.shared_http_parser_libname:
452+
o['libraries'] += ['-l%s' % options.shared_http_parser_libname]
453+
elif options.shared_http_parser:
454+
o['libraries'] += ['-lhttp_parser']
455+
if options.shared_http_parser_includes:
456+
o['include_dirs'] += [options.shared_http_parser_includes]
457+
458+
425459
def configure_v8(o):
426460
o['variables']['v8_use_snapshot'] = b(not options.without_snapshot)
427461
o['variables']['node_shared_v8'] = b(options.shared_v8)
@@ -475,6 +509,7 @@ output = {
475509

476510
configure_node(output)
477511
configure_libz(output)
512+
configure_http_parser(output)
478513
configure_v8(output)
479514
configure_openssl(output)
480515

doc/api/process.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ An example of the possible output looks like:
299299
{ host_arch: 'x64',
300300
node_install_npm: 'true',
301301
node_prefix: '',
302+
node_shared_http_parser: 'false',
302303
node_shared_v8: 'false',
303304
node_shared_zlib: 'false',
304305
node_use_dtrace: 'false',

node.gyp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
'node_use_etw%': 'false',
99
'node_shared_v8%': 'false',
1010
'node_shared_zlib%': 'false',
11+
'node_shared_http_parser%': 'false',
1112
'node_use_openssl%': 'true',
1213
'node_use_systemtap%': 'false',
1314
'node_shared_openssl%': 'false',
@@ -59,7 +60,6 @@
5960

6061
'dependencies': [
6162
'deps/cares/cares.gyp:cares',
62-
'deps/http_parser/http_parser.gyp:http_parser',
6363
'deps/uv/uv.gyp:libuv',
6464
'node_js2c#host',
6565
],
@@ -201,6 +201,10 @@
201201
'dependencies': [ 'deps/zlib/zlib.gyp:zlib' ],
202202
}],
203203

204+
[ 'node_shared_http_parser=="false"', {
205+
'dependencies': [ 'deps/http_parser/http_parser.gyp:http_parser' ],
206+
}],
207+
204208
[ 'OS=="win"', {
205209
'sources': [
206210
'src/res/node.rc',

0 commit comments

Comments
 (0)