Skip to content

Commit

Permalink
Create x64-mac and x64-win toolchains from prebuilt toolchain with mu…
Browse files Browse the repository at this point in the history
…ltilib copied in
  • Loading branch information
will-v-pi committed Aug 30, 2024
1 parent 7fca792 commit 3ae6617
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
bin/picotool-*-mac.zip
bin/pico-sdk-tools-*-mac.zip
bin/openocd-*-mac.zip
bin/riscv-toolchain-*-mac.zip
bin/riscv-toolchain-*.zip
- name: Add Release Asset
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
Expand All @@ -76,7 +76,7 @@ jobs:
bin/picotool-*-mac.zip
bin/pico-sdk-tools-*-mac.zip
bin/openocd-*-mac.zip
bin/riscv-toolchain-*-mac.zip
bin/riscv-toolchain-*.zip
build_linux:
name: Build Linux
Expand Down
22 changes: 22 additions & 0 deletions build_macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,26 @@ if [[ "$SKIP_RISCV" != 1 ]]; then
pushd "$builddir/riscv-install/"
tar -a -cf "$topd/bin/$filename" *
popd

# Package x64-mac riscv toolchain separately as well
version="14"
echo "Risc-V Toolchain version $version"

filename="riscv-toolchain-${version}-x64-mac.zip"

echo "Saving Risc-V Toolchain package to $filename"
pushd "$builddir/riscv-install-x64-mac/"
tar -a -cf "$topd/bin/$filename" *
popd

# Package x64-win riscv toolchain separately as well
version="14"
echo "Risc-V Toolchain version $version"

filename="riscv-toolchain-${version}-x64-win.zip"

echo "Saving Risc-V Toolchain package to $filename"
pushd "$builddir/riscv-install-x64-win/"
tar -a -cf "$topd/bin/$filename" *
popd
fi
31 changes: 31 additions & 0 deletions packages/macos/riscv/build-riscv-gcc-other.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

set -euo pipefail

URL=$1
SUFFIX=$2

BASEINSTALLDIR="riscv-install"
INSTALLDIR="$BASEINSTALLDIR-$SUFFIX"
rm -rf $INSTALLDIR
mkdir -p $INSTALLDIR

BUILDDIR=$(pwd)

ZIPFILE=$(basename -- "$URL")
FILENAME="${ZIPFILE%.*}"

wget $URL
unzip $ZIPFILE -d $INSTALLDIR
mv $INSTALLDIR/$FILENAME/* $INSTALLDIR
rm -rf $INSTALLDIR/$FILENAME

# Remove existing multilibs
rm -rf $INSTALLDIR/lib/gcc/riscv32-unknown-elf/*/rv32*
rm -rf $INSTALLDIR/lib/gcc/riscv32-unknown-elf/*/rv64*
rm -rf $INSTALLDIR/riscv32-unknown-elf/lib/rv32*
rm -rf $INSTALLDIR/riscv32-unknown-elf/lib/rv64*

# Add new lib
cp -r $BASEINSTALLDIR/lib/gcc/riscv32-unknown-elf/*/rv32* $INSTALLDIR/lib/gcc/riscv32-unknown-elf/*/
cp -r $BASEINSTALLDIR/riscv32-unknown-elf/lib/rv32* $INSTALLDIR/riscv32-unknown-elf/lib/
7 changes: 7 additions & 0 deletions packages/macos/riscv/build-riscv-gcc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,10 @@ cd riscv-gnu-toolchain
./configure --prefix=$BUILDDIR/$INSTALLDIR --with-arch=rv32ima_zicsr_zifencei_zba_zbb_zbs_zbkb_zca_zcb --with-abi=ilp32 --with-multilib-generator="rv32ima_zicsr_zifencei_zba_zbb_zbs_zbkb_zca_zcb-ilp32--;rv32imac_zicsr_zifencei_zba_zbb_zbs_zbkb-ilp32--" --with-gcc-src=$BUILDDIR/gcc
# 4 threads, as 8 threads runs out of memory
make -j4

# Make x64 and Windows toolchains, by copying multilib into existing toolchains
cd ..
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

$SCRIPT_DIR/build-riscv-gcc-other.sh "https://buildbot.embecosm.com/job/riscv32-gcc-macos-release/21/artifact/riscv32-embecosm-macos-gcc13.3.0.zip" "x64-mac"
$SCRIPT_DIR/build-riscv-gcc-other.sh "https://buildbot.embecosm.com/job/riscv32-gcc-win64-release/24/artifact/riscv32-embecosm-win64-gcc13.2.0.zip" "x64-win"

0 comments on commit 3ae6617

Please sign in to comment.