Skip to content

Commit

Permalink
Update to GCC 13.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Kartatz committed Aug 24, 2023
1 parent 0820ee6 commit 1fe9e25
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 29 deletions.
89 changes: 69 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,92 @@ on:
- '**'

jobs:
build:
native-build:
name: 'Native build'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
with:
submodules: true
- name: Build Raiden
run: |
bash './build.sh' 'native'
- name: Generate tarball
run: |
declare tarball_filename='/tmp/x86_64-linux-gnu.tar.xz'
tar --directory='/tmp' --create --file=- 'obggcc' | xz --threads='0' --compress -9 > "${tarball_filename}"
sha256sum "${tarball_filename}" | sed 's|/tmp/||' > "${tarball_filename}.sha256"
- name: Upload artifact
uses: actions/upload-artifact@main
with:
name: native-toolchain
if-no-files-found: error
path: |
/tmp/x86_64-linux-gnu.tar.xz
/tmp/x86_64-linux-gnu.tar.xz.sha256
- name: Cache artifact
uses: actions/cache@main
with:
key: gcc-13.2.0
path: |
/tmp/x86_64-linux-gnu.tar.xz
/tmp/x86_64-linux-gnu.tar.xz.sha256
cross-build:
name: 'Cross build'
needs: native-build
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
target: [
alpha-unknown-linux-gnu,
x86_64-unknown-linux-gnu,
i386-unknown-linux-gnu,
arm-unknown-linux-gnueabi,
arm-unknown-linux-gnueabihf,
hppa-unknown-linux-gnu,
aarch64-unknown-linux-gnu,
mips-unknown-linux-gnu,
mipsel-unknown-linux-gnu,
powerpc-unknown-linux-gnu,
s390-unknown-linux-gnu,
s390x-unknown-linux-gnu,
sparc-unknown-linux-gnu,
powerpc64le-unknown-linux-gnu
'alpha-unknown-linux-gnu',
'x86_64-unknown-linux-gnu',
'i386-unknown-linux-gnu',
'arm-unknown-linux-gnueabi',
'arm-unknown-linux-gnueabihf',
'hppa-unknown-linux-gnu',
'aarch64-unknown-linux-gnu',
'mips-unknown-linux-gnu',
'mipsel-unknown-linux-gnu',
'powerpc-unknown-linux-gnu',
's390-unknown-linux-gnu',
's390x-unknown-linux-gnu',
'sparc-unknown-linux-gnu',
'powerpc64le-unknown-linux-gnu'
]
steps:
- uses: actions/checkout@main
with:
submodules: true
- name: Restore artifact
uses: actions/cache@main
with:
key: gcc-13.2.0
fail-on-cache-miss: true
path: |
/tmp/x86_64-linux-gnu.tar.xz
/tmp/x86_64-linux-gnu.tar.xz.sha256
- name: Setup toolchain
run: |
tar --directory='/tmp' --extract --file='./x86_64-linux-gnu.tar.xz'
mv '/tmp/obggcc' '/tmp/obggcc-toolchain'
- name: Build OBGGCC with OBGGCC
run: |
source './tools/setup_toolchain.sh'
bash './build.sh' '${{ matrix.target }}'
- name: Generate tarball
run: |
declare tarball_filename='${{ matrix.target }}.tar.xz'
tar --directory='/tmp' --create --file=- 'obggcc' | xz --threads=0 --compress -9 > "${tarball_filename}"
sha256sum "${tarball_filename}" > "${tarball_filename}.sha256"
declare tarball_filename='/tmp/${{ matrix.target }}.tar.xz'
tar --directory='/tmp' --create --file=- 'obggcc' | xz --threads='0' --compress -9 > "${tarball_filename}"
sha256sum "${tarball_filename}" | sed 's|/tmp/||' > "${tarball_filename}.sha256"
- name: Upload artifact
uses: actions/upload-artifact@main
with:
name: cross-toolchain
if-no-files-found: error
path: |
${{ matrix.target }}.tar.xz
${{ matrix.target }}.tar.xz.sha256
/tmp/${{ matrix.target }}.tar.xz
/tmp/${{ matrix.target }}.tar.xz.sha256
40 changes: 31 additions & 9 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ declare -r obggcc_revision="$(git rev-parse --short HEAD)"
declare -r current_source_directory="${PWD}"

