diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index a2ed2df..9a5a2fb 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,47 +76,78 @@ jobs: allowUpdates: true artifacts: libc_v8_${{ env.V8_REVISION }}_${{ env.OS }}_${{ env.ARCH }}.a - build-arm64-linux: + # 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: - OS: linux + OS: ios ARCH: aarch64 + TARGET_ENVIRONMENT: simulator - 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 + runs-on: macos-latest steps: - uses: mlugg/setup-zig@v2 with: @@ -130,7 +162,7 @@ jobs: submodules: recursive fetch-depth: 0 - - run: zig build get-v8 + - 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 diff --git a/build-tools/build_v8.sh b/build-tools/build_v8.sh index b11106a..b2f2bd1 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 target_environment=\"${TARGET_ENVIRONMENT}\"" +fi TARGET_ARCH=${ARCH} if [ "${ARCH}" = "amd64" ]; then diff --git a/build-tools/utils.sh b/build-tools/utils.sh index 25bee89..d451211 100644 --- a/build-tools/utils.sh +++ b/build-tools/utils.sh @@ -23,8 +23,14 @@ case $(uname -m) in *) fail "unsupported architecture: $(uname -m)" esac -case "$OSTYPE" in - darwin*) OS="mac" ;; - linux*) OS="linux" ;; - *) fail "unsupported platform: ${OSTYPE}" +: "${OS:=unset}" +case "$OS" in + macos) OS="mac" ;; + unset) + case "$OSTYPE" in + darwin*) OS="mac" ;; + linux*) OS="linux" ;; + *) fail "unsupported platform: ${OSTYPE}" + esac + ;; esac 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, };