|
1 | 1 | {
|
| 2 | + # 'force_load' means to include the static libs into the shared lib or |
| 3 | + # executable. Therefore, it is enabled when building: |
| 4 | + # 1. The executable and it uses static lib (cctest and node) |
| 5 | + # 2. The shared lib |
| 6 | + # Linker optimizes out functions that are not used. When force_load=true, |
| 7 | + # --whole-archive,force_load and /WHOLEARCHIVE are used to include |
| 8 | + # all obj files in static libs into the executable or shared lib. |
| 9 | + 'variables': { |
| 10 | + 'variables': { |
| 11 | + 'variables': { |
| 12 | + 'force_load%': 'true', |
| 13 | + 'current_type%': '<(_type)', |
| 14 | + }, |
| 15 | + 'force_load%': '<(force_load)', |
| 16 | + 'conditions': [ |
| 17 | + ['current_type=="static_library"', { |
| 18 | + 'force_load': 'false', |
| 19 | + }], |
| 20 | + [ 'current_type=="executable" and node_target_type=="shared_library"', { |
| 21 | + 'force_load': 'false', |
| 22 | + }] |
| 23 | + ], |
| 24 | + }, |
| 25 | + 'force_load%': '<(force_load)', |
| 26 | + }, |
2 | 27 | 'conditions': [
|
3 | 28 | [ 'node_shared=="false"', {
|
4 | 29 | 'msvs_settings': {
|
|
36 | 61 | [ 'node_v8_options!=""', {
|
37 | 62 | 'defines': [ 'NODE_V8_OPTIONS="<(node_v8_options)"'],
|
38 | 63 | }],
|
39 |
| - # No node_main.cc for anything except executable |
40 |
| - [ 'node_target_type!="executable"', { |
41 |
| - 'sources!': [ |
42 |
| - 'src/node_main.cc', |
43 |
| - ], |
44 |
| - }], |
45 | 64 | [ 'node_release_urlbase!=""', {
|
46 | 65 | 'defines': [
|
47 | 66 | 'NODE_RELEASE_URLBASE="<(node_release_urlbase)"',
|
|
70 | 89 | 'deps/v8/src/third_party/vtune/v8vtune.gyp:v8_vtune'
|
71 | 90 | ],
|
72 | 91 | }],
|
73 |
| - [ 'node_use_lttng=="true"', { |
74 |
| - 'defines': [ 'HAVE_LTTNG=1' ], |
75 |
| - 'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ], |
76 |
| - 'libraries': [ '-llttng-ust' ], |
77 |
| - 'sources': [ |
78 |
| - 'src/node_lttng.cc' |
79 |
| - ], |
80 |
| - } ], |
81 |
| - [ 'node_use_etw=="true" and node_target_type!="static_library"', { |
82 |
| - 'defines': [ 'HAVE_ETW=1' ], |
83 |
| - 'dependencies': [ 'node_etw' ], |
84 |
| - 'sources': [ |
85 |
| - 'src/node_win32_etw_provider.h', |
86 |
| - 'src/node_win32_etw_provider-inl.h', |
87 |
| - 'src/node_win32_etw_provider.cc', |
88 |
| - 'src/node_dtrace.cc', |
89 |
| - 'tools/msvs/genfiles/node_etw_provider.h', |
90 |
| - 'tools/msvs/genfiles/node_etw_provider.rc', |
91 |
| - ] |
92 |
| - } ], |
93 |
| - [ 'node_use_perfctr=="true" and node_target_type!="static_library"', { |
94 |
| - 'defines': [ 'HAVE_PERFCTR=1' ], |
95 |
| - 'dependencies': [ 'node_perfctr' ], |
96 |
| - 'sources': [ |
97 |
| - 'src/node_win32_perfctr_provider.h', |
98 |
| - 'src/node_win32_perfctr_provider.cc', |
99 |
| - 'src/node_counters.cc', |
100 |
| - 'src/node_counters.h', |
101 |
| - 'tools/msvs/genfiles/node_perfctr_provider.rc', |
102 |
| - ] |
103 |
| - } ], |
104 | 92 | [ 'node_no_browser_globals=="true"', {
|
105 | 93 | 'defines': [ 'NODE_NO_BROWSER_GLOBALS' ],
|
106 | 94 | } ],
|
107 | 95 | [ 'node_use_bundled_v8=="true" and v8_postmortem_support=="true"', {
|
108 | 96 | 'dependencies': [ 'deps/v8/src/v8.gyp:postmortem-metadata' ],
|
109 | 97 | 'conditions': [
|
110 | 98 | # -force_load is not applicable for the static library
|
111 |
| - [ 'node_target_type!="static_library"', { |
| 99 | + [ 'force_load=="true"', { |
112 | 100 | 'xcode_settings': {
|
113 | 101 | 'OTHER_LDFLAGS': [
|
114 | 102 | '-Wl,-force_load,<(V8_BASE)',
|
|
159 | 147 | 'defines': [
|
160 | 148 | '_LINUX_SOURCE_COMPAT',
|
161 | 149 | ],
|
| 150 | + 'conditions': [ |
| 151 | + [ 'force_load=="true"', { |
| 152 | + |
| 153 | + 'actions': [ |
| 154 | + { |
| 155 | + 'action_name': 'expfile', |
| 156 | + 'inputs': [ |
| 157 | + '<(OBJ_DIR)' |
| 158 | + ], |
| 159 | + 'outputs': [ |
| 160 | + '<(PRODUCT_DIR)/node.exp' |
| 161 | + ], |
| 162 | + 'action': [ |
| 163 | + 'sh', 'tools/create_expfile.sh', |
| 164 | + '<@(_inputs)', '<@(_outputs)' |
| 165 | + ], |
| 166 | + } |
| 167 | + ], |
| 168 | + 'ldflags': ['-Wl,-bE:<(PRODUCT_DIR)/node.exp', '-Wl,-brtl'], |
| 169 | + }], |
| 170 | + ], |
162 | 171 | }],
|
163 | 172 | [ 'OS=="solaris"', {
|
164 | 173 | 'libraries': [
|
|
174 | 183 | 'NODE_PLATFORM="sunos"',
|
175 | 184 | ],
|
176 | 185 | }],
|
177 |
| - [ '(OS=="freebsd" or OS=="linux") and node_shared=="false" and coverage=="false"', { |
| 186 | + [ '(OS=="freebsd" or OS=="linux") and node_shared=="false"' |
| 187 | + ' and coverage=="false" and force_load=="true"', { |
178 | 188 | 'ldflags': [ '-Wl,-z,noexecstack',
|
179 | 189 | '-Wl,--whole-archive <(V8_BASE)',
|
180 | 190 | '-Wl,--no-whole-archive' ]
|
181 | 191 | }],
|
182 |
| - [ '(OS=="freebsd" or OS=="linux") and node_shared=="false" and coverage=="true"', { |
| 192 | + [ '(OS=="freebsd" or OS=="linux") and node_shared=="false"' |
| 193 | + ' and coverage=="true" and force_load=="true"', { |
183 | 194 | 'ldflags': [ '-Wl,-z,noexecstack',
|
184 | 195 | '-Wl,--whole-archive <(V8_BASE)',
|
185 | 196 | '-Wl,--no-whole-archive',
|
|
206 | 217 | [ 'OS=="sunos"', {
|
207 | 218 | 'ldflags': [ '-Wl,-M,/usr/lib/ld/map.noexstk' ],
|
208 | 219 | }],
|
| 220 | + |
| 221 | + [ 'node_use_openssl=="true"', { |
| 222 | + 'defines': [ 'HAVE_OPENSSL=1' ], |
| 223 | + 'conditions': [ |
| 224 | + ['openssl_fips != ""', { |
| 225 | + 'defines': [ 'NODE_FIPS_MODE' ], |
| 226 | + }], |
| 227 | + [ 'node_shared_openssl=="false"', { |
| 228 | + 'dependencies': [ |
| 229 | + './deps/openssl/openssl.gyp:openssl', |
| 230 | + |
| 231 | + # For tests |
| 232 | + './deps/openssl/openssl.gyp:openssl-cli', |
| 233 | + ], |
| 234 | + 'conditions': [ |
| 235 | + # -force_load or --whole-archive are not applicable for |
| 236 | + # the static library |
| 237 | + [ 'force_load=="true"', { |
| 238 | + 'xcode_settings': { |
| 239 | + 'OTHER_LDFLAGS': [ |
| 240 | + '-Wl,-force_load,<(PRODUCT_DIR)/<(OPENSSL_PRODUCT)', |
| 241 | + ], |
| 242 | + }, |
| 243 | + 'conditions': [ |
| 244 | + ['OS in "linux freebsd" and node_shared=="false"', { |
| 245 | + 'ldflags': [ |
| 246 | + '-Wl,--whole-archive,' |
| 247 | + '<(OBJ_DIR)/deps/openssl/' |
| 248 | + '<(OPENSSL_PRODUCT)', |
| 249 | + '-Wl,--no-whole-archive', |
| 250 | + ], |
| 251 | + }], |
| 252 | + # openssl.def is based on zlib.def, zlib symbols |
| 253 | + # are always exported. |
| 254 | + ['use_openssl_def==1', { |
| 255 | + 'sources': ['<(SHARED_INTERMEDIATE_DIR)/openssl.def'], |
| 256 | + }], |
| 257 | + ['OS=="win" and use_openssl_def==0', { |
| 258 | + 'sources': ['deps/zlib/win32/zlib.def'], |
| 259 | + }], |
| 260 | + ], |
| 261 | + }], |
| 262 | + ], |
| 263 | + }]] |
| 264 | + |
| 265 | + }, { |
| 266 | + 'defines': [ 'HAVE_OPENSSL=0' ] |
| 267 | + }], |
| 268 | + |
209 | 269 | ],
|
210 | 270 | }
|
0 commit comments