Skip to content

Commit

Permalink
Add GitHub Actions CI
Browse files Browse the repository at this point in the history
The current approach is to build binutils/GCC/newlib from scratch. Among
the approaches that I tried, it seemed the easiest:

 - Downloading devkitPPC binaries: Tends to fail due to server-side rate-limiting
 - Building devkitPPC from source: Works, but lacks a little-endian libgcc
 - Enabling multilib in devkitPPC's GCC: GCC build fails for some reason
 - This approach: Takes about 10 minutes, but works
  • Loading branch information
neuschaefer committed Nov 4, 2024
1 parent 234890e commit 0d55538
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/build-binutils.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh
# Build powerpc binutils (required for gcc)
set -e

VERSION=2.43.1
MIRROR=https://ftpmirror.gnu.org/gnu
DIR=binutils-$VERSION
TARBALL=$DIR.tar.xz
URL=$MIRROR/binutils/$TARBALL
SHA512SUM=20977ad17729141a2c26d358628f44a0944b84dcfefdec2ba029c2d02f40dfc41cc91c0631044560d2bd6f9a51e1f15846b4b311befbe14f1239f14ff7d57824

BASEDIR=$(pwd)
wget -c $URL -O $TARBALL
echo "$SHA512SUM $TARBALL" | sha512sum -c
tar xf $TARBALL
cd $DIR
./configure --target=powerpc-eabi --prefix=$BASEDIR/toolchain --enable-poison-system-directories
make
make install
20 changes: 20 additions & 0 deletions .github/build-gcc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh
# Build powerpc-none-eabi-gcc and libgcc for LE and BE.
set -e

VERSION=14.2.0
MIRROR=https://ftpmirror.gnu.org/gnu
DIR=gcc-$VERSION
TARBALL=$DIR.tar.xz
URL=$MIRROR/gcc/$DIR/$TARBALL
SHA512SUM=932bdef0cda94bacedf452ab17f103c0cb511ff2cec55e9112fc0328cbf1d803b42595728ea7b200e0a057c03e85626f937012e49a7515bc5dd256b2bf4bc396

BASEDIR=$(pwd)
export PATH="$BASEDIR:$PATH"
wget -c $URL -O $TARBALL
echo "$SHA512SUM $TARBALL" | sha512sum -c
tar xf $TARBALL
mkdir -p $DIR/build; cd $DIR/build
../configure --target=powerpc-eabi --enable-languages=c --disable-shared --disable-threads --disable-libssp --disable-analyzer --enable-poison-system-directories --with-newlib --with-headers=$BASEDIR/newlib-*/newlib/libc/include --prefix=$BASEDIR/toolchain
make
make install
21 changes: 21 additions & 0 deletions .github/build-newlib.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh
# Build powerpc newlib
set -e

VERSION=4.4.0.20231231
MIRROR=https://sourceware.org/pub/
DIR=newlib-$VERSION
TARBALL=$DIR.tar.gz
URL=$MIRROR/newlib/$TARBALL
SHA512SUM=ea3baa0b7c9175aae024f0b7d272be092ef2c07483239a99329203e18a44bc23093d29e0ffcbe14bc591f610f0829eacd646cabb06d1c34aa23239cb1b814b46

BASEDIR=$(pwd)
wget -c $URL -O $TARBALL
echo "$SHA512SUM $TARBALL" | sha512sum -c
tar xf $TARBALL
cd $DIR
if [ "x$EXTRACT_ONLY" = x ]; then
./configure --host=powerpc-eabi --prefix=$BASEDIR/toolchain --disable-newlib-supplied-syscalls
make
make install
fi
51 changes: 51 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Build maciNTosh

on: [ push, pull_request ]

jobs:
build:
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4

- name: Setup build
run: |
echo MAKEFLAGS="-j$(nproc || echo 1)" >> $GITHUB_ENV
- name: build binutils & GCC
run: |
sudo apt-get update && sudo apt-get install -y wget build-essential libmpfr-dev libgmp-dev libmpc-dev
.github/build-binutils.sh
EXTRACT_ONLY=1 .github/build-newlib.sh
.github/build-gcc.sh
.github/build-newlib.sh
make -C gcc-*/build install
echo "DEVKITPPC=$(pwd)/toolchain" >> $GITHUB_ENV
- name: build big endian libc
run: make -C baselibc

- name: build ARC firmware for Mac99 (unin)
run: |
mkdir -p arcunin/build
make -C arcloader_unin
make -C arcunin/baselibc
make -C arcunin
- name: build ARC firmware for Gossamer (grackle)
run: |
mkdir -p arcgrackle/build
make -C arcloader_grackle
make -C arcgrackle/baselibc
make -C arcgrackle
- uses: actions/upload-artifact@v4
with:
path: |
arcloader_*/stage1.elf
arcloader_*/stage1.elf.map
arc*/stage2.elf
arc*/stage2.elf.map
# TODO: create CD images

0 comments on commit 0d55538

Please sign in to comment.