declare -r toolchain_directory='/tmp/obggcc'
declare -r toolchain_tarball="${current_source_directory}/linux-cross.tar.xz"

declare -r gmp_tarball='/tmp/gmp.tar.xz'
declare -r gmp_directory='/tmp/gmp-6.2.1'
Expand All @@ -22,12 +21,34 @@ declare -r binutils_tarball='/tmp/binutils.tar.xz'
declare -r binutils_directory='/tmp/binutils-2.40'

declare -r gcc_tarball='/tmp/gcc.tar.gz'
declare -r gcc_directory='/tmp/gcc-master'
declare -r gcc_directory='/tmp/gcc-13.2.0'

declare -r optflags='-Os'
declare -r linkflags='-Wl,-s'

source "./toolchains/${1}.sh"
declare -r max_jobs="$(($(nproc) * 8))"

declare build_type="${1}"

if [ -z "${build_type}" ]; then
build_type='native'
fi

declare is_native='0'

if [ "${build_type}" == 'native' ]; then
is_native='1'
fi

declare OBGGCC_TOOLCHAIN='/tmp/obggcc-toolchain'
declare CROSS_COMPILE_TRIPLET=''

declare cross_compile_flags=''

if ! (( is_native )); then
source "./toolchains/${build_type}.sh"
cross_compile_flags+="--host=${CROSS_COMPILE_TRIPLET}"
fi

if ! [ -f "${gmp_tarball}" ]; then
wget --no-verbose 'https://mirrors.kernel.org/gnu/gmp/gmp-6.2.1.tar.xz' --output-document="${gmp_tarball}"
Expand All @@ -50,7 +71,7 @@ if ! [ -f "${binutils_tarball}" ]; then
fi

if ! [ -f "${gcc_tarball}" ]; then
wget --no-verbose 'https://codeload.github.com/gcc-mirror/gcc/tar.gz/refs/heads/master' --output-document="${gcc_tarball}"
wget --no-verbose 'https://mirrors.kernel.org/gnu/gcc/gcc-13.2.0/gcc-13.2.0.tar.xz' --output-document="${gcc_tarball}"
tar --directory="$(dirname "${gcc_directory}")" --extract --file="${gcc_tarball}"
fi

Expand Down Expand Up @@ -198,6 +219,7 @@ for target in "${targets[@]}"; do
--disable-gprofng \
--with-static-standard-libraries \
--program-prefix="${triple}-" \
--with-sysroot="${toolchain_directory}/${triple}" \
CFLAGS="${optflags}" \
CXXFLAGS="${optflags}" \
LDFLAGS="${linkflags}"
Expand All @@ -220,6 +242,10 @@ for target in "${targets[@]}"; do
--with-mpfr="${toolchain_directory}" \
--with-static-standard-libraries \
--with-bugurl='https://github.com/AmanoTeam/obggcc/issues' \
--with-gcc-major-version-only \
--with-pkgversion="OBGGCC v0.5-${obggcc_revision}" \
--with-sysroot="${toolchain_directory}/${triple}" \
--with-native-system-header-dir='/include' \
--enable-__cxa_atexit \
--enable-cet='auto' \
--enable-checking='release' \
Expand All @@ -243,12 +269,8 @@ for target in "${targets[@]}"; do
--disable-werror \
--disable-multilib \
--disable-plugin \
--without-headers \
--with-gcc-major-version-only \
--with-pkgversion="OBGGCC v0.4-${obggcc_revision}" \
--with-sysroot="${toolchain_directory}/${triple}" \
--with-native-system-header-dir='/include' \
--disable-nls \
--without-headers \
${extra_configure_flags} \
CFLAGS="${optflags}" \
CXXFLAGS="${optflags}" \
Expand Down

0 comments on commit 1fe9e25

Please sign in to comment.