From da949277daaffa4f67158988e86b0a01ea6dca39 Mon Sep 17 00:00:00 2001 From: Carson Katri Date: Tue, 16 Sep 2025 12:38:49 -0400 Subject: [PATCH 1/4] Add support for flags to build on iOS --- build-tools/build_v8.sh | 3 +++ build-tools/utils.sh | 15 ++++++++++----- build.zig | 1 + 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/build-tools/build_v8.sh b/build-tools/build_v8.sh index b11106a..5db4085 100644 --- a/build-tools/build_v8.sh +++ b/build-tools/build_v8.sh @@ -32,6 +32,9 @@ EXTRA_ARGS="" if [ "${OS}" = "linux" ] && [ "${ARCH}" == "arm64" ]; then EXTRA_ARGS="clang_base_path=\"/usr/lib/llvm-21\" clang_use_chrome_plugins=false treat_warnings_as_errors=false" fi +if [ "${OS}" = "ios" ]; then + EXTRA_ARGS="v8_enable_pointer_compression=false v8_enable_webassembly=false" +fi TARGET_ARCH=${ARCH} if [ "${ARCH}" = "amd64" ]; then diff --git a/build-tools/utils.sh b/build-tools/utils.sh index 25bee89..3834329 100644 --- a/build-tools/utils.sh +++ b/build-tools/utils.sh @@ -23,8 +23,13 @@ case $(uname -m) in *) fail "unsupported architecture: $(uname -m)" esac -case "$OSTYPE" in - darwin*) OS="mac" ;; - linux*) OS="linux" ;; - *) fail "unsupported platform: ${OSTYPE}" -esac +: "${OS:=unset}" +case "$OS" in + unset) + case "$OSTYPE" in + darwin*) OS="mac" ;; + linux*) OS="linux" ;; + *) fail "unsupported platform: ${OSTYPE}" + esac + ;; +esac \ No newline at end of file diff --git a/build.zig b/build.zig index c7a99d4..2a643b3 100644 --- a/build.zig +++ b/build.zig @@ -132,6 +132,7 @@ pub fn build(b: *std.Build) !void { const os = switch (target.result.os.tag) { .linux => "linux", .macos => "macos", + .ios => "ios", else => return error.UnsupportedPlatform, }; From cbe76200ff2003d5b78752190c88d88b4e009f3a Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Fri, 19 Sep 2025 14:20:42 +0200 Subject: [PATCH 2/4] ci: add io build --- .github/workflows/build-release.yml | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index a2ed2df..cb2e257 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -139,3 +139,33 @@ jobs: with: allowUpdates: true artifacts: libc_v8_${{ env.V8_REVISION }}_${{ env.OS }}_${{ env.ARCH }}.a + + build-aarch64-ios: + env: + OS: ios + ARCH: aarch64 + + runs-on: macos-latest + 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=macos zig build get-v8 # We force the OS to macos here b/c ios 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 From 8bfd935a1c303cb9ed35890e1c6783a859add77d Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Fri, 19 Sep 2025 14:26:28 +0200 Subject: [PATCH 3/4] REVERT-ME --- .github/workflows/build-release.yml | 129 ++++++++++++++-------------- 1 file changed, 65 insertions(+), 64 deletions(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index cb2e257..7f2e4f1 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -6,6 +6,7 @@ on: - "**" # Allows you to run this workflow manually from the Actions tab workflow_dispatch: + pull_request: permissions: contents: write @@ -75,70 +76,70 @@ jobs: allowUpdates: true artifacts: libc_v8_${{ env.V8_REVISION }}_${{ env.OS }}_${{ env.ARCH }}.a - build-arm64-linux: - env: - OS: linux - ARCH: aarch64 - - runs-on: ubuntu-22.04-arm - steps: - - uses: mlugg/setup-zig@v2 - with: - version: ${{ env.ZIG_VERSION }} - - - uses: actions/checkout@v4 - with: - submodules: recursive - fetch-depth: 0 - - - run: | - sudo apt-get update - sudo apt-get install -yq libglib2.0-dev lld - wget https://apt.llvm.org/llvm.sh - chmod +x llvm.sh - sudo ./llvm.sh 21 - sudo ln -nsf /usr/lib/llvm-21/lib/clang/21/lib/linux/libclang_rt.builtins-aarch64.a /usr/lib/llvm-21/lib/clang/21/lib/linux/libclang_rt.builtins.a && \ - sudo ln -nsf /usr/lib/llvm-21/lib/clang/21/lib/linux/ /usr/lib/llvm-21/lib/clang/21/lib/aarch64-unknown-linux-gnu - - - run: zig build 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 - - build-x86_64-macos: - env: - OS: macos - ARCH: x86_64 - - runs-on: macos-15-large - 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: zig build 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 + # build-arm64-linux: + # env: + # OS: linux + # ARCH: aarch64 + + # runs-on: ubuntu-22.04-arm + # steps: + # - uses: mlugg/setup-zig@v2 + # with: + # version: ${{ env.ZIG_VERSION }} + + # - uses: actions/checkout@v4 + # with: + # submodules: recursive + # fetch-depth: 0 + + # - run: | + # sudo apt-get update + # sudo apt-get install -yq libglib2.0-dev lld + # wget https://apt.llvm.org/llvm.sh + # chmod +x llvm.sh + # sudo ./llvm.sh 21 + # sudo ln -nsf /usr/lib/llvm-21/lib/clang/21/lib/linux/libclang_rt.builtins-aarch64.a /usr/lib/llvm-21/lib/clang/21/lib/linux/libclang_rt.builtins.a && \ + # sudo ln -nsf /usr/lib/llvm-21/lib/clang/21/lib/linux/ /usr/lib/llvm-21/lib/clang/21/lib/aarch64-unknown-linux-gnu + + # - run: zig build 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 + + # build-x86_64-macos: + # env: + # OS: macos + # ARCH: x86_64 + + # runs-on: macos-15-large + # 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: zig build 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 build-aarch64-ios: env: From 8589ee0d5431085d676db148cdd680920b212f88 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Fri, 19 Sep 2025 14:57:07 +0200 Subject: [PATCH 4/4] fix build OS when setting macos --- build-tools/utils.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build-tools/utils.sh b/build-tools/utils.sh index 3834329..d451211 100644 --- a/build-tools/utils.sh +++ b/build-tools/utils.sh @@ -25,6 +25,7 @@ esac : "${OS:=unset}" case "$OS" in + macos) OS="mac" ;; unset) case "$OSTYPE" in darwin*) OS="mac" ;; @@ -32,4 +33,4 @@ case "$OS" in *) fail "unsupported platform: ${OSTYPE}" esac ;; -esac \ No newline at end of file +esac