diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 3d3ea72..0eef409 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -39,7 +39,7 @@ jobs: sudo ln -fs /usr/share/zoneinfo/UTC /etc/localtime sudo apt-get update sudo apt-get upgrade -y - sudo apt-get install -y apt-utils sudo lsb-core git python nodejs npm wget openjdk-8-jre openjdk-8-jdk + sudo apt-get install -y apt-utils sudo lsb-core git python ninja-build nodejs npm wget openjdk-8-jre openjdk-8-jdk - name: Export settings from npm package run: npm run export_npm_env @@ -61,17 +61,17 @@ jobs: run: | scripts/build.sh android arm - - name: Build V8 x86 - run: | - scripts/build.sh android x86 + # - name: Build V8 x86 + # run: | + # scripts/build.sh android x86 - - name: Build V8 arm64 - run: | - scripts/build.sh android arm64 + # - name: Build V8 arm64 + # run: | + # scripts/build.sh android arm64 - - name: Build V8 x64 - run: | - scripts/build.sh android x64 + # - name: Build V8 x64 + # run: | + # scripts/build.sh android x64 - name: Archive run: | diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index 90529a8..40cf6c3 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -19,6 +19,7 @@ jobs: - name: Setup V8 build environment run: | brew install coreutils + brew install 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 deleted file mode 100644 index c57dfad..0000000 --- a/.github/workflows/tools_macos_android.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: v8-android tools builder for macos host - -on: [workflow_dispatch] - -env: - CACHE_KEY_SUFFIX: v2 - -jobs: - macos: - runs-on: macOS-latest - - strategy: - matrix: - variant: [intl, nointl, jit-intl, jit-nointl] - - env: - NO_INTL: ${{ contains(matrix.variant, 'nointl') }} - NO_JIT: ${{ !contains(matrix.variant, 'jit') }} - TOOLS_ONLY: true - - steps: - - uses: actions/checkout@v3 - - - name: Export settings from npm package - run: npm run export_npm_env - - - name: Setup V8 build environment - run: | - brew install coreutils - scripts/setup.sh -r ${{ env.V8_VERSION }} macos_android - - - name: Patch V8 - run: scripts/patch.sh macos_android - - # - name: Build arm - # run: | - # scripts/build.sh macos_android arm - # - # - name: Build x86 - # run: | - # scripts/build.sh macos_android x86 - - - name: Build arm64 - run: | - scripts/build.sh macos_android arm64 - - - name: Build x64 - run: | - scripts/build.sh macos_android x64 - - - name: Archive - run: | - scripts/archive.sh macos_android - tar -cvf dist.tar dist - - - uses: actions/upload-artifact@v3 - with: - name: macos-tools-${{ matrix.variant }} - path: dist.tar diff --git a/package.json b/package.json index 95da005..8daa827 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,7 @@ "setup_ios": "bash -c '. ./scripts/export_npm_env.sh && ./scripts/setup.sh ios'", "setup_macos_android": "bash -c '. ./scripts/export_npm_env.sh && ./scripts/setup.sh macos_android'", "start": "bash -c '. ./scripts/export_npm_env.sh && ./scripts/start.sh android'", - "start_ios": "bash -c '. ./scripts/export_npm_env.sh && ./scripts/start.sh ios'", - "start_tools_macos_android": "bash -c '. ./scripts/export_npm_env.sh && TOOLS_ONLY=true ./scripts/start.sh macos_android'" + "start_ios": "bash -c '. ./scripts/export_npm_env.sh && ./scripts/start.sh ios'" }, "config": { "V8": "10.3.22" diff --git a/patches/mkcodecache.patch b/patches/mkcodecache.patch deleted file mode 100644 index 7497788..0000000 --- a/patches/mkcodecache.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff --git a/BUILD.gn b/BUILD.gn -index 19731feebe..66f28d7313 100644 ---- a/BUILD.gn -+++ b/BUILD.gn -@@ -5670,6 +5681,31 @@ if (current_toolchain == v8_generator_toolchain) { - } - } - -+ -+group("mkcodecache_group") { -+ deps = [ ":mkcodecache($v8_generator_toolchain)" ] -+} -+ -+if (current_toolchain == v8_generator_toolchain) { -+ v8_executable("mkcodecache") { -+ visibility = [ ":*" ] # Only targets in this file can depend on this. -+ -+ sources = [ -+ "src/mkcodecache/mkcodecache.cc", -+ ] -+ -+ configs = [ ":internal_config" ] -+ -+ deps = [ -+ ":v8", -+ ":v8_libbase", -+ ":v8_libplatform", -+ ":v8_tracing", -+ "//build/win:default_exe_manifest", -+ ] -+ } -+} -+ - if (current_toolchain == v8_snapshot_toolchain) { - v8_executable("mksnapshot") { - visibility = [ ":*" ] # Only targets in this file can depend on this. diff --git a/scripts/archive.sh b/scripts/archive.sh index 27af0fe..788ac1b 100755 --- a/scripts/archive.sh +++ b/scripts/archive.sh @@ -2,11 +2,6 @@ source $(dirname $0)/env.sh function makeDistPackageDir() { - if [[ ${TOOLS_ONLY} = "true" ]]; then - echo "${DIST_DIR}/packages/v8-android-tools" - return 0 - fi - local jit_suffix="" local intl_suffix="" if [[ ${NO_JIT} != "true" ]]; then @@ -58,25 +53,6 @@ function copyHeaders() { cp -Rf "${V8_DIR}/include" "${DIST_PACKAGE_DIR}/include" } -function copyTools() { - printf "\n\n\t\t===================== adding tools to ${DIST_PACKAGE_DIR}/tools =====================\n\n" - cp -Rf "${BUILD_DIR}/tools" "${DIST_PACKAGE_DIR}/" -} - -function copySnapshotBlobIfNeeded() { - if [[ ${EXTERNAL_STARTUP_DATA} = "true" || ${TOOLS_ONLY} = "true" ]]; then - printf "\n\n\t\t===================== adding snapshot_blob to ${DIST_PACKAGE_DIR}/snapshot_blob =====================\n\n" - cp -Rf "${BUILD_DIR}/snapshot_blob" "${DIST_PACKAGE_DIR}/" - fi -} - - -if [[ ${TOOLS_ONLY} = "true" ]]; then - mkdir -p "$DIST_PACKAGE_DIR" - copyTools - exit 0 -fi - if [[ ${PLATFORM} = "android" ]]; then # export ANDROID_HOME="${V8_DIR}/third_party/android_sdk/public" # export ANDROID_NDK="${V8_DIR}/third_party/android_ndk" @@ -87,11 +63,7 @@ if [[ ${PLATFORM} = "android" ]]; then copyDylib # copyAndroidTools # copyHeaders - # copyTools - copySnapshotBlobIfNeeded elif [[ ${PLATFORM} = "ios" ]]; then copyDylib # copyHeaders - # copyTools - # copySnapshotBlobIfNeeded fi diff --git a/scripts/build.sh b/scripts/build.sh index e09aa2c..77151bc 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -8,25 +8,21 @@ ARCH=$2 GN_ARGS_BASE=" is_component_build=false - v8_monolithic=false + v8_monolithic=true v8_static_library=true use_custom_libcxx=false icu_use_data_file=false treat_warnings_as_errors=false - default_min_sdk_version=21 + default_min_sdk_version=17 symbol_level=0 v8_enable_v8_checks=false v8_enable_debugging_features=false v8_enable_webassembly=true + v8_use_external_startup_data=false is_official_build=true + target_os=\"${PLATFORM}\" " -if [[ ${PLATFORM} = "macos_android" ]]; then - GN_ARGS_BASE="${GN_ARGS_BASE} target_os=\"android\" host_cpu=\"x64\"" -else - GN_ARGS_BASE="${GN_ARGS_BASE} target_os=\"${PLATFORM}\"" -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}\"" elif [[ ${PLATFORM} = "android" ]]; then @@ -42,12 +38,6 @@ if [[ ${NO_JIT} = "true" ]]; then GN_ARGS_BASE="${GN_ARGS_BASE} v8_enable_lite_mode=true" fi -if [[ ${EXTERNAL_STARTUP_DATA} = "true" || ${TOOLS_ONLY} = "true" ]]; then - GN_ARGS_BASE="${GN_ARGS_BASE} v8_use_external_startup_data=true" -else - GN_ARGS_BASE="${GN_ARGS_BASE} v8_use_external_startup_data=false" -fi - if [[ "$BUILD_TYPE" = "Debug" ]] then GN_ARGS_BUILD_TYPE=' @@ -105,16 +95,8 @@ function buildArch() echo "Build v8 ${arch} variant NO_INTL=${NO_INTL} NO_JIT=${NO_JIT}" gn gen --args="${GN_ARGS_BASE} ${GN_ARGS_BUILD_TYPE} v8_target_cpu=\"${arch}\" target_cpu=\"${arch}\"" "out.v8.${arch}" - if [[ ${TOOLS_ONLY} = "true" ]]; then - date ; ninja ${NINJA_PARAMS} -C "out.v8.${arch}" run_mksnapshot_default mkcodecache_group ; date - copySnapshot $arch - copyMkcodecache $arch - else - date ; ninja ${NINJA_PARAMS} -C "out.v8.${arch}" v8_base_without_compiler v8_compiler v8_libplatform v8_libbase v8_bigint v8_snapshot torque_generated_initializers torque_generated_definitions cppgc_base v8_heap_base_headers v8_heap_base run_mksnapshot_default; date - copyLib $arch - copySnapshot $arch - # copyMkcodecache $arch - fi + date ; ninja ${NINJA_PARAMS} -C "out.v8.${arch}" ; date + copyLib $arch } function copyLib() @@ -131,33 +113,6 @@ function copyLib() fi } -function copySnapshot() -{ - local arch=$1 - 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" - - 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" - fi -} - -function copyMkcodecache() -{ - local arch=$1 - 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" - - 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" - fi -} - if [[ ${ARCH} ]]; then buildArch "${ARCH}" elif [[ ${PLATFORM} = "android" ]]; then @@ -168,9 +123,4 @@ elif [[ ${PLATFORM} = "android" ]]; then elif [[ ${PLATFORM} = "ios" ]]; then buildArch "arm64" # buildArch "x64" -elif [[ ${PLATFORM} = "macos_android" ]]; then - # buildArch "arm" - # buildArch "x86" - buildArch "arm64" - buildArch "x64" fi diff --git a/scripts/env.sh b/scripts/env.sh index 87cc8c9..8fb1364 100755 --- a/scripts/env.sh +++ b/scripts/env.sh @@ -17,7 +17,7 @@ function abs_path() function verify_platform() { local arg=$1 - SUPPORTED_PLATFORMS=(android ios macos_android) + SUPPORTED_PLATFORMS=(android ios) local valid_platform= for platform in ${SUPPORTED_PLATFORMS[@]} do @@ -44,7 +44,6 @@ PATCHES_DIR="${ROOT_DIR}/patches" NDK_VERSION="r21e" IOS_DEPLOYMENT_TARGET="9" -EXTERNAL_STARTUP_DATA="true" export PATH="$DEPOT_TOOLS_DIR:$PATH" PLATFORM=$(verify_platform $1) diff --git a/scripts/export_npm_env.sh b/scripts/export_npm_env.sh index b56601b..3868668 100755 --- a/scripts/export_npm_env.sh +++ b/scripts/export_npm_env.sh @@ -1,4 +1,7 @@ #!/bin/bash -e + +npm_package_config_V8=${npm_package_config_V8:-$(node -p 'require("./package.json").config.V8')} + if [[ ${CIRCLECI} ]]; then echo "export VERSION=${npm_package_version}" >> $BASH_ENV echo "export V8_VERSION=${npm_package_config_V8}" >> $BASH_ENV diff --git a/scripts/patch.sh b/scripts/patch.sh index 62419b6..f1df4ee 100755 --- a/scripts/patch.sh +++ b/scripts/patch.sh @@ -22,9 +22,6 @@ V8_PATCHSET_ANDROID=( # revert https://chromium.googlesource.com/chromium/src/build/+/7bb5f36104 "v8_97_android_unwind_link_error.patch" - # Add mkcodecache tool - "mkcodecache.patch" - # Fix for [react-native-bottom-sheet](https://github.com/gorhom/react-native-bottom-sheet) not working # revert https://chromium-review.googlesource.com/c/v8/v8/+/3548458 # "fix_for_bottom_sheet.patch" @@ -43,19 +40,11 @@ V8_PATCHSET_IOS=( # Fix use_system_xcode build error "system_xcode_build_error.patch" - # Add mkcodecache tool - "mkcodecache.patch" - # Fix for [react-native-bottom-sheet](https://github.com/gorhom/react-native-bottom-sheet) not working # revert https://chromium-review.googlesource.com/c/v8/v8/+/3548458 # "fix_for_bottom_sheet.patch" ) -V8_PATCHSET_MACOS_ANDROID=( - # Add mkcodecache tool - "mkcodecache.patch" -) - ###################################################################################### # Patchset management end ###################################################################################### @@ -71,11 +60,6 @@ function setupNDK() { unset ndk_major_version } -function setupMkCodecache() { - mkdir -p "${V8_DIR}/src/mkcodecache" - cp -f "${ROOT_DIR}/mkcodecache/mkcodecache.cc" "${V8_DIR}/src/mkcodecache/" -} - if [[ ${PLATFORM} = "android" ]]; then for patch in "${V8_PATCHSET_ANDROID[@]}" do @@ -84,7 +68,6 @@ if [[ ${PLATFORM} = "android" ]]; then done setupNDK - setupMkCodecache elif [[ ${PLATFORM} = "ios" ]]; then for patch in "${V8_PATCHSET_IOS[@]}" do @@ -92,14 +75,4 @@ elif [[ ${PLATFORM} = "ios" ]]; then patch -d "${V8_DIR}" -p1 < "${PATCHES_DIR}/$patch" done - setupMkCodecache -elif [[ ${PLATFORM} = "macos_android" ]]; then - for patch in "${V8_PATCHSET_MACOS_ANDROID[@]}" - do - printf "### Patch set: ${patch}\n" - patch -d "${V8_DIR}" -p1 < "${PATCHES_DIR}/$patch" - done - - setupNDK - setupMkCodecache fi diff --git a/scripts/setup.sh b/scripts/setup.sh index 1429c35..beb7079 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -17,12 +17,12 @@ source $(dirname $0)/env.sh # Install NDK function installNDK() { - local host_arch=$1 + local ndk_filename="android-ndk-${NDK_VERSION}-linux-x86_64.zip" 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/${ndk_filename}" + unzip -q "$ndk_filename" + rm -f "$ndk_filename" popd } @@ -70,15 +70,6 @@ if [[ ${PLATFORM} = "android" ]]; then # Workaround to install missing android_sdk tools gclient sync --deps=android - installNDK "linux" - exit 0 -fi - -if [[ ${PLATFORM} = "macos_android" ]]; then - gclient sync --deps=android ${GCLIENT_SYNC_ARGS} || true - sed -i "" "s#2c2138e811487b13020eb331482fb991fd399d4e#083aa67a0d3309ebe37eafbe7bfd96c235a019cf#g" v8/DEPS - gclient sync --deps=android - - installNDK "darwin" + installNDK exit 0 fi diff --git a/scripts/start.sh b/scripts/start.sh index 9852a87..768c6e8 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -7,21 +7,10 @@ fi cd "${V8_DIR}" -if [[ ${MKSNAPSHOT_ONLY} = "true" ]]; then - gclient sync --reset --with_branch_head --revision ${V8_VERSION} -elif [[ ${MKCODECACHE_ONLY} = "true" ]]; then - gclient sync --deps=android --reset --with_branch_head --revision ${V8_VERSION} -else - gclient sync --deps=${PLATFORM} --reset --with_branch_head --revision ${V8_VERSION} -fi +gclient sync --deps=${PLATFORM} --reset --with_branch_head --revision ${V8_VERSION} cd "${ROOT_DIR}" scripts/patch.sh ${PLATFORM} -scripts/build.sh ${PLATFORM} -scripts/archive.sh ${PLATFORM} - -if [[ ${TOOLS_ONLY} != "true" ]]; then - NO_INTL=true scripts/build.sh ${PLATFORM} - NO_INTL=true scripts/archive.sh ${PLATFORM} -fi +NO_INTL=true scripts/build.sh ${PLATFORM} +NO_INTL=true scripts/archive.sh ${PLATFORM}