diff options
-rw-r--r-- | common.gypi | 68 | ||||
-rwxr-xr-x | configure.py | 6 | ||||
-rw-r--r-- | deps/cares/cares.gyp | 4 | ||||
-rw-r--r-- | deps/uv/src/unix/darwin.c | 4 | ||||
-rw-r--r-- | deps/v8/BUILD.gn | 1 | ||||
-rw-r--r-- | deps/v8/src/wasm/code-space-access.h | 2 | ||||
-rw-r--r-- | deps/v8/src/wasm/wasm-code-manager.cc | 2 | ||||
-rw-r--r-- | node.gyp | 1 | ||||
-rw-r--r-- | node.gypi | 14 | ||||
-rw-r--r-- | taler-ios-build/.gitignore | 1 | ||||
-rwxr-xr-x | taler-ios-build/arm64 | 35 | ||||
-rwxr-xr-x | taler-ios-build/build-ios-node | 25 | ||||
-rwxr-xr-x | taler-ios-build/build-ios-v8 | 43 | ||||
-rwxr-xr-x | taler-ios-build/x64 | 35 | ||||
-rw-r--r-- | tools/gyp/pylib/gyp/generator/ninja.py | 4 |
15 files changed, 234 insertions, 11 deletions
diff --git a/common.gypi b/common.gypi index 67aa8e7200..a221cb84e1 100644 --- a/common.gypi +++ b/common.gypi @@ -104,10 +104,12 @@ 'openssl_product': '<(STATIC_LIB_PREFIX)openssl<(STATIC_LIB_SUFFIX)', }], ['OS=="mac"', { - 'clang%': 1, 'obj_dir%': '<(PRODUCT_DIR)/obj.target', 'v8_base': '<(PRODUCT_DIR)/libv8_snapshot.a', }], + ['OS=="mac" or OS=="ios"', { + 'clang%': 1, + }], ['target_arch in "ppc64 s390x"', { 'v8_enable_backtrace': 1, }], @@ -329,7 +331,7 @@ 'cflags!': [ '-fomit-frame-pointer' ], 'ldflags': [ '-fsanitize=address' ], }], - ['asan == 1 and OS == "mac"', { + ['asan == 1 and (OS == "mac" or OS=="ios")', { 'xcode_settings': { 'OTHER_CFLAGS+': [ '-fno-omit-frame-pointer', @@ -524,6 +526,68 @@ }], ], }], + ['OS=="ios"', { + 'defines': ['_DARWIN_USE_64_BIT_INODE=1'], + 'xcode_settings': { + 'ALWAYS_SEARCH_USER_PATHS': 'NO', + 'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks + 'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic + # (Equivalent to -fPIC) + 'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions + 'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti + 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings + 'PREBINDING': 'NO', # No -Wl,-prebind + 'IPHONEOS_DEPLOYMENT_TARGET': '10.0', # -miphoneos-version-min=9.0 + 'USE_HEADERMAP': 'NO', + 'OTHER_CFLAGS': [ + '-fno-strict-aliasing', + ], + 'WARNING_CFLAGS': [ + '-Wall', + '-Wendif-labels', + '-W', + '-Wno-unused-parameter', + ], + }, + 'target_conditions': [ + ['_type!="static_library"', { + 'xcode_settings': { + 'OTHER_LDFLAGS': [ + '-Wl,-no_pie', + '-Wl,-search_paths_first', + ], + }, + }], + ], + 'conditions': [ + ['target_arch=="x64"', { + 'xcode_settings': {'ARCHS': ['x86_64']}, + }], + [ 'target_arch=="arm64"', { + 'xcode_settings': { + 'ARCHS': ['arm64'], + 'OTHER_CFLAGS': [ + '-fembed-bitcode' + ], + 'OTHER_CPLUSPLUSFLAGS': [ + '-fembed-bitcode' + ], + }, + }], + ['clang==1', { + 'xcode_settings': { + 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0', + 'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++1y', # -std=gnu++1y + 'CLANG_CXX_LIBRARY': 'libc++', + }, + }], + ['target_arch=="x64"', { + 'xcode_settings': { 'SDKROOT': 'iphonesimulator' }, + }, { + 'xcode_settings': { 'SDKROOT': 'iphoneos', 'ENABLE_BITCODE': 'YES' }, + }], + ], + }], ['OS=="freebsd" and node_use_dtrace=="true"', { 'libraries': [ '-lelf' ], }], diff --git a/configure.py b/configure.py index 8ed8524b26..f6548bebc9 100755 --- a/configure.py +++ b/configure.py @@ -44,7 +44,7 @@ from gyp_node import run_gyp 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', 'x32','x64', 'x86', 'x86_64', 's390x') valid_arm_float_abi = ('soft', 'softfp', 'hard') @@ -1144,6 +1144,8 @@ def gcc_version_ge(version_checked): def configure_node(o): if options.dest_os == 'android': o['variables']['OS'] = 'android' + if options.dest_os == 'ios': + o['variables']['OS'] = 'ios' o['variables']['node_prefix'] = options.prefix o['variables']['node_install_npm'] = b(not options.without_npm) o['variables']['debug_node'] = b(options.debug_node) @@ -1991,6 +1993,8 @@ gyp_args += args if warn.warned and not options.verbose: warn('warnings were emitted in the configure phase') +print("gyp args:", gyp_args) + print_verbose("running: \n " + " ".join(['python', 'tools/gyp_node.py'] + gyp_args)) run_gyp(gyp_args) info('configure completed successfully') diff --git a/deps/cares/cares.gyp b/deps/cares/cares.gyp index 0dc4ff9317..6ec84df47d 100644 --- a/deps/cares/cares.gyp +++ b/deps/cares/cares.gyp @@ -158,6 +158,10 @@ 'include_dirs': [ 'config/darwin' ], 'sources': [ 'config/darwin/ares_config.h' ] }], + [ 'OS=="ios"', { + 'include_dirs': [ 'config/darwin' ], + 'sources': [ 'config/darwin/ares_config.h' ] + }], [ 'OS=="freebsd" or OS=="dragonflybsd"', { 'include_dirs': [ 'config/freebsd' ], 'sources': [ 'config/freebsd/ares_config.h' ] diff --git a/deps/uv/src/unix/darwin.c b/deps/uv/src/unix/darwin.c index d0ecd452d8..8ef12362f8 100644 --- a/deps/uv/src/unix/darwin.c +++ b/deps/uv/src/unix/darwin.c @@ -33,9 +33,9 @@ #include <sys/sysctl.h> #include <unistd.h> /* sysconf */ -#if !TARGET_OS_IPHONE +//#if !TARGET_OS_IPHONE #include "darwin-stub.h" -#endif +//#endif static uv_once_t once = UV_ONCE_INIT; static uint64_t (*time_func)(void); diff --git a/deps/v8/BUILD.gn b/deps/v8/BUILD.gn index 94b598bc9a..353588088d 100644 --- a/deps/v8/BUILD.gn +++ b/deps/v8/BUILD.gn @@ -893,6 +893,7 @@ config("toolchain") { if (is_clang) { cflags += [ "-Wmissing-field-initializers" ] + cflags += [ "-Wno-error" ] if (v8_current_cpu != "mips" && v8_current_cpu != "mipsel") { # We exclude MIPS because the IsMipsArchVariant macro causes trouble. diff --git a/deps/v8/src/wasm/code-space-access.h b/deps/v8/src/wasm/code-space-access.h index 5eeb980e17..1f066a9103 100644 --- a/deps/v8/src/wasm/code-space-access.h +++ b/deps/v8/src/wasm/code-space-access.h @@ -12,7 +12,7 @@ namespace v8 { namespace internal { -#if defined(V8_OS_MACOSX) && defined(V8_HOST_ARCH_ARM64) +#if defined(V8_OS_MACOSX) && defined(V8_HOST_ARCH_ARM64) && !defined(V8_OS_IOS) // Ignoring this warning is considered better than relying on // __builtin_available. diff --git a/deps/v8/src/wasm/wasm-code-manager.cc b/deps/v8/src/wasm/wasm-code-manager.cc index ac68dc970c..3a34ede56a 100644 --- a/deps/v8/src/wasm/wasm-code-manager.cc +++ b/deps/v8/src/wasm/wasm-code-manager.cc @@ -49,7 +49,7 @@ namespace wasm { using trap_handler::ProtectedInstructionData; -#if defined(V8_OS_MACOSX) && defined(V8_HOST_ARCH_ARM64) +#if defined(V8_OS_MACOSX) && defined(V8_HOST_ARCH_ARM64) && !defined(V8_OS_IOS) thread_local int CodeSpaceWriteScope::code_space_write_nesting_level_ = 0; #endif @@ -570,6 +570,7 @@ 'include_dirs': [ 'src', + 'deps/v8/include', '<(SHARED_INTERMEDIATE_DIR)' # for node_natives.h ], 'dependencies': [ @@ -68,6 +68,20 @@ [ 'node_enable_d8=="true"', { 'dependencies': [ 'tools/v8_gypfiles/d8.gyp:d8' ], }], + [ 'node_use_bundled_v8=="false" and target_arch=="arm64" and OS=="ios"', { + 'libraries': [ + '<!(pwd)/deps/v8/out.gn/ios-arm64/obj/libv8_libbase.a', + '<!(pwd)/deps/v8/out.gn/ios-arm64/obj/libv8_libplatform.a', + '<!(pwd)/deps/v8/out.gn/ios-arm64/obj/libv8_monolith.a', + ] + }], + [ 'node_use_bundled_v8=="false" and target_arch=="x64" and OS=="ios"', { + 'libraries': [ + '<!(pwd)/deps/v8/out.gn/ios-x64/obj/libv8_libbase.a', + '<!(pwd)/deps/v8/out.gn/ios-x64/obj/libv8_libplatform.a', + '<!(pwd)/deps/v8/out.gn/ios-x64/obj/libv8_monolith.a', + ] + }], [ 'node_use_bundled_v8=="true"', { 'dependencies': [ 'tools/v8_gypfiles/v8.gyp:v8_snapshot', diff --git a/taler-ios-build/.gitignore b/taler-ios-build/.gitignore new file mode 100644 index 0000000000..724bbe1c11 --- /dev/null +++ b/taler-ios-build/.gitignore @@ -0,0 +1 @@ +compiled/ diff --git a/taler-ios-build/arm64 b/taler-ios-build/arm64 new file mode 100755 index 0000000000..8668039ded --- /dev/null +++ b/taler-ios-build/arm64 @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +set -eu -o pipefail + +scriptdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" +cd $scriptdir + +API_LEVEL=21 +BUILD_HOST_TAG='mac-x86_64' + +########## +# Build V8 +########## + +./build-ios-v8 arm64 + +cd $scriptdir/.. +x=$scriptdir/compiled/arm64-v8a/ +mkdir -p $x +cp deps/v8/out.gn/ios-arm64/obj/*.a $x/ + +############ +# Build Node +############ + +export DEST_CPU_ARCH=arm64 + +cd $scriptdir + +./build-ios-node arm64 + +cd $scriptdir/.. +x=$scriptdir/compiled/arm64-v8a/ +mkdir -p $x +cp out/Release/libnode.*.dylib $x/ diff --git a/taler-ios-build/build-ios-node b/taler-ios-build/build-ios-node new file mode 100755 index 0000000000..2bf5e71a1e --- /dev/null +++ b/taler-ios-build/build-ios-node @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +# This script assumes that all the right environment variables +# (CC, LD, STRIP, ...) areset. + +set -eu -o pipefail + +scriptdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" +cd $scriptdir/.. + +export GYP_DEFINES="OS=ios clang=1" + +function myconf() { + ./configure \ + --ninja \ + --cross-compiling \ + --dest-cpu=$DEST_CPU_ARCH \ + --dest-os=ios \ + --without-intl \ + --openssl-no-asm \ + --without-bundled-v8 \ + --shared +} + +myconf && make diff --git a/taler-ios-build/build-ios-v8 b/taler-ios-build/build-ios-v8 new file mode 100755 index 0000000000..23471dca12 --- /dev/null +++ b/taler-ios-build/build-ios-v8 @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +set -eu -o pipefail + +scriptdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" +cd $scriptdir/.. + +DEST_CPU_ARCH=$1 + +# We do not export anything about the tool chain, as v8 +# will pick their own toolchain for android from the ndk + +cd ./deps/v8 + +python3 ./tools/node/fetch_deps.py $PWD + +gn_args=$(cat <<EOF +is_official_build = true +v8_enable_backtrace = false +v8_enable_slow_dchecks = true +v8_optimized_debug = false +ios_deployment_target = 10 +is_component_build = false +is_debug = false +target_cpu = "$DEST_CPU_ARCH" +target_os = "ios" +use_custom_libcxx = false +use_xcode_clang = true +v8_enable_i18n_support = false +v8_monolithic = true +v8_use_external_startup_data = false +EOF +) + +echo gn_args $gn_args + +echo "executing gn gen" + +./buildtools/mac/gn gen out.gn/ios-$DEST_CPU_ARCH "--args=$gn_args" + +echo "executing ninja" + +./_depot_tools/ninja -C out.gn/ios-$DEST_CPU_ARCH v8_monolith d8 diff --git a/taler-ios-build/x64 b/taler-ios-build/x64 new file mode 100755 index 0000000000..f7d01f2f68 --- /dev/null +++ b/taler-ios-build/x64 @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +set -eu -o pipefail + +scriptdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" +cd $scriptdir + +API_LEVEL=21 +BUILD_HOST_TAG='mac-x86_64' + +########## +# Build V8 +########## + +./build-ios-v8 x64 + +cd $scriptdir/.. +x=$scriptdir/compiled/x64-v8a/ +mkdir -p $x +cp deps/v8/out.gn/ios-x64/*.so $x/ + +############ +# Build Node +############ + +export DEST_CPU_ARCH=x64 + +cd $scriptdir + +./build-ios-node x64 + +cd $scriptdir/.. +x=$scriptdir/compiled/x64-v8a/ +mkdir -p $x +cp out/Release/libnode.*.dylib $x/ diff --git a/tools/gyp/pylib/gyp/generator/ninja.py b/tools/gyp/pylib/gyp/generator/ninja.py index e064bad7ed..8e0f7e4fe0 100644 --- a/tools/gyp/pylib/gyp/generator/ninja.py +++ b/tools/gyp/pylib/gyp/generator/ninja.py @@ -2906,10 +2906,6 @@ def CallGenerateOutputForConfig(arglist): def GenerateOutput(target_list, target_dicts, data, params): # Update target_dicts for iOS device builds. - target_dicts = gyp.xcode_emulation.CloneConfigurationForDeviceAndEmulator( - target_dicts - ) - user_config = params.get("generator_flags", {}).get("config", None) if gyp.common.GetFlavor(params) == "win": target_list, target_dicts = MSVSUtil.ShardTargets(target_list, target_dicts) |