Skip to content

Enable GPC's "WITH_SHARED" as a GCC configure arg --with-gpc-shared o… #103

Enable GPC's "WITH_SHARED" as a GCC configure arg --with-gpc-shared o…

Enable GPC's "WITH_SHARED" as a GCC configure arg --with-gpc-shared o… #103

name: GNU Embedded Toolchain CI
on:
workflow_dispatch:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
BUILD_DEPENDS: make binutils gcc gcc-multilib g++ bison flex libtool gawk gettext texinfo file libisl-dev dejagnu
# If these older source package releases will not build without disabling Fortify and/or run without buffer overflow errors,
# then "make CPPFLAGS=-U_FORTIFY_SOURCE" might be necessary
# Passing that to this older configure might not work, as should otherwise seem doable per
# the link https://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html
CROSS_TARGET: --target=h8300-hitachi-coff
COMMON_CONFIG_ARGS: --prefix=/usr/local/brickbot
COMMON_GCC_CONFIG_ARGS: --with-gcc --with-gnu-as --with-gnu-ld --with-newlib --disable-libssp --disable-multilib --enable-target-optspace
BUILD_DIR_GCC: build/gcc-gpc
BUILD_DIR_GPC: build/gpc
BUILD_DIR_GDB: build/gdb
SYSROOT_DIR: sysroot
GCC_INSTALL_NAME: h8300-coff-gcc_install
TOOLCHAIN_INSTALL_NAME: h8300-coff-toolchain_install
jobs:
build_cross_gcc_gpc_job:
name: Build gcc+binutils+newlib+ada+f77+gcj+objc+gpc cross-compiler for the H8/300
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
steps:
- name: Get latest from version control
uses: actions/checkout@v4
with:
# git-restore-mtime-bare uses the ref log to find the correct timestamp
# for each file. This requires a full git history. The default value (1)
# creates a shallow checkout.
fetch-depth: 0
# Fix timestamps (needed to prevent gcc/c-parse.c from sometimes being regenerated during build)
- name: Restore source timestamps
uses: chetan/git-restore-mtime-action@v2
- name: Update build environment
run: sudo apt-get --assume-yes update
- name: Install build dependencies
run: sudo apt-get --assume-yes install $BUILD_DEPENDS
- name: Setup the build directory for an H8/300 cross-toolchain
run: mkdir -p $BUILD_DIR_GCC
# Run the GCC build steps
- name: Configure the build for a GCC H8/300 cross-compiler
run: |
cd $BUILD_DIR_GCC
echo "Current working directory: $PWD"
../../src-unified/configure --enable-languages=c,c++,ada,f77,java,objc,pascal $CROSS_TARGET $COMMON_GCC_CONFIG_ARGS $COMMON_CONFIG_ARGS
- name: Execute the build for a GCC H8/300 cross-compiler
run: |
cd $BUILD_DIR_GCC
echo "Current working directory: $PWD"
make
- name: Test install the built GCC H8/300 cross-compiler
run: |
cd $BUILD_DIR_GCC
echo "Current working directory: $PWD"
sudo make DESTDIR=$GITHUB_WORKSPACE/$SYSROOT_DIR install
# Before archiving, tar the host installation output to preserve file permission
# c.f. https://github.com/actions/upload-artifact?tab=readme-ov-file#permission-loss
# To avoid including a "." or other unwanted directory, c.f. https://stackoverflow.com/a/39530409
- name: Tar the host installation snapshot to preserve file permissions
run: find $SYSROOT_DIR -printf "%P\n" | sort | tar --verbose --create --file build/${{ env.GCC_INSTALL_NAME }}.tar --no-recursion --directory=$SYSROOT_DIR --files-from=-
- name: Archive the host installation snapshot tar file
uses: actions/upload-artifact@v4
with:
name: ${{ env.GCC_INSTALL_NAME }}_[runner~${{ matrix.os }}]_run${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }}
path: build/${{ env.GCC_INSTALL_NAME }}.tar
- name: Install the built GCC H8/300 cross-compiler
run: |
cd $BUILD_DIR_GCC
echo "Current working directory: $PWD"
sudo make install
# # Run the GPC build steps
# - name: Configure the build for a GPC H8/300 cross-compiler
# run: |
# cd $BUILD_DIR_GCC
# echo "Current working directory: $PWD"
# ../../src-unified/configure --enable-languages=pascal $CROSS_TARGET $COMMON_GCC_CONFIG_ARGS $COMMON_CONFIG_ARGS
#
# - name: Execute the build for a GPC H8/300 cross-compiler
# run: |
# cd $BUILD_DIR_GCC
# echo "Current working directory: $PWD"
# make
#
# - name: Test install the built GPC H8/300 cross-compiler
# run: |
# cd $BUILD_DIR_GCC/gcc
# echo "Current working directory: $PWD"
# sudo make DESTDIR=$GITHUB_WORKSPACE/$SYSROOT_DIR pascal.install
#
# # Before archiving, tar the host installation output to preserve file permission
# # c.f. https://github.com/actions/upload-artifact?tab=readme-ov-file#permission-loss
# # To avoid including a "." or other unwanted directory, c.f. https://stackoverflow.com/a/39530409
# - name: Tar the host installation snapshot to preserve file permissions
# run: find $SYSROOT_DIR -printf "%P\n" | sort | tar --verbose --create --file build/${{ env.TOOLCHAIN_INSTALL_NAME }}.tar --no-recursion --directory=$SYSROOT_DIR --files-from=-
#
# - name: Archive the host installation snapshot tar file
# uses: actions/upload-artifact@v4
# with:
# name: ${{ env.TOOLCHAIN_INSTALL_NAME }}_[runner~${{ matrix.os }}]_run${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }}
# path: build/${{ env.TOOLCHAIN_INSTALL_NAME }}.tar
#
# - name: Install the built GPC H8/300 cross-compiler
# run: |
# cd $BUILD_DIR_GCC/gcc
# echo "Current working directory: $PWD"
# sudo make pascal.install
build_cross_gdb_job:
name: Build GDB for the H8/300
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
steps:
- name: Get latest from version control
uses: actions/checkout@v4
with:
# git-restore-mtime-bare uses the ref log to find the correct timestamp
# for each file. This requires a full git history. The default value (1)
# creates a shallow checkout.
fetch-depth: 0
# Fix timestamps (needed to prevent gcc/c-parse.c from sometimes being regenerated during build)
- name: Restore source timestamps
uses: chetan/git-restore-mtime-action@v2
- name: Update build environment
run: sudo apt-get --assume-yes update
- name: Install build dependencies
run: sudo apt-get --assume-yes install $BUILD_DEPENDS python3-dev autoconf procps libncurses-dev libncurses5-dev libexpat1-dev
- name: Setup the build folders for an H8/300 GDB
run: mkdir -p $BUILD_DIR_GDB
- name: Configure the build for an H8/300 GDB
run: |
cd $BUILD_DIR_GDB
echo "Current working directory: $PWD"
../../src-projects/gdb-7.12.1/configure CXXFLAGS='-D_GLIBCXX_USE_CXX11_ABI=0 -std=c++98' --without-python $CROSS_TARGET $COMMON_CONFIG_ARGS
- name: Execute the build for an H8/300 GDB
run: |
cd $BUILD_DIR_GDB
echo "Current working directory: $PWD"
make
- name: Test install the built H8/300 GDB
run: |
cd $BUILD_DIR_GDB
echo "Current working directory: $PWD"
make DESTDIR=$GITHUB_WORKSPACE/$SYSROOT_DIR install
# Before archiving, tar the host installation output to preserve file permission
# c.f. https://github.com/actions/upload-artifact?tab=readme-ov-file#permission-loss
# To avoid including a "." or other unwanted directory, c.f. https://stackoverflow.com/a/39530409
- name: Tar the host installation snapshot to preserve file permissions
run: find $SYSROOT_DIR -printf "%P\n" | sort | tar --verbose --create --file build/h8300-coff-gdb_install.tar --no-recursion --directory=$SYSROOT_DIR --files-from=-
- name: Archive the host installation snapshot tar file
uses: actions/upload-artifact@v4
with:
name: h8300-coff-gdb_install_[runner~${{ matrix.os }}]_run${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }}
path: build/h8300-coff-gdb_install.tar
build_native_gpc_job:
name: Build a native GPC compiler (non-cross-compiling)
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
steps:
- name: Get latest from version control
uses: actions/checkout@v4
with:
# git-restore-mtime-bare uses the ref log to find the correct timestamp
# for each file. This requires a full git history. The default value (1)
# creates a shallow checkout.
fetch-depth: 0
# Fix timestamps
- name: Restore source timestamps
uses: chetan/git-restore-mtime-action@v2
- name: Update build environment
run: sudo apt-get --assume-yes update
- name: Install build dependencies
run: sudo apt-get --assume-yes install $BUILD_DEPENDS
- name: Setup the build folders for a native gcc+binutils+gpc compiler
run: mkdir -p $BUILD_DIR_GPC
- name: Configure the build for a native gcc+binutils+gpc compiler
run: |
cd $BUILD_DIR_GPC
echo "Current working directory: $PWD"
../../src-unified/configure --enable-languages=c,pascal $COMMON_GCC_CONFIG_ARGS $COMMON_CONFIG_ARGS
- name: Execute the build for a native gcc+binutils+gpc compiler
run: |
cd $BUILD_DIR_GPC
echo "Current working directory: $PWD"
make
- name: Test install the built native gcc+binutils+gpc compiler
run: |
cd $BUILD_DIR_GPC
echo "Current working directory: $PWD"
make DESTDIR=$GITHUB_WORKSPACE/$SYSROOT_DIR install
# Before archiving, tar the host installation output to preserve file permission
# c.f. https://github.com/actions/upload-artifact?tab=readme-ov-file#permission-loss
# To avoid including a "." or other unwanted directory, c.f. https://stackoverflow.com/a/39530409
- name: Tar the host installation snapshot to preserve file permissions
run: find $SYSROOT_DIR -printf "%P\n" | sort | tar --verbose --create --file build/native-gpc_install.tar --no-recursion --directory=$SYSROOT_DIR --files-from=-
- name: Archive the host installation snapshot tar file
uses: actions/upload-artifact@v4
with:
name: native-gpc_install_[runner~${{ matrix.os }}]_run${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }}
path: build/native-gpc_install.tar
- name: Install the built native gcc+binutils+gpc compiler
run: |
cd $BUILD_DIR_GPC
echo "Current working directory: $PWD"
sudo make install