Browse Source

build: add "--partly-static" build options

A lot of machines don't upgrade libstdc++.so library for a long time,
but the new version of node requires the latest GLIBCXX.

Using "--fully-static" configurable options may resolve this problem,
but the side effect is that the size of the executable file will be
increased.

Adding "--partly-static" configurable options it will only build
libgcc and libstdc++ libraries into executable file, resolve the
problem and control the size of file.

PR-URL: https://github.com/nodejs/node/pull/4152
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
process-exit-stdio-flushing
Super Zheng 9 years ago
committed by Ben Noordhuis
parent
commit
95dd890b32
  1. 25
      configure

25
configure

@ -84,7 +84,13 @@ parser.add_option("--fully-static",
action="store_true", action="store_true",
dest="fully_static", dest="fully_static",
help="Generate an executable without external dynamic libraries. This " help="Generate an executable without external dynamic libraries. This "
"will not work on OSX when using default compilation environment") "will not work on OSX when using the default compilation environment")
parser.add_option("--partly-static",
action="store_true",
dest="partly_static",
help="Generate an executable with libgcc and libstdc++ libraries. This "
"will not work on OSX when using the default compilation environment")
parser.add_option("--enable-vtune-profiling", parser.add_option("--enable-vtune-profiling",
action="store_true", action="store_true",
@ -816,12 +822,19 @@ def configure_openssl(o):
configure_library('openssl', o) configure_library('openssl', o)
def configure_fullystatic(o): def configure_static(o):
if options.fully_static: if options.fully_static or options.partly_static:
o['libraries'] += ['-static']
if flavor == 'mac': if flavor == 'mac':
print("Generation of static executable will not work on OSX " print("Generation of static executable will not work on OSX "
"when using default compilation environment") "when using the default compilation environment")
return
if options.fully_static:
o['libraries'] += ['-static']
elif options.partly_static:
o['libraries'] += ['-static-libgcc', '-static-libstdc++']
if options.enable_asan:
o['libraries'] += ['-static-libasan']
def configure_winsdk(o): def configure_winsdk(o):
@ -1119,7 +1132,7 @@ configure_v8(output)
configure_openssl(output) configure_openssl(output)
configure_winsdk(output) configure_winsdk(output)
configure_intl(output) configure_intl(output)
configure_fullystatic(output) configure_static(output)
# variables should be a root level element, # variables should be a root level element,
# move everything else to target_defaults # move everything else to target_defaults

Loading…
Cancel
Save