Skip to content

Commit

Permalink
Add script to build GCC toolchain
Browse files Browse the repository at this point in the history
  • Loading branch information
imphil committed Aug 7, 2019
1 parent a8e50f6 commit d11575d
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
42 changes: 42 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Azure Pipelines CI build configuration
# Documentation at https://aka.ms/yaml

variables:
# commit reference in https://github.com/riscv/riscv-gnu-toolchain
RISCV_GNU_TOOLCHAIN_COMMIT_ID: 2e334e222d43bcde237c289385c977dcab81eda9

trigger:
branches:
include:
- master

jobs:
- job: "GCC"
displayName: "RV32 GCC"
pool:
vmImage: "ubuntu-16.04"
steps:
- bash: |
# Dependencies as listed at
# https://github.com/riscv/riscv-gnu-toolchain
sudo apt-get install -y autoconf automake autotools-dev curl \
libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison \
flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev
displayName: 'Install build dependencies'
- bash: |
sudo mkdir /tools/riscv && sudo chmod 777 /tools/riscv
./build-gcc.sh
displayName: 'Build GCC toolchain'
env:
ARTIFACT_STAGING_DIR: $(Build.ArtifactStagingDirectory)
- task: GithubRelease@0
displayName: 'Upload to GitHub releases'
inputs:
gitHubConnection: lowrisc-artifact-upload
repositoryName: lowrisc/lowrisc-toolchains
tagSource: auto
assets: |
$(Build.ArtifactStagingDirectory)/build.log
$(Build.ArtifactStagingDirectory)/*.tar.xz
42 changes: 42 additions & 0 deletions build-gcc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

set -e
set -x

TOP=$PWD

TOOLCHAIN_NAME=lowrisc-toolchain-gcc-rv32imc-$(git -C $TOP describe --always)

mkdir -p build/gcc
cd build/gcc
git clone --recursive https://github.com/riscv/riscv-gnu-toolchain
cd riscv-gnu-toolchain
git checkout $RISCV_GNU_TOOLCHAIN_COMMIT_ID
./configure --prefix=/tools/riscv \
--with-abi=ilp32 \
--with-arch=rv32imc \
--with-cmodel=medany 2>&1 | tee $ARTIFACT_STAGING_DIR/build.log
make -j$(nproc) 2>&1 | tee $ARTIFACT_STAGING_DIR/build.log
# Includes make install

echo 'Version:' >> /tools/riscv/buildinfo
git -C $TOP describe --always >> /tools/riscv/buildinfo
echo >> /tools/riscv/buildinfo

echo 'Version of https://github.com/riscv/riscv-gnu-toolchain:' >> /tools/riscv/buildinfo
git -C $TOP/build/gcc/riscv-gnu-toolchain describe --always >> /tools/riscv/buildinfo
echo >> /tools/riscv/buildinfo

echo 'GCC version:' >> /tools/riscv/buildinfo
/tools/riscv/bin/riscv32-unknown-elf-gcc --version | head -n1 >> /tools/riscv/buildinfo
echo >> /tools/riscv/buildinfo

echo "Built at $(date -u) on $(hostname)" >> /tools/riscv/buildinfo
echo >> /tools/riscv/buildinfo

tar -cJ \
--directory=/tools \
-f $ARTIFACT_STAGING_DIR/$TOOLCHAIN_NAME.tar.xz \
--transform="s@riscv@$TOOLCHAIN_NAME@" \
--owner=0 --group=0 \
riscv

0 comments on commit d11575d

Please sign in to comment.