mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-04-25 02:27:58 +00:00
Build LLVM for Windows (#248)
This PR changes the CI build scripts to also build LLVM for windows. **It doesn't build `revive` itself for windows**. This will come in a follow up. But once we have a LLVM binary release the turn around time will be much quicker for experimenting with the revive windows build. I manually uploaded the release those changes produce [here](https://github.com/paritytech/revive-alex-workflowtest/releases/tag/llvm-18.1.8-revive.22f3ceb). This enables this PR's CI to find the proper release. This is necessary because I am also making changes to the folder structure and artifact naming that the other CI jobs are depending on. Releases generated from this branch can be inspected here: https://github.com/paritytech/revive-alex-workflowtest/releases/tag/v0.1.0-dev.12 Summary of changes: - Change `llvm-builder` to use MSVC toolchain on windows - Fix `llvm-builder` to work with `.exe` files - Unify the llvm release jobs into a single one. This removed a lot of copy pasted code and also speeds up the build by giving each their own runner. - Use the LLVM target triple to name the binary releases instead of an ad-hoc naming convention - Remove the nested folder hierarchy inside the llvm release. Its just now a single folder `llvm-<target>` that contains the toolchain. - Give jobs and workflows consistent names - Replace all runners bei their `*-latest` counterpart - Only use `parity-large` to build llvm now. All other jobs use github runners
This commit is contained in:
committed by
GitHub
parent
93788e72e9
commit
2fb8beee62
@@ -1,4 +1,4 @@
|
||||
name: "get emsdk"
|
||||
name: "Get Emscripten SDK"
|
||||
inputs:
|
||||
version:
|
||||
description: ""
|
||||
@@ -9,7 +9,6 @@ inputs:
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
|
||||
- name: install emsdk
|
||||
shell: bash
|
||||
run: |
|
||||
@@ -17,4 +16,4 @@ runs:
|
||||
cd emsdk
|
||||
git checkout tags/${{ inputs.version }}
|
||||
./emsdk install ${{ inputs.version }}
|
||||
./emsdk activate ${{ inputs.version }}
|
||||
./emsdk activate ${{ inputs.version }}
|
||||
|
||||
@@ -1,29 +1,12 @@
|
||||
# example:
|
||||
#
|
||||
# - name: get llvm
|
||||
# uses: ./.github/actions/get-llvm
|
||||
# - uses: ./.github/actions/get-llvm
|
||||
# with:
|
||||
# releasePrefix: llvm-
|
||||
# artifactArch: macos-arm64
|
||||
# dir: target-llvm/macos
|
||||
# target: x86_64-unknown-linux-gnu
|
||||
|
||||
name: "get llvm"
|
||||
name: "Download LLVM"
|
||||
inputs:
|
||||
artifactArch:
|
||||
target:
|
||||
required: true
|
||||
releasePrefix:
|
||||
description: "LLVM release tag prefix to search"
|
||||
required: false
|
||||
default: "llvm-"
|
||||
dir:
|
||||
description: "Archive extract path (`tar -C`)"
|
||||
required: false
|
||||
default: "./"
|
||||
stripComponents:
|
||||
description: "Strip UMBER leading components from file names on extraction (`tar --strip-components`)"
|
||||
required: false
|
||||
default: 0
|
||||
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
@@ -32,16 +15,15 @@ runs:
|
||||
id: find
|
||||
uses: actions/github-script@v7
|
||||
env:
|
||||
releasePrefix: ${{ inputs.releasePrefix }}
|
||||
artifactArch: ${{ inputs.artifactArch }}
|
||||
target: ${{ inputs.target }}
|
||||
with:
|
||||
result-encoding: string
|
||||
script: |
|
||||
let page = 1;
|
||||
let releases = [];
|
||||
|
||||
let releasePrefix = process.env.releasePrefix
|
||||
let artifactArch = process.env.artifactArch
|
||||
let releasePrefix = "llvm-"
|
||||
let target = process.env.target
|
||||
|
||||
do {
|
||||
const res = await github.rest.repos.listReleases({
|
||||
@@ -61,10 +43,10 @@ runs:
|
||||
});
|
||||
if (llvmLatestRelease){
|
||||
let asset = llvmLatestRelease.assets.find(asset =>{
|
||||
return asset.name.includes(artifactArch);
|
||||
return asset.name.includes(target);
|
||||
});
|
||||
if (!asset){
|
||||
core.setFailed(`Artifact for '${artifactArch}' not found in release ${llvmLatestRelease.tag_name} (${llvmLatestRelease.html_url})`);
|
||||
core.setFailed(`Artifact for '${target}' not found in release ${llvmLatestRelease.tag_name} (${llvmLatestRelease.html_url})`);
|
||||
process.exit();
|
||||
}
|
||||
return asset.browser_download_url;
|
||||
@@ -79,13 +61,10 @@ runs:
|
||||
- name: download
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p ${{ inputs.dir }}
|
||||
curl -sSLo llvm.tar.gz ${{ steps.find.outputs.result }}
|
||||
ls -al
|
||||
|
||||
- name: unpack
|
||||
shell: bash
|
||||
run: |
|
||||
tar -xf llvm.tar.gz -C ${{ inputs.dir }} --strip-components=${{ inputs.stripComponents }}
|
||||
tar -xf llvm.tar.gz
|
||||
rm llvm.tar.gz
|
||||
ls -al ${{ inputs.dir }}
|
||||
@@ -0,0 +1,31 @@
|
||||
name: "Install Solidity Compiler"
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Put Solc Direcotry into PATH
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p solc
|
||||
echo "$(pwd)/solc/" >> $GITHUB_PATH
|
||||
|
||||
- name: Figure out Solc Download URL
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ "${{ runner.os }}" == "Linux" ]]; then
|
||||
echo "SOLC_NAME=solc-static-linux" >> $GITHUB_ENV
|
||||
elif [[ "${{ runner.os }}" == "Windows" ]]; then
|
||||
echo "SOLC_NAME=solc-windows.exe" >> $GITHUB_ENV
|
||||
else
|
||||
echo "SOLC_NAME=solc-macos" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Download Solc
|
||||
shell: bash
|
||||
run: |
|
||||
curl -sSL --output solc/solc https://github.com/ethereum/solidity/releases/download/v0.8.28/${SOLC_NAME}
|
||||
|
||||
- name: Make Solc Executable
|
||||
shell: bash
|
||||
run: |
|
||||
chmod +x solc/solc
|
||||
@@ -1,5 +1,4 @@
|
||||
name: Release LLVM
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
@@ -9,15 +8,15 @@ on:
|
||||
description: llvm version in "x.x.x" format, e.g. "18.1.8"
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
create-release:
|
||||
runs-on: ubuntu-latest
|
||||
create-release-draft:
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
contents: write
|
||||
outputs:
|
||||
@@ -27,145 +26,107 @@ jobs:
|
||||
run: |
|
||||
echo "version=llvm-${{ inputs.llvm_version }}-revive.${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: create release
|
||||
- name: Create Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
name: "LLVM binaries release: ${{ steps.resolve-version.outputs.version }}"
|
||||
body: "This release includes binaries of LLVM, used to compile revive itself"
|
||||
make_latest: "false"
|
||||
name: ${{ steps.resolve-version.outputs.version }}
|
||||
body: "LLVM is a dependency of revive. The LLVM releases are used by our CI to build revive."
|
||||
draft: true
|
||||
tag_name: ${{ steps.resolve-version.outputs.version }}
|
||||
|
||||
build-macos:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [macos-14, macos-13]
|
||||
target: [x86_64-unknown-linux-gnu, x86_64-unknown-linux-musl, wasm32-unknown-emscripten, aarch64-apple-darwin, x86_64-apple-darwin, x86_64-pc-windows-msvc]
|
||||
include:
|
||||
- os: macos-13
|
||||
arch: x64
|
||||
- os: macos-14
|
||||
arch: arm64
|
||||
needs: create-release
|
||||
runs-on: ${{ matrix.os }}
|
||||
name: "build-macos-${{ matrix.arch }}"
|
||||
- target: x86_64-unknown-linux-gnu
|
||||
builder-arg: gnu
|
||||
host: linux
|
||||
runner: parity-large
|
||||
- target: x86_64-unknown-linux-musl
|
||||
builder-arg: musl
|
||||
host: linux
|
||||
runner: parity-large
|
||||
- target: wasm32-unknown-emscripten
|
||||
builder-arg: emscripten
|
||||
host: linux
|
||||
runner: parity-large
|
||||
- target: aarch64-apple-darwin
|
||||
builder-arg: gnu
|
||||
host: macos
|
||||
runner: macos-14
|
||||
- target: x86_64-apple-darwin
|
||||
builder-arg: gnu
|
||||
host: macos
|
||||
runner: macos-13
|
||||
- target: x86_64-pc-windows-msvc
|
||||
builder-arg: gnu
|
||||
host: windows
|
||||
runner: windows-2022
|
||||
needs: create-release-draft
|
||||
runs-on: ${{ matrix.runner }}
|
||||
env:
|
||||
RUST_LOG: trace
|
||||
permissions:
|
||||
contents: write # for uploading assets to release
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: install macos deps
|
||||
run: |
|
||||
brew install ninja
|
||||
|
||||
- name: versions
|
||||
run: |
|
||||
rustup show
|
||||
cargo --version
|
||||
cmake --version
|
||||
echo "bash:" && bash --version
|
||||
echo "ninja:" && ninja --version
|
||||
echo "clang:" && clang --version
|
||||
|
||||
- name: Build LLVM
|
||||
run: |
|
||||
make install-llvm
|
||||
|
||||
- name: clean
|
||||
# check removed files
|
||||
run: |
|
||||
cd target-llvm/gnu/target-final/bin/
|
||||
rm diagtool llvm-libtool-darwin llvm-lipo llvm-pdbutil llvm-dwarfdump llvm-nm llvm-readobj llvm-cfi-verify \
|
||||
sancov llvm-debuginfo-analyzer llvm-objdump llvm-profgen llvm-extract llvm-jitlink llvm-c-test llvm-gsymutil llvm-dwp \
|
||||
dsymutil llvm-dwarfutil llvm-exegesis lli clang-rename bugpoint clang-extdef-mapping clang-refactor c-index-test \
|
||||
llvm-reduce llvm-lto clang-linker-wrapper llc llvm-lto2
|
||||
|
||||
- name: package artifacts
|
||||
run: |
|
||||
tar -czf "${{ needs.create-release.outputs.version }}-macos-${{ matrix.arch }}.tar.gz" target-llvm/gnu/target-final
|
||||
|
||||
- name: upload archive to release
|
||||
uses: softprops/action-gh-release@v2
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
make_latest: "false"
|
||||
tag_name: ${{ needs.create-release.outputs.version }}
|
||||
files: |
|
||||
${{ needs.create-release.outputs.version }}-macos-${{ matrix.arch }}.tar.gz
|
||||
# without this it will override our rust flags
|
||||
rustflags: ""
|
||||
cache-key: ${{ matrix.target }}
|
||||
|
||||
|
||||
build-linux-all:
|
||||
needs: create-release
|
||||
runs-on: parity-large
|
||||
env:
|
||||
RUST_LOG: trace
|
||||
permissions:
|
||||
contents: write # for uploading assets to release
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: install linux deps
|
||||
- name: Install Dependencies
|
||||
if: ${{ matrix.host == 'linux' }}
|
||||
run: |
|
||||
sudo apt-get update && sudo apt-get install -y cmake ninja-build curl git libssl-dev pkg-config clang lld musl
|
||||
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
components: rust-src
|
||||
target: wasm32-unknown-emscripten
|
||||
rustflags: ""
|
||||
|
||||
- name: versions
|
||||
- name: Install Dependencies
|
||||
if: ${{ matrix.host == 'macos' }}
|
||||
run: |
|
||||
rustup show
|
||||
cargo --version
|
||||
cmake --version
|
||||
echo "bash:" && bash --version
|
||||
echo "ninja:" && ninja --version
|
||||
echo "clang:" && clang --version
|
||||
brew install ninja
|
||||
|
||||
- name: Build host LLVM
|
||||
- name: Install LLVM Builder
|
||||
run: |
|
||||
make install-llvm
|
||||
cargo install --path crates/llvm-builder
|
||||
|
||||
- name: Build gnu LLVM
|
||||
- name: Clone LLVM
|
||||
run: |
|
||||
revive-llvm clone
|
||||
revive-llvm build --llvm-projects lld --llvm-projects clang
|
||||
revive-llvm --target-env ${{ matrix.builder-arg }} clone
|
||||
|
||||
- name: Build musl LLVM
|
||||
- name: Build LLVM
|
||||
if: ${{ matrix.target != 'wasm32-unknown-emscripten' }}
|
||||
run: |
|
||||
revive-llvm --target-env musl build --llvm-projects lld --llvm-projects clang
|
||||
revive-llvm --target-env ${{ matrix.builder-arg }} build --llvm-projects lld --llvm-projects clang
|
||||
|
||||
- name: Build emscripten LLVM
|
||||
- name: Build LLVM
|
||||
if: ${{ matrix.target == 'wasm32-unknown-emscripten' }}
|
||||
run: |
|
||||
revive-llvm --target-env emscripten clone
|
||||
source emsdk/emsdk_env.sh
|
||||
revive-llvm --target-env emscripten build --llvm-projects lld
|
||||
revive-llvm --target-env ${{ matrix.builder-arg }} build --llvm-projects lld
|
||||
|
||||
- name: clean
|
||||
# check removed files
|
||||
- name: Remove Unnecessary Binaries
|
||||
shell: bash
|
||||
run: |
|
||||
for target in gnu emscripten musl; do
|
||||
cd target-llvm/${target}/target-final/bin/
|
||||
rm -rf diagtool llvm-libtool-darwin llvm-lipo llvm-pdbutil llvm-dwarfdump llvm-nm llvm-readobj llvm-cfi-verify \
|
||||
sancov llvm-debuginfo-analyzer llvm-objdump llvm-profgen llvm-extract llvm-jitlink llvm-c-test llvm-gsymutil llvm-dwp \
|
||||
dsymutil llvm-dwarfutil llvm-exegesis lli clang-rename bugpoint clang-extdef-mapping clang-refactor c-index-test \
|
||||
llvm-reduce llvm-lto clang-linker-wrapper llc llvm-lto2 llvm-otool llvm-readelf
|
||||
cd -
|
||||
done
|
||||
cd target-llvm/${{ matrix.builder-arg }}/target-final/bin/
|
||||
rm -f diagtool* llvm-libtool-darwin* llvm-lipo* llvm-pdbutil* llvm-dwarfdump* llvm-nm* llvm-readobj* llvm-cfi-verify* \
|
||||
sancov* llvm-debuginfo-analyzer* llvm-objdump* llvm-profgen* llvm-extract* llvm-jitlink* llvm-c-test* llvm-gsymutil* llvm-dwp* \
|
||||
dsymutil* llvm-dwarfutil* llvm-exegesis* lli clang-rename* bugpoint* clang-extdef-mapping* clang-refactor* c-index-test* \
|
||||
llvm-reduce* llvm-lto* clang-linker-wrapper* llc* llvm-lto2* llvm-otool* llvm-readelf* \
|
||||
clang-repl* clang-check* clang-scan-deps*
|
||||
cd -
|
||||
|
||||
- name: package artifacts
|
||||
- name: Package Artifact
|
||||
shell: bash
|
||||
run: |
|
||||
tar -czf "${{ needs.create-release.outputs.version }}-x86_64-linux-gnu-linux.tar.gz" target-llvm/gnu/target-final
|
||||
tar -czf "${{ needs.create-release.outputs.version }}-x86_64-linux-musl.tar.gz" target-llvm/musl/target-final
|
||||
tar -czf "${{ needs.create-release.outputs.version }}-wasm32-unknown-emscripten.tar.gz" target-llvm/emscripten/target-final
|
||||
mv target-llvm/${{ matrix.builder-arg }}/target-final/ llvm-${{ matrix.target }}
|
||||
tar -czf "${{ needs.create-release-draft.outputs.version }}-${{ matrix.target }}.tar.gz" llvm-${{ matrix.target }}
|
||||
|
||||
- name: upload archive to release
|
||||
- name: Add Artifact to Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
make_latest: "false"
|
||||
tag_name: ${{ needs.create-release.outputs.version }}
|
||||
tag_name: ${{ needs.create-release-draft.outputs.version }}
|
||||
draft: true
|
||||
files: |
|
||||
${{ needs.create-release.outputs.version }}-x86_64-linux-gnu-linux.tar.gz
|
||||
${{ needs.create-release.outputs.version }}-x86_64-linux-musl.tar.gz
|
||||
${{ needs.create-release.outputs.version }}-wasm32-unknown-emscripten.tar.gz
|
||||
${{ needs.create-release-draft.outputs.version }}-${{ matrix.target }}.tar.gz
|
||||
|
||||
+104
-189
@@ -1,23 +1,22 @@
|
||||
name: Release
|
||||
run-name: Release ${{ github.ref_name }}
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "main"
|
||||
branches: ["main"]
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened, ready_for_review, labeled]
|
||||
branches: ["main"]
|
||||
types: [opened, synchronize, labled, unlabled]
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
#rust-musl-cross:x86_64-musl
|
||||
CARGO_TERM_COLOR: always
|
||||
RUST_MUSL_CROSS_IMAGE: messense/rust-musl-cross@sha256:68b86bc7cb2867259e6b233415a665ff4469c28b57763e78c3bfea1c68091561
|
||||
RUST_LOG: trace
|
||||
|
||||
jobs:
|
||||
tag:
|
||||
check-version-changed:
|
||||
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'release-test')
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
@@ -27,13 +26,11 @@ jobs:
|
||||
PKG_VER: ${{ steps.versions.outputs.PKG_VER }}
|
||||
RELEASE_NOTES: ${{ steps.versions.outputs.RELEASE_NOTES }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-tags: "true"
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
|
||||
- name: Versions
|
||||
- name: Check Versions
|
||||
id: versions
|
||||
run: |
|
||||
export CURRENT_TAG=$(git describe --tags --abbrev=0 --exclude "llvm-*")
|
||||
@@ -62,190 +59,112 @@ jobs:
|
||||
echo "$RELEASE_NOTES" >> $GITHUB_OUTPUT
|
||||
echo 'EOF' >> $GITHUB_OUTPUT
|
||||
|
||||
build-macos:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [macos-14, macos-13]
|
||||
target: [x86_64-unknown-linux-musl, aarch64-apple-darwin, x86_64-apple-darwin]
|
||||
include:
|
||||
- os: macos-13
|
||||
arch: x64
|
||||
- os: macos-14
|
||||
arch: arm64
|
||||
if: ${{ needs.tag.outputs.TAG == 'new' }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
name: build-macos
|
||||
needs: [tag]
|
||||
- target: x86_64-unknown-linux-musl
|
||||
type: musl
|
||||
runner: ubuntu-24.04
|
||||
- target: aarch64-apple-darwin
|
||||
type: native
|
||||
runner: macos-14
|
||||
- target: x86_64-apple-darwin
|
||||
type: native
|
||||
runner: macos-13
|
||||
if: ${{ needs.check-version-changed.outputs.TAG == 'new' }}
|
||||
runs-on: ${{ matrix.runner }}
|
||||
needs: [check-version-changed]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: get llvm
|
||||
uses: ./.github/actions/get-llvm
|
||||
with:
|
||||
releasePrefix: llvm-
|
||||
artifactArch: macos-${{ matrix.arch }}
|
||||
dir: ./
|
||||
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
components: rust-src
|
||||
target: wasm32-unknown-emscripten
|
||||
# without this it will override our rust flags
|
||||
rustflags: ""
|
||||
cache-key: ${{ matrix.target }}
|
||||
|
||||
- name: install macos deps
|
||||
run: |
|
||||
brew install ninja
|
||||
- name: Download LLVM
|
||||
uses: ./.github/actions/get-llvm
|
||||
with:
|
||||
target: ${{ matrix.target }}
|
||||
|
||||
- name: versions
|
||||
- name: Build
|
||||
if: ${{ matrix.type == 'native' }}
|
||||
run: |
|
||||
rustup show
|
||||
cargo --version
|
||||
cmake --version
|
||||
echo "bash:" && bash --version
|
||||
echo "ninja:" && ninja --version
|
||||
echo "clang:" && clang --version
|
||||
|
||||
- name: build revive
|
||||
run: |
|
||||
export LLVM_SYS_181_PREFIX=$PWD/target-llvm/gnu/target-final
|
||||
export LLVM_SYS_181_PREFIX=$PWD/llvm-${{ matrix.target }}
|
||||
make install-bin
|
||||
cp ./target/release/resolc ./target/release/resolc-${{ matrix.arch }}
|
||||
mv target/release/resolc resolc-${{ matrix.target }}
|
||||
|
||||
- name: check revive
|
||||
- name: Build
|
||||
if: ${{ matrix.type == 'musl' }}
|
||||
run: |
|
||||
mkdir solc
|
||||
curl -sSLo solc/solc https://github.com/ethereum/solidity/releases/download/v0.8.28/solc-macos
|
||||
chmod +x solc/solc
|
||||
PATH=$PWD/solc:$PATH
|
||||
result=$(./target/release/resolc-${{ matrix.arch }} --bin crates/integration/contracts/flipper.sol)
|
||||
echo $result
|
||||
if [[ $result == *'0x50564d'* ]]; then exit 0; else exit 1; fi
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: "revive-macos-${{ matrix.arch }}"
|
||||
path: |
|
||||
./target/release/resolc-${{ matrix.arch }}
|
||||
retention-days: 1
|
||||
|
||||
macos-universal-binary:
|
||||
runs-on: macos-14
|
||||
needs: [build-macos]
|
||||
steps:
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: revive-macos-*
|
||||
path: revive-macos
|
||||
|
||||
- name: run lipo
|
||||
run: |
|
||||
lipo revive-macos/revive-macos-arm64/resolc-arm64 revive-macos/revive-macos-x64/resolc-x64 -create -output resolc-macos
|
||||
chmod +x resolc-macos
|
||||
|
||||
- name: compress macos artifact
|
||||
run: |
|
||||
tar -czf resolc-macos.tar.gz ./resolc-macos
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: resolc-macos.tar.gz
|
||||
path: |
|
||||
resolc-macos.tar.gz
|
||||
retention-days: 1
|
||||
|
||||
build-linux-all:
|
||||
if: ${{ needs.tag.outputs.TAG == 'new' }}
|
||||
runs-on: parity-large
|
||||
needs: [tag]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: install linux deps
|
||||
run: |
|
||||
sudo apt-get update && sudo apt-get install -y cmake ninja-build \
|
||||
curl git libssl-dev pkg-config clang lld musl
|
||||
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
components: rust-src
|
||||
target: wasm32-unknown-emscripten
|
||||
rustflags: ""
|
||||
|
||||
- name: versions
|
||||
run: |
|
||||
rustup show
|
||||
cargo --version
|
||||
cmake --version
|
||||
echo "bash:" && bash --version
|
||||
echo "ninja:" && ninja --version
|
||||
echo "clang:" && clang --version
|
||||
|
||||
- name: get llvm musl
|
||||
uses: ./.github/actions/get-llvm
|
||||
with:
|
||||
releasePrefix: llvm-
|
||||
artifactArch: x86_64-linux-musl
|
||||
dir: ./
|
||||
|
||||
# Build revive
|
||||
|
||||
- name: build musl
|
||||
run: |
|
||||
mkdir resolc-out
|
||||
docker run -v $PWD:/opt/revive $RUST_MUSL_CROSS_IMAGE /bin/bash -c "
|
||||
cd /opt/revive
|
||||
chown -R root:root .
|
||||
apt update && apt upgrade -y && apt install -y pkg-config
|
||||
export LLVM_SYS_181_PREFIX=/opt/revive/target-llvm/musl/target-final
|
||||
export LLVM_SYS_181_PREFIX=/opt/revive/llvm-${{ matrix.target }}
|
||||
make install-bin
|
||||
cp /root/.cargo/bin/resolc /opt/revive/resolc-out/resolc-static-linux
|
||||
mv target/${{ matrix.target }}/release/resolc resolc-${{ matrix.target }}
|
||||
"
|
||||
sudo chown -R $(id -u):$(id -g) .
|
||||
|
||||
- name: check musl
|
||||
- name: Install Solc
|
||||
uses: ./.github/actions/get-solc
|
||||
|
||||
- name: Basic Sanity Check
|
||||
run: |
|
||||
mkdir solc
|
||||
curl -sSLo solc/solc https://github.com/ethereum/solidity/releases/download/v0.8.28/solc-static-linux
|
||||
chmod +x solc/solc
|
||||
PATH=$PWD/solc:$PATH
|
||||
result=$(./resolc-out/resolc-static-linux --bin crates/integration/contracts/flipper.sol)
|
||||
result=$(./resolc-${{ matrix.target }} --bin crates/integration/contracts/flipper.sol)
|
||||
echo $result
|
||||
if [[ $result == *'0x50564d'* ]]; then exit 0; else exit 1; fi
|
||||
|
||||
- name: compress musl artifact
|
||||
run: |
|
||||
tar -czf $(pwd)/resolc-static-linux.tar.gz -C ./resolc-out resolc-static-linux
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: resolc-static-linux.tar.gz
|
||||
path: |
|
||||
resolc-static-linux.tar.gz
|
||||
name: resolc-${{ matrix.target }}
|
||||
path: resolc-${{ matrix.target }}
|
||||
retention-days: 1
|
||||
|
||||
build-wasm:
|
||||
if: ${{ needs.check-version-changed.outputs.TAG == 'new' }}
|
||||
runs-on: ubuntu-24.04
|
||||
needs: [check-version-changed]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
target: wasm32-unknown-emscripten
|
||||
# without this it will override our rust flags
|
||||
rustflags: ""
|
||||
|
||||
- name: Download Host LLVM
|
||||
uses: ./.github/actions/get-llvm
|
||||
with:
|
||||
target: x86_64-unknown-linux-gnu
|
||||
|
||||
- name: Download Wasm LLVM
|
||||
uses: ./.github/actions/get-llvm
|
||||
with:
|
||||
target: wasm32-unknown-emscripten
|
||||
|
||||
- name: Download EMSDK
|
||||
uses: ./.github/actions/get-emsdk
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
export LLVM_SYS_181_PREFIX=$PWD/llvm-x86_64-unknown-linux-gnu
|
||||
export REVIVE_LLVM_TARGET_PREFIX=$PWD/llvm-wasm32-unknown-emscripten
|
||||
source emsdk/emsdk_env.sh
|
||||
make install-wasm
|
||||
chmod -x ./target/wasm32-unknown-emscripten/release/resolc.wasm
|
||||
|
||||
- name: Set Up Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: "20"
|
||||
node-version: "20"
|
||||
|
||||
- name: get llvm emscripten
|
||||
uses: ./.github/actions/get-llvm
|
||||
with:
|
||||
artifactArch: emscripten
|
||||
|
||||
- name: install emsdk
|
||||
uses: ./.github/actions/get-emsdk
|
||||
|
||||
- name: build wasm
|
||||
run: |
|
||||
export LLVM_SYS_181_PREFIX=$PWD/target-llvm/musl/target-final
|
||||
export REVIVE_LLVM_TARGET_PREFIX=$PWD/target-llvm/emscripten/target-final
|
||||
source emsdk/emsdk_env.sh
|
||||
rustup target add wasm32-unknown-emscripten
|
||||
make install-wasm
|
||||
chmod -x ./target/wasm32-unknown-emscripten/release/resolc.wasm
|
||||
|
||||
- name: check wasm
|
||||
- name: Basic Sanity Check
|
||||
run: |
|
||||
mkdir -p solc
|
||||
curl -sSLo solc/soljson.js https://github.com/ethereum/solidity/releases/download/v0.8.28/soljson.js
|
||||
node -e "
|
||||
const soljson = require('solc/soljson');
|
||||
@@ -281,44 +200,41 @@ jobs:
|
||||
if(!bytecode.startsWith('50564d')) { process.exit(1); }
|
||||
"
|
||||
|
||||
- name: compress wasm artifact
|
||||
- name: Compress Artifact
|
||||
run: |
|
||||
tar -czf $(pwd)/resolc-wasm.tar.gz -C ./target/wasm32-unknown-emscripten/release/ \
|
||||
tar -czf $(pwd)/resolc-wasm32-unknown-emscripten.tar.gz -C ./target/wasm32-unknown-emscripten/release/ \
|
||||
resolc.js \
|
||||
resolc.wasm \
|
||||
resolc_web.js
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: resolc-wasm.tar.gz
|
||||
path: |
|
||||
resolc-wasm.tar.gz
|
||||
name: resolc-wasm32-unknown-emscripten.tar.gz
|
||||
path: resolc-wasm32-unknown-emscripten.tar.gz
|
||||
retention-days: 1
|
||||
|
||||
create-release:
|
||||
if: github.event_name != 'pull_request'
|
||||
needs: [tag, build-linux-all, macos-universal-binary]
|
||||
runs-on: ubuntu-24.04
|
||||
needs: [check-version-changed, build-wasm]
|
||||
runs-on: macos-14
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Download revive-wasm
|
||||
- name: Download Artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: resolc-wasm.tar.gz
|
||||
path: resolc-wasm/
|
||||
merge-multiple: true
|
||||
|
||||
- name: Download revive-linux
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: resolc-static-linux.tar.gz
|
||||
path: resolc-linux/
|
||||
- name: Create macOS Fat Binary
|
||||
run: |
|
||||
lipo resolc-aarch64-apple-darwin resolc-x86_64-apple-darwin -create -output resolc-universal-apple-darwin
|
||||
|
||||
- name: Download revive-macos
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: resolc-macos.tar.gz
|
||||
path: resolc-macos/
|
||||
- name: Compress Artifacts
|
||||
run: |
|
||||
chmod +x resolc-x86_64-unknown-linux-musl
|
||||
chmod +x resolc-universal-apple-darwin
|
||||
tar -czf resolc-x86_64-unknown-linux-musl.tar.gz resolc-x86_64-unknown-linux-musl
|
||||
tar -czf resolc-universal-apple-darwin.tar.gz resolc-universal-apple-darwin
|
||||
|
||||
- name: create-release
|
||||
uses: softprops/action-gh-release@v2
|
||||
@@ -328,12 +244,11 @@ jobs:
|
||||
|
||||
# Note for macOS Users
|
||||
The macOS binary is unsigned and it needs to be made runnable using `xattr -c resolc-macos`.
|
||||
tag_name: ${{ needs.tag.outputs.PKG_VER }}
|
||||
name: ${{ needs.tag.outputs.PKG_VER }}
|
||||
tag_name: ${{ needs.check-version-changed.outputs.PKG_VER }}
|
||||
name: ${{ needs.check-version-changed.outputs.PKG_VER }}
|
||||
draft: true
|
||||
target_commitish: ${{ github.sha }}
|
||||
files: |
|
||||
./resolc-linux/resolc-static-linux.tar.gz
|
||||
./resolc-macos/resolc-macos.tar.gz
|
||||
./resolc-wasm/resolc-wasm.tar.gz
|
||||
|
||||
resolc-x86_64-unknown-linux-musl.tar.gz
|
||||
resolc-universal-apple-darwin.tar.gz
|
||||
resolc-wasm32-unknown-emscripten.tar.gz
|
||||
|
||||
@@ -1,43 +1,45 @@
|
||||
name: Test LLVM Builder
|
||||
on:
|
||||
pull_request:
|
||||
types: [assigned, opened, synchronize, reopened]
|
||||
branches: ["main"]
|
||||
types: [opened, synchronize]
|
||||
paths:
|
||||
- 'LLVM.lock'
|
||||
- 'crates/llvm-builder/**'
|
||||
- '.github/workflows/revive-llvm-test.yml'
|
||||
- '.github/workflows/test-llvm-builder.yml'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
test:
|
||||
strategy:
|
||||
matrix:
|
||||
runner: [parity-large, macos-14, macos-13]
|
||||
runner: [parity-large, macos-14, windows-2022]
|
||||
runs-on: ${{ matrix.runner }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
# without this it will override our rust flags
|
||||
rustflags: ""
|
||||
cache-key: ${{ matrix.runner }}
|
||||
|
||||
- name: Install apt dependencies
|
||||
- name: Install Dependencies
|
||||
if: matrix.runner == 'parity-large'
|
||||
run: |
|
||||
sudo apt update && sudo apt-get install -y cmake ninja-build curl git libssl-dev pkg-config clang lld musl
|
||||
|
||||
- name: Install macos dependencies
|
||||
if: matrix.runner == 'macos-14' || matrix.runner == 'macos-13'
|
||||
- name: Install Dependencies
|
||||
if: matrix.runner == 'macos-14'
|
||||
run: |
|
||||
brew install ninja
|
||||
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
components: rust-src
|
||||
rustflags: ""
|
||||
|
||||
- run: |
|
||||
rustup show
|
||||
cargo --version
|
||||
cmake --version
|
||||
bash --version
|
||||
|
||||
- name: Test llvm-builder
|
||||
- name: Test
|
||||
run: make test-llvm-builder
|
||||
env:
|
||||
RUST_LOG: trace
|
||||
@@ -1,10 +1,10 @@
|
||||
name: Build revive-wasm
|
||||
name: Test Wasm Version
|
||||
on:
|
||||
push:
|
||||
branches: ["main"]
|
||||
pull_request:
|
||||
branches: ["main"]
|
||||
workflow_dispatch:
|
||||
types: [opened, synchronize]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
@@ -15,48 +15,38 @@ env:
|
||||
REVIVE_WASM_INSTALL_DIR: ${{ github.workspace }}/target/wasm32-unknown-emscripten/release
|
||||
|
||||
jobs:
|
||||
build-revive-wasm:
|
||||
build:
|
||||
runs-on: ubuntu-24.04
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust stable toolchain
|
||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
components: rust-src
|
||||
target: wasm32-unknown-emscripten
|
||||
# without this it will override our rust flags
|
||||
rustflags: ""
|
||||
|
||||
- name: get llvm gnu
|
||||
- name: Download Host LLVM
|
||||
uses: ./.github/actions/get-llvm
|
||||
with:
|
||||
artifactArch: x86_64-linux-gnu
|
||||
- name: get llvm emscripten
|
||||
uses: ./.github/actions/get-llvm
|
||||
with:
|
||||
artifactArch: emscripten
|
||||
target: x86_64-unknown-linux-gnu
|
||||
|
||||
- name: install emsdk
|
||||
- name: Download Wasm LLVM
|
||||
uses: ./.github/actions/get-llvm
|
||||
with:
|
||||
target: wasm32-unknown-emscripten
|
||||
|
||||
- name: Install emsdk
|
||||
uses: ./.github/actions/get-emsdk
|
||||
|
||||
- name: Setup revive environment variables
|
||||
- name: Set LLVM Environment Variables
|
||||
run: |
|
||||
echo "LLVM_SYS_181_PREFIX=$(pwd)/target-llvm/gnu/target-final" >> $GITHUB_ENV
|
||||
echo "REVIVE_LLVM_TARGET_PREFIX=$(pwd)/target-llvm/emscripten/target-final" >> $GITHUB_ENV
|
||||
echo "LLVM_SYS_181_PREFIX=$(pwd)/llvm-x86_64-unknown-linux-gnu" >> $GITHUB_ENV
|
||||
echo "REVIVE_LLVM_TARGET_PREFIX=$(pwd)/llvm-wasm32-unknown-emscripten" >> $GITHUB_ENV
|
||||
|
||||
- run: |
|
||||
rustup show
|
||||
cargo --version
|
||||
rustup +nightly show
|
||||
cargo +nightly --version
|
||||
cmake --version
|
||||
bash --version
|
||||
|
||||
- name: Build revive
|
||||
- name: Build Revive
|
||||
run: |
|
||||
source emsdk/emsdk_env.sh
|
||||
make install-wasm
|
||||
@@ -70,8 +60,8 @@ jobs:
|
||||
${{ env.REVIVE_WASM_INSTALL_DIR }}/resolc_web.js
|
||||
retention-days: 1
|
||||
|
||||
test-revive-wasm:
|
||||
needs: build-revive-wasm
|
||||
test:
|
||||
needs: build
|
||||
strategy:
|
||||
matrix:
|
||||
os: ["ubuntu-24.04", "macos-14", "windows-2022"]
|
||||
@@ -93,7 +83,7 @@ jobs:
|
||||
with:
|
||||
node-version: "20"
|
||||
|
||||
- name: Install packages
|
||||
- name: Install Node Packages
|
||||
run: npm install
|
||||
|
||||
- name: Run Playwright tests
|
||||
@@ -1,10 +1,10 @@
|
||||
name: Build
|
||||
|
||||
name: Test
|
||||
on:
|
||||
push:
|
||||
branches: ["main"]
|
||||
pull_request:
|
||||
branches: ["main"]
|
||||
types: [opened, synchronize]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
@@ -14,27 +14,28 @@ env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
build-ubuntu-x86:
|
||||
test:
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
# without this it will override our rust flags
|
||||
rustflags: ""
|
||||
|
||||
- name: Install solc
|
||||
- name: Install Solc
|
||||
uses: ./.github/actions/get-solc
|
||||
|
||||
- name: Download LLVM
|
||||
uses: ./.github/actions/get-llvm
|
||||
with:
|
||||
target: x86_64-unknown-linux-gnu
|
||||
|
||||
- name: Set LLVM Environment Variables
|
||||
run: |
|
||||
mkdir -p solc
|
||||
curl -sSL --output solc/solc https://github.com/ethereum/solidity/releases/download/v0.8.28/solc-static-linux
|
||||
chmod +x solc/solc
|
||||
echo "$(pwd)/solc/" >> $GITHUB_PATH
|
||||
echo "LLVM_SYS_181_PREFIX=$(pwd)/llvm-x86_64-unknown-linux-gnu" >> $GITHUB_ENV
|
||||
|
||||
- name: Install LLVM
|
||||
run: |
|
||||
curl -sSL --output llvm.tar.xz https://github.com/paritytech/revive/releases/download/v0.1.0-dev.7/clang+llvm-18.1.8-x86_64-linux-gnu-ubuntu-24.04.tar.xz
|
||||
mkdir llvm18
|
||||
tar Jxf llvm.tar.xz -C llvm18/
|
||||
echo "LLVM_SYS_181_PREFIX=$(pwd)/llvm18" >> $GITHUB_ENV
|
||||
|
||||
- name: Install geth
|
||||
- name: Install Geth
|
||||
run: |
|
||||
sudo add-apt-repository -y ppa:ethereum/ethereum
|
||||
sudo apt update
|
||||
@@ -56,9 +57,3 @@ jobs:
|
||||
|
||||
- name: Test CLI
|
||||
run: make test-cli
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ github.job }}-resolc
|
||||
path: ./target/release/resolc
|
||||
retention-days: 1
|
||||
Generated
+1
@@ -8357,6 +8357,7 @@ dependencies = [
|
||||
"serde",
|
||||
"tar",
|
||||
"toml 0.8.20",
|
||||
"which",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -32,6 +32,7 @@ tar = { workspace = true }
|
||||
flate2 = { workspace = true }
|
||||
env_logger = { workspace = true }
|
||||
log = { workspace = true }
|
||||
which = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
assert_cmd = { workspace = true }
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
//! Utilities for compiling the LLVM compiler-rt builtins.
|
||||
|
||||
use crate::utils::path_windows_to_unix as to_unix;
|
||||
use std::{env::consts::EXE_EXTENSION, process::Command};
|
||||
|
||||
/// Static CFLAGS variable passed to the compiler building the compiler-rt builtins.
|
||||
const C_FLAGS: [&str; 6] = [
|
||||
"--target=riscv64",
|
||||
@@ -44,24 +47,31 @@ fn cmake_dynamic_args(
|
||||
|
||||
let mut clang_path = llvm_target_host.to_path_buf();
|
||||
clang_path.push("bin/clang");
|
||||
clang_path.set_extension(EXE_EXTENSION);
|
||||
|
||||
let mut clangxx_path = llvm_target_host.to_path_buf();
|
||||
clangxx_path.push("bin/clang++");
|
||||
clangxx_path.set_extension(EXE_EXTENSION);
|
||||
|
||||
let mut llvm_config_path = llvm_target_host.to_path_buf();
|
||||
llvm_config_path.push("bin/llvm-config");
|
||||
llvm_config_path.set_extension(EXE_EXTENSION);
|
||||
|
||||
let mut ar_path = llvm_target_host.to_path_buf();
|
||||
ar_path.push("bin/llvm-ar");
|
||||
ar_path.set_extension(EXE_EXTENSION);
|
||||
|
||||
let mut nm_path = llvm_target_host.to_path_buf();
|
||||
nm_path.push("bin/llvm-nm");
|
||||
nm_path.set_extension(EXE_EXTENSION);
|
||||
|
||||
let mut ranlib_path = llvm_target_host.to_path_buf();
|
||||
ranlib_path.push("bin/llvm-ranlib");
|
||||
ranlib_path.set_extension(EXE_EXTENSION);
|
||||
|
||||
let mut linker_path = llvm_target_host.to_path_buf();
|
||||
linker_path.push("bin/ld.lld");
|
||||
linker_path.set_extension(EXE_EXTENSION);
|
||||
|
||||
Ok([
|
||||
format!(
|
||||
@@ -76,12 +86,18 @@ fn cmake_dynamic_args(
|
||||
format!("-DCMAKE_C_FLAGS='{}'", C_FLAGS.join(" ")),
|
||||
format!("-DCMAKE_ASM_FLAGS='{}'", C_FLAGS.join(" ")),
|
||||
format!("-DCMAKE_CXX_FLAGS='{}'", C_FLAGS.join(" ")),
|
||||
format!("-DCMAKE_C_COMPILER='{}'", clang_path.to_string_lossy()),
|
||||
format!("-DCMAKE_ASM_COMPILER='{}'", clang_path.to_string_lossy()),
|
||||
format!("-DCMAKE_CXX_COMPILER='{}'", clangxx_path.to_string_lossy()),
|
||||
format!("-DCMAKE_AR='{}'", ar_path.to_string_lossy()),
|
||||
format!("-DCMAKE_NM='{}'", nm_path.to_string_lossy()),
|
||||
format!("-DCMAKE_RANLIB='{}'", ranlib_path.to_string_lossy()),
|
||||
format!(
|
||||
"-DCMAKE_C_COMPILER='{}'",
|
||||
to_unix(clang_path.clone())?.display()
|
||||
),
|
||||
format!("-DCMAKE_ASM_COMPILER='{}'", to_unix(clang_path)?.display()),
|
||||
format!(
|
||||
"-DCMAKE_CXX_COMPILER='{}'",
|
||||
to_unix(clangxx_path)?.display()
|
||||
),
|
||||
format!("-DCMAKE_AR='{}'", to_unix(ar_path)?.display()),
|
||||
format!("-DCMAKE_NM='{}'", to_unix(nm_path)?.display()),
|
||||
format!("-DCMAKE_RANLIB='{}'", to_unix(ranlib_path)?.display()),
|
||||
format!(
|
||||
"-DLLVM_CONFIG_PATH='{}'",
|
||||
llvm_config_path.to_string_lossy()
|
||||
@@ -101,7 +117,13 @@ pub fn build(
|
||||
log::info!("building compiler-rt for rv64emac");
|
||||
|
||||
crate::utils::check_presence("cmake")?;
|
||||
crate::utils::check_presence("ninja")?;
|
||||
|
||||
let generator = if cfg!(target_os = "windows") {
|
||||
"Visual Studio 17 2022"
|
||||
} else {
|
||||
crate::utils::check_presence("ninja")?;
|
||||
"Ninja"
|
||||
};
|
||||
|
||||
let llvm_module_compiler_rt = crate::LLVMPath::llvm_module_compiler_rt()?;
|
||||
let llvm_compiler_rt_build = crate::LLVMPath::llvm_build_compiler_rt()?;
|
||||
@@ -114,7 +136,7 @@ pub fn build(
|
||||
"-B",
|
||||
llvm_compiler_rt_build.to_string_lossy().as_ref(),
|
||||
"-G",
|
||||
"Ninja",
|
||||
generator,
|
||||
])
|
||||
.args(CMAKE_STATIC_ARGS)
|
||||
.args(cmake_dynamic_args(build_type, target_env)?)
|
||||
@@ -131,7 +153,17 @@ pub fn build(
|
||||
"LLVM compiler-rt building cmake",
|
||||
)?;
|
||||
|
||||
crate::utils::ninja(&llvm_compiler_rt_build)?;
|
||||
crate::utils::command(
|
||||
Command::new("cmake").args([
|
||||
"--build",
|
||||
llvm_compiler_rt_build.to_string_lossy().as_ref(),
|
||||
"--target",
|
||||
"install",
|
||||
"--config",
|
||||
build_type.to_string().as_str(),
|
||||
]),
|
||||
"Building",
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ pub fn build(
|
||||
sanitizer,
|
||||
)?;
|
||||
} else if cfg!(target_os = "windows") {
|
||||
platforms::x86_64_windows_gnu::build(
|
||||
platforms::x86_64_windows_msvc::build(
|
||||
build_type,
|
||||
targets,
|
||||
llvm_projects,
|
||||
|
||||
@@ -8,7 +8,7 @@ pub mod wasm32_emscripten;
|
||||
pub mod x86_64_linux_gnu;
|
||||
pub mod x86_64_linux_musl;
|
||||
pub mod x86_64_macos;
|
||||
pub mod x86_64_windows_gnu;
|
||||
pub mod x86_64_windows_msvc;
|
||||
|
||||
use std::str::FromStr;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ use std::path::Path;
|
||||
use std::process::Command;
|
||||
|
||||
/// The build options shared by all platforms.
|
||||
pub const SHARED_BUILD_OPTS: [&str; 19] = [
|
||||
pub const SHARED_BUILD_OPTS: [&str; 21] = [
|
||||
"-DPACKAGE_VENDOR='Parity Technologies'",
|
||||
"-DCMAKE_BUILD_WITH_INSTALL_RPATH=1",
|
||||
"-DLLVM_BUILD_DOCS='Off'",
|
||||
@@ -28,6 +28,8 @@ pub const SHARED_BUILD_OPTS: [&str; 19] = [
|
||||
"-DCMAKE_EXPORT_COMPILE_COMMANDS='On'",
|
||||
"-DPython3_FIND_REGISTRY='LAST'", // Use Python version from $PATH, not from registry
|
||||
"-DBUG_REPORT_URL='https://github.com/paritytech/contract-issues/issues/'",
|
||||
"-DCLANG_ENABLE_ARCMT='Off'",
|
||||
"-DCLANG_ENABLE_STATIC_ANALYZER='Off'",
|
||||
];
|
||||
|
||||
/// The build options shared by all platforms except MUSL.
|
||||
|
||||
+12
-24
@@ -1,7 +1,6 @@
|
||||
//! The revive LLVM amd64 `windows-gnu` builder.
|
||||
|
||||
use std::collections::HashSet;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
|
||||
use crate::build_type::BuildType;
|
||||
@@ -28,10 +27,6 @@ pub fn build(
|
||||
sanitizer: Option<Sanitizer>,
|
||||
) -> anyhow::Result<()> {
|
||||
crate::utils::check_presence("cmake")?;
|
||||
crate::utils::check_presence("clang")?;
|
||||
crate::utils::check_presence("clang++")?;
|
||||
crate::utils::check_presence("lld")?;
|
||||
crate::utils::check_presence("ninja")?;
|
||||
|
||||
let llvm_module_llvm =
|
||||
LLVMPath::llvm_module_llvm().and_then(crate::utils::path_windows_to_unix)?;
|
||||
@@ -48,15 +43,12 @@ pub fn build(
|
||||
"-B",
|
||||
llvm_build_final.to_string_lossy().as_ref(),
|
||||
"-G",
|
||||
"Ninja",
|
||||
"Visual Studio 17 2022",
|
||||
format!(
|
||||
"-DCMAKE_INSTALL_PREFIX='{}'",
|
||||
llvm_target_final.to_string_lossy().as_ref(),
|
||||
)
|
||||
.as_str(),
|
||||
format!("-DCMAKE_BUILD_TYPE='{build_type}'").as_str(),
|
||||
"-DCMAKE_C_COMPILER='clang'",
|
||||
"-DCMAKE_CXX_COMPILER='clang++'",
|
||||
format!(
|
||||
"-DLLVM_TARGETS_TO_BUILD='{}'",
|
||||
targets
|
||||
@@ -75,7 +67,7 @@ pub fn build(
|
||||
.join(";")
|
||||
)
|
||||
.as_str(),
|
||||
"-DLLVM_USE_LINKER='lld'",
|
||||
"-DLLVM_BUILD_LLVM_C_DYLIB=Off",
|
||||
])
|
||||
.args(crate::platforms::shared::shared_build_opts_default_target(
|
||||
default_target,
|
||||
@@ -107,20 +99,16 @@ pub fn build(
|
||||
"LLVM building cmake",
|
||||
)?;
|
||||
|
||||
crate::utils::ninja(llvm_build_final.as_ref())?;
|
||||
|
||||
let libstdcpp_source_path = match std::env::var("LIBSTDCPP_SOURCE_PATH") {
|
||||
Ok(libstdcpp_source_path) => PathBuf::from(libstdcpp_source_path),
|
||||
Err(error) => anyhow::bail!(
|
||||
"The `LIBSTDCPP_SOURCE_PATH` must be set to the path to the libstdc++.a static library: {}", error
|
||||
),
|
||||
};
|
||||
let mut libstdcpp_destination_path = llvm_target_final;
|
||||
libstdcpp_destination_path.push("./lib/libstdc++.a");
|
||||
fs_extra::file::copy(
|
||||
crate::utils::path_windows_to_unix(libstdcpp_source_path)?,
|
||||
crate::utils::path_windows_to_unix(libstdcpp_destination_path)?,
|
||||
&fs_extra::file::CopyOptions::default(),
|
||||
crate::utils::command(
|
||||
Command::new("cmake").args([
|
||||
"--build",
|
||||
llvm_build_final.to_string_lossy().as_ref(),
|
||||
"--target",
|
||||
"install",
|
||||
"--config",
|
||||
build_type.to_string().as_str(),
|
||||
]),
|
||||
"Building with msbuild",
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
@@ -7,6 +7,7 @@ use std::process::Command;
|
||||
use std::process::Stdio;
|
||||
use std::time::Duration;
|
||||
|
||||
use anyhow::Context;
|
||||
use path_slash::PathBufExt;
|
||||
|
||||
/// The LLVM host repository URL.
|
||||
@@ -131,11 +132,8 @@ pub fn path_windows_to_unix<P: AsRef<Path> + PathBufExt>(path: P) -> anyhow::Res
|
||||
|
||||
/// Checks if the tool exists in the system.
|
||||
pub fn check_presence(name: &str) -> anyhow::Result<()> {
|
||||
let description = &format!("checking the `{name}` executable");
|
||||
log::info!("{description}");
|
||||
|
||||
command(Command::new("which").arg(name), description)
|
||||
.map_err(|_| anyhow::anyhow!("Tool `{}` is missing. Please install", name))
|
||||
which::which(name).with_context(|| format!("Tool `{name}` is missing. Please install"))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Identify XCode version using `pkgutil`.
|
||||
|
||||
Reference in New Issue
Block a user