|
6 | 6 | 'v8_enable_31bit_smis_on_64bit_arch%': 0, |
7 | 7 | 'force_dynamic_crt%': 0, |
8 | 8 | 'node_builtin_modules_path%': '', |
| 9 | + # `node` executable target name. |
9 | 10 | 'node_core_target_name%': 'node', |
10 | | - 'node_enable_v8_vtunejit%': 'false', |
| 11 | + # Derived flag from `node_shared`. |
| 12 | + # On most platforms, this is `static_library` if `node_shared` is false and `shared_library` if `node_shared` is true. |
| 13 | + # AIX needs to generate static library first and then link to shared library `node_aix_shared`. |
| 14 | + # TODO(legendecas): move this to depend on target `node_base` in AIX build . |
11 | 15 | 'node_intermediate_lib_type%': 'static_library', |
| 16 | + # `libnode` target name, can be a `static_library` or `shared_library` based on `node_shared`. |
| 17 | + # NOTE: Gyp will prefix this with `lib` if this name does not start with `lib`. |
12 | 18 | 'node_lib_target_name%': 'libnode', |
13 | 19 | 'node_module_version%': '', |
14 | 20 | 'node_no_browser_globals%': 'false', |
|
41 | 47 | 'node_use_sqlite%': 'true', |
42 | 48 | 'node_use_ffi%': 'false', |
43 | 49 | 'node_use_v8_platform%': 'true', |
| 50 | + 'node_enable_v8_vtunejit%': 'false', |
44 | 51 | 'node_v8_options%': '', |
45 | 52 | 'node_write_snapshot_as_string_literals': 'true', |
46 | 53 | 'ossfuzz' : 'false', |
|
670 | 677 | }], |
671 | 678 | ], |
672 | 679 | }], |
673 | | - [ 'node_intermediate_lib_type=="static_library" and node_shared=="false"', { |
| 680 | + [ 'node_shared=="false"', { |
674 | 681 | 'xcode_settings': { |
675 | 682 | 'OTHER_LDFLAGS': [ |
676 | | - '-Wl,-force_load,<(PRODUCT_DIR)/<(STATIC_LIB_PREFIX)<(node_core_target_name)<(STATIC_LIB_SUFFIX)', |
| 683 | + '-Wl,-force_load,<(PRODUCT_DIR)/<(STATIC_LIB_PREFIX)node_base<(STATIC_LIB_SUFFIX)', |
677 | 684 | ], |
678 | 685 | }, |
679 | 686 | 'msvs_settings': { |
680 | 687 | 'VCLinkerTool': { |
681 | 688 | 'AdditionalOptions': [ |
682 | | - '/WHOLEARCHIVE:<(PRODUCT_DIR)/lib/<(node_lib_target_name)<(STATIC_LIB_SUFFIX)', |
| 689 | + '/WHOLEARCHIVE:<(PRODUCT_DIR)/lib/<(STATIC_LIB_PREFIX)node_base<(STATIC_LIB_SUFFIX)', |
683 | 690 | '/WHOLEARCHIVE:<(PRODUCT_DIR)/lib/<(STATIC_LIB_PREFIX)v8_base_without_compiler<(STATIC_LIB_SUFFIX)', |
684 | 691 | ], |
685 | 692 | }, |
|
695 | 702 | ['node_use_bundled_v8=="true" and OS != "aix" and OS != "os400" and OS != "mac" and OS != "ios"', { |
696 | 703 | 'ldflags': [ |
697 | 704 | '-Wl,--whole-archive', |
698 | | - '<(obj_dir)/<(STATIC_LIB_PREFIX)<(node_core_target_name)<(STATIC_LIB_SUFFIX)', |
| 705 | + '<(obj_dir)/<(STATIC_LIB_PREFIX)node_base<(STATIC_LIB_SUFFIX)', |
699 | 706 | '<(obj_dir)/tools/v8_gypfiles/<(STATIC_LIB_PREFIX)v8_base_without_compiler<(STATIC_LIB_SUFFIX)', |
700 | 707 | '-Wl,--no-whole-archive', |
701 | 708 | ], |
702 | 709 | }], |
703 | 710 | ['node_use_bundled_v8!="true" and OS != "aix" and OS != "os400" and OS != "mac" and OS != "ios"', { |
704 | 711 | 'ldflags': [ |
705 | 712 | '-Wl,--whole-archive', |
706 | | - '<(obj_dir)/<(STATIC_LIB_PREFIX)<(node_core_target_name)<(STATIC_LIB_SUFFIX)', |
| 713 | + '<(obj_dir)/<(STATIC_LIB_PREFIX)node_base<(STATIC_LIB_SUFFIX)', |
707 | 714 | '-Wl,--no-whole-archive', |
708 | 715 | ], |
709 | 716 | }], |
|
771 | 778 | 'LinkIncremental': 2, # enable incremental linking |
772 | 779 | }, |
773 | 780 | }, |
774 | | - }], |
775 | | - ['node_use_node_snapshot=="true"', { |
776 | | - 'dependencies': [ |
777 | | - 'node_mksnapshot', |
778 | | - ], |
779 | | - 'conditions': [ |
780 | | - ['node_snapshot_main!=""', { |
781 | | - 'actions': [ |
782 | | - { |
783 | | - 'action_name': 'node_mksnapshot', |
784 | | - 'process_outputs_as_sources': 1, |
785 | | - 'inputs': [ |
786 | | - '<(node_mksnapshot_exec)', |
787 | | - '<(node_snapshot_main)', |
788 | | - ], |
789 | | - 'outputs': [ |
790 | | - '<(SHARED_INTERMEDIATE_DIR)/node_snapshot.cc', |
791 | | - ], |
792 | | - 'action': [ |
793 | | - '<(node_mksnapshot_exec)', |
794 | | - '--build-snapshot', |
795 | | - '<(node_snapshot_main)', |
796 | | - '<@(_outputs)', |
797 | | - ], |
798 | | - }, |
799 | | - ], |
800 | | - }, { |
801 | | - 'actions': [ |
802 | | - { |
803 | | - 'action_name': 'node_mksnapshot', |
804 | | - 'process_outputs_as_sources': 1, |
805 | | - 'inputs': [ |
806 | | - '<(node_mksnapshot_exec)', |
807 | | - ], |
808 | | - 'outputs': [ |
809 | | - '<(SHARED_INTERMEDIATE_DIR)/node_snapshot.cc', |
810 | | - ], |
811 | | - 'action': [ |
812 | | - '<@(_inputs)', |
813 | | - '<@(_outputs)', |
814 | | - ], |
815 | | - }, |
816 | | - ], |
817 | | - }], |
818 | | - ], |
819 | | - }, { |
820 | | - 'sources': [ |
821 | | - 'src/node_snapshot_stub.cc' |
822 | | - ], |
823 | 781 | }], |
824 | 782 | [ 'OS in "linux freebsd openharmony" and ' |
825 | 783 | 'target_arch=="x64"', { |
|
913 | 871 | ], |
914 | 872 | }, # node_core_target_name |
915 | 873 | { |
916 | | - 'target_name': '<(node_lib_target_name)', |
917 | | - 'type': '<(node_intermediate_lib_type)', |
| 874 | + 'target_name': 'node_base', |
| 875 | + 'type': 'static_library', |
918 | 876 | 'includes': [ |
919 | 877 | 'node.gypi', |
920 | 878 | ], |
|
933 | 891 | # Dependency headers |
934 | 892 | 'deps/v8/include/v8.h', |
935 | 893 | 'deps/postject/postject-api.h', |
936 | | - # javascript files to make for an even more pleasant IDE experience |
937 | | - '<@(library_files)', |
938 | | - '<@(deps_files)', |
939 | 894 | # node.gyp is added by default, common.gypi is added for change detection |
940 | 895 | 'common.gypi', |
941 | 896 | ], |
|
979 | 934 | }], |
980 | 935 | [ 'node_builtin_modules_path!=""', { |
981 | 936 | 'defines': [ 'NODE_BUILTIN_MODULES_PATH="<(node_builtin_modules_path)"' ], |
982 | | - # When loading builtins from disk, JS source files do not need to |
983 | | - # trigger rebuilds since the binary reads them at runtime. |
984 | | - 'sources!': [ |
985 | | - '<@(library_files)', |
986 | | - '<@(deps_files)', |
987 | | - ], |
988 | | - }], |
989 | | - [ 'node_shared=="true"', { |
990 | | - 'sources': [ |
991 | | - 'src/node_snapshot_stub.cc', |
992 | | - ] |
993 | 937 | }], |
994 | 938 | [ 'node_use_bundled_v8!="false"', { |
995 | 939 | 'dependencies': [ 'tools/v8_gypfiles/abseil.gyp:abseil' ], |
|
1042 | 986 | 'defines': [ 'HAVE_INSPECTOR=0' ] |
1043 | 987 | }], |
1044 | 988 | [ 'OS=="win"', { |
1045 | | - 'conditions': [ |
1046 | | - [ 'node_intermediate_lib_type!="static_library"', { |
1047 | | - 'sources': [ |
1048 | | - 'src/res/node.rc', |
1049 | | - ], |
1050 | | - }], |
1051 | | - ], |
1052 | 989 | 'libraries': [ |
1053 | 990 | 'Dbghelp', |
1054 | 991 | 'Psapi', |
|
1071 | 1008 | [ 'node_use_lief=="true" and node_shared_lief=="true"', { |
1072 | 1009 | 'defines': [ 'HAVE_LIEF=1' ], |
1073 | 1010 | }], |
1074 | | - [ 'node_use_sqlite=="true"', { |
1075 | | - 'sources': [ |
1076 | | - '<@(node_sqlite_sources)', |
1077 | | - ], |
1078 | | - }], |
1079 | | - [ 'node_use_ffi=="true"', { |
1080 | | - 'sources': [ |
1081 | | - '<@(node_ffi_sources)', |
1082 | | - ], |
1083 | | - 'conditions': [ |
1084 | | - [ 'node_shared_ffi=="false"', { |
1085 | | - 'dependencies': [ |
1086 | | - 'deps/libffi/libffi.gyp:libffi', |
1087 | | - ], |
1088 | | - }], |
1089 | | - ], |
1090 | | - }], |
1091 | 1011 | [ 'node_use_quic=="true"', { |
1092 | 1012 | 'sources': [ |
1093 | 1013 | '<@(node_quic_sources)', |
|
1155 | 1075 | [ 'debug_nghttp2==1', { |
1156 | 1076 | 'defines': [ 'NODE_DEBUG_NGHTTP2=1' ] |
1157 | 1077 | }], |
1158 | | - # Thin LTO for node sources (scoped to libnode, not global) |
| 1078 | + # Thin LTO for node sources (scoped to node_base, not global) |
1159 | 1079 | ['node_with_ltcg=="true"', { |
1160 | 1080 | 'msvs_settings': { |
1161 | 1081 | 'VCCLCompilerTool': { |
|
1200 | 1120 | ], |
1201 | 1121 | }, |
1202 | 1122 | ], |
| 1123 | + }, # node_base |
| 1124 | + { |
| 1125 | + 'target_name': '<(node_lib_target_name)', |
| 1126 | + 'type': '<(node_intermediate_lib_type)', |
| 1127 | + 'includes': [ |
| 1128 | + 'node.gypi', |
| 1129 | + ], |
| 1130 | + |
| 1131 | + 'include_dirs': [ |
| 1132 | + 'src', |
| 1133 | + 'deps/v8/include', |
| 1134 | + 'deps/uv/include', |
| 1135 | + ], |
| 1136 | + |
| 1137 | + 'dependencies': [ |
| 1138 | + 'node_base', |
| 1139 | + ], |
| 1140 | + |
| 1141 | + 'defines': [ |
| 1142 | + 'NODE_ARCH="<(target_arch)"', |
| 1143 | + 'NODE_PLATFORM="<(OS)"', |
| 1144 | + 'NODE_WANT_INTERNALS=1', |
| 1145 | + ], |
| 1146 | + |
| 1147 | + 'sources': [ |
| 1148 | + # javascript files to make for an even more pleasant IDE experience |
| 1149 | + '<@(library_files)', |
| 1150 | + '<@(deps_files)', |
| 1151 | + ], |
| 1152 | + |
| 1153 | + 'conditions': [ |
| 1154 | + [ 'node_builtin_modules_path!=""', { |
| 1155 | + # When loading builtins from disk, JS source files do not need to |
| 1156 | + # trigger rebuilds since the binary reads them at runtime. |
| 1157 | + 'sources!': [ |
| 1158 | + '<@(library_files)', |
| 1159 | + '<@(deps_files)', |
| 1160 | + ], |
| 1161 | + }], |
| 1162 | + ['node_use_node_snapshot=="true"', { |
| 1163 | + 'dependencies': [ |
| 1164 | + 'node_mksnapshot', |
| 1165 | + ], |
| 1166 | + 'conditions': [ |
| 1167 | + ['node_snapshot_main!=""', { |
| 1168 | + 'actions': [ |
| 1169 | + { |
| 1170 | + 'action_name': 'node_mksnapshot', |
| 1171 | + 'process_outputs_as_sources': 1, |
| 1172 | + 'inputs': [ |
| 1173 | + '<(node_mksnapshot_exec)', |
| 1174 | + '<(node_snapshot_main)', |
| 1175 | + ], |
| 1176 | + 'outputs': [ |
| 1177 | + '<(SHARED_INTERMEDIATE_DIR)/node_snapshot.cc', |
| 1178 | + ], |
| 1179 | + 'action': [ |
| 1180 | + '<(node_mksnapshot_exec)', |
| 1181 | + '--build-snapshot', |
| 1182 | + '<(node_snapshot_main)', |
| 1183 | + '<@(_outputs)', |
| 1184 | + ], |
| 1185 | + }, |
| 1186 | + ], |
| 1187 | + }, { |
| 1188 | + 'actions': [ |
| 1189 | + { |
| 1190 | + 'action_name': 'node_mksnapshot', |
| 1191 | + 'process_outputs_as_sources': 1, |
| 1192 | + 'inputs': [ |
| 1193 | + '<(node_mksnapshot_exec)', |
| 1194 | + ], |
| 1195 | + 'outputs': [ |
| 1196 | + '<(SHARED_INTERMEDIATE_DIR)/node_snapshot.cc', |
| 1197 | + ], |
| 1198 | + 'action': [ |
| 1199 | + '<@(_inputs)', |
| 1200 | + '<@(_outputs)', |
| 1201 | + ], |
| 1202 | + }, |
| 1203 | + ], |
| 1204 | + }], |
| 1205 | + ], |
| 1206 | + }, { |
| 1207 | + 'sources': [ |
| 1208 | + 'src/node_snapshot_stub.cc' |
| 1209 | + ], |
| 1210 | + }], |
| 1211 | + [ 'node_shared=="true"', { |
| 1212 | + 'xcode_settings': { |
| 1213 | + 'OTHER_LDFLAGS': [ |
| 1214 | + '-Wl,-force_load,<(PRODUCT_DIR)/<(STATIC_LIB_PREFIX)node_base<(STATIC_LIB_SUFFIX)', |
| 1215 | + ], |
| 1216 | + }, |
| 1217 | + 'conditions': [ |
| 1218 | + ['OS!="aix" and OS!="os400" and OS!="mac" and OS!="ios"', { |
| 1219 | + 'ldflags': [ |
| 1220 | + '-Wl,--whole-archive', |
| 1221 | + '<(obj_dir)/<(STATIC_LIB_PREFIX)node_base<(STATIC_LIB_SUFFIX)', |
| 1222 | + '-Wl,--no-whole-archive', |
| 1223 | + ], |
| 1224 | + }], |
| 1225 | + ], |
| 1226 | + }], |
| 1227 | + [ 'node_shared=="true" and node_module_version!="" and OS!="win"', { |
| 1228 | + 'product_extension': '<(shlib_suffix)', |
| 1229 | + 'xcode_settings': { |
| 1230 | + 'LD_DYLIB_INSTALL_NAME': |
| 1231 | + '@rpath/lib<(node_core_target_name).<(shlib_suffix)' |
| 1232 | + }, |
| 1233 | + }], |
| 1234 | + ['node_shared=="true" and OS in "aix os400"', { |
| 1235 | + 'product_name': 'node_base', |
| 1236 | + }], |
| 1237 | + [ 'node_shared=="true" and OS=="win"', { |
| 1238 | + 'sources': [ |
| 1239 | + 'src/res/node.rc', |
| 1240 | + ], |
| 1241 | + }], |
| 1242 | + ], |
1203 | 1243 | }, # node_lib_target_name |
1204 | 1244 | { # fuzz_env |
1205 | 1245 | 'target_name': 'fuzz_env', |
|
1692 | 1732 | 'type': 'executable', |
1693 | 1733 |
|
1694 | 1734 | 'dependencies': [ |
1695 | | - '<(node_lib_target_name)', |
| 1735 | + 'node_base', |
1696 | 1736 | ], |
1697 | 1737 |
|
1698 | 1738 | 'includes': [ |
|
0 commit comments