diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3866b38..4e53f11 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,15 +13,27 @@ jobs: - uses: actions/checkout@main with: submodules: true + - name: Check for cache + id: check-cache + uses: actions/cache@main + with: + key: gcc-14.1.0 + lookup-only: true + path: | + /tmp/x86_64-linux-gnu.tar.xz + /tmp/x86_64-linux-gnu.tar.xz.sha256 - name: Build Raiden + if: ${{ steps.check-cache.outputs.cache-hit != 'true' }} run: | bash './build.sh' 'native' - name: Generate tarball + if: ${{ steps.check-cache.outputs.cache-hit != 'true' }} run: | declare tarball_filename='/tmp/x86_64-linux-gnu.tar.xz' tar --directory='/tmp' --create --file=- 'raiden' | xz --threads='0' --compress -9 > "${tarball_filename}" sha256sum "${tarball_filename}" | sed 's|/tmp/||' > "${tarball_filename}.sha256" - name: Upload artifact + if: ${{ steps.check-cache.outputs.cache-hit != 'true' }} uses: actions/upload-artifact@main with: name: native-toolchain @@ -29,6 +41,14 @@ jobs: path: | /tmp/x86_64-linux-gnu.tar.xz /tmp/x86_64-linux-gnu.tar.xz.sha256 + - name: Cache artifact + if: ${{ steps.check-cache.outputs.cache-hit != 'true' }} + uses: actions/cache@main + with: + key: gcc-14.1.0 + path: | + /tmp/x86_64-linux-gnu.tar.xz + /tmp/x86_64-linux-gnu.tar.xz.sha256 cross-build: name: 'Cross build' @@ -38,6 +58,7 @@ jobs: strategy: matrix: target: [ + 'ia64-unknown-linux-gnu', 'alpha-unknown-linux-gnu', 'x86_64-unknown-linux-gnu', 'i386-unknown-linux-gnu', @@ -51,19 +72,28 @@ jobs: 's390-unknown-linux-gnu', 's390x-unknown-linux-gnu', 'sparc-unknown-linux-gnu', - 'powerpc64le-unknown-linux-gnu' + 'powerpc64le-unknown-linux-gnu', + 'mips64el-unknown-linux-gnuabi64' ] steps: - uses: actions/checkout@main with: submodules: true + - name: Restore from cache + uses: actions/cache@main + with: + key: gcc-14.1.0 + fail-on-cache-miss: true + path: | + /tmp/x86_64-linux-gnu.tar.xz + /tmp/x86_64-linux-gnu.tar.xz.sha256 - name: Download artifact uses: actions/download-artifact@main with: name: native-toolchain - name: Setup toolchain run: | - tar --directory='/tmp' --extract --file='./x86_64-linux-gnu.tar.xz' + tar --directory='/tmp' --extract --file='/tmp/x86_64-linux-gnu.tar.xz' mv '/tmp/raiden' '/tmp/raiden-toolchain' - name: Build Raiden with OBGGCC run: | @@ -79,7 +109,7 @@ jobs: - name: Upload artifact uses: actions/upload-artifact@main with: - name: cross-toolchain + name: ${{ matrix.target }} if-no-files-found: error path: | /tmp/${{ matrix.target }}.tar.xz diff --git a/build.sh b/build.sh index 40e36f8..dea37f4 100644 --- a/build.sh +++ b/build.sh @@ -2,31 +2,31 @@ set -eu -declare -r current_source_directory="${PWD}" +declare -r workdir="${PWD}" declare -r revision="$(git rev-parse --short HEAD)" declare -r toolchain_directory='/tmp/raiden' declare -r gmp_tarball='/tmp/gmp.tar.xz' -declare -r gmp_directory='/tmp/gmp-6.2.1' +declare -r gmp_directory='/tmp/gmp-6.3.0' declare -r mpfr_tarball='/tmp/mpfr.tar.xz' -declare -r mpfr_directory='/tmp/mpfr-4.2.0' +declare -r mpfr_directory='/tmp/mpfr-4.2.1' declare -r mpc_tarball='/tmp/mpc.tar.gz' declare -r mpc_directory='/tmp/mpc-1.3.1' declare -r binutils_tarball='/tmp/binutils.tar.xz' -declare -r binutils_directory='/tmp/binutils-2.40' +declare -r binutils_directory='/tmp/binutils-2.42' declare -r gcc_tarball='/tmp/gcc.tar.gz' -declare -r gcc_directory='/tmp/gcc-13.2.0' +declare -r gcc_directory='/tmp/gcc-14.1.0' declare -r optflags='-Os' declare -r linkflags='-Wl,-s' -declare -r max_jobs="$(($(nproc) * 8))" +declare -r max_jobs="$(($(nproc) * 17))" declare build_type="${1}" @@ -51,27 +51,29 @@ if ! (( is_native )); then fi if ! [ -f "${gmp_tarball}" ]; then - curl --connect-timeout '10' --retry '15' --retry-all-errors --fail --silent --url 'https://mirrors.kernel.org/gnu/gmp/gmp-6.2.1.tar.xz' --output "${gmp_tarball}" + wget --no-verbose 'https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.xz' --output-document="${gmp_tarball}" tar --directory="$(dirname "${gmp_directory}")" --extract --file="${gmp_tarball}" fi if ! [ -f "${mpfr_tarball}" ]; then - curl --connect-timeout '10' --retry '15' --retry-all-errors --fail --silent --url 'https://mirrors.kernel.org/gnu/mpfr/mpfr-4.2.0.tar.xz' --output "${mpfr_tarball}" + wget --no-verbose 'https://ftp.gnu.org/gnu/mpfr/mpfr-4.2.1.tar.xz' --output-document="${mpfr_tarball}" tar --directory="$(dirname "${mpfr_directory}")" --extract --file="${mpfr_tarball}" fi if ! [ -f "${mpc_tarball}" ]; then - curl --connect-timeout '10' --retry '15' --retry-all-errors --fail --silent --url 'https://mirrors.kernel.org/gnu/mpc/mpc-1.3.1.tar.gz' --output "${mpc_tarball}" + wget --no-verbose 'https://ftp.gnu.org/gnu/mpc/mpc-1.3.1.tar.gz' --output-document="${mpc_tarball}" tar --directory="$(dirname "${mpc_directory}")" --extract --file="${mpc_tarball}" fi if ! [ -f "${binutils_tarball}" ]; then - curl --connect-timeout '10' --retry '15' --retry-all-errors --fail --silent --url 'https://mirrors.kernel.org/gnu/binutils/binutils-2.40.tar.xz' --output "${binutils_tarball}" + wget --no-verbose 'https://ftp.gnu.org/gnu/binutils/binutils-2.42.tar.xz' --output-document="${binutils_tarball}" tar --directory="$(dirname "${binutils_directory}")" --extract --file="${binutils_tarball}" + + patch --directory="${binutils_directory}" --strip='1' --input="${workdir}/patches/0001-Revert-gold-Use-char16_t-char32_t-instead-of-uint16_.patch" fi if ! [ -f "${gcc_tarball}" ]; then - curl --connect-timeout '10' --retry '15' --retry-all-errors --fail --silent --url 'https://mirrors.kernel.org/gnu/gcc/gcc-13.2.0/gcc-13.2.0.tar.xz' --output "${gcc_tarball}" + wget --no-verbose 'https://ftp.gnu.org/gnu/gcc/gcc-14.1.0/gcc-14.1.0.tar.xz' --output-document="${gcc_tarball}" tar --directory="$(dirname "${gcc_directory}")" --extract --file="${gcc_tarball}" fi @@ -128,6 +130,7 @@ make all --jobs make install declare -ra targets=( + 'powerpc-unknown-linux-musl' 'mips64-unknown-linux-musl' 'armv7l-unknown-linux-musleabihf' 'powerpc64le-unknown-linux-musl' @@ -140,11 +143,11 @@ declare -ra targets=( ) for target in "${targets[@]}"; do - source "${current_source_directory}/${target}.sh" + source "${workdir}/${target}.sh" cd "$(mktemp --directory)" - if [ "${os}" == 'void' ]; then + if [ "${os}" == 'void' ] || [ "${os}" == 'sabotage' ]; then declare sysroot_filename="./sysroot.tar.xz" else declare sysroot_filename="./sysroot.tar.gz" @@ -167,10 +170,15 @@ for target in "${targets[@]}"; do [ -d "${toolchain_directory}/${triplet}" ] || mkdir --parent "${toolchain_directory}/${triplet}" - cp --recursive './usr/include' "${toolchain_directory}/${triplet}" - cp --recursive './usr/lib' "${toolchain_directory}/${triplet}" + if [ "${os}" == 'sabotage' ]; then + cp --recursive './opt/musl/include' "${toolchain_directory}/${triplet}" + cp --recursive './opt/then/lib' "${toolchain_directory}/${triplet}" + else + cp --recursive './usr/include' "${toolchain_directory}/${triplet}" + cp --recursive './usr/lib' "${toolchain_directory}/${triplet}" + fi - if [ -d './lib' ]; then + if [ "${os}" != 'sabotage' ] && [ -d './lib' ]; then cp --remove-destination --recursive './lib/'* "${toolchain_directory}/${triplet}/lib" fi @@ -235,7 +243,7 @@ for target in "${targets[@]}"; do --with-mpc="${toolchain_directory}" \ --with-mpfr="${toolchain_directory}" \ --with-bugurl='https://github.com/AmanoTeam/Raiden/issues' \ - --with-pkgversion="Raiden v0.4-${revision}" \ + --with-pkgversion="Raiden v0.5-${revision}" \ --with-sysroot="${toolchain_directory}/${triplet}" \ --with-gcc-major-version-only \ --with-native-system-header-dir='/include' \ @@ -285,7 +293,7 @@ for target in "${targets[@]}"; do for name in *; do rm "${name}" - ln -s "../../bin/${triplet}-${name}" "${name}" + ln --symbolic "../../bin/${triplet}-${name}" "${name}" done rm --recursive "${toolchain_directory}/share" diff --git a/powerpc-unknown-linux-musl.sh b/powerpc-unknown-linux-musl.sh new file mode 100644 index 0000000..5230f2c --- /dev/null +++ b/powerpc-unknown-linux-musl.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +declare packages=() + +declare extra_configure_flags='' + +declare triplet='powerpc-unknown-linux-musl' + +declare ld='ld-musl-powerpc.so.1' + +declare sysroot='https://web.archive.org/web/0if_/https://ftp.barfooze.de/pub/sabotage/sabotage-0.9.8-powerpc-rootfs.tar.xz' + +declare os='sabotage'