nodejs20/0001-build-allow-linking-against-system-http_parser.patch
2012-12-18 08:51:29 -05:00

118 lines
4.0 KiB
Diff

From 0fc5e8b88b7ac7e47deb689e866836434792224e Mon Sep 17 00:00:00 2001
From: Stephen Gallagher <sgallagh@redhat.com>
Date: Tue, 23 Oct 2012 09:01:26 -0400
Subject: [PATCH 1/3] build: allow linking against system http_parser
---
configure | 35 +++++++++++++++++++++++++++++++++++
doc/api/process.markdown | 1 +
node.gyp | 6 +++++-
3 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/configure b/configure
index 1f1343441a5f5fb00bfab2b3b1ec6475820efa13..1fa522755de68a0eb182dde110b8c4a1a8f4aa7c 100755
--- a/configure
+++ b/configure
@@ -124,6 +124,26 @@ parser.add_option("--shared-zlib-libname",
dest="shared_zlib_libname",
help="Alternative lib name to link to (default: 'z')")
+parser.add_option("--shared-http-parser",
+ action="store_true",
+ dest="shared_http_parser",
+ help="Link to a shared http_parser DLL instead of static linking")
+
+parser.add_option("--shared-http-parser-includes",
+ action="store",
+ dest="shared_http_parser_includes",
+ help="Directory containing http_parser header files")
+
+parser.add_option("--shared-http-parser-libpath",
+ action="store",
+ dest="shared_http_parser_libpath",
+ help="A directory to search for the shared http_parser DLL")
+
+parser.add_option("--shared-http-parser-libname",
+ action="store",
+ dest="shared_http_parser_libname",
+ help="Alternative lib name to link to (default: 'http_parser')")
+
parser.add_option("--with-dtrace",
action="store_true",
dest="with_dtrace",
@@ -400,6 +420,20 @@ def configure_libz(o):
o['include_dirs'] += [options.shared_zlib_includes]
+def configure_http_parser(o):
+ o['variables']['node_shared_http_parser'] = b(options.shared_http_parser)
+
+ # assume shared http_parser if one of these is set?
+ if options.shared_http_parser_libpath:
+ o['libraries'] += ['-L%s' % options.shared_http_parser_libpath]
+ if options.shared_http_parser_libname:
+ o['libraries'] += ['-l%s' % options.shared_http_parser_libname]
+ elif options.shared_http_parser:
+ o['libraries'] += ['-lhttp_parser']
+ if options.shared_http_parser_includes:
+ o['include_dirs'] += [options.shared_http_parser_includes]
+
+
def configure_v8(o):
o['variables']['v8_use_snapshot'] = b(not options.without_snapshot)
o['variables']['node_shared_v8'] = b(options.shared_v8)
@@ -453,6 +487,7 @@ output = {
configure_node(output)
configure_libz(output)
+configure_http_parser(output)
configure_v8(output)
configure_openssl(output)
diff --git a/doc/api/process.markdown b/doc/api/process.markdown
index d8612600c6530b3febe9316b3230412d450a2ca5..41b163a15532f829a7d6c2b88ae9a9f31de0a9c8 100644
--- a/doc/api/process.markdown
+++ b/doc/api/process.markdown
@@ -299,6 +299,7 @@ An example of the possible output looks like:
{ host_arch: 'x64',
node_install_npm: 'true',
node_prefix: '',
+ node_shared_http_parser: 'false',
node_shared_v8: 'false',
node_shared_zlib: 'false',
node_use_dtrace: 'false',
diff --git a/node.gyp b/node.gyp
index 939870a56157ab4410cd668be36689d092894ca1..a9903cd1c42cab4295d79d452ef1187c7fa7dbe3 100644
--- a/node.gyp
+++ b/node.gyp
@@ -8,6 +8,7 @@
'node_use_etw%': 'false',
'node_shared_v8%': 'false',
'node_shared_zlib%': 'false',
+ 'node_shared_http_parser%': 'false',
'node_use_openssl%': 'true',
'node_shared_openssl%': 'false',
'library_files': [
@@ -58,7 +59,6 @@
'dependencies': [
'deps/cares/cares.gyp:cares',
- 'deps/http_parser/http_parser.gyp:http_parser',
'deps/uv/uv.gyp:libuv',
'node_js2c#host',
],
@@ -192,6 +192,10 @@
'dependencies': [ 'deps/zlib/zlib.gyp:zlib' ],
}],
+ [ 'node_shared_http_parser=="false"', {
+ 'dependencies': [ 'deps/http_parser/http_parser.gyp:http_parser' ],
+ }],
+
[ 'OS=="win"', {
'sources': [
'src/res/node.rc',
--
1.8.0