Skip to content
This repository has been archived by the owner on Mar 6, 2023. It is now read-only.

Commit

Permalink
Simplify build process: No more docker; GH Actions instead of CircleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
rleh committed Dec 18, 2020
1 parent 97187a9 commit 5b088d1
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 121 deletions.
77 changes: 0 additions & 77 deletions .circleci/config.yml

This file was deleted.

74 changes: 74 additions & 0 deletions .github/workflows/build-risc-v-gcc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Build RISC-V GCC

on:
push:
workflow_dispatch:

jobs:
build-risc-v-gcc:
runs-on: ubuntu-20.04

steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y autoconf automake autotools-dev curl python3 libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev git
- name: Clone riscv/riscv-gnu-toolchain
run: |
git clone --recursive --jobs 16 --quiet https://github.com/riscv/riscv-gnu-toolchain
- name: Configure
run: |
cd riscv-gnu-toolchain
./configure --prefix=/opt/modm-riscv-gcc --enable-multilib
- name: Build
run: |
cd riscv-gnu-toolchain
make -j8
- name: Compiling test files
run: |
/opt/modm-riscv-gcc/bin/riscv64-unknown-elf-g++ --version
echo "int main() { return 0;}" > main1.cpp
/opt/modm-riscv-gcc/bin/riscv64-unknown-elf-g++ main1.cpp
#- name: Fake toolchain
# run: |
# mkdir -p /opt/riscv-gcc/bin
# cp $(which true) /opt/riscv-gcc/bin/riscv64-unknown-elf-g++

- name: Create tarball
run: |
tar cjf modm-riscv-gcc.tar.bz2 -C /opt modm-riscv-gcc
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: modm-riscv-gcc
path: modm-riscv-gcc.tar.bz2

- name: Create release
if: startsWith(github.ref, 'refs/tags/')
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: RISC-V GCC ${{ github.ref }}
draft: false
prerelease: false

- name: Upload release asset
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./modm-riscv-gcc.tar.bz2
asset_name: modm-riscv-gcc.tar.bz2
asset_content_type: application/x-bzip2
11 changes: 0 additions & 11 deletions Dockerfile

This file was deleted.

38 changes: 5 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Up-to-date RISC-V GNU GCC Toolchain from source

[![CircleCI](https://circleci.com/gh/modm-ext/riscv-gcc.svg?style=svg)](https://circleci.com/gh/modm-ext/riscv-gcc)

## Installation

Download the latest `modm-riscv-gcc.tar.bz2` from [Releases](https://github.com/modm-ext/docker-riscv-gcc/releases)
Download the latest `modm-riscv-gcc.tar.bz2` from [Releases](https://github.com/modm-io/riscv-gcc/releases)
and unpack it to `/opt`:

```sh
Expand All @@ -18,40 +16,14 @@ e.g. by adding the following line to your `~/.bashrc` file:
export PATH="/opt/modm-riscv-gcc/bin:$PATH"
```

## Building locally with Docker

There is a Docker image with all prerequisites for building, created from the `Dockerfile` in this repository.
Pull and start the image from Dockerhub with:

```sh
docker run -it modm/riscv-gcc-prerequisites
```

Or build the image from the local `Dockerfile` and start it:

```sh
docker build --tag riscv-gcc-prerequisites:local .
docker run -it riscv-gcc-prerequisites:local
```

Inside the Docker container get this repository
## Building local

```sh
git clone https://github.com/modm-ext/docker-riscv-gcc.git
```
The build script is written for Ubuntu 20.04.

Run the build.sh script
Just run the build.sh script:

```sh
cd docker-riscv-gcc
time ./build.sh
./build.sh
```

The toolchain will be in `/opt/modm-riscv-gcc`.

## Building in CircleCI

There is a CircleCI job defined in `.circleci/config.yml` which builds the
toolchain using the Docker container. For tagged commits, a Github release
will be created with the toolchain put into a downloadable `.tar.bz2` at
[Releases](https://github.com/modm-ext/docker-riscv-gcc/releases).
5 changes: 5 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/usr/bin/env bash

# Install dependencies
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y autoconf automake autotools-dev curl python3 libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev git

# Get sources
git clone --recursive https://github.com/riscv/riscv-gnu-toolchain
cd riscv-gnu-toolchain
Expand Down

0 comments on commit 5b088d1

Please sign in to comment.