This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | ||
| on: | ||
| workflow_dispatch: | ||
| branches: | ||
| - '**' | ||
| push: | ||
| branches: | ||
| - '**' | ||
| permissions: write-all | ||
| jobs: | ||
| cross-build: | ||
| name: 'Cross build' | ||
| needs: native-build | ||
| runs-on: ubuntu-latest | ||
| continue-on-error: true | ||
| strategy: | ||
| matrix: | ||
| target: [ | ||
| # Windows | ||
| 'x86_64-w64-mingw32', | ||
| 'i686-w64-mingw32', | ||
| 'aarch64-w64-mingw32', | ||
| # macOS | ||
| 'aarch64-unknown-apple-darwin', | ||
| 'x86_64-unknown-apple-darwin', | ||
| # Linux (glibc) | ||
| 'x86_64-unknown-linux-gnu', | ||
| 'i386-unknown-linux-gnu', | ||
| 'arm-unknown-linux-gnueabi', | ||
| 'arm-unknown-linux-gnueabihf', | ||
| 'aarch64-unknown-linux-gnu', | ||
| # Linux (musl) | ||
| 'aarch64-unknown-linux-musl', | ||
| 'x86_64-unknown-linux-musl', | ||
| 'armv6-unknown-linux-musleabihf', | ||
| 'armv7-unknown-linux-musleabihf', | ||
| 'i386-unknown-linux-musl', | ||
| # FreeBSD | ||
| 'x86_64-unknown-freebsd', | ||
| 'aarch64-unknown-freebsd', | ||
| 'i386-unknown-freebsd', | ||
| # NetBSD | ||
| 'i386-unknown-netbsdelf', | ||
| 'x86_64-unknown-netbsd', | ||
| # DragonFly BSD | ||
| 'x86_64-unknown-dragonfly', | ||
| # Android | ||
| 'x86_64-unknown-linux-android', | ||
| 'i686-unknown-linux-android21', | ||
| 'aarch64-unknown-linux-android', | ||
| 'riscv64-unknown-linux-android', | ||
| 'armv7-unknown-linux-androideabi21', | ||
| 'mips64el-unknown-linux-android', | ||
| 'mipsel-unknown-linux-android21' | ||
| ] | ||
| steps: | ||
| - uses: actions/checkout@main | ||
| - name: Install required dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install build-essential autoconf libtool | ||
| - name: Cross-compile Pino to ${{ matrix.target }} | ||
| run: | | ||
| if [[ '${{ matrix.target }}' = *'-linux-musl'* ]]; then | ||
| declare -r RAIDEN_TAG='gcc-15' | ||
| declare -r RAIDEN_TARBALL='/tmp/toolchain.tar.xz' | ||
| declare -r RAIDEN_URL="https://github.com/AmanoTeam/musl-gcc-cross/releases/download/${RAIDEN_TAG}/x86_64-unknown-linux-gnu.tar.xz" | ||
| curl --connect-timeout '10' --retry '15' --retry-all-errors --fail --silent --location --url "${RAIDEN_URL}" --output "${RAIDEN_TARBALL}" | ||
| tar --directory="$(dirname "${RAIDEN_TARBALL}")" --extract --file="${RAIDEN_TARBALL}" | ||
| export RAIDEN_HOME='/tmp/musl-gcc-cross' | ||
| export PATH="${RAIDEN_HOME}/bin:${PATH}" | ||
| source "${RAIDEN_HOME}/build/autotools/${{ matrix.target }}.sh" | ||
| elif [[ '${{ matrix.target }}' = *'-linux-gnu'* ]]; then | ||
| declare -r OBGGCC_TAG='gcc-16' | ||
| declare -r OBGGCC_TARBALL='/tmp/toolchain.tar.xz' | ||
| declare -r OBGGCC_URL="https://github.com/AmanoTeam/obggcc/releases/download/${OBGGCC_TAG}/x86_64-unknown-linux-gnu.tar.xz" | ||
| curl --connect-timeout '10' --retry '15' --retry-all-errors --fail --silent --location --url "${OBGGCC_URL}" --output "${OBGGCC_TARBALL}" | ||
| tar --directory="$(dirname "${OBGGCC_TARBALL}")" --extract --file="${OBGGCC_TARBALL}" | ||
| export OBGGCC_ARM_MODE='true' | ||
| export OBGGCC_HOME='/tmp/obggcc' | ||
| export PATH="${OBGGCC_HOME}/bin:${PATH}" | ||
| source "${OBGGCC_HOME}/build/autotools/${{ matrix.target }}.sh" | ||
| elif [[ '${{ matrix.target }}' = *'-freebsd' ]]; then | ||
| declare -r LOKI_TAG='gcc-16' | ||
| declare -r LOKI_TARBALL='/tmp/toolchain.tar.xz' | ||
| declare -r LOKI_URL="https://github.com/AmanoTeam/freebsd-gcc-cross/releases/download/${LOKI_TAG}/x86_64-unknown-linux-gnu.tar.xz" | ||
| curl --silent --connect-timeout '10' --retry '15' --retry-all-errors --fail --location --url "${LOKI_URL}" --output "${LOKI_TARBALL}" | ||
| tar --directory="$(dirname "${LOKI_TARBALL}")" --extract --file="${LOKI_TARBALL}" | ||
| export LOKI_HOME='/tmp/freebsd-gcc-cross' | ||
| export PATH="${LOKI_HOME}/bin:${PATH}" | ||
| source "${LOKI_HOME}/build/autotools/${{ matrix.target }}.sh" | ||
| elif [[ '${{ matrix.target }}' = *'-netbsd'* ]]; then | ||
| declare -r DAKINI_TAG='gcc-15' | ||
| declare -r DAKINI_TARBALL='/tmp/toolchain.tar.xz' | ||
| declare -r DAKINI_URL="https://github.com/AmanoTeam/netbsd-gcc-cross/releases/download/${DAKINI_TAG}/x86_64-unknown-linux-gnu.tar.xz" | ||
| curl --connect-timeout '10' --retry '15' --retry-all-errors --fail --silent --location --url "${DAKINI_URL}" --output "${DAKINI_TARBALL}" | ||
| tar --directory="$(dirname "${DAKINI_TARBALL}")" --extract --file="${DAKINI_TARBALL}" | ||
| export DAKINI_HOME='/tmp/netbsd-gcc-cross' | ||
| export PATH="${DAKINI_HOME}/bin:${PATH}" | ||
| source "${DAKINI_HOME}/build/autotools/${{ matrix.target }}.sh" | ||
| elif [[ '${{ matrix.target }}' = *'-dragonfly' ]]; then | ||
| declare -r VENTI_TAG='gcc-16' | ||
| declare -r VENTI_TARBALL='/tmp/toolchain.tar.xz' | ||
| declare -r VENTI_URL="https://github.com/AmanoTeam/dragonfly-gcc-cross/releases/download/${VENTI_TAG}/x86_64-unknown-linux-gnu.tar.xz" | ||
| curl --connect-timeout '10' --retry '15' --retry-all-errors --fail --silent --location --url "${VENTI_URL}" --output "${VENTI_TARBALL}" | ||
| tar --directory="$(dirname "${VENTI_TARBALL}")" --extract --file="${VENTI_TARBALL}" | ||
| export VENTI_HOME='/tmp/dragonfly-gcc-cross' | ||
| export PATH="${VENTI_HOME}/bin:${PATH}" | ||
| source "${VENTI_HOME}/build/autotools/${{ matrix.target }}.sh" | ||
| elif [[ '${{ matrix.target }}' = *'-mingw32' ]]; then | ||
| declare -r MINGW_TAG='gcc-16' | ||
| declare -r MINGW_TARBALL='/tmp/toolchain.tar.xz' | ||
| declare -r MINGW_URL="https://github.com/AmanoTeam/mingw-gcc-cross/releases/download/${MINGW_TAG}/x86_64-unknown-linux-gnu.tar.xz" | ||
| curl --connect-timeout '10' --retry '15' --retry-all-errors --fail --silent --location --url "${MINGW_URL}" --output "${MINGW_TARBALL}" | ||
| tar --directory="$(dirname "${MINGW_TARBALL}")" --extract --file="${MINGW_TARBALL}" | ||
| export MINGW_HOME='/tmp/mingw-gcc-cross' | ||
| export PATH="${MINGW_HOME}/bin:${PATH}" | ||
| source "${MINGW_HOME}/build/autotools/${{ matrix.target }}.sh" | ||
| elif [[ '${{ matrix.target }}' = *'-darwin' ]]; then | ||
| curl \ | ||
| --silent \ | ||
| --show-error \ | ||
| --fail \ | ||
| --url 'https://raw.githubusercontent.com/AmanoTeam/darwin-clang-cross/refs/heads/master/main.sh' \ | ||
| | bash -s -- install | ||
| export DARWIN_HOME='/tmp/darwin-clang-cross' | ||
| export PATH="${DARWIN_HOME}/bin:${PATH}" | ||
| source "${DARWIN_HOME}/build/autotools/${{ matrix.target }}.sh" | ||
| elif [[ '${{ matrix.target }}' = *'-android'* ]]; then | ||
| declare -r PINO_TAG='gcc-16' | ||
| declare -r PINO_TARBALL='/tmp/toolchain.tar.xz' | ||
| declare -r PINO_URL="https://github.com/AmanoTeam/Pino/releases/download/${PINO_TAG}/x86_64-unknown-linux-gnu.tar.xz" | ||
| curl --connect-timeout '10' --retry '15' --retry-all-errors --fail --silent --location --url "${PINO_URL}" --output "${PINO_TARBALL}" | ||
| tar --directory="$(dirname "${PINO_TARBALL}")" --extract --file="${PINO_TARBALL}" | ||
| export PINO_HOME='/tmp/android-gcc-cross' | ||
| export PATH="${PINO_HOME}/bin:${PATH}" | ||
| source "${PINO_HOME}/build/autotools/${{ matrix.target }}.sh" | ||
| fi | ||
| echo "CROSS_COMPILE_TRIPLET=${CROSS_COMPILE_TRIPLET}" >> "${GITHUB_ENV}" | ||
| bash './build.sh' "${CROSS_COMPILE_TRIPLET}" | ||
| - name: Create logs | ||
| if: always() | ||
| run: | | ||
| declare logs='' | ||
| while read file; do | ||
| logs+="${file} " | ||
| done <<< $(find "/tmp/"*"/build" -wholename '*.log' -o -wholename '*.yaml' -o -wholename '*Makefile') | ||
| tar --create --file=- ${logs} | xz --threads='0' --compress -9 > '/tmp/logs.tar.xz' | ||
| - name: Upload logs | ||
| if: always() | ||
| uses: actions/upload-artifact@main | ||
| with: | ||
| name: ${{ matrix.target }}-logs | ||
| if-no-files-found: error | ||
| path: | | ||
| /tmp/logs.tar.xz | ||
| - name: Generate tarball | ||
| run: | | ||
| if [[ '${{ env.CROSS_COMPILE_TRIPLET }}' = *'-mingw32' ]]; then | ||
| declare tarball_filename='/tmp/${{ env.CROSS_COMPILE_TRIPLET }}.7z' | ||
| cd '/tmp' | ||
| 7z a "${tarball_filename}" 'autotools' \ | ||
| -t7z \ | ||
| -mx=9 \ | ||
| -m0=lzma2:d=128m:fb=128 \ | ||
| -ms=on \ | ||
| -mmt="$(nproc)" | ||
| else | ||
| declare tarball_filename='/tmp/${{ env.CROSS_COMPILE_TRIPLET }}.tar.xz' | ||
| tar --directory='/tmp' --create --file=- 'autotools' | xz --threads='0' --extreme --memlimit-compress='100%' --compress -9 > "${tarball_filename}" | ||
| fi | ||
| sha256sum "${tarball_filename}" | sed 's|/tmp/||' > "${tarball_filename}.sha256" | ||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@main | ||
| with: | ||
| name: ${{ env.CROSS_COMPILE_TRIPLET }} | ||
| if-no-files-found: error | ||
| path: | | ||
| /tmp/${{ env.CROSS_COMPILE_TRIPLET }}.* | ||
| release: | ||
| needs: cross-build | ||
| runs-on: ubuntu-latest | ||
| name: Create release | ||
| steps: | ||
| - name: Download all artifacts | ||
| uses: actions/download-artifact@main | ||
| - name: Create release | ||
| uses: softprops/action-gh-release@master | ||
| with: | ||
| tag_name: rolling | ||
| name: 'Autotools' | ||
| files: ./*/*-{unknown,w64,apple}-*.{tar.xz,7z}* | ||
| draft: false | ||
| prerelease: false | ||
| fail_on_unmatched_files: true | ||
| body: '*' | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||