2016-10-18 14:41:26 +00:00
|
|
|
{
|
2017-12-05 00:07:53 +00:00
|
|
|
# 'force_load' means to include the static libs into the shared lib or
|
|
|
|
# executable. Therefore, it is enabled when building:
|
|
|
|
# 1. The executable and it uses static lib (cctest and node)
|
|
|
|
# 2. The shared lib
|
|
|
|
# Linker optimizes out functions that are not used. When force_load=true,
|
|
|
|
# --whole-archive,force_load and /WHOLEARCHIVE are used to include
|
|
|
|
# all obj files in static libs into the executable or shared lib.
|
|
|
|
'variables': {
|
|
|
|
'variables': {
|
|
|
|
'variables': {
|
|
|
|
'force_load%': 'true',
|
|
|
|
'current_type%': '<(_type)',
|
|
|
|
},
|
|
|
|
'force_load%': '<(force_load)',
|
|
|
|
'conditions': [
|
|
|
|
['current_type=="static_library"', {
|
|
|
|
'force_load': 'false',
|
|
|
|
}],
|
|
|
|
[ 'current_type=="executable" and node_target_type=="shared_library"', {
|
|
|
|
'force_load': 'false',
|
|
|
|
}]
|
|
|
|
],
|
|
|
|
},
|
|
|
|
'force_load%': '<(force_load)',
|
|
|
|
},
|
2019-04-06 18:22:45 +00:00
|
|
|
|
2016-10-18 14:41:26 +00:00
|
|
|
'conditions': [
|
2018-10-13 19:13:43 +00:00
|
|
|
[ 'clang==1', {
|
2023-01-13 01:41:46 +00:00
|
|
|
'cflags': [ '-Werror=undefined-inline', '-Werror=extra-semi']
|
2018-10-29 18:40:38 +00:00
|
|
|
}],
|
build: fix various shared library build issues
Node.js unofficially supports a shared library variant where the
main node executable is a thin wrapper around node.dll/libnode.so.
The key benefit of this is to support embedding Node.js in other
applications.
Since Node.js 12 there have been a number of issues preventing the
shared library build from working correctly, primarily on Windows:
* A number of functions used executables such as `mksnapshot` are
not exported from `libnode.dll` using a `NODE_EXTERN` attribute
* A dependency on the `Winmm` system library is missing
* Incorrect defines on executable targets leads to `node.exe`
claiming to export a number of functions that are actually in
`libnode.dll`
* Because `node.exe` attempts to export symbols, `node.lib` gets
generated causing native extensions to try to link against
`node.exe` not `libnode.dll`.
* Similarly, because `node.dll` was renamed to `libnode.dll`,
native extensions don't know to look for `libnode.lib` rather
than `node.lib`.
* On macOS an RPATH is added to find `libnode.dylib` relative to
`node` in the same folder. This works fine from the
`out/Release` folder but not from an installed prefix, where
`node` will be in `bin/` and `libnode.dylib` will be in `lib/`.
* Similarly on Linux, no RPATH is added so LD_LIBRARY_PATH needs
setting correctly for `bin/node` to find `lib/libnode.so`.
For the `libnode.lib` vs `node.lib` issue there are two possible
options:
1. Ensure `node.lib` from `node.exe` does not get generated, and
instead copy `libnode.lib` to `node.lib`. This means addons
compiled when referencing the correct `node.lib` file will
correctly depend on `libnode.dll`. The down side is that
native addons compiled with stock Node.js will still try to
resolve symbols against node.exe rather than libnode.dll.
2. After building `libnode.dll`, dump the exports using `dumpbin`,
and process this to generate a `node.def` file to be linked into
`node.exe` with the `/DEF:node.def` flag. The export entries
in `node.def` will all read
```
my_symbol=libnode.my_symbol
```
so that `node.exe` will redirect all exported symbols back to
`libnode.dll`. This has the benefit that addons compiled with
stock Node.js will load correctly into `node.exe` from a shared
library build, but means that every embedding executable also
needs to perform this same trick.
I went with the first option as it is the cleaner of the two
solutions in my opinion. Projects wishing to generate a shared
library variant of Node.js can now, for example,
```
.\vcbuild dll package vs
```
to generate a full node installation including `libnode.dll`,
`Release\node.lib`, and all the necessary headers. Native addons
can then be built against the shared library build easily by
specifying the correct `nodedir` option.
For example
```
>npx node-gyp configure --nodedir
C:\Users\User\node\Release\node-v18.0.0-win-x64
...
>npx node-gyp build
...
>dumpbin /dependents build\Release\binding.node
Microsoft (R) COFF/PE Dumper Version 14.29.30136.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file build\Release\binding.node
File Type: DLL
Image has the following dependencies:
KERNEL32.dll
libnode.dll
VCRUNTIME140.dll
api-ms-win-crt-string-l1-1-0.dll
api-ms-win-crt-stdio-l1-1-0.dll
api-ms-win-crt-runtime-l1-1-0.dll
...
```
PR-URL: https://github.com/nodejs/node/pull/41850
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
2022-02-04 10:12:57 +00:00
|
|
|
[ '"<(_type)"=="executable"', {
|
2016-10-18 14:41:26 +00:00
|
|
|
'msvs_settings': {
|
|
|
|
'VCManifestTool': {
|
|
|
|
'EmbedManifest': 'true',
|
|
|
|
'AdditionalManifestFiles': 'src/res/node.exe.extra.manifest'
|
|
|
|
}
|
|
|
|
},
|
2019-04-06 18:22:45 +00:00
|
|
|
}],
|
|
|
|
[ 'node_shared=="true"', {
|
2016-10-18 14:41:26 +00:00
|
|
|
'defines': [
|
|
|
|
'NODE_SHARED_MODE',
|
|
|
|
],
|
build: fix various shared library build issues
Node.js unofficially supports a shared library variant where the
main node executable is a thin wrapper around node.dll/libnode.so.
The key benefit of this is to support embedding Node.js in other
applications.
Since Node.js 12 there have been a number of issues preventing the
shared library build from working correctly, primarily on Windows:
* A number of functions used executables such as `mksnapshot` are
not exported from `libnode.dll` using a `NODE_EXTERN` attribute
* A dependency on the `Winmm` system library is missing
* Incorrect defines on executable targets leads to `node.exe`
claiming to export a number of functions that are actually in
`libnode.dll`
* Because `node.exe` attempts to export symbols, `node.lib` gets
generated causing native extensions to try to link against
`node.exe` not `libnode.dll`.
* Similarly, because `node.dll` was renamed to `libnode.dll`,
native extensions don't know to look for `libnode.lib` rather
than `node.lib`.
* On macOS an RPATH is added to find `libnode.dylib` relative to
`node` in the same folder. This works fine from the
`out/Release` folder but not from an installed prefix, where
`node` will be in `bin/` and `libnode.dylib` will be in `lib/`.
* Similarly on Linux, no RPATH is added so LD_LIBRARY_PATH needs
setting correctly for `bin/node` to find `lib/libnode.so`.
For the `libnode.lib` vs `node.lib` issue there are two possible
options:
1. Ensure `node.lib` from `node.exe` does not get generated, and
instead copy `libnode.lib` to `node.lib`. This means addons
compiled when referencing the correct `node.lib` file will
correctly depend on `libnode.dll`. The down side is that
native addons compiled with stock Node.js will still try to
resolve symbols against node.exe rather than libnode.dll.
2. After building `libnode.dll`, dump the exports using `dumpbin`,
and process this to generate a `node.def` file to be linked into
`node.exe` with the `/DEF:node.def` flag. The export entries
in `node.def` will all read
```
my_symbol=libnode.my_symbol
```
so that `node.exe` will redirect all exported symbols back to
`libnode.dll`. This has the benefit that addons compiled with
stock Node.js will load correctly into `node.exe` from a shared
library build, but means that every embedding executable also
needs to perform this same trick.
I went with the first option as it is the cleaner of the two
solutions in my opinion. Projects wishing to generate a shared
library variant of Node.js can now, for example,
```
.\vcbuild dll package vs
```
to generate a full node installation including `libnode.dll`,
`Release\node.lib`, and all the necessary headers. Native addons
can then be built against the shared library build easily by
specifying the correct `nodedir` option.
For example
```
>npx node-gyp configure --nodedir
C:\Users\User\node\Release\node-v18.0.0-win-x64
...
>npx node-gyp build
...
>dumpbin /dependents build\Release\binding.node
Microsoft (R) COFF/PE Dumper Version 14.29.30136.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file build\Release\binding.node
File Type: DLL
Image has the following dependencies:
KERNEL32.dll
libnode.dll
VCRUNTIME140.dll
api-ms-win-crt-string-l1-1-0.dll
api-ms-win-crt-stdio-l1-1-0.dll
api-ms-win-crt-runtime-l1-1-0.dll
...
```
PR-URL: https://github.com/nodejs/node/pull/41850
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
2022-02-04 10:12:57 +00:00
|
|
|
'conditions': [
|
|
|
|
['"<(_type)"=="executable"', {
|
|
|
|
'defines': [
|
|
|
|
'USING_UV_SHARED',
|
|
|
|
'USING_V8_SHARED',
|
|
|
|
'BUILDING_NODE_EXTENSION'
|
|
|
|
],
|
|
|
|
'defines!': [
|
|
|
|
'BUILDING_V8_SHARED=1',
|
|
|
|
'BUILDING_UV_SHARED=1'
|
|
|
|
]
|
|
|
|
}],
|
|
|
|
],
|
2016-10-18 14:41:26 +00:00
|
|
|
}],
|
2018-03-07 20:25:26 +00:00
|
|
|
[ 'OS=="win"', {
|
|
|
|
'defines!': [
|
|
|
|
'NODE_PLATFORM="win"',
|
|
|
|
],
|
|
|
|
'defines': [
|
|
|
|
'FD_SETSIZE=1024',
|
|
|
|
# we need to use node's preferred "win32" rather than gyp's preferred "win"
|
|
|
|
'NODE_PLATFORM="win32"',
|
|
|
|
'_UNICODE=1',
|
|
|
|
],
|
2024-05-13 19:05:05 +00:00
|
|
|
'conditions': [
|
|
|
|
['clang==0', {
|
|
|
|
'msvs_precompiled_header': 'tools/msvs/pch/node_pch.h',
|
|
|
|
'msvs_precompiled_source': 'tools/msvs/pch/node_pch.cc',
|
|
|
|
'sources': [
|
|
|
|
'<(_msvs_precompiled_header)',
|
|
|
|
'<(_msvs_precompiled_source)',
|
|
|
|
],
|
|
|
|
}],
|
2018-10-13 19:13:43 +00:00
|
|
|
],
|
2019-02-04 20:49:47 +00:00
|
|
|
}, { # POSIX
|
|
|
|
'defines': [ '__POSIX__' ],
|
2018-10-13 19:13:43 +00:00
|
|
|
}],
|
2016-10-18 14:41:26 +00:00
|
|
|
[ 'node_enable_d8=="true"', {
|
2019-07-17 15:55:12 +00:00
|
|
|
'dependencies': [ 'tools/v8_gypfiles/d8.gyp:d8' ],
|
2016-10-18 14:41:26 +00:00
|
|
|
}],
|
|
|
|
[ 'node_use_bundled_v8=="true"', {
|
2019-03-25 02:58:29 +00:00
|
|
|
'dependencies': [
|
2020-03-05 23:56:02 +00:00
|
|
|
'tools/v8_gypfiles/v8.gyp:v8_snapshot',
|
2019-03-25 02:58:29 +00:00
|
|
|
'tools/v8_gypfiles/v8.gyp:v8_libplatform',
|
2016-10-18 14:41:26 +00:00
|
|
|
],
|
|
|
|
}],
|
|
|
|
[ 'node_use_v8_platform=="true"', {
|
|
|
|
'defines': [
|
|
|
|
'NODE_USE_V8_PLATFORM=1',
|
|
|
|
],
|
|
|
|
}, {
|
|
|
|
'defines': [
|
|
|
|
'NODE_USE_V8_PLATFORM=0',
|
|
|
|
],
|
|
|
|
}],
|
2022-12-23 17:06:05 +00:00
|
|
|
[ 'v8_enable_shared_ro_heap==1', {
|
|
|
|
'defines': ['NODE_V8_SHARED_RO_HEAP',],
|
|
|
|
}],
|
2016-10-18 14:41:26 +00:00
|
|
|
[ 'node_tag!=""', {
|
|
|
|
'defines': [ 'NODE_TAG="<(node_tag)"' ],
|
|
|
|
}],
|
|
|
|
[ 'node_v8_options!=""', {
|
|
|
|
'defines': [ 'NODE_V8_OPTIONS="<(node_v8_options)"'],
|
|
|
|
}],
|
|
|
|
[ 'node_release_urlbase!=""', {
|
|
|
|
'defines': [
|
|
|
|
'NODE_RELEASE_URLBASE="<(node_release_urlbase)"',
|
|
|
|
]
|
|
|
|
}],
|
|
|
|
[ 'v8_enable_i18n_support==1', {
|
|
|
|
'defines': [ 'NODE_HAVE_I18N_SUPPORT=1' ],
|
|
|
|
'dependencies': [
|
|
|
|
'<(icu_gyp_path):icui18n',
|
|
|
|
'<(icu_gyp_path):icuuc',
|
|
|
|
],
|
|
|
|
'conditions': [
|
|
|
|
[ 'icu_small=="true"', {
|
|
|
|
'defines': [ 'NODE_HAVE_SMALL_ICU=1' ],
|
2019-12-06 21:40:25 +00:00
|
|
|
'conditions': [
|
|
|
|
[ 'icu_default_data!=""', {
|
|
|
|
'defines': [
|
|
|
|
'NODE_ICU_DEFAULT_DATA_DIR="<(icu_default_data)"',
|
|
|
|
],
|
|
|
|
}],
|
|
|
|
],
|
2016-10-18 14:41:26 +00:00
|
|
|
}]],
|
|
|
|
}],
|
2022-11-22 08:28:19 +00:00
|
|
|
[ 'node_use_bundled_v8=="true" and \
|
|
|
|
node_enable_v8_vtunejit=="true" and (target_arch=="x64" or \
|
|
|
|
target_arch=="ia32" or target_arch=="x32")', {
|
|
|
|
'defines': [ 'NODE_ENABLE_VTUNE_PROFILING' ],
|
|
|
|
'dependencies': [
|
|
|
|
'tools/v8_gypfiles/v8vtune.gyp:v8_vtune'
|
|
|
|
],
|
|
|
|
}],
|
2016-10-18 14:41:26 +00:00
|
|
|
[ 'node_no_browser_globals=="true"', {
|
|
|
|
'defines': [ 'NODE_NO_BROWSER_GLOBALS' ],
|
|
|
|
} ],
|
|
|
|
[ 'node_shared_zlib=="false"', {
|
|
|
|
'dependencies': [ 'deps/zlib/zlib.gyp:zlib' ],
|
2023-12-04 17:30:58 +00:00
|
|
|
'defines': [ 'NODE_BUNDLED_ZLIB' ],
|
2018-01-17 21:16:14 +00:00
|
|
|
'conditions': [
|
|
|
|
[ 'force_load=="true"', {
|
|
|
|
'xcode_settings': {
|
|
|
|
'OTHER_LDFLAGS': [
|
2019-03-29 07:38:12 +00:00
|
|
|
'-Wl,-force_load,<(PRODUCT_DIR)/<(STATIC_LIB_PREFIX)zlib<(STATIC_LIB_SUFFIX)',
|
2018-01-17 21:16:14 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
'msvs_settings': {
|
|
|
|
'VCLinkerTool': {
|
|
|
|
'AdditionalOptions': [
|
2024-05-13 19:05:05 +00:00
|
|
|
'/WHOLEARCHIVE:<(PRODUCT_DIR)/lib/zlib<(STATIC_LIB_SUFFIX)',
|
2018-01-17 21:16:14 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'conditions': [
|
2023-02-22 04:18:56 +00:00
|
|
|
['OS!="aix" and OS!="os400" and OS!="ios" and node_shared=="false"', {
|
2018-01-17 21:16:14 +00:00
|
|
|
'ldflags': [
|
2019-03-29 07:38:12 +00:00
|
|
|
'-Wl,--whole-archive',
|
2019-04-07 19:02:04 +00:00
|
|
|
'<(obj_dir)/deps/zlib/<(STATIC_LIB_PREFIX)zlib<(STATIC_LIB_SUFFIX)',
|
2018-01-17 21:16:14 +00:00
|
|
|
'-Wl,--no-whole-archive',
|
|
|
|
],
|
|
|
|
}],
|
|
|
|
],
|
|
|
|
}],
|
|
|
|
],
|
2016-10-18 14:41:26 +00:00
|
|
|
}],
|
|
|
|
|
2018-11-30 06:39:02 +00:00
|
|
|
[ 'node_shared_http_parser=="false"', {
|
|
|
|
'dependencies': [
|
|
|
|
'deps/llhttp/llhttp.gyp:llhttp'
|
|
|
|
],
|
2018-10-30 02:06:09 +00:00
|
|
|
} ],
|
2016-10-18 14:41:26 +00:00
|
|
|
|
|
|
|
[ 'node_shared_cares=="false"', {
|
|
|
|
'dependencies': [ 'deps/cares/cares.gyp:cares' ],
|
|
|
|
}],
|
|
|
|
|
|
|
|
[ 'node_shared_libuv=="false"', {
|
|
|
|
'dependencies': [ 'deps/uv/uv.gyp:libuv' ],
|
2018-01-17 21:16:14 +00:00
|
|
|
'conditions': [
|
|
|
|
[ 'force_load=="true"', {
|
|
|
|
'xcode_settings': {
|
|
|
|
'OTHER_LDFLAGS': [
|
2019-03-29 07:38:12 +00:00
|
|
|
'-Wl,-force_load,<(PRODUCT_DIR)/libuv<(STATIC_LIB_SUFFIX)',
|
2018-01-17 21:16:14 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
'msvs_settings': {
|
|
|
|
'VCLinkerTool': {
|
|
|
|
'AdditionalOptions': [
|
2024-05-13 19:05:05 +00:00
|
|
|
'/WHOLEARCHIVE:<(PRODUCT_DIR)/lib/libuv<(STATIC_LIB_SUFFIX)',
|
2018-01-17 21:16:14 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'conditions': [
|
2023-02-22 04:18:56 +00:00
|
|
|
['OS!="aix" and OS!="os400" and OS!="ios" and node_shared=="false"', {
|
2018-01-17 21:16:14 +00:00
|
|
|
'ldflags': [
|
2019-03-29 07:38:12 +00:00
|
|
|
'-Wl,--whole-archive',
|
2019-04-07 19:02:04 +00:00
|
|
|
'<(obj_dir)/deps/uv/<(STATIC_LIB_PREFIX)uv<(STATIC_LIB_SUFFIX)',
|
2018-01-17 21:16:14 +00:00
|
|
|
'-Wl,--no-whole-archive',
|
|
|
|
],
|
|
|
|
}],
|
|
|
|
],
|
|
|
|
}],
|
|
|
|
],
|
2016-10-18 14:41:26 +00:00
|
|
|
}],
|
|
|
|
|
2020-11-25 06:49:21 +00:00
|
|
|
[ 'node_shared_uvwasi=="false"', {
|
|
|
|
'dependencies': [ 'deps/uvwasi/uvwasi.gyp:uvwasi' ],
|
|
|
|
}],
|
|
|
|
|
2017-11-06 08:59:01 +00:00
|
|
|
[ 'node_shared_nghttp2=="false"', {
|
|
|
|
'dependencies': [ 'deps/nghttp2/nghttp2.gyp:nghttp2' ],
|
|
|
|
}],
|
|
|
|
|
2018-11-27 01:16:34 +00:00
|
|
|
[ 'node_shared_brotli=="false"', {
|
|
|
|
'dependencies': [ 'deps/brotli/brotli.gyp:brotli' ],
|
|
|
|
}],
|
|
|
|
|
2024-06-22 23:15:42 +00:00
|
|
|
[ 'node_shared_sqlite=="false"', {
|
|
|
|
'dependencies': [ 'deps/sqlite/sqlite.gyp:sqlite' ],
|
|
|
|
}],
|
|
|
|
|
2016-10-18 14:41:26 +00:00
|
|
|
[ 'OS=="mac"', {
|
2024-07-15 20:32:26 +00:00
|
|
|
# linking Corefoundation is needed since certain macOS debugging tools
|
2016-10-18 14:41:26 +00:00
|
|
|
# like Instruments require it for some features
|
|
|
|
'libraries': [ '-framework CoreFoundation' ],
|
|
|
|
'defines!': [
|
|
|
|
'NODE_PLATFORM="mac"',
|
|
|
|
],
|
|
|
|
'defines': [
|
|
|
|
# we need to use node's preferred "darwin" rather than gyp's preferred "mac"
|
|
|
|
'NODE_PLATFORM="darwin"',
|
|
|
|
],
|
|
|
|
}],
|
|
|
|
[ 'OS=="freebsd"', {
|
|
|
|
'libraries': [
|
|
|
|
'-lutil',
|
|
|
|
'-lkvm',
|
|
|
|
],
|
|
|
|
}],
|
2023-02-22 04:18:56 +00:00
|
|
|
[ 'OS in "aix os400"', {
|
2016-10-18 14:41:26 +00:00
|
|
|
'defines': [
|
|
|
|
'_LINUX_SOURCE_COMPAT',
|
2019-04-07 19:02:04 +00:00
|
|
|
'__STDC_FORMAT_MACROS',
|
2016-10-18 14:41:26 +00:00
|
|
|
],
|
2017-12-05 00:07:53 +00:00
|
|
|
'conditions': [
|
|
|
|
[ 'force_load=="true"', {
|
2019-04-07 19:02:04 +00:00
|
|
|
'variables': {
|
|
|
|
'exp_filename': '<(PRODUCT_DIR)/<(_target_name).exp',
|
|
|
|
},
|
2017-12-05 00:07:53 +00:00
|
|
|
'actions': [
|
|
|
|
{
|
|
|
|
'action_name': 'expfile',
|
|
|
|
'inputs': [
|
2019-04-07 19:02:04 +00:00
|
|
|
'<(obj_dir)',
|
2017-12-05 00:07:53 +00:00
|
|
|
],
|
|
|
|
'outputs': [
|
2019-04-07 19:02:04 +00:00
|
|
|
'<(exp_filename)',
|
2017-12-05 00:07:53 +00:00
|
|
|
],
|
|
|
|
'action': [
|
|
|
|
'sh', 'tools/create_expfile.sh',
|
2019-04-07 19:02:04 +00:00
|
|
|
'<@(_inputs)',
|
|
|
|
'<@(_outputs)',
|
2017-12-05 00:07:53 +00:00
|
|
|
],
|
|
|
|
}
|
|
|
|
],
|
2019-04-07 19:02:04 +00:00
|
|
|
'ldflags': [
|
|
|
|
'-Wl,-bE:<(exp_filename)',
|
|
|
|
'-Wl,-brtl',
|
|
|
|
],
|
2017-12-05 00:07:53 +00:00
|
|
|
}],
|
|
|
|
],
|
2016-10-18 14:41:26 +00:00
|
|
|
}],
|
|
|
|
[ 'OS=="solaris"', {
|
|
|
|
'libraries': [
|
|
|
|
'-lkstat',
|
|
|
|
'-lumem',
|
|
|
|
],
|
|
|
|
'defines!': [
|
|
|
|
'NODE_PLATFORM="solaris"',
|
|
|
|
],
|
|
|
|
'defines': [
|
|
|
|
# we need to use node's preferred "sunos"
|
|
|
|
# rather than gyp's preferred "solaris"
|
|
|
|
'NODE_PLATFORM="sunos"',
|
|
|
|
],
|
|
|
|
}],
|
2017-12-05 00:07:53 +00:00
|
|
|
[ '(OS=="freebsd" or OS=="linux") and node_shared=="false"'
|
2018-01-27 06:35:35 +00:00
|
|
|
' and force_load=="true"', {
|
2019-03-29 07:38:12 +00:00
|
|
|
'ldflags': [
|
|
|
|
'-Wl,-z,noexecstack',
|
|
|
|
'-Wl,--whole-archive <(v8_base)',
|
|
|
|
'-Wl,--no-whole-archive',
|
|
|
|
]
|
|
|
|
}],
|
|
|
|
[ 'node_use_bundled_v8=="true" and v8_postmortem_support==1 and force_load=="true"', {
|
|
|
|
'xcode_settings': {
|
|
|
|
'OTHER_LDFLAGS': [
|
|
|
|
'-Wl,-force_load,<(v8_base)',
|
|
|
|
],
|
|
|
|
},
|
2016-10-18 14:41:26 +00:00
|
|
|
}],
|
2020-02-05 14:24:14 +00:00
|
|
|
[ 'debug_node=="true"', {
|
|
|
|
'cflags!': [ '-O3' ],
|
|
|
|
'cflags': [ '-g', '-O0' ],
|
|
|
|
'defines': [ 'DEBUG' ],
|
|
|
|
'xcode_settings': {
|
|
|
|
'OTHER_CFLAGS': [
|
|
|
|
'-g', '-O0'
|
|
|
|
],
|
|
|
|
},
|
|
|
|
}],
|
2018-11-20 16:26:48 +00:00
|
|
|
[ 'coverage=="true" and node_shared=="false" and OS in "mac freebsd linux"', {
|
|
|
|
'cflags!': [ '-O3' ],
|
2018-01-27 06:35:35 +00:00
|
|
|
'ldflags': [ '--coverage',
|
2016-10-18 14:41:26 +00:00
|
|
|
'-g',
|
|
|
|
'-O0' ],
|
2018-01-27 06:35:35 +00:00
|
|
|
'cflags': [ '--coverage',
|
2016-10-18 14:41:26 +00:00
|
|
|
'-g',
|
2017-04-13 20:31:44 +00:00
|
|
|
'-O0' ],
|
2017-10-09 18:30:38 +00:00
|
|
|
'xcode_settings': {
|
2018-11-20 16:26:48 +00:00
|
|
|
'OTHER_CFLAGS': [
|
2017-10-09 18:30:38 +00:00
|
|
|
'--coverage',
|
|
|
|
'-g',
|
|
|
|
'-O0'
|
|
|
|
],
|
2018-11-20 16:26:48 +00:00
|
|
|
},
|
|
|
|
'conditions': [
|
|
|
|
[ '_type=="executable"', {
|
|
|
|
'xcode_settings': {
|
|
|
|
'OTHER_LDFLAGS': [ '--coverage', ],
|
|
|
|
},
|
|
|
|
}],
|
|
|
|
],
|
2017-10-09 18:30:38 +00:00
|
|
|
}],
|
2022-08-23 17:50:21 +00:00
|
|
|
[ 'coverage=="true"', {
|
|
|
|
'defines': [
|
|
|
|
'ALLOW_ATTACHING_DEBUGGER_IN_WATCH_MODE',
|
|
|
|
'ALLOW_ATTACHING_DEBUGGER_IN_TEST_RUNNER',
|
|
|
|
],
|
|
|
|
}],
|
2016-10-18 14:41:26 +00:00
|
|
|
[ 'OS=="sunos"', {
|
|
|
|
'ldflags': [ '-Wl,-M,/usr/lib/ld/map.noexstk' ],
|
|
|
|
}],
|
2019-09-26 22:17:30 +00:00
|
|
|
[ 'OS=="linux"', {
|
|
|
|
'libraries!': [
|
|
|
|
'-lrt'
|
|
|
|
],
|
|
|
|
}],
|
2018-05-03 08:51:56 +00:00
|
|
|
[ 'OS in "freebsd linux"', {
|
|
|
|
'ldflags': [ '-Wl,-z,relro',
|
|
|
|
'-Wl,-z,now' ]
|
|
|
|
}],
|
2017-12-05 00:07:53 +00:00
|
|
|
[ 'node_use_openssl=="true"', {
|
|
|
|
'defines': [ 'HAVE_OPENSSL=1' ],
|
|
|
|
'conditions': [
|
|
|
|
[ 'node_shared_openssl=="false"', {
|
2021-04-14 09:19:54 +00:00
|
|
|
'defines': [ 'OPENSSL_API_COMPAT=0x10100000L', ],
|
2017-12-05 00:07:53 +00:00
|
|
|
'dependencies': [
|
|
|
|
'./deps/openssl/openssl.gyp:openssl',
|
|
|
|
|
|
|
|
# For tests
|
|
|
|
'./deps/openssl/openssl.gyp:openssl-cli',
|
|
|
|
],
|
|
|
|
'conditions': [
|
|
|
|
# -force_load or --whole-archive are not applicable for
|
|
|
|
# the static library
|
|
|
|
[ 'force_load=="true"', {
|
|
|
|
'xcode_settings': {
|
|
|
|
'OTHER_LDFLAGS': [
|
2017-10-16 13:34:42 +00:00
|
|
|
'-Wl,-force_load,<(PRODUCT_DIR)/<(openssl_product)',
|
2017-12-05 00:07:53 +00:00
|
|
|
],
|
|
|
|
},
|
2018-01-17 21:16:14 +00:00
|
|
|
'msvs_settings': {
|
|
|
|
'VCLinkerTool': {
|
|
|
|
'AdditionalOptions': [
|
2024-05-13 19:05:05 +00:00
|
|
|
'/WHOLEARCHIVE:<(PRODUCT_DIR)/lib/<(openssl_product)',
|
2018-01-17 21:16:14 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2017-12-05 00:07:53 +00:00
|
|
|
'conditions': [
|
|
|
|
['OS in "linux freebsd" and node_shared=="false"', {
|
|
|
|
'ldflags': [
|
|
|
|
'-Wl,--whole-archive,'
|
2018-01-17 21:16:14 +00:00
|
|
|
'<(obj_dir)/deps/openssl/<(openssl_product)',
|
2017-12-05 00:07:53 +00:00
|
|
|
'-Wl,--no-whole-archive',
|
|
|
|
],
|
|
|
|
}],
|
|
|
|
# openssl.def is based on zlib.def, zlib symbols
|
|
|
|
# are always exported.
|
|
|
|
['use_openssl_def==1', {
|
|
|
|
'sources': ['<(SHARED_INTERMEDIATE_DIR)/openssl.def'],
|
|
|
|
}],
|
|
|
|
['OS=="win" and use_openssl_def==0', {
|
|
|
|
'sources': ['deps/zlib/win32/zlib.def'],
|
|
|
|
}],
|
|
|
|
],
|
|
|
|
}],
|
2021-03-09 21:50:08 +00:00
|
|
|
]
|
|
|
|
}],
|
|
|
|
[ 'openssl_quic=="true" and node_shared_ngtcp2=="false"', {
|
|
|
|
'dependencies': [ './deps/ngtcp2/ngtcp2.gyp:ngtcp2' ]
|
|
|
|
}],
|
|
|
|
[ 'openssl_quic=="true" and node_shared_nghttp3=="false"', {
|
|
|
|
'dependencies': [ './deps/ngtcp2/ngtcp2.gyp:nghttp3' ]
|
|
|
|
}]
|
|
|
|
]
|
2017-12-05 00:07:53 +00:00
|
|
|
}, {
|
|
|
|
'defines': [ 'HAVE_OPENSSL=0' ]
|
|
|
|
}],
|
2024-08-02 10:37:36 +00:00
|
|
|
[ 'node_use_amaro=="true"', {
|
|
|
|
'defines': [ 'HAVE_AMARO=1' ],
|
|
|
|
}, {
|
|
|
|
'defines': [ 'HAVE_AMARO=0' ]
|
|
|
|
}],
|
2016-10-18 14:41:26 +00:00
|
|
|
],
|
|
|
|
}
|