Move env setup outside of build.sh

This commit is contained in:
topjohnwu 2024-06-17 17:24:56 -07:00
parent 1ff1a3ceca
commit dcfd8a060e
3 changed files with 18 additions and 21 deletions

View File

@ -22,7 +22,13 @@ jobs:
python-version: "3.x" python-version: "3.x"
- name: Build toolchain - name: Build toolchain
run: ./build.sh run: |
sudo apt-get -y install cmake ninja-build libzstd-dev binutils-dev
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 17
rm llvm.sh
./build.sh
- name: Upload build artifact - name: Upload build artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
@ -93,6 +99,7 @@ jobs:
- name: Build toolchain - name: Build toolchain
run: | run: |
brew install ninja zstd binutils
./build.sh clone build ./build.sh clone build
mkdir tmp mkdir tmp
tar c out | xz --x86 --lzma2 > tmp/out.x64.tar.xz tar c out | xz --x86 --lzma2 > tmp/out.x64.tar.xz
@ -119,9 +126,8 @@ jobs:
python-version: "3.x" python-version: "3.x"
- name: Build toolchain - name: Build toolchain
env:
SKIP_DIST: 1
run: | run: |
brew install ninja zstd binutils
./build.sh clone build ./build.sh clone build
mkdir tmp mkdir tmp
tar c out | xz > tmp/out.arm64.tar.xz tar c out | xz > tmp/out.arm64.tar.xz

View File

@ -23,30 +23,21 @@ if [ $OS = "darwin" ]; then
NATIVE_TRIPLE="${NATIVE_ARCH}-apple-darwin" NATIVE_TRIPLE="${NATIVE_ARCH}-apple-darwin"
DYN_EXT='dylib' DYN_EXT='dylib'
EXE_FMT='Mach-O' EXE_FMT='Mach-O'
# Hardcode to 16k page to support both x64 and arm64
# export JEMALLOC_SYS_WITH_LG_PAGE=14
command -v ninja >/dev/null || brew install ninja
command -v zstd >/dev/null || brew install zstd
brew install binutils
sed -i '' "s|BREW_PREFIX|$(brew --prefix)|g" config-darwin.toml
else else
NDK_DIRNAME='linux-x86_64' NDK_DIRNAME='linux-x86_64'
TRIPLE="${ARCH}-unknown-linux-gnu" TRIPLE="${ARCH}-unknown-linux-gnu"
NATIVE_TRIPLE="${NATIVE_ARCH}-unknown-linux-gnu" NATIVE_TRIPLE="${NATIVE_ARCH}-unknown-linux-gnu"
DYN_EXT='so' DYN_EXT='so'
EXE_FMT='ELF' EXE_FMT='ELF'
command -v cmake >/dev/null || sudo apt-get -y install cmake
command -v ninja >/dev/null || sudo apt-get -y install ninja-build
command -v clang-12 >/dev/null || sudo apt-get -y install clang-12
command -v lld-12 >/dev/null || sudo apt-get -y install lld-12
dpkg-query -W libzstd-dev >/dev/null 2>&1 || sudo apt-get -y install libzstd-dev
sudo apt-get -y install binutils-dev
fi fi
build() { build() {
if [ $OS = "darwin" ]; then
sed -i '' "s|BREW_PREFIX|$(brew --prefix)|g" config-darwin.toml
# Manually set page size if cross compilation is required (arm64 require 16k page)
# export JEMALLOC_SYS_WITH_LG_PAGE=14
fi
cd rust cd rust
python3 ./x.py --config "../config-${OS}.toml" --host $TRIPLE install python3 ./x.py --config "../config-${OS}.toml" --host $TRIPLE install
cd ../ cd ../

View File

@ -47,6 +47,6 @@ codegen-units = 1
[target.x86_64-unknown-linux-gnu] [target.x86_64-unknown-linux-gnu]
llvm-has-rust-patches = false llvm-has-rust-patches = false
cc = "clang-12" cc = "clang-17"
cxx = "clang++-12" cxx = "clang++-17"
linker = "clang-12" linker = "clang-17"