Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
env:
OS: linux
ARCH: x86_64
TARGET_OS: linux

runs-on: ubuntu-22.04
steps:
Expand Down Expand Up @@ -49,6 +50,7 @@ jobs:
env:
OS: macos
ARCH: aarch64
TARGET_OS: macos

runs-on: macos-latest
steps:
Expand Down Expand Up @@ -79,6 +81,7 @@ jobs:
env:
OS: linux
ARCH: aarch64
TARGET_OS: linux

runs-on: ubuntu-22.04-arm
steps:
Expand Down Expand Up @@ -114,6 +117,7 @@ jobs:
env:
OS: macos
ARCH: x86_64
TARGET_OS: macos

runs-on: macos-15-large
steps:
Expand Down Expand Up @@ -145,6 +149,7 @@ jobs:
OS: ios
ARCH: aarch64
TARGET_ENVIRONMENT: simulator
TARGET_OS: ios

runs-on: macos-latest
steps:
Expand All @@ -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
47 changes: 46 additions & 1 deletion build-tools/build_v8.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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}
Expand Down
101 changes: 70 additions & 31 deletions build-tools/get_v8.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<EOF
solutions = [
{
"name": "src",
"url": "https://chromium.googlesource.com/v8/v8.git",
"deps_file": "DEPS",
"managed": False,
"custom_deps": {},
},
]
target_os = ["android"]
EOF

# Sync Android-specific deps
gclient sync

pushd src
git checkout ${REVISION}
popd

gclient sync

pushd src
./build/install-build-deps.sh
popd
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
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