Skip to content

Commit

Permalink
Rework shell script and CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Kormanyos committed Jan 30, 2024
1 parent 85bea6a commit 5feafd1
Show file tree
Hide file tree
Showing 4 changed files with 160 additions and 116 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/build-msys64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
##############################################################################
# Copyright Christopher Kormanyos 2023 - 2024.
# Distributed under The Unlicense.

name: build-msys64
on:
push:
branches:
- '**'
pull_request:
jobs:
gcc-v850-unknown-elf-build-msys2:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
strategy:
fail-fast: false
matrix:
gccversion: [ 12.3.0, 13.2.0 ]
steps:
- uses: actions/checkout@v4
- name: get-nuwen-mingw
shell: cmd
run: |
C:\msys64\usr\bin\echo.exe get-nuwen-mingw
C:\msys64\usr\bin\wget.exe --no-check-certificate https://nuwen.net/files/mingw/mingw-19.0.exe
- name: unpack-nuwen-mingw
shell: cmd
run: |
C:\msys64\usr\bin\echo.exe unpack-nuwen-mingw
start /b /wait ./mingw-19.0.exe -y -gm2 -InstallPath="D:\\a\\gcc-v850-unknown-elf-build\\gcc-v850-unknown-elf-build\\mingw"
- uses: msys2/setup-msys2@v2
with:
msystem: mingw64
update: true
install: autoconf automake bzip2 cmake git make ninja patch python texinfo wget
- name: gcc-v850-unknown-elf-100
run: |
echo 'gcc-v850-unknown-elf-100.sh'
./gcc-v850-unknown-elf-100.sh ${{ matrix.gccversion }} x86_64-w64-mingw32 x86_64-w64-mingw32 /d/a/gcc-v850-unknown-elf-build/gcc-v850-unknown-elf-build/mingw
- name: gcc-v850-unknown-elf-partially-verify-result
run: |
echo 'gcc-v850-unknown-elf partial verify result'
ls -la /d/a/gcc-v850-unknown-elf-build/gcc-v850-unknown-elf-build/local/gcc-${{ matrix.gccversion }}-v850-unknown-elf/bin
ls -la /d/a/gcc-v850-unknown-elf-build/gcc-v850-unknown-elf-build/local/gcc-${{ matrix.gccversion }}-v850-unknown-elf/bin/v850-unknown-elf-gcc.exe
ls -la /d/a/gcc-v850-unknown-elf-build/gcc-v850-unknown-elf-build/local/gcc-${{ matrix.gccversion }}-v850-unknown-elf/bin/v850-unknown-elf-g++.exe
- uses: actions/upload-artifact@v4
with:
name: gcc-${{ matrix.gccversion }}-avr_x86_64-w64-mingw32
path: d:/a/gcc-v850-unknown-elf-build/gcc-v850-unknown-elf-build/local/gcc-${{ matrix.gccversion }}-v850-unknown-elf
- name: gcc-v850-unknown-elf-test-with-real-time-cpp
run: |
echo "test gcc-v850-unknown-elf with real-time-cpp"
echo "clone ckormanyos/real-time-cpp"
git clone -b master --depth 1 https://github.com/ckormanyos/real-time-cpp.git /d/a/gcc-v850-unknown-elf-build/gcc-v850-unknown-elf-build/real-time-cpp
rm -rf /d/a/gcc-v850-unknown-elf-build/gcc-v850-unknown-elf-build/local/gcc-${{ matrix.branchname }}-v850-unknown-elf/lib/bfd-plugins
cd /d/a/gcc-v850-unknown-elf-build/gcc-v850-unknown-elf-build/real-time-cpp/ref_app
PATH=/d/a/gcc-v850-unknown-elf-build/gcc-v850-unknown-elf-build/local/gcc-${{ matrix.gccversion }}-v850-unknown-elf/bin:"$PATH"
./target/build/build.sh v850es_fx2 rebuild
ls -la bin/ref_app.elf bin/ref_app.hex
ls -la bin/ref_app.map bin/ref_app.s19
ls -la bin/ref_app_cppfilt.txt
ls -la bin/ref_app_nm.txt
ls -la bin/ref_app_readelf.txt
ls -la bin/ref_app_size.txt
57 changes: 57 additions & 0 deletions .github/workflows/build-ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
##############################################################################
# Copyright Christopher Kormanyos 2023 - 2024.
# Distributed under The Unlicense.

