From 862a498cd4c156f440a3b560bd8f5fa7e396670b Mon Sep 17 00:00:00 2001 From: LongYinan Date: Mon, 5 Feb 2024 13:18:59 +0800 Subject: [PATCH] Update llvm/clang --- .github/workflows/CI.yaml | 29 ++++++++++++----------------- .github/workflows/skia.yaml | 11 ++++++++--- Cargo.toml | 5 +++++ 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 8b8e3f3c..883f8e4d 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -25,11 +25,12 @@ jobs: settings: - host: macos-14 target: 'x86_64-apple-darwin' - setup: brew install nasm + setup: brew install nasm llvm build: | rustc --print target-cpus + export PATH="/opt/homebrew/opt/llvm/bin:$PATH" + clang --version yarn build --target x86_64-apple-darwin - strip -x skia.darwin-x64.node downloadTarget: '' - host: windows-latest build: yarn build --target x86_64-pc-windows-msvc @@ -39,10 +40,7 @@ jobs: target: 'x86_64-unknown-linux-gnu' downloadTarget: '' docker: ghcr.io/brooooooklyn/canvas/ubuntu-builder:jammy - build: >- - set -e && - yarn build --target x86_64-unknown-linux-gnu && - strip skia.linux-x64-gnu.node + build: yarn build --target x86_64-unknown-linux-gnu - host: ubuntu-latest downloadTarget: 'x86_64-unknown-linux-musl' target: 'x86_64-unknown-linux-musl' @@ -52,11 +50,12 @@ jobs: export LIB_AOM_STATIC_LIB_PATH=/usr/lib && export LIB_AOM_INCLUDE_PATH=/usr/include/aom/aom && export LIB_AOM_PKG_CONFIG_PATH=/usr/lib/pkgconfig && - yarn build --target x86_64-unknown-linux-musl && - strip skia.linux-x64-musl.node + yarn build --target x86_64-unknown-linux-musl - host: macos-14 downloadTarget: 'aarch64-apple-darwin' target: 'aarch64-apple-darwin' + setup: | + brew install llvm build: | sudo rm -Rf /Library/Developer/CommandLineTools/SDKs/*; export CC=$(xcrun -f clang); @@ -64,8 +63,9 @@ jobs: SYSROOT=$(xcrun --sdk macosx --show-sdk-path); export CFLAGS="-isysroot $SYSROOT -isystem $SYSROOT"; export MACOSX_DEPLOYMENT_TARGET='11.0' + export PATH="/opt/homebrew/opt/llvm/bin:$PATH" + clang --version yarn build --target aarch64-apple-darwin - strip -x skia.darwin-arm64.node - host: ubuntu-latest downloadTarget: 'aarch64-unknown-linux-gnu' target: 'aarch64-unknown-linux-gnu' @@ -74,8 +74,7 @@ jobs: set -e && rustup toolchain install $(cat ./rust-toolchain) && rustup target add aarch64-unknown-linux-gnu && - yarn build --target aarch64-unknown-linux-gnu && - llvm-strip-16 skia.linux-arm64-gnu.node + yarn build --target aarch64-unknown-linux-gnu - host: ubuntu-latest target: 'aarch64-unknown-linux-musl' downloadTarget: 'aarch64-unknown-linux-musl' @@ -88,8 +87,7 @@ jobs: export LIB_AOM_PKG_CONFIG_PATH=/usr/aarch64-alpine-linux-musl/aom/lib/pkgconfig/aom.pc && export LIB_AOM_INCLUDE_PATH=/usr/aarch64-alpine-linux-musl/aom/include && export LIB_AOM_STATIC_LIB_PATH=/usr/aarch64-alpine-linux-musl/aom/lib && - yarn build --target aarch64-unknown-linux-musl && - /aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip skia.linux-arm64-musl.node + yarn build --target aarch64-unknown-linux-musl - host: ubuntu-latest target: 'armv7-unknown-linux-gnueabihf' downloadTarget: 'armv7-unknown-linux-gnueabihf' @@ -103,9 +101,7 @@ jobs: sudo docker cp ubuntu-jammy-armv7:/usr/lib/llvm-14/lib /usr/arm-linux-gnueabihf/lib/llvm-14/lib sudo docker cp ubuntu-jammy-armv7:/usr/lib/llvm-14/include /usr/arm-linux-gnueabihf/lib/llvm-14/include docker stop ubuntu-jammy-armv7 - build: | - yarn build --target armv7-unknown-linux-gnueabihf --zig --zig-link-only --zig-abi-suffix=2.18 - arm-linux-gnueabihf-strip skia.linux-arm-gnueabihf.node + build: yarn build --target armv7-unknown-linux-gnueabihf --zig --zig-link-only --zig-abi-suffix=2.18 - host: ubuntu-latest target: 'aarch64-linux-android' downloadTarget: 'aarch64-linux-android' @@ -115,7 +111,6 @@ jobs: chmod 777 "${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/lib/clang/${CLANG_VERSION}/lib/linux/aarch64/libgcc.a" echo "INPUT(-lunwind)" > "${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/lib/clang/${CLANG_VERSION}/lib/linux/aarch64/libgcc.a" yarn build --target aarch64-linux-android - ${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip skia.android-arm64.node name: stable - ${{ matrix.settings.target }} - node@18 runs-on: ${{ matrix.settings.host }} diff --git a/.github/workflows/skia.yaml b/.github/workflows/skia.yaml index e0ce4ea5..50a6ccfd 100644 --- a/.github/workflows/skia.yaml +++ b/.github/workflows/skia.yaml @@ -48,7 +48,7 @@ jobs: shell: bash - name: Install tools on macOS - run: brew install ninja + run: brew install ninja llvm if: matrix.os == 'macos-14' - name: Install tools on Windows @@ -83,6 +83,8 @@ jobs: env: PYTHONHTTPSVERIFY: 0 run: | + export PATH="/opt/homebrew/opt/llvm/bin:$PATH" + clang --version node ./scripts/build-skia.js - name: Compile skia @@ -128,10 +130,13 @@ jobs: shell: bash - name: Install tools on macOS - run: brew install ninja + run: brew install ninja llvm - name: Compile skia - run: node ./scripts/build-skia.js --target=aarch64-apple-darwin + run: | + export PATH="/opt/homebrew/opt/llvm/bin:$PATH" + clang --version + node ./scripts/build-skia.js --target=aarch64-apple-darwin env: MACOSX_DEPLOYMENT_TARGET: '11.0' diff --git a/Cargo.toml b/Cargo.toml index 121a8faf..91312d66 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,3 +39,8 @@ mimalloc-rust = { version = "0.2", features = ["local-dynamic-tls"] } [build-dependencies] cc = "1" napi-build = "2" + +[profile.release] +lto = true +codegen-units = 1 +strip = "symbols"