From f7d5738cf84a910c321a25e8e6c34d7d0781fb8f Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Mon, 22 Jul 2024 16:10:07 -0700 Subject: [PATCH] Make llvm version configurable --- .github/workflows/build.yml | 32 ++++++++++++++++++++++---------- mac-release.bash | 9 ++++++--- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fc2d0ac65b813..bd400d47db32c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,5 +1,8 @@ name: CI +env: + LLVM_VERSION: 18 + # Controls when the workflow will run on: # Triggers the workflow on push or pull request events but only for the "master" branch @@ -8,6 +11,10 @@ on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: + inputs: + llvm_version: + description: "LLVM version" + default: "18" jobs: macos: @@ -60,6 +67,9 @@ jobs: package_json_arch: "arm64" CMAKE_BUILD_TYPE: Release steps: + - name: "Set LLVM version" + if: github.event == 'workflow_dispatch' + run: echo "LLVM_VERSION=${{inputs.llvm_version}}" >> $GITHUB_ENV - uses: actions/checkout@v4 with: sparse-checkout-cone-mode: false @@ -74,20 +84,22 @@ jobs: HOMEBREW_NO_INSTALL_CLEANUP: 1 HOMEBREW_NO_ANALYTICS_THIS_RUN: 1 run: | - echo "${{matrix.brew_prefix}}/llvm@16/bin" >> $GITHUB_PATH - brew install llvm@16 python icu4c ninja -f --overwrite - brew link llvm@16 -f --overwrite + echo "${{matrix.brew_prefix}}/llvm@${{env.LLVM_VERSION}}/bin" >> $GITHUB_PATH + brew install llvm@${{env.LLVM_VERSION}} python icu4c ninja -f --overwrite + brew link llvm@${{env.LLVM_VERSION}} -f --overwrite - name: Run env: ICU_INCLUDE_DIRS: ${{matrix.brew_prefix}}/icu4c/include LDFLAGS: "${{env.LDFLAGS}} -L${{matrix.brew_prefix}}/llvm/lib/c++ -Wl,-rpath,${{matrix.brew_prefix}}/llvm/lib/c++" - CC: "${{matrix.brew_prefix}}/llvm@16/bin/clang" - CXX: "${{matrix.brew_prefix}}/llvm@16/bin/clang++" - CMAKE_C_COMPILER: "${{matrix.brew_prefix}}/llvm@16/bin/clang" - CMAKE_CXX_COMPILER: "${{matrix.brew_prefix}}/llvm@16/bin/clang++" - CMAKE_C_FLAGS: "-fuse-ld=lld -fno-exceptions ${{matrix.lto_flag}} -fvisibility=hidden -fvisibility-inlines-hidden -O3 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -faddrsig " - CMAKE_CXX_FLAGS: "-fuse-ld=lld -I${{matrix.brew_prefix}}/llvm/include -fno-exceptions ${{matrix.lto_flag}} -fvisibility=hidden -fvisibility-inlines-hidden -O3 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -faddrsig -fno-c++-static-destructors " - CMAKE_OSX_DEPLOYMENT_TARGET: "12.0" + CC: "${{matrix.brew_prefix}}/llvm@${{env.LLVM_VERSION}}/bin/clang" + CXX: "${{matrix.brew_prefix}}/llvm@${{env.LLVM_VERSION}}/bin/clang++" + RANLIB: "${{matrix.brew_prefix}}/llvm@${{env.LLVM_VERSION}}/bin/ranlib" + AR: "${{matrix.brew_prefix}}/llvm@${{env.LLVM_VERSION}}/bin/llvm-ar" + CMAKE_C_COMPILER: "${{matrix.brew_prefix}}/llvm@${{env.LLVM_VERSION}}/bin/clang" + CMAKE_CXX_COMPILER: "${{matrix.brew_prefix}}/llvm@${{env.LLVM_VERSION}}/bin/clang++" + CMAKE_C_FLAGS: " -fno-exceptions ${{matrix.lto_flag}} -fvisibility=hidden -fvisibility-inlines-hidden -O3 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -faddrsig " + CMAKE_CXX_FLAGS: " -I${{matrix.brew_prefix}}/llvm/include -fno-exceptions ${{matrix.lto_flag}} -fvisibility=hidden -fvisibility-inlines-hidden -O3 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -faddrsig -fno-c++-static-destructors " + CMAKE_OSX_DEPLOYMENT_TARGET: "13.0" CMAKE_BUILD_TYPE: ${{matrix.CMAKE_BUILD_TYPE}} PACKAGE_JSON_ARCH: ${{matrix.package_json_arch}} PACKAGE_JSON_LABEL: ${{matrix.label}} diff --git a/mac-release.bash b/mac-release.bash index 3a41ec41c20ab..9dbd980c8e6b0 100644 --- a/mac-release.bash +++ b/mac-release.bash @@ -16,6 +16,9 @@ CMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS:-} CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Release} RUNNER_TEMP=${RUNNER_TEMP:-/tmp} PACKAGE_JSON_LABEL=${PACKAGE_JSON_LABEL:-bun-webkit-$CMAKE_BUILD_TYPE} +AR=${AR:-llvm-ar} +RANLIB=${RANLIB:-llvm-ranlib} +CMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET:-13.0} rm -rf $RUNNER_TEMP/webkit-release $RUNNER_TEMP/bun-webkit $RUNNER_TEMP/bun-webkit $RUNNER_TEMP/bun-webkit.tar.gz mkdir -p $RUNNER_TEMP/webkit-release @@ -34,11 +37,11 @@ cmake \ -DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS" \ -DUSE_BUN_JSC_ADDITIONS=ON \ -DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld" \ - -DCMAKE_AR=$(which llvm-ar) \ - -DCMAKE_RANLIB=$(which llvm-ranlib) \ + -DCMAKE_AR="$AR" \ + -DCMAKE_RANLIB="$RANLIB" \ -DALLOW_LINE_AND_COLUMN_NUMBER_IN_BUILTINS=ON \ -G Ninja \ - -DCMAKE_OSX_DEPLOYMENT_TARGET=12.0 \ + -DCMAKE_OSX_DEPLOYMENT_TARGET=$CMAKE_OSX_DEPLOYMENT_TARGET \ -DPTHREAD_JIT_PERMISSIONS_API=1 \ -DUSE_PTHREAD_JIT_PERMISSIONS_API=ON \ -DENABLE_REMOTE_INSPECTOR=ON \