From 554f922db36546f95724b96ff023751aab1d5e6e Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Thu, 29 Feb 2024 16:45:19 +0530 Subject: [PATCH 01/10] musl libc builds --- .github/workflows/ci.yml | 9 +++++++++ musl-build.sh | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100755 musl-build.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 25d186b6a9..757a0e76b3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -207,6 +207,15 @@ jobs: ${{ matrix.config.cargo }} clippy --all-targets --locked ${{ env.CARGO_VARIANT_FLAG }} --target ${{ matrix.config.target }} -- -D clippy::all + - name: Build Musl + if: matrix.config.target == 'x86_64-unknown-linux-gnu' + run: | + docker run -v "$PWD":/usr/src/rusty_v8 -w /usr/src/rusty_v8 rust:alpine3.16 ./musl-build.sh + cp target/${{ matrix.config.variant }}/gn_out/obj/librusty_v8.a target/librusty_v8_${{ matrix.config.variant }}_x86_64-unknown-linux-musl.a + + - name: Rustfmt + run: cargo fmt -- --check + - name: Prepare binary publish if: matrix.config.variant == 'debug' || matrix.config.variant == 'release' run: | diff --git a/musl-build.sh b/musl-build.sh new file mode 100755 index 0000000000..81458cec19 --- /dev/null +++ b/musl-build.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +apk add git \ + gcc \ + ninja \ + python3 \ + clang \ + g++ \ + pkgconfig \ + glib-dev \ + llvm13-dev \ + binutils-gold \ + sccache +ln -s /usr/bin/python3 /usr/bin/python + +export V8_FROM_SOURCE="yes" +export CLANG_BASE_PATH="/usr" +export SCCACHE_DIR="./target/sccache" +export SCCACHE="/usr/bin/sccache" +export GN_ARGS="use_custom_libcxx=false use_lld=false v8_enable_backtrace=false v8_enable_debugging_features=false" +GN="$(pwd)/gn/out/gn" +export GN + +# Bulid GN +if [ ! -d "./gn" ]; then + git clone https://gn.googlesource.com/gn + ( + cd gn || exit + python3 build/gen.py + ninja -C out + ) +fi + +# Build rusty_v8 +cargo build -vv From 51bfc0901d5aefbf90415cd1b4ffe6c5c4cf4490 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Thu, 29 Feb 2024 16:51:40 +0530 Subject: [PATCH 02/10] run CI From be0ec9c4dafe370bf4dc0e932d0b925cbd61693d Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Thu, 29 Feb 2024 16:59:21 +0530 Subject: [PATCH 03/10] run CI --- .github/workflows/ci.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 757a0e76b3..d36db9ca7f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -193,6 +193,11 @@ jobs: curl -O http://commondatastorage.googleapis.com/chromium-browser-clang-staging/Mac/dsymutil-llvmorg-17-init-19076-g5533fc10-1.tgz tar -C tools/clang/dsymutil/ -xvzf dsymutil-llvmorg-17-init-19076-g5533fc10-1.tgz V8_FROM_SOURCE=true RUSTFLAGS="-C opt-level=1 -Zsanitizer=address" cargo +nightly -Z build-std test --lib --bins --tests -vv --target ${{ matrix.config.target }} + - name: Build Musl + if: matrix.config.target == 'x86_64-unknown-linux-gnu' + run: | + docker run -v "$PWD":/usr/src/rusty_v8 -w /usr/src/rusty_v8 rust:alpine3.16 ./musl-build.sh + cp target/${{ matrix.config.variant }}/gn_out/obj/librusty_v8.a target/librusty_v8_${{ matrix.config.variant }}_x86_64-unknown-linux-musl.a - name: Test env: @@ -207,12 +212,6 @@ jobs: ${{ matrix.config.cargo }} clippy --all-targets --locked ${{ env.CARGO_VARIANT_FLAG }} --target ${{ matrix.config.target }} -- -D clippy::all - - name: Build Musl - if: matrix.config.target == 'x86_64-unknown-linux-gnu' - run: | - docker run -v "$PWD":/usr/src/rusty_v8 -w /usr/src/rusty_v8 rust:alpine3.16 ./musl-build.sh - cp target/${{ matrix.config.variant }}/gn_out/obj/librusty_v8.a target/librusty_v8_${{ matrix.config.variant }}_x86_64-unknown-linux-musl.a - - name: Rustfmt run: cargo fmt -- --check From e0e3c41c7aa008073968b533bb36c0563d6e0740 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Thu, 29 Feb 2024 17:08:17 +0530 Subject: [PATCH 04/10] run CI --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d36db9ca7f..6cb72a3d0e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -145,7 +145,7 @@ jobs: key: cargo-${{ matrix.config.target }}-${{ matrix.config.variant }}-${{ hashFiles('Cargo.lock', 'build.rs', 'git_submodule_status.txt') }} restore-keys: - cargo-${{ matrix.config.target }}-${{ matrix.config.variant }}- + cargo-${{ matrix.config.target }}-${{ matrix.config.variant }}-1 - name: Install and start sccache shell: pwsh From fd35e5ac7fe3643715165c7854e0abf51fb24bec Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Thu, 29 Feb 2024 18:38:26 +0530 Subject: [PATCH 05/10] fix docker cp --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6cb72a3d0e..3d1acd71f9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -197,7 +197,7 @@ jobs: if: matrix.config.target == 'x86_64-unknown-linux-gnu' run: | docker run -v "$PWD":/usr/src/rusty_v8 -w /usr/src/rusty_v8 rust:alpine3.16 ./musl-build.sh - cp target/${{ matrix.config.variant }}/gn_out/obj/librusty_v8.a target/librusty_v8_${{ matrix.config.variant }}_x86_64-unknown-linux-musl.a + docker cp $(docker ps -lq):/usr/src/rusty_v8/target/${{ matrix.config.variant }}/gn_out/obj/librusty_v8.a target/librusty_v8_${{ matrix.config.variant }}_x86_64-unknown-linux-musl.a - name: Test env: From 4d140e39b77d4d63162fd41de4127f7b43d47389 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Thu, 29 Feb 2024 20:01:53 +0530 Subject: [PATCH 06/10] fix variant flag --- .github/workflows/ci.yml | 2 +- musl-build.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3d1acd71f9..778a690c91 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -196,7 +196,7 @@ jobs: - name: Build Musl if: matrix.config.target == 'x86_64-unknown-linux-gnu' run: | - docker run -v "$PWD":/usr/src/rusty_v8 -w /usr/src/rusty_v8 rust:alpine3.16 ./musl-build.sh + docker run -v "$PWD":/usr/src/rusty_v8 -w /usr/src/rusty_v8 rust:alpine3.16 ./musl-build.sh ${{ env.CARGO_VARIANT_FLAG }} docker cp $(docker ps -lq):/usr/src/rusty_v8/target/${{ matrix.config.variant }}/gn_out/obj/librusty_v8.a target/librusty_v8_${{ matrix.config.variant }}_x86_64-unknown-linux-musl.a - name: Test diff --git a/musl-build.sh b/musl-build.sh index 81458cec19..376078d384 100755 --- a/musl-build.sh +++ b/musl-build.sh @@ -31,5 +31,5 @@ if [ ! -d "./gn" ]; then ) fi -# Build rusty_v8 -cargo build -vv +# Build rusty_v8 and pass through the arguments +cargo build -vv $@ From ee6506290646dced1103cb05a601394853e2ccc7 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Fri, 1 Mar 2024 22:31:09 +0530 Subject: [PATCH 07/10] docker perms --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 778a690c91..a1f7e63061 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -198,6 +198,7 @@ jobs: run: | docker run -v "$PWD":/usr/src/rusty_v8 -w /usr/src/rusty_v8 rust:alpine3.16 ./musl-build.sh ${{ env.CARGO_VARIANT_FLAG }} docker cp $(docker ps -lq):/usr/src/rusty_v8/target/${{ matrix.config.variant }}/gn_out/obj/librusty_v8.a target/librusty_v8_${{ matrix.config.variant }}_x86_64-unknown-linux-musl.a + sudo chown $(id -u):$(id -g) /usr/src/rusty_v8 - name: Test env: From 6338ce1bc44be4fb66a3c068c6c312c299563c6d Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Fri, 1 Mar 2024 23:50:33 +0530 Subject: [PATCH 08/10] docker perms --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a1f7e63061..a730aa04f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -198,7 +198,7 @@ jobs: run: | docker run -v "$PWD":/usr/src/rusty_v8 -w /usr/src/rusty_v8 rust:alpine3.16 ./musl-build.sh ${{ env.CARGO_VARIANT_FLAG }} docker cp $(docker ps -lq):/usr/src/rusty_v8/target/${{ matrix.config.variant }}/gn_out/obj/librusty_v8.a target/librusty_v8_${{ matrix.config.variant }}_x86_64-unknown-linux-musl.a - sudo chown $(id -u):$(id -g) /usr/src/rusty_v8 + sudo chown $(id -u):$(id -g) target/ - name: Test env: From 21347b7d70dcee6fa453b83f6877a40f3774a7bd Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Mon, 4 Mar 2024 09:02:12 +0530 Subject: [PATCH 09/10] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a730aa04f0..49df298353 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -198,7 +198,7 @@ jobs: run: | docker run -v "$PWD":/usr/src/rusty_v8 -w /usr/src/rusty_v8 rust:alpine3.16 ./musl-build.sh ${{ env.CARGO_VARIANT_FLAG }} docker cp $(docker ps -lq):/usr/src/rusty_v8/target/${{ matrix.config.variant }}/gn_out/obj/librusty_v8.a target/librusty_v8_${{ matrix.config.variant }}_x86_64-unknown-linux-musl.a - sudo chown $(id -u):$(id -g) target/ + sudo chown $(id -u):$(id -g) /home/runner/work/rusty_v8/rusty_v8/target/debug/ - name: Test env: From 3488653ca49dc14661868fe69ae8f5ca4d99ad71 Mon Sep 17 00:00:00 2001 From: Ronny Chan Date: Thu, 24 Oct 2024 13:31:00 -0400 Subject: [PATCH 10/10] build musl target --- musl-build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/musl-build.sh b/musl-build.sh index 376078d384..56ba8d6ce3 100755 --- a/musl-build.sh +++ b/musl-build.sh @@ -32,4 +32,4 @@ if [ ! -d "./gn" ]; then fi # Build rusty_v8 and pass through the arguments -cargo build -vv $@ +cargo build -vv $@ --target=x86_64-unknown-linux-musl