2023-03-09 02:47:17 +00:00
|
|
|
---
|
2022-02-18 08:58:56 +00:00
|
|
|
name: Build toolchains
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
samples:
|
|
|
|
description: Stringified JSON list of samples
|
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
canadian-cross:
|
|
|
|
description: Build Canadian Cross toolchain(x86_64-w64-mingw32)
|
|
|
|
default: false
|
|
|
|
required: false
|
|
|
|
type: boolean
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ${{ matrix.host }}
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-05-11 03:03:39 +00:00
|
|
|
host: ["ubuntu-22.04", "macos-12"]
|
2022-02-18 08:58:56 +00:00
|
|
|
sample: ${{ fromJSON(inputs.samples) }}
|
|
|
|
exclude:
|
|
|
|
# Exclude both glibc & uClibc ARC Linux toolchains as
|
|
|
|
# there's no known use of ARC Linux toolchains on Mac,
|
|
|
|
# and anyway glibc fails to build for ARC700,
|
|
|
|
# see https://github.com/crosstool-ng/crosstool-ng/pull/1456#issuecomment-779150246
|
2024-05-11 03:03:39 +00:00
|
|
|
- {host: "macos-12", sample: "arc-multilib-linux-gnu"}
|
|
|
|
- {host: "macos-12", sample: "arc-multilib-linux-uclibc"}
|
2022-02-18 08:58:56 +00:00
|
|
|
|
|
|
|
# Exclude mips*-*-linux-gnu because of <byteswap.h> usage in
|
|
|
|
# elf-entry.c for linux kernel headers. <byteswap.h> is a GNU
|
|
|
|
# extension and doesn't exist on MacOS X
|
2024-05-11 03:03:39 +00:00
|
|
|
- {host: "macos-12", sample: "mips-unknown-linux-gnu"}
|
|
|
|
- {host: "macos-12", sample: "mips64-unknown-linux-gnu"}
|
2022-02-18 08:58:56 +00:00
|
|
|
|
|
|
|
# Exclude x86_64-w64-mingw32,x86_64-pc-linux-gnu because it crashes on m4 build with
|
|
|
|
# a Segmentation fault
|
2024-05-11 03:03:39 +00:00
|
|
|
- {host: "macos-12", sample: "x86_64-w64-mingw32,x86_64-pc-linux-gnu"}
|
2022-02-18 08:58:56 +00:00
|
|
|
steps:
|
|
|
|
- name: create case sensitive workspace volume for macOS
|
|
|
|
if: ${{ runner.os == 'macOS' }}
|
|
|
|
run: |
|
|
|
|
cd ..
|
|
|
|
rmdir crosstool-ng
|
2024-03-05 23:32:09 +00:00
|
|
|
hdiutil create "${HOME}/Workspace.sparseimage" -volname crosstool-ng -type SPARSE -size 20g -fs HFSX
|
|
|
|
hdiutil mount "${HOME}/Workspace.sparseimage" -mountroot /Users/runner/work/crosstool-ng
|
2022-02-18 08:58:56 +00:00
|
|
|
cd crosstool-ng
|
|
|
|
- name: download ct-ng
|
2024-03-05 23:32:09 +00:00
|
|
|
uses: actions/download-artifact@v4
|
2022-02-18 08:58:56 +00:00
|
|
|
with:
|
|
|
|
name: crosstool.${{ matrix.host }}
|
|
|
|
- name: extract ct-ng
|
|
|
|
run: |
|
|
|
|
tar -xf ct-ng.tar
|
|
|
|
- name: download tarballs
|
2024-03-05 23:32:09 +00:00
|
|
|
uses: actions/cache/restore@v4
|
2022-02-18 08:58:56 +00:00
|
|
|
with:
|
2023-09-19 17:43:10 +00:00
|
|
|
path: src.tar
|
|
|
|
key: src.tar-${{ hashFiles('.local/share/crosstool-ng/packages') }}-${{ hashFiles('.local/share/crosstool-ng/samples') }}
|
2022-02-18 08:58:56 +00:00
|
|
|
- name: extract tarballs
|
2023-09-19 17:43:10 +00:00
|
|
|
continue-on-error: true
|
2022-02-18 08:58:56 +00:00
|
|
|
run: |
|
|
|
|
tar -xvf src.tar
|
|
|
|
- name: prereq Linux
|
|
|
|
if: ${{ runner.os == 'Linux' }}
|
|
|
|
run: |
|
2024-03-27 22:07:50 +00:00
|
|
|
sudo apt-get update && sudo apt-get install -y bison flex gperf help2man libtool-bin meson ninja-build texinfo
|
2024-03-05 23:32:09 +00:00
|
|
|
echo "${{ github.workspace }}/.local/bin" >> "$GITHUB_PATH"
|
2022-02-18 08:58:56 +00:00
|
|
|
- name: prereq macOS
|
|
|
|
if: ${{ runner.os == 'macOS' }}
|
|
|
|
run: |
|
|
|
|
brew install autoconf automake bash binutils gawk gnu-sed \
|
2024-05-08 08:13:24 +00:00
|
|
|
gnu-tar help2man make ncurses pkg-config texinfo libtool
|
2024-03-05 23:32:09 +00:00
|
|
|
echo "${{ github.workspace }}/.local/bin" >> "$GITHUB_PATH"
|
2022-02-18 08:58:56 +00:00
|
|
|
- name: download x86_64-w64-mingw32.${{ matrix.host }} tarball
|
|
|
|
if: ${{ inputs.canadian-cross }}
|
2024-03-05 23:32:09 +00:00
|
|
|
uses: actions/download-artifact@v4
|
2022-02-18 08:58:56 +00:00
|
|
|
with:
|
|
|
|
name: x86_64-w64-mingw32.${{ matrix.host }}.tar
|
|
|
|
- name: install x86_64-w64-mingw32.${{ matrix.host }} toolchain
|
|
|
|
if: ${{ inputs.canadian-cross }}
|
|
|
|
run: |
|
|
|
|
mkdir -p ${{ github.workspace }}/x86_64-w64-mingw32
|
|
|
|
tar -C ${{ github.workspace }}/x86_64-w64-mingw32 \
|
|
|
|
-xf x86_64-w64-mingw32.${{ matrix.host }}.tar
|
2024-03-05 23:32:09 +00:00
|
|
|
echo "${{ github.workspace }}/x86_64-w64-mingw32/bin" >> "$GITHUB_PATH"
|
2022-02-18 08:58:56 +00:00
|
|
|
- name: build ${{ matrix.sample }} for ${{ matrix.host }}
|
|
|
|
run: |
|
|
|
|
mkdir -p src
|
|
|
|
ct-ng ${{ matrix.sample }}
|
|
|
|
sed -i -e '/CT_LOG_PROGRESS_BAR/s/y$/n/' .config
|
|
|
|
sed -i -e '/CT_LOCAL_TARBALLS_DIR/s/HOME/CT_TOP_DIR/' .config
|
|
|
|
sed -i -e '/CT_PREFIX_DIR/s/HOME/CT_TOP_DIR/' .config
|
2023-08-09 06:18:24 +00:00
|
|
|
sed -i -e '/CT_GLIBC_ENABLE_DEBUG/s/y$/n/' .config
|
2024-05-11 03:03:39 +00:00
|
|
|
test ${{ matrix.host }} = "macos-12" && sed -i -e '/CT_GDB_CROSS_PYTHON/s/y$/n/' .config
|
2022-02-18 08:58:56 +00:00
|
|
|
ct-ng build
|
|
|
|
- name: create ${{ matrix.sample }}.${{ matrix.host }} tarball
|
|
|
|
if: ${{ matrix.sample == 'x86_64-w64-mingw32' }}
|
|
|
|
run: |
|
|
|
|
tar -C ${{ github.workspace }}/x-tools/${{ matrix.sample }} \
|
|
|
|
-cf ${{ matrix.sample }}.${{ matrix.host }}.tar .
|
|
|
|
- name: upload ${{ matrix.sample }}.${{ matrix.host }} tarball
|
|
|
|
if: ${{ matrix.sample == 'x86_64-w64-mingw32' }}
|
2024-03-05 23:32:09 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2022-02-18 08:58:56 +00:00
|
|
|
with:
|
2022-10-27 08:48:01 +00:00
|
|
|
name: ${{ matrix.sample }}.${{ matrix.host }}.tar
|
2022-02-18 08:58:56 +00:00
|
|
|
path: |
|
2022-10-27 08:48:01 +00:00
|
|
|
${{ matrix.sample }}.${{ matrix.host }}.tar
|
2022-02-18 08:58:56 +00:00
|
|
|
- name: upload log
|
2024-03-05 23:32:09 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2022-02-18 08:58:56 +00:00
|
|
|
with:
|
|
|
|
name: ${{ matrix.sample }}.${{ matrix.host }}.log
|
|
|
|
path: |
|
|
|
|
build.log
|
|
|
|
.config
|
|
|
|
if: ${{ always() }}
|