diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 4553d8b..1775bc0 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -19,6 +19,7 @@ jobs: env: OS: linux ARCH: x86_64 + TARGET_OS: linux runs-on: ubuntu-22.04 steps: @@ -49,6 +50,7 @@ jobs: env: OS: macos ARCH: aarch64 + TARGET_OS: macos runs-on: macos-latest steps: @@ -79,6 +81,7 @@ jobs: env: OS: linux ARCH: aarch64 + TARGET_OS: linux runs-on: ubuntu-22.04-arm steps: @@ -114,6 +117,7 @@ jobs: env: OS: macos ARCH: x86_64 + TARGET_OS: macos runs-on: macos-15-large steps: @@ -145,6 +149,7 @@ jobs: OS: ios ARCH: aarch64 TARGET_ENVIRONMENT: simulator + TARGET_OS: ios runs-on: macos-latest steps: @@ -170,3 +175,35 @@ jobs: with: allowUpdates: true artifacts: libc_v8_${{ env.V8_REVISION }}_${{ env.OS }}_${{ env.TARGET_ENVIRONMENT }}_${{ env.ARCH }}.a + + build-arm64-android: + env: + OS: android + ARCH: arm64 + HOST_ARCH: x64 + TARGET_OS: android + + runs-on: ubuntu-22.04 + steps: + - uses: mlugg/setup-zig@v2 + with: + version: ${{ env.ZIG_VERSION }} + + - uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 + + - run: OS=linux zig build get-v8 # We force the OS to linux here b/c android is not supported by get-v8 + - run: zig build -Doptimize=ReleaseSafe build-v8 + - run: mv v8/out/${{ env.OS }}/release/obj/zig/libc_v8.a libc_v8_${{ env.V8_REVISION }}_${{ env.OS }}_${{ env.ARCH }}.a + + - name: Upload the build + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifacts: libc_v8_${{ env.V8_REVISION }}_${{ env.OS }}_${{ env.ARCH }}.a diff --git a/build-tools/build_v8.sh b/build-tools/build_v8.sh index b2f2bd1..fc4f44a 100644 --- a/build-tools/build_v8.sh +++ b/build-tools/build_v8.sh @@ -35,11 +35,56 @@ fi if [ "${OS}" = "ios" ]; then EXTRA_ARGS="v8_enable_pointer_compression=false v8_enable_webassembly=false target_environment=\"${TARGET_ENVIRONMENT}\"" fi +if [ "${OS}" = "android" ]; then + EXTRA_ARGS=' + clang_use_chrome_plugins = false + is_component_build = false + use_dummy_lastchange = true + use_sysroot = false + simple_template_names = false + symbol_level = 1 + use_debug_fission = false + v8_embedder_string = "-lightpanda" + v8_enable_sandbox = false + v8_enable_javascript_promise_hooks = true + v8_promise_internal_field_count = 1 + v8_use_external_startup_data = false + v8_imminent_deprecation_warnings = false + v8_enable_private_mapping_fork_optimization = true + v8_use_zlib = true + v8_enable_snapshot_compression = false + v8_enable_handle_zapping = false + v8_typed_array_max_size_in_heap = 0 + v8_array_buffer_internal_field_count = 2 + v8_array_buffer_view_internal_field_count = 2 + v8_enable_verify_heap = false + v8_enable_fuzztest = false + v8_enable_v8_checks = false + use_relative_vtables_abi = false + icu_use_data_file = false + v8_enable_temporal_support = false + use_llvm_libatomic = false + target_os = "android" + target_cpu = "arm64" + v8_target_cpu = "arm64" + is_debug = false + v8_enable_pointer_compression=false + v8_enable_webassembly=false + is_official_build=false + + v8_target_cpu="arm64" + v8_enable_pointer_compression=false + v8_enable_webassembly=false + ' +fi TARGET_ARCH=${ARCH} if [ "${ARCH}" = "amd64" ]; then TARGET_ARCH="x64" fi +if [ "${ARCH}" = "aarch64" ]; then + TARGET_ARCH="arm64" +fi tools/gn \ --root=src \ @@ -49,7 +94,7 @@ tools/gn \ --args=" target_os=\"${OS}\" target_cpu=\"${TARGET_ARCH}\" - host_cpu=\"${TARGET_ARCH}\" + host_cpu=\"${HOST_ARCH}\" is_debug=${IS_DEBUG} symbol_level=${SYMBOL_LEVEL} is_official_build=false ${EXTRA_ARGS} diff --git a/build-tools/get_v8.sh b/build-tools/get_v8.sh index cee571a..c9e4e53 100644 --- a/build-tools/get_v8.sh +++ b/build-tools/get_v8.sh @@ -28,35 +28,74 @@ cloneDep() { clone $dep_path $2 $dep_commit } -if [ -d "src" ]; then - warn "v8/src/ already exists, only cloning dependencies" +if [ "${TARGET_OS}" = "android" ]; then + say "setting up Android dependencies" + + # depot_tools are required to get GN/Ninja working with Android + if [ ! -d "depot_tools" ]; then + say "cloning depot_tools" + git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git depot_tools + fi + + export PATH=$(pwd)/depot_tools:$PATH + + # Add minimal .gclient for Android builds + cat > .gclient < deps.json - -cloneDep 'build' 'src/build' -cloneDep 'third_party/jinja2' 'src/third_party/jinja2' -cloneDep 'buildtools' 'src/buildtools' -cloneDep 'tools/clang' 'src/tools/clang' -cloneDep 'third_party/zlib' 'src/third_party/zlib' -cloneDep 'third_party/googletest/src' 'src/third_party/googletest/src' -cloneDep 'third_party/markupsafe' 'src/third_party/markupsafe' -cloneDep 'third_party/icu' 'src/third_party/icu' -cloneDep 'third_party/abseil-cpp' 'src/third_party/abseil-cpp' -cloneDep 'third_party/simdutf' 'src/third_party/simdutf' -cloneDep 'third_party/highway/src' 'src/third_party/highway/src/' -cloneDep 'third_party/libc++/src' 'src/third_party/libc++/src' -cloneDep 'third_party/libc++abi/src' 'src/third_party/libc++abi/src' -cloneDep 'third_party/llvm-libc/src' 'src/third_party/llvm-libc/src' -cloneDep 'third_party/fp16/src' 'src/third_party/fp16/src' -cloneDep 'third_party/fast_float/src' 'src/third_party/fast_float/src' -cloneDep 'third_party/dragonbox/src' 'src/third_party/dragonbox/src' - -# Add an empty gclient_args.gni so gn is happy. gclient also creates an empty file. -echo "# generated by get_v8.sh" > src/build/config/gclient_args.gni - -say "gettting prebuilt clang binary" -python3 src/tools/clang/scripts/update.py + if [ -d "src" ]; then + warn "v8/src/ already exists, only cloning dependencies" + else + say "cloning V8 into v8/src/" + git clone --depth=1 --branch ${REVISION} "https://chromium.googlesource.com/v8/v8.git" src + fi + + python3 deps_parse.py src/DEPS > deps.json + + cloneDep 'build' 'src/build' + cloneDep 'third_party/jinja2' 'src/third_party/jinja2' + cloneDep 'buildtools' 'src/buildtools' + cloneDep 'tools/clang' 'src/tools/clang' + cloneDep 'third_party/zlib' 'src/third_party/zlib' + cloneDep 'third_party/googletest/src' 'src/third_party/googletest/src' + cloneDep 'third_party/markupsafe' 'src/third_party/markupsafe' + cloneDep 'third_party/icu' 'src/third_party/icu' + cloneDep 'third_party/abseil-cpp' 'src/third_party/abseil-cpp' + cloneDep 'third_party/simdutf' 'src/third_party/simdutf' + cloneDep 'third_party/highway/src' 'src/third_party/highway/src/' + cloneDep 'third_party/libc++/src' 'src/third_party/libc++/src' + cloneDep 'third_party/libc++abi/src' 'src/third_party/libc++abi/src' + cloneDep 'third_party/llvm-libc/src' 'src/third_party/llvm-libc/src' + cloneDep 'third_party/fp16/src' 'src/third_party/fp16/src' + cloneDep 'third_party/fast_float/src' 'src/third_party/fast_float/src' + cloneDep 'third_party/dragonbox/src' 'src/third_party/dragonbox/src' + + # Add an empty gclient_args.gni so gn is happy. gclient also creates an empty file. + echo "# generated by get_v8.sh" > src/build/config/gclient_args.gni + + say "gettting prebuilt clang binary" + python3 src/tools/clang/scripts/update.py +fi \ No newline at end of file