From 2ad570098283e864a8420a38971142d4eec2abbc Mon Sep 17 00:00:00 2001 From: chexiongsheng Date: Wed, 21 Sep 2022 18:02:40 +0800 Subject: [PATCH] gyp: libnode for ios app embedding PR-URL: https://github.com/nodejs/node/pull/44210 Reviewed-By: Jiawen Geng --- configure.py | 4 ++-- deps/cares/cares.gyp | 2 +- node.gyp | 2 +- node.gypi | 4 ++-- tools/v8_gypfiles/v8.gyp | 14 +++++++++++--- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/configure.py b/configure.py index e9b610a16d75d0..d3192ca04ca336 100755 --- a/configure.py +++ b/configure.py @@ -45,7 +45,7 @@ parser = argparse.ArgumentParser() valid_os = ('win', 'mac', 'solaris', 'freebsd', 'openbsd', 'linux', - 'android', 'aix', 'cloudabi') + 'android', 'aix', 'cloudabi', 'ios') valid_arch = ('arm', 'arm64', 'ia32', 'mips', 'mipsel', 'mips64el', 'ppc', 'ppc64', 'x64', 'x86', 'x86_64', 's390x', 'riscv64', 'loong64') valid_arm_float_abi = ('soft', 'softfp', 'hard') @@ -2081,7 +2081,7 @@ def make_bin_override(): gyp_args = ['--no-parallel', '-Dconfiguring_node=1'] if options.use_ninja: - gyp_args += ['-f', 'ninja'] + gyp_args += ['-f', 'ninja-' + flavor] elif flavor == 'win' and sys.platform != 'msys': gyp_args += ['-f', 'msvs', '-G', 'msvs_version=auto'] else: diff --git a/deps/cares/cares.gyp b/deps/cares/cares.gyp index 88933e00745d30..74f0e78e069f1e 100644 --- a/deps/cares/cares.gyp +++ b/deps/cares/cares.gyp @@ -157,7 +157,7 @@ 'include_dirs': [ 'config/linux' ], 'sources': [ 'config/linux/ares_config.h' ] }], - [ 'OS=="mac"', { + [ 'OS=="mac" or OS=="ios"', { 'include_dirs': [ 'config/darwin' ], 'sources': [ 'config/darwin/ares_config.h' ] }], diff --git a/node.gyp b/node.gyp index 75dc652871d51d..24505da7babe46 100644 --- a/node.gyp +++ b/node.gyp @@ -229,7 +229,7 @@ }, }, 'conditions': [ - ['OS != "aix" and OS != "mac"', { + ['OS != "aix" and OS != "mac" and OS != "ios"', { 'ldflags': [ '-Wl,--whole-archive', '<(obj_dir)/<(STATIC_LIB_PREFIX)<(node_core_target_name)<(STATIC_LIB_SUFFIX)', diff --git a/node.gypi b/node.gypi index f46f246e241d1b..10ac1cd1b97d6d 100644 --- a/node.gypi +++ b/node.gypi @@ -145,7 +145,7 @@ }, }, 'conditions': [ - ['OS!="aix" and node_shared=="false"', { + ['OS!="aix" and OS!="ios" and node_shared=="false"', { 'ldflags': [ '-Wl,--whole-archive', '<(obj_dir)/deps/zlib/<(STATIC_LIB_PREFIX)zlib<(STATIC_LIB_SUFFIX)', @@ -184,7 +184,7 @@ }, }, 'conditions': [ - ['OS!="aix" and node_shared=="false"', { + ['OS!="aix" and OS!="ios" and node_shared=="false"', { 'ldflags': [ '-Wl,--whole-archive', '<(obj_dir)/deps/uv/<(STATIC_LIB_PREFIX)uv<(STATIC_LIB_SUFFIX)', diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp index 73099a03e49d78..ed042f88296186 100644 --- a/tools/v8_gypfiles/v8.gyp +++ b/tools/v8_gypfiles/v8.gyp @@ -822,7 +822,8 @@ 'conditions': [ ['v8_enable_webassembly==1', { 'conditions': [ - ['OS=="mac" or (_toolset=="host" and host_arch=="x64" and OS=="linux")', { + ['OS=="mac" or OS=="ios" or ' + '(_toolset=="host" and host_arch=="x64" and (host_os=="linux" or host_os=="mac"))', { 'sources': [ '<(V8_ROOT)/src/trap-handler/handler-inside-posix.cc', '<(V8_ROOT)/src/trap-handler/handler-outside-posix.cc', @@ -836,7 +837,8 @@ ], }], # TODO(targos): Replace False with OS=="win" if handler-outside-simulator.cc becomes compatible with MSVC. - ['_toolset=="host" and host_arch=="x64" and (OS=="linux" or OS=="mac" or False)', { + ['_toolset=="host" and host_arch=="x64" and ' + '(host_os=="linux" or host_os=="mac" or False)', { 'sources': [ '<(V8_ROOT)/src/trap-handler/handler-outside-simulator.cc', ], @@ -1115,12 +1117,18 @@ '<(V8_ROOT)/src/base/platform/platform-fuchsia.cc', ] }], - ['OS == "mac" or OS == "ios"', { + ['OS == "mac" or (_toolset=="host" and host_os=="mac")', { 'sources': [ '<(V8_ROOT)/src/base/debug/stack_trace_posix.cc', '<(V8_ROOT)/src/base/platform/platform-macos.cc', ] }], + ['OS == "ios"', { + 'sources': [ + '<(V8_ROOT)/src/base/debug/stack_trace_posix.cc', + '<(V8_ROOT)/src/base/platform/platform-darwin.cc', + ] + }], ['is_win', { 'sources': [ '<(V8_ROOT)/src/base/debug/stack_trace_win.cc',