diff --git a/.github/Dockerfile b/.github/Dockerfile index bf81ca3..b20b138 100644 --- a/.github/Dockerfile +++ b/.github/Dockerfile @@ -5,7 +5,7 @@ RUN apt-get update ENV DEBIAN_FRONTEND noninteractive RUN apt-get install -y sudo -RUN useradd -rm -d /home/ubuntu -s /bin/bash -g root -G sudo -u 1000 ubuntu +RUN useradd -rm -d /home/ubuntu -s /bin/bash -g root -G sudo -u 1001 ubuntu RUN echo "ubuntu ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers USER ubuntu WORKDIR /home/ubuntu diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 3fdec71..a95e82a 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -1,6 +1,8 @@ name: Build for Android -on: [push] +on: + push: + workflow_dispatch: env: CACHE_KEY_SUFFIX: v2 @@ -20,6 +22,7 @@ jobs: TZ: UTC NO_INTL: ${{ contains(matrix.variant, 'nointl') }} NO_JIT: ${{ !contains(matrix.variant, 'jit') }} + DEPOT_TOOLS_UPDATE: 0 steps: - name: Setup docker workspace diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index 2922d7c..b58ad0f 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -1,10 +1,15 @@ name: iOS build -on: [push] +on: + push: + workflow_dispatch: + +env: + DEPOT_TOOLS_UPDATE: 0 jobs: build: - runs-on: macOS-latest + runs-on: macos-11 env: NO_INTL: false NO_JIT: true @@ -18,7 +23,7 @@ jobs: - name: Setup V8 build environment run: | - brew install coreutils + brew install coreutils ninja scripts/setup.sh -r ${V8_VERSION} ios - name: Patch V8 diff --git a/.github/workflows/tools_macos_android.yml b/.github/workflows/tools_macos_android.yml index 26fb92d..be47b92 100644 --- a/.github/workflows/tools_macos_android.yml +++ b/.github/workflows/tools_macos_android.yml @@ -1,9 +1,11 @@ name: v8-android tools builder for macos host -on: [push] +on: + workflow_dispatch: env: CACHE_KEY_SUFFIX: v2 + DEPOT_TOOLS_UPDATE: 0 jobs: macos: diff --git a/README.md b/README.md index 3e83108..6317b41 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ To integrate with React Native, please check [react-native-v8](https://github.co 1. Single libv8android.so (or libv8.so on iOS) file. 2. Support i18n and JavaScript [Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl). 3. V8 Lite mode (JIT-less mode) https://v8.dev/blog/v8-lite -4. Build by Android official NDK r21e which prevent potential ABI incompatible issue to integrate with React Native. +4. Build by Android official NDK r23e which prevent potential ABI incompatible issue to integrate with React Native. ## Build Guides diff --git a/package.json b/package.json index 83693ce..94cd5fb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "private": true, - "version": "10.100.1", + "version": "11.1000.4", "workspaces": [ "packages/*" ], diff --git a/packages/v8-android-jit-nointl/package.json b/packages/v8-android-jit-nointl/package.json index d2f5d24..b60c0df 100644 --- a/packages/v8-android-jit-nointl/package.json +++ b/packages/v8-android-jit-nointl/package.json @@ -1,6 +1,6 @@ { "name": "v8-android-jit-nointl", - "version": "10.100.1", + "version": "11.1000.4", "description": "Pre-build version of V8 to be used by React Native apps", "repository": { "type": "git", @@ -18,6 +18,6 @@ }, "homepage": "https://github.com/Kudo/v8-android-buildscripts#readme", "files": [ - "dist/" + "dist/**/*" ] } diff --git a/packages/v8-android-jit/package.json b/packages/v8-android-jit/package.json index 0d9c792..79d6dd0 100644 --- a/packages/v8-android-jit/package.json +++ b/packages/v8-android-jit/package.json @@ -1,6 +1,6 @@ { "name": "v8-android-jit", - "version": "10.100.1", + "version": "11.1000.4", "description": "Pre-build version of V8 to be used by React Native apps", "repository": { "type": "git", @@ -18,6 +18,6 @@ }, "homepage": "https://github.com/Kudo/v8-android-buildscripts#readme", "files": [ - "dist/" + "dist/**/*" ] } diff --git a/packages/v8-android-nointl/package.json b/packages/v8-android-nointl/package.json index f696a34..fa2236c 100644 --- a/packages/v8-android-nointl/package.json +++ b/packages/v8-android-nointl/package.json @@ -1,6 +1,6 @@ { "name": "v8-android-nointl", - "version": "10.100.1", + "version": "11.1000.4", "description": "Pre-build version of V8 to be used by React Native apps (Non Intl supported version)", "repository": { "type": "git", @@ -18,6 +18,6 @@ }, "homepage": "https://github.com/Kudo/v8-android-buildscripts#readme", "files": [ - "dist/" + "dist/**/*" ] } diff --git a/packages/v8-android-tools-linux/package.json b/packages/v8-android-tools-linux/package.json index 3c1b3c4..d9b5e42 100644 --- a/packages/v8-android-tools-linux/package.json +++ b/packages/v8-android-tools-linux/package.json @@ -1,6 +1,6 @@ { "name": "v8-android-tools-linux", - "version": "10.100.1", + "version": "11.1000.4", "description": "Tools for v8-android", "repository": { "type": "git", diff --git a/packages/v8-android-tools-macos/package.json b/packages/v8-android-tools-macos/package.json index f6a2a5c..f935c0f 100644 --- a/packages/v8-android-tools-macos/package.json +++ b/packages/v8-android-tools-macos/package.json @@ -1,6 +1,6 @@ { "name": "v8-android-tools-macos", - "version": "10.100.1", + "version": "11.1000.4", "description": "Tools for v8-android", "repository": { "type": "git", diff --git a/packages/v8-android/package.json b/packages/v8-android/package.json index 3237bcf..d63e93a 100644 --- a/packages/v8-android/package.json +++ b/packages/v8-android/package.json @@ -1,6 +1,6 @@ { "name": "v8-android", - "version": "10.100.1", + "version": "11.1000.4", "description": "Pre-build version of V8 to be used by React Native apps", "repository": { "type": "git", @@ -18,6 +18,6 @@ }, "homepage": "https://github.com/Kudo/v8-android-buildscripts#readme", "files": [ - "dist/" + "dist/**/*" ] } diff --git a/packages/v8-ios/package.json b/packages/v8-ios/package.json new file mode 100644 index 0000000..52b8533 --- /dev/null +++ b/packages/v8-ios/package.json @@ -0,0 +1,27 @@ +{ + "name": "v8-ios", + "version": "11.110.0", + "description": "Pre-build version of V8 to be used by React Native apps", + "repository": { + "type": "git", + "url": "git+https://github.com/Kudo/v8-android-buildscripts.git", + "directory": "packages/v8-ios" + }, + "keywords": [ + "react-native", + "ios", + "v8" + ], + "author": "Kudo Chien", + "license": "BSD-2-Clause", + "bugs": { + "url": "https://github.com/Kudo/v8-android-buildscripts/issues" + }, + "homepage": "https://github.com/Kudo/v8-android-buildscripts#readme", + "files": [ + "v8-ios.podspec", + "include/", + "v8.xcframework/**/*", + "tools/" + ] +} diff --git a/packages/v8-ios/v8-ios.podspec b/packages/v8-ios/v8-ios.podspec new file mode 100644 index 0000000..56b818d --- /dev/null +++ b/packages/v8-ios/v8-ios.podspec @@ -0,0 +1,21 @@ +require "json" + +package = JSON.parse(File.read(File.join(__dir__, 'package.json'))) + +Pod::Spec.new do |s| + s.name = package['name'] + s.version = package['version'] + s.summary = package['description'] + s.license = package['license'] + + s.author = package['author'] + s.homepage = package['homepage'] + s.platforms = { :ios => "12.0" } + + s.source = { :http => "https://registry.npmjs.org/v8-ios/-/v8-ios-#{s.version}.tgz" } + + s.vendored_framework = 'v8.xcframework' + s.source_files = 'include/**/*.h' + s.preserve_paths = 'include' + s.header_mappings_dir = 'include' +end diff --git a/patches/system_xcode_build_error.patch b/patches/system_xcode_build_error.patch index acf8c23..c9d4723 100644 --- a/patches/system_xcode_build_error.patch +++ b/patches/system_xcode_build_error.patch @@ -11,3 +11,20 @@ index bc3de06d0..1e96de22c 100644 # TODO(https://crbug.com/1231236): Use -ffile-compilation-dir= here. cflags += [ "-Xclang", +diff --git a/config/c++/BUILD.gn b/config/c++/BUILD.gn +index e7ed69ec8..cf73e4490 100644 +--- a/build/config/c++/BUILD.gn ++++ b/build/config/c++/BUILD.gn +@@ -121,7 +121,11 @@ config("runtime_library") { + + # Make sure we don't link against the system libstdc++ or libc++. + if (is_clang) { +- ldflags += [ "-nostdlib++" ] ++ if (target_environment == "simulator" && current_cpu == "arm64") { ++ // noop ++ } else { ++ ldflags += [ "-nostdlib++" ] ++ } + } else { + # Gcc has a built-in abs() definition with default visibility. + # If it was not disabled, it would conflict with libc++'s abs() diff --git a/patches/v8_97_android_unwind_link_error.patch b/patches/v8_97_android_unwind_link_error.patch deleted file mode 100644 index ab38e6c..0000000 --- a/patches/v8_97_android_unwind_link_error.patch +++ /dev/null @@ -1,47 +0,0 @@ -diff --git a/build/config/android/BUILD.gn b/build/config/android/BUILD.gn -index 4fc5565e2..c48c53536 100644 ---- a/build/config/android/BUILD.gn -+++ b/build/config/android/BUILD.gn -@@ -41,12 +41,18 @@ config("compiler") { - } - - ldflags = [ -+ # Don't allow visible symbols from libgcc or libc++ to be -+ # re-exported. -+ "-Wl,--exclude-libs=libgcc.a", -+ - # Don't allow visible symbols from libraries that contain - # assembly code with symbols that aren't hidden properly. - # http://crbug.com/448386 - "-Wl,--exclude-libs=libvpx_assembly_arm.a", - ] - -+ # TODO(crbug.com/1184398): Move to compiler-rt when we are ready. -+ ldflags += [ "--rtlib=libgcc" ] - if (current_cpu == "arm64") { - if (arm_control_flow_integrity == "standard") { - cflags += [ "-mbranch-protection=standard" ] -@@ -55,10 +61,6 @@ config("compiler") { - } - } - -- # Instead of using an unwind lib from the toolchain, -- # buildtools/third_party/libunwind will be built and used directly. -- ldflags += [ "--unwindlib=none" ] -- - # $compile_api_level corresponds to the API level used for the sysroot path - # calculation in //build/config/android/config.gni - if (android_64bit_target_cpu) { -@@ -80,8 +82,11 @@ config("compiler") { - # that is Android-only. Please see that target for advice on what should go in - # :runtime_library vs. :compiler. - config("runtime_library") { -+ # Let the linker find libgcc.a. -+ ldflags = [ "--gcc-toolchain=" + -+ rebase_path(android_toolchain_root, root_build_dir) ] -+ - libs = [] -- ldflags = [] - - # On 64-bit platforms, the only symbols provided by libandroid_support.a are - # strto{d,f,l,ul}_l. These symbols are not used by our libc++, and newer NDKs diff --git a/patches/v8_android_unwind_link_error.patch b/patches/v8_android_unwind_link_error.patch new file mode 100644 index 0000000..141884a --- /dev/null +++ b/patches/v8_android_unwind_link_error.patch @@ -0,0 +1,26 @@ +diff --git a/build/config/android/BUILD.gn b/build/config/android/BUILD.gn +index 63b37e0c1..10fdb3cbf 100644 +--- a/build/config/android/BUILD.gn ++++ b/build/config/android/BUILD.gn +@@ -57,9 +57,18 @@ config("compiler") { + } + } + +- # Instead of using an unwind lib from the toolchain, +- # buildtools/third_party/libunwind will be built and used directly. +- ldflags += [ "--unwindlib=none" ] ++ if (current_cpu == "x86") { ++ arch_dir = "i386" ++ } else if (current_cpu == "x64") { ++ arch_dir = "x86_64" ++ } else if (current_cpu == "arm") { ++ arch_dir = "arm" ++ } else if (current_cpu == "arm64") { ++ arch_dir = "aarch64" ++ } else { ++ assert(false, "Unknown Android ABI: " + current_cpu) ++ } ++ lib_dirs = [ "$android_ndk_library_path/clang/12.0.9/lib/linux/$arch_dir"] + + # $compile_api_level corresponds to the API level used for the sysroot path + # calculation in //build/config/android/config.gni diff --git a/scripts/archive.sh b/scripts/archive.sh index bc5f0d1..20c9eb6 100755 --- a/scripts/archive.sh +++ b/scripts/archive.sh @@ -21,6 +21,7 @@ function makeDistPackageDir() { } DIST_PACKAGE_DIR=$(makeDistPackageDir) +mkdir -p "${DIST_PACKAGE_DIR}" function createAAR() { printf "\n\n\t\t===================== create aar =====================\n\n" @@ -30,16 +31,45 @@ function createAAR() { popd } -function createUniversalDylib() { - printf "\n\n\t\t===================== create universal dylib =====================\n\n" - mkdir -p "${BUILD_DIR}/lib/universal" - lipo "${BUILD_DIR}/lib/arm64/libv8.dylib" "${BUILD_DIR}/lib/x64/libv8.dylib" -output "${BUILD_DIR}/lib/universal/libv8.dylib" -create -} - -function copyDylib() { - printf "\n\n\t\t===================== copy dylib =====================\n\n" - mkdir -p "${DIST_PACKAGE_DIR}" - cp -Rf "${BUILD_DIR}/lib" "${DIST_PACKAGE_DIR}/" +function createXcframework() { + plist=$(cat << EOF + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + v8 + CFBundleIdentifier + io.csie.kudo.v8.framework + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + + +EOF +) + printf "\n\n\t\t===================== create ios device framework =====================\n\n" + mkdir -p "${BUILD_DIR}/ios-arm64/v8.framework" + echo "${plist}" > "${BUILD_DIR}/ios-arm64/v8.framework/Info.plist" + cp -f "${BUILD_DIR}/lib/device/arm64/libv8.dylib" "${BUILD_DIR}/ios-arm64/v8.framework/v8" + install_name_tool -id "@rpath/v8.framework/v8" "${BUILD_DIR}/ios-arm64/v8.framework/v8" + + printf "\n\n\t\t===================== create ios simulator framework =====================\n\n" + mkdir -p "${BUILD_DIR}/ios-arm64_x86_64-simulator/v8.framework" + echo "${plist}" > "${BUILD_DIR}/ios-arm64_x86_64-simulator/v8.framework/Info.plist" + lipo "${BUILD_DIR}/lib/simulator/arm64/libv8.dylib" "${BUILD_DIR}/lib/simulator/x64/libv8.dylib" -output "${BUILD_DIR}/ios-arm64_x86_64-simulator/v8.framework/v8" -create + install_name_tool -id "@rpath/v8.framework/v8" "${BUILD_DIR}/ios-arm64_x86_64-simulator/v8.framework/v8" + + printf "\n\n\t\t===================== create ios xcframework =====================\n\n" + rm -rf "${BUILD_DIR}/v8.xcframework" + xcodebuild -create-xcframework -framework "${BUILD_DIR}/ios-arm64/v8.framework" -framework "${BUILD_DIR}/ios-arm64_x86_64-simulator/v8.framework" -output "${BUILD_DIR}/v8.xcframework" + + cp -Rf "${BUILD_DIR}/v8.xcframework" "${DIST_PACKAGE_DIR}/v8.xcframework" } function createUnstrippedLibs() { @@ -87,8 +117,7 @@ if [[ ${PLATFORM} = "android" ]]; then copyTools copySnapshotBlobIfNeeded elif [[ ${PLATFORM} = "ios" ]]; then - createUniversalDylib - copyDylib + createXcframework copyHeaders copyTools copySnapshotBlobIfNeeded diff --git a/scripts/build.sh b/scripts/build.sh index 8c0a9c2..54cc78a 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -12,6 +12,7 @@ GN_ARGS_BASE=" icu_use_data_file=false treat_warnings_as_errors=false default_min_sdk_version=21 + v8_enable_sandbox=false " if [[ ${PLATFORM} = "macos_android" ]]; then @@ -21,7 +22,7 @@ else fi if [[ ${PLATFORM} = "ios" ]]; then - GN_ARGS_BASE="${GN_ARGS_BASE} enable_ios_bitcode=false use_xcode_clang=true ios_enable_code_signing=false v8_enable_pointer_compression=false ios_deployment_target=${IOS_DEPLOYMENT_TARGET}" + GN_ARGS_BASE="${GN_ARGS_BASE} enable_ios_bitcode=false use_xcode_clang=true ios_enable_code_signing=false v8_enable_pointer_compression=false ios_deployment_target=\"${IOS_DEPLOYMENT_TARGET}\" v8_control_flow_integrity=false v8_enable_lite_mode=true" elif [[ ${PLATFORM} = "android" ]]; then # Workaround v8 sysroot build issues with custom ndk GN_ARGS_BASE="${GN_ARGS_BASE} use_sysroot=false" @@ -93,6 +94,7 @@ function normalize_arch_for_platform() function buildArch() { local arch=$1 + local ios_env=$2 local platform_arch=$(normalize_arch_for_platform $arch) local target='' @@ -109,71 +111,86 @@ function buildArch() exit 1 fi - echo "Build v8 ${arch} variant NO_INTL=${NO_INTL} NO_JIT=${NO_JIT}" - gn gen --args="${GN_ARGS_BASE} ${GN_ARGS_BUILD_TYPE} target_cpu=\"${arch}\"" "out.v8.${arch}" + local output_dir='' + if [[ ${PLATFORM} = "ios" ]]; then + echo "Build v8 ${ios_env} ${arch} variant NO_INTL=${NO_INTL}" + output_dir="out.v8.ios.${ios_env}.${arch}" + gn gen --args="${GN_ARGS_BASE} ${GN_ARGS_BUILD_TYPE} target_cpu=\"${arch}\" target_environment=\"${ios_env}\"" "${output_dir}" + else + echo "Build v8 ${arch} variant NO_INTL=${NO_INTL} NO_JIT=${NO_JIT}" + output_dir="out.v8.${arch}" + gn gen --args="${GN_ARGS_BASE} ${GN_ARGS_BUILD_TYPE} target_cpu=\"${arch}\"" "${output_dir}" + fi if [[ ${TOOLS_ONLY} = "true" ]]; then - date ; ninja ${NINJA_PARAMS} -C "out.v8.${arch}" run_mksnapshot_default mkcodecache_group ; date - copySnapshot $arch - copyMkcodecache $arch + date ; ninja ${NINJA_PARAMS} -C "${output_dir}" run_mksnapshot_default mkcodecache_group ; date + copySnapshot "${arch}" "${output_dir}" + copyMkcodecache "${arch}" "${output_dir}" else - date ; ninja ${NINJA_PARAMS} -C "out.v8.${arch}" ${target} run_mksnapshot_default mkcodecache_group ; date - copyLib $arch - copySnapshot $arch - copyMkcodecache $arch + date ; ninja ${NINJA_PARAMS} -C "${output_dir}" ${target} run_mksnapshot_default mkcodecache_group ; date + copyLib "${arch}" "${output_dir}" "${ios_env}" + copySnapshot "${arch}" "${output_dir}" + copyMkcodecache "${arch}" "${output_dir}" fi } function copyLib() { local arch=$1 + local output_dir=$2 + local ios_env=$3 local platform_arch=$(normalize_arch_for_platform $arch) local target='' local target_ext='' + local lib_dir='' if [[ ${PLATFORM} = "android" ]]; then target="libv8android" target_ext=".so" + lib_dir="${platform_arch}" elif [[ ${PLATFORM} = "ios" ]]; then target="libv8" target_ext=".dylib" + lib_dir="${ios_env}/${platform_arch}" else exit 1 fi - mkdir -p "${BUILD_DIR}/lib/${platform_arch}" - cp -f "out.v8.${arch}/${target}${target_ext}" "${BUILD_DIR}/lib/${platform_arch}/${target}${target_ext}" + mkdir -p "${BUILD_DIR}/lib/${lib_dir}" + cp -f "${output_dir}/${target}${target_ext}" "${BUILD_DIR}/lib/${lib_dir}/${target}${target_ext}" - if [[ -d "out.v8.${arch}/lib.unstripped" ]]; then - mkdir -p "${BUILD_DIR}/lib.unstripped/${platform_arch}" - cp -f "out.v8.${arch}/lib.unstripped/${target}${target_ext}" "${BUILD_DIR}/lib.unstripped/${platform_arch}/${target}${target_ext}" + if [[ -d "${output_dir}/lib.unstripped" ]]; then + mkdir -p "${BUILD_DIR}/lib.unstripped/${lib_dir}" + cp -f "${output_dir}/lib.unstripped/${target}${target_ext}" "${BUILD_DIR}/lib.unstripped/${lib_dir}/${target}${target_ext}" fi } function copySnapshot() { local arch=$1 + local output_dir=$2 local platform_arch=$(normalize_arch_for_platform $arch) mkdir -p "${BUILD_DIR}/tools/${PLATFORM}/${platform_arch}" - cp -f out.v8.${arch}/clang_*/mksnapshot "${BUILD_DIR}/tools/${PLATFORM}/${platform_arch}/mksnapshot" + cp -f ${output_dir}/clang_*/mksnapshot "${BUILD_DIR}/tools/${PLATFORM}/${platform_arch}/mksnapshot" if [[ ${EXTERNAL_STARTUP_DATA} = "true" || ${TOOLS_ONLY} = "true" ]]; then mkdir -p "${BUILD_DIR}/snapshot_blob/${platform_arch}" - cp -f out.v8.${arch}/snapshot_blob.bin "${BUILD_DIR}/snapshot_blob/${platform_arch}/snapshot_blob.bin" + cp -f ${output_dir}/snapshot_blob.bin "${BUILD_DIR}/snapshot_blob/${platform_arch}/snapshot_blob.bin" fi } function copyMkcodecache() { local arch=$1 + local output_dir=$2 local platform_arch=$(normalize_arch_for_platform $arch) mkdir -p "${BUILD_DIR}/tools/${PLATFORM}/${platform_arch}" - cp -f out.v8.${arch}/clang_*/mkcodecache "${BUILD_DIR}/tools/${PLATFORM}/${platform_arch}/mkcodecache" + cp -f ${output_dir}/clang_*/mkcodecache "${BUILD_DIR}/tools/${PLATFORM}/${platform_arch}/mkcodecache" if [[ ${EXTERNAL_STARTUP_DATA} = "true" || ${TOOLS_ONLY} = "true" ]]; then - cp -f out.v8.${arch}/clang_*/snapshot_blob.bin "${BUILD_DIR}/tools/${PLATFORM}/${platform_arch}/snapshot_blob.bin" + cp -f ${output_dir}/clang_*/snapshot_blob.bin "${BUILD_DIR}/tools/${PLATFORM}/${platform_arch}/snapshot_blob.bin" fi } @@ -185,8 +202,9 @@ elif [[ ${PLATFORM} = "android" ]]; then buildArch "arm64" buildArch "x64" elif [[ ${PLATFORM} = "ios" ]]; then - buildArch "arm64" - buildArch "x64" + buildArch "arm64" "device" + buildArch "arm64" "simulator" + buildArch "x64" "simulator" elif [[ ${PLATFORM} = "macos_android" ]]; then # buildArch "arm" # buildArch "x86" diff --git a/scripts/env.sh b/scripts/env.sh index 87cc8c9..4154a0e 100755 --- a/scripts/env.sh +++ b/scripts/env.sh @@ -42,9 +42,15 @@ V8_DIR="${ROOT_DIR}/v8" DIST_DIR="${ROOT_DIR}/dist" PATCHES_DIR="${ROOT_DIR}/patches" -NDK_VERSION="r21e" -IOS_DEPLOYMENT_TARGET="9" -EXTERNAL_STARTUP_DATA="true" +NDK_VERSION="r23c" +IOS_DEPLOYMENT_TARGET="12.0" export PATH="$DEPOT_TOOLS_DIR:$PATH" PLATFORM=$(verify_platform $1) + +if [[ ${PLATFORM} = "android" ]]; then + EXTERNAL_STARTUP_DATA="true" +else + EXTERNAL_STARTUP_DATA="false" + NO_JIT="true" +fi diff --git a/scripts/patch.sh b/scripts/patch.sh index b8ad0f5..f2f3355 100755 --- a/scripts/patch.sh +++ b/scripts/patch.sh @@ -18,9 +18,9 @@ V8_PATCHSET_ANDROID=( # Fix v8 9.7 build error "v8_97_android_build_error.patch" - # Fix v8 9.7 libunwind link error - # revert https://chromium.googlesource.com/chromium/src/build/+/7bb5f36104 - "v8_97_android_unwind_link_error.patch" + # Fix v8 libunwind link error + # link the libunwind from official ndk rather than the chromium's builtin toolchain + "v8_android_unwind_link_error.patch" # Add mkcodecache tool "mkcodecache.patch" diff --git a/scripts/setup.sh b/scripts/setup.sh index 1429c35..211cb8e 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -20,14 +20,17 @@ function installNDK() { local host_arch=$1 pushd . cd "${V8_DIR}" - wget -q https://dl.google.com/android/repository/android-ndk-${NDK_VERSION}-${host_arch}-x86_64.zip - unzip -q android-ndk-${NDK_VERSION}-${host_arch}-x86_64.zip - rm -f android-ndk-${NDK_VERSION}-${host_arch}-x86_64.zip + wget -q https://dl.google.com/android/repository/android-ndk-${NDK_VERSION}-${host_arch}.zip + unzip -q android-ndk-${NDK_VERSION}-${host_arch}.zip + rm -f android-ndk-${NDK_VERSION}-${host_arch}.zip popd } if [[ ! -d "${DEPOT_TOOLS_DIR}" || ! -f "${DEPOT_TOOLS_DIR}/gclient" ]]; then git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git "${DEPOT_TOOLS_DIR}" + pushd "${DEPOT_TOOLS_DIR}" + git checkout 'main@{2022-07-05}' + popd fi gclient config --name v8 --unmanaged "https://chromium.googlesource.com/v8/v8.git" @@ -47,6 +50,7 @@ if [[ ${PLATFORM} = "android" ]]; then sudo bash -c 'v8/build/install-build-deps-android.sh' sudo apt-get -y install \ + ninja-build \ libc6-dev \ libc6-dev-i386 \ libc6-dev-armel-cross \