name: build-ubuntu
on:
push:
branches:
- '**'
pull_request:
jobs:
gcc-v850-unknown-elf-build-native:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
gccversion: [ 13.2.0 ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: update-build-essentials
run: sudo apt install autoconf texinfo xz-utils
- name: gcc-v850-unknown-elf-100
run: |
echo 'gcc-v850-unknown-elf-100.sh'
./gcc-v850-unknown-elf-100.sh ${{ matrix.gccversion }} x86_64-linux-gnu x86_64-linux-gnu
- name: gcc-v850-unknown-elf-partially-verify-result
run: |
echo 'gcc-v850-unknown-elf partial verify result'
ls -la ${{ runner.workspace }}/gcc-v850-unknown-elf-build/local/gcc-${{ matrix.gccversion }}-v850-unknown-elf/bin
ls -la ${{ runner.workspace }}/gcc-v850-unknown-elf-build/local/gcc-${{ matrix.gccversion }}-v850-unknown-elf/bin/v850-unknown-elf-gcc
ls -la ${{ runner.workspace }}/gcc-v850-unknown-elf-build/local/gcc-${{ matrix.gccversion }}-v850-unknown-elf/bin/v850-unknown-elf-g++
cd ${{ runner.workspace }}/gcc-v850-unknown-elf-build/local
tar -czf gcc-${{ matrix.gccversion }}-v850-unknown-elf.tar.gz gcc-${{ matrix.gccversion }}-v850-unknown-elf
- uses: actions/upload-artifact@v4
with:
name: gcc-${{ matrix.gccversion }}-avr_x86_64-linux-gnu
path: ${{ runner.workspace }}/gcc-v850-unknown-elf-build/local/gcc-${{ matrix.gccversion }}-v850-unknown-elf.tar.gz
retention-days: 3
- name: gcc-v850-unknown-elf-test-with-real-time-cpp
run: |
echo "test gcc-v850-unknown-elf with real-time-cpp"
echo "clone ckormanyos/real-time-cpp"
git clone -b master --depth 1 https://github.com/ckormanyos/real-time-cpp.git ${{ runner.workspace }}/gcc-v850-unknown-elf-build/real-time-cpp
cd ${{ runner.workspace }}/gcc-v850-unknown-elf-build/real-time-cpp/ref_app
PATH=${{ runner.workspace }}/gcc-v850-unknown-elf-build/local/gcc-${{ matrix.gccversion }}-v850-unknown-elf/bin:"$PATH"
./target/build/build.sh v850es_fx2 rebuild
ls -la bin/ref_app.elf bin/ref_app.hex
ls -la bin/ref_app.map bin/ref_app.s19
ls -la bin/ref_app_cppfilt.txt
ls -la bin/ref_app_nm.txt
ls -la bin/ref_app_readelf.txt
ls -la bin/ref_app_size.txt
68 changes: 0 additions & 68 deletions .github/workflows/gcc-v850-unknown-elf-build-msys2.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,42 +1,34 @@
#!/usr/bin/env bash
#
# Copyright Christopher Kormanyos 2023.
# Copyright Christopher Kormanyos 2023 - 2024.
# Distributed under The Unlicense.
#
# Example call:
# ./v850-unknown-elf-gcc-100-my_ver_x86_64-w64-mingw32.sh 13.2.0 /c/mingw
# Example call(s):
# ./gcc-v850-unknown-elf-100.sh 13.2.0 x86_64-linux-gnu x86_64-linux-gnu
# ./gcc-v850-unknown-elf-100.sh 13.2.0 x86_64-w64-mingw32 x86_64-w64-mingw32 /c/mingw
#

SCRIPT_PATH=$(readlink -f "$BASH_SOURCE")
SCRIPT_DIR=$(dirname "$SCRIPT_PATH")

MY_VERSION=$1
OLD_MINGW_PATH=$2
BUILD_NAME=$2
HOST_NAME=$3


if [[ "$BUILD_NAME" == "x86_64-w64-mingw32" ]]; then
# echo 'install necessary packages and build tools'
# pacman -S --needed --noconfirm autoconf automake bzip2 cmake git make ninja patch python texinfo wget

# Get standalone msys2 from nuwen (contains standalone gcc-x86_64-w64-mingw32).
# The page describing this is: https://nuwen.net/mingw.html
# The exact download link is: https://nuwen.net/files/mingw/mingw-19.0.exe

# For detailed background information, see also the detailed instructions
# at GitHub from Stephan T. Lavavej's repositiony.
# These can be found here: https://github.com/StephanTLavavej/mingw-distro


echo 'clean gcc_build directory'
rm -rf gcc_build | true


echo 'make and enter gcc_build directory'
mkdir -p $SCRIPT_DIR/gcc_build
echo


#echo 'copy gcc patch file'
#cd $SCRIPT_DIR/gcc_build
#cp ../v850-unknown-elf-gcc-100-"$MY_VERSION"_x86_64-w64-mingw32.patch .
#echo


OLD_MINGW_PATH=$4
echo 'append standalone gcc-x86_64-w64-mingw32 path'
export X_DISTRO_ROOT="$OLD_MINGW_PATH"
export X_DISTRO_BIN=$X_DISTRO_ROOT/bin
Expand All @@ -46,12 +38,22 @@ export PATH=$PATH:$X_DISTRO_BIN
export C_INCLUDE_PATH=$X_DISTRO_INC
export CPLUS_INCLUDE_PATH=$X_DISTRO_INC
echo
fi


echo 'clean gcc_build directory'
rm -rf gcc_build | true


echo 'make and enter gcc_build directory'
mkdir -p $SCRIPT_DIR/gcc_build
echo


echo 'query version pre-installed standalone gcc-x86_64-w64-mingw32'
echo 'query system gcc'
g++ -v
result_old_distro=$?
echo "result_old_distro: " "$result_old_distro"
result_system_gcc=$?
echo "result_system_gcc: " "$result_system_gcc"
echo


Expand Down Expand Up @@ -86,7 +88,7 @@ echo 'build libiconv'
tar -xf libiconv-1.17.tar.gz
mkdir objdir-libiconv-1.17
cd objdir-libiconv-1.17
../libiconv-1.17/configure --prefix=$SCRIPT_DIR/local/libiconv-1.17 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --enable-static --disable-shared
../libiconv-1.17/configure --prefix=$SCRIPT_DIR/local/libiconv-1.17 --build="$BUILD_NAME" --target="$HOST_NAME" --host="$HOST_NAME" --enable-static --disable-shared
make --jobs=6
make install
echo
Expand All @@ -97,7 +99,7 @@ echo 'build gmp'
tar -xf gmp-6.3.0.tar.xz
mkdir objdir-gmp-6.3.0
cd objdir-gmp-6.3.0
../gmp-6.3.0/configure --prefix=$SCRIPT_DIR/local/gmp-6.3.0 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --enable-static --disable-shared
../gmp-6.3.0/configure --prefix=$SCRIPT_DIR/local/gmp-6.3.0 --build="$BUILD_NAME" --target="$HOST_NAME" --host="$HOST_NAME" --enable-static --disable-shared
make --jobs=6
make install
echo
Expand All @@ -108,7 +110,7 @@ echo 'build mpfr'
tar -xf mpfr-4.2.1.tar.xz
mkdir objdir-mpfr-4.2.1
cd objdir-mpfr-4.2.1
../mpfr-4.2.1/configure --prefix=$SCRIPT_DIR/local/mpfr-4.2.1 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --enable-static --disable-shared --with-gmp=$SCRIPT_DIR/local/gmp-6.3.0
../mpfr-4.2.1/configure --prefix=$SCRIPT_DIR/local/mpfr-4.2.1 --build="$BUILD_NAME" --target="$HOST_NAME" --host="$HOST_NAME" --enable-static --disable-shared --with-gmp=$SCRIPT_DIR/local/gmp-6.3.0
make --jobs=6
make install
echo
Expand All @@ -119,7 +121,7 @@ echo 'build mpc'
tar -xf mpc-1.3.1.tar.gz
mkdir objdir-mpc-1.3.1
cd objdir-mpc-1.3.1
../mpc-1.3.1/configure --prefix=$SCRIPT_DIR/local/mpc-1.3.1 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --enable-static --disable-shared --with-gmp=$SCRIPT_DIR/local/gmp-6.3.0 --with-mpfr=$SCRIPT_DIR/local/mpfr-4.2.1
../mpc-1.3.1/configure --prefix=$SCRIPT_DIR/local/mpc-1.3.1 --build="$BUILD_NAME" --target="$HOST_NAME" --host="$HOST_NAME" --enable-static --disable-shared --with-gmp=$SCRIPT_DIR/local/gmp-6.3.0 --with-mpfr=$SCRIPT_DIR/local/mpfr-4.2.1
make --jobs=6
make install
echo
Expand All @@ -130,7 +132,7 @@ echo 'build isl'
tar -xjf isl-0.15.tar.bz2
mkdir objdir-isl-0.15
cd objdir-isl-0.15
../isl-0.15/configure --prefix=$SCRIPT_DIR/local/isl-0.15 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --enable-static --disable-shared --with-gmp-prefix=$SCRIPT_DIR/local/gmp-6.3.0
../isl-0.15/configure --prefix=$SCRIPT_DIR/local/isl-0.15 --build="$BUILD_NAME" --target="$HOST_NAME" --host="$HOST_NAME" --enable-static --disable-shared --with-gmp-prefix=$SCRIPT_DIR/local/gmp-6.3.0
make --jobs=6
make install
echo
Expand All @@ -141,7 +143,7 @@ echo 'build cloog'
tar -xf cloog-0.18.1.tar.gz
mkdir objdir-cloog-0.18.1
cd objdir-cloog-0.18.1
../cloog-0.18.1/configure --prefix=$SCRIPT_DIR/local/cloog-0.18.1 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --enable-static --disable-shared --with-isl=$SCRIPT_DIR/local/isl-0.15 --with-gmp-prefix=$SCRIPT_DIR/local/gmp-6.3.0
../cloog-0.18.1/configure --prefix=$SCRIPT_DIR/local/cloog-0.18.1 --build="$BUILD_NAME" --target="$HOST_NAME" --host="$HOST_NAME" --enable-static --disable-shared --with-isl=$SCRIPT_DIR/local/isl-0.15 --with-gmp-prefix=$SCRIPT_DIR/local/gmp-6.3.0
make --jobs=6
make install
echo
Expand All @@ -152,32 +154,21 @@ echo 'build binutils'
tar -xf binutils-2.41.tar.xz
mkdir objdir-binutils-2.41-v850-unknown-elf-gcc-"$MY_VERSION"
cd objdir-binutils-2.41-v850-unknown-elf-gcc-"$MY_VERSION"
../binutils-2.41/configure --prefix=$SCRIPT_DIR/local/gcc-"$MY_VERSION"-v850-unknown-elf --target=v850-unknown-elf --enable-languages=c,c++ --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --with-pkgversion='Built by ckormanyos/real-time-cpp' --disable-plugins --enable-static --disable-shared --disable-tls --disable-libada --disable-libssp --disable-nls --enable-mingw-wildcard --with-gnu-as --with-dwarf2 --disable-__cxa_atexit --disable-threads --disable-win32-registry --disable-sjlj-exceptions --with-isl=$SCRIPT_DIR/local/isl-0.15 --with-cloog=$SCRIPT_DIR/local/cloog-0.18.1 --with-gmp=$SCRIPT_DIR/local/gmp-6.3.0 --with-mpfr=$SCRIPT_DIR/local/mpfr-4.2.1 --with-mpc=$SCRIPT_DIR/local/mpc-1.3.1 --with-libiconv-prefix=$SCRIPT_DIR/local/libiconv-1.17 --with-zstd=$SCRIPT_DIR/local/zstd-1.5.5/lib --disable-werror
../binutils-2.41/configure --prefix=$SCRIPT_DIR/local/gcc-"$MY_VERSION"-v850-unknown-elf --target=v850-unknown-elf --enable-languages=c,c++ --build="$BUILD_NAME" --host="$HOST_NAME" --with-pkgversion='Built by ckormanyos/real-time-cpp' --disable-plugins --enable-static --disable-shared --disable-tls --disable-libada --disable-libssp --disable-nls --enable-mingw-wildcard --with-gnu-as --with-dwarf2 --disable-__cxa_atexit --disable-threads --disable-win32-registry --disable-sjlj-exceptions --with-isl=$SCRIPT_DIR/local/isl-0.15 --with-cloog=$SCRIPT_DIR/local/cloog-0.18.1 --with-gmp=$SCRIPT_DIR/local/gmp-6.3.0 --with-mpfr=$SCRIPT_DIR/local/mpfr-4.2.1 --with-mpc=$SCRIPT_DIR/local/mpc-1.3.1 --with-libiconv-prefix=$SCRIPT_DIR/local/libiconv-1.17 --with-zstd=$SCRIPT_DIR/local/zstd-1.5.5/lib --disable-werror
make --jobs=6
make install
echo


ls -la $SCRIPT_DIR/local/gcc-"$MY_VERSION"-v850-unknown-elf/bin
ls -la $SCRIPT_DIR/local/gcc-"$MY_VERSION"-v850-unknown-elf/bin/v850-unknown-elf-ld.exe
ls -la $SCRIPT_DIR/local/gcc-"$MY_VERSION"-v850-unknown-elf/bin/v850-unknown-elf-ld*
result_binutils=$?


echo "result_binutils: " "$result_binutils"
echo


#
# Notes on patch of GCC-12.3.0
#

# How do you make the patch? (Example for gcc-12.3.0)
# diff -ru gcc-12.3.0/ gcc-12.3.0_new/ > v850-unknown-elf-gcc-100-12.3.0_x86_64-w64-mingw32.patch

# How do you apply the patch? (Example for gcc-12.3.0)
# patch -p0 < v850-unknown-elf-gcc-100-12.3.0_x86_64-w64-mingw32.patch


cd $SCRIPT_DIR/gcc_build
echo 'build gcc'
tar -xf gcc-"$MY_VERSION".tar.xz
Expand All @@ -186,24 +177,22 @@ cd newlib-4.4.0.20231231
cp -r newlib libgloss ../gcc-"$MY_VERSION"
cd ..
mkdir objdir-gcc-"$MY_VERSION"-v850-unknown-elf
cd objdir-gcc-"$MY_VERSION"-v850-unknown-elf
../gcc-"$MY_VERSION"/configure --prefix=$SCRIPT_DIR/local/gcc-"$MY_VERSION"-v850-unknown-elf --target=v850-unknown-elf --enable-languages=c,c++ --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --with-pkgversion='Built by ckormanyos/real-time-cpp' --disable-gcov --enable-static --disable-shared --with-newlib --disable-tls --disable-libada --disable-libssp --disable-nls --enable-mingw-wildcard --with-gnu-as --with-dwarf2 --disable-__cxa_atexit --disable-threads --disable-win32-registry --disable-sjlj-exceptions --disable-libquadmath --disable-fixed-point --disable-decimal-float --with-isl=$SCRIPT_DIR/local/isl-0.15 --with-cloog=$SCRIPT_DIR/local/cloog-0.18.1 --with-gmp=$SCRIPT_DIR/local/gmp-6.3.0 --with-mpfr=$SCRIPT_DIR/local/mpfr-4.2.1 --with-mpc=$SCRIPT_DIR/local/mpc-1.3.1 --with-libiconv-prefix=$SCRIPT_DIR/local/libiconv-1.17 --with-zstd=$SCRIPT_DIR/local/zstd-1.5.5/lib
cd mkdir objdir-gcc-"$MY_VERSION"-v850-unknown-elf
../gcc-"$MY_VERSION"/configure --prefix=$SCRIPT_DIR/local/gcc-"$MY_VERSION"-v850-unknown-elf --target=v850-unknown-elf --enable-languages=c,c++ --build="$BUILD_NAME" --host="$HOST_NAME" --with-pkgversion='Built by ckormanyos/real-time-cpp' --disable-gcov --enable-static --disable-shared --with-newlib --disable-tls --disable-libada --disable-libssp --disable-nls --enable-mingw-wildcard --with-gnu-as --with-dwarf2 --disable-__cxa_atexit --disable-threads --disable-win32-registry --disable-sjlj-exceptions --disable-libquadmath --disable-fixed-point --disable-decimal-float --with-isl=$SCRIPT_DIR/local/isl-0.15 --with-cloog=$SCRIPT_DIR/local/cloog-0.18.1 --with-gmp=$SCRIPT_DIR/local/gmp-6.3.0 --with-mpfr=$SCRIPT_DIR/local/mpfr-4.2.1 --with-mpc=$SCRIPT_DIR/local/mpc-1.3.1 --with-libiconv-prefix=$SCRIPT_DIR/local/libiconv-1.17 --with-zstd=$SCRIPT_DIR/local/zstd-1.5.5/lib
make --jobs=6
make install
echo


ls -la $SCRIPT_DIR/local/gcc-"$MY_VERSION"-v850-unknown-elf/bin
ls -la $SCRIPT_DIR/local/gcc-"$MY_VERSION"-v850-unknown-elf/bin/v850-unknown-elf-g++.exe
ls -la $SCRIPT_DIR/local/gcc-"$MY_VERSION"-v850-unknown-elf/bin/v850-unknown-elf-gcc*
result_gcc=$?


echo "result_gcc: " "$result_gcc"
echo


result_total=$((result_old_distro+result_binutils+result_gcc))

result_total=$((result_system_gcc+result_binutils+result_gcc))

echo "result_total: " "$result_total"
echo
Expand Down

0 comments on commit 5feafd1

Please sign in to comment.