Skip to content

Commit 050a1d4

Browse files
Merge pull request #134 from dreamer-coding/cross_targets
2 parents 0de70da + b4e2adc commit 050a1d4

File tree

4 files changed

+189
-109
lines changed

4 files changed

+189
-109
lines changed

.github/ciimage/Dockerfile.alpine

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Use a specific Alpine base image
2+
FROM alpine:3.21
3+
4+
# Set environment variables to avoid interaction
5+
ENV TZ=UTC \
6+
CC=clang \
7+
CXX=clang++ \
8+
LD_LIBRARY_PATH=/usr/local/lib
9+
10+
# Install system dependencies
11+
RUN apk add --no-cache \
12+
bash \
13+
build-base \
14+
clang \
15+
gdb \
16+
llvm \
17+
libstdc++ \
18+
python3 \
19+
py3-pip \
20+
git \
21+
wget \
22+
ca-certificates \
23+
tzdata \
24+
&& python3 -m ensurepip \
25+
&& pip3 install --no-cache-dir --upgrade pip \
26+
&& pip3 install --no-cache-dir meson==1.3.0 ninja==1.10.2
27+
28+
# Set working directory
29+
WORKDIR /workspace
30+
31+
# Default command
32+
CMD ["bash"]
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Use a specific openSUSE base image
2+
FROM opensuse/leap:15.5
3+
4+
# Set environment variables to avoid interaction
5+
ENV TZ=UTC \
6+
CC=clang \
7+
CXX=clang++ \
8+
LD_LIBRARY_PATH=/usr/local/lib \
9+
ZYPPER_ASSUME_YES=1 \
10+
DEBIAN_FRONTEND=noninteractive
11+
12+
# Install system dependencies
13+
RUN zypper refresh && \
14+
zypper install -y \
15+
bash \
16+
gcc \
17+
gcc-c++ \
18+
clang \
19+
gdb \
20+
llvm \
21+
libstdc++-devel \
22+
python3 \
23+
python3-pip \
24+
git \
25+
wget \
26+
ca-certificates \
27+
&& zypper clean --all
28+
29+
# Upgrade pip and install Meson + Ninja
30+
RUN python3 -m ensurepip && \
31+
python3 -m pip install --no-cache-dir --upgrade pip && \
32+
python3 -m pip install --no-cache-dir meson==1.3.0 ninja==1.10.2
33+
34+
# Set working directory
35+
WORKDIR /workspace
36+
37+
# Default command
38+
CMD ["bash"]

.github/workflows/crossfile_ci.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: Crossfile CI
2+
3+
on:
4+
push:
5+
paths:
6+
- "**.c"
7+
- "**.h"
8+
- "**.py"
9+
- "**.build"
10+
- "**.options"
11+
pull_request:
12+
paths:
13+
- "**.c"
14+
- "**.h"
15+
- "**.py"
16+
- "**.build"
17+
- "**.options"
18+
19+
jobs:
20+
build_cross:
21+
name: Building on Bedrock ${{ matrix.architecture }}
22+
runs-on: ubuntu-latest # Using Ubuntu as the base system for cross-compilation
23+
24+
strategy:
25+
matrix:
26+
architecture: [arm, arm64, mips, mipsel, riscv64, ppc, ppc64le, sparc64, s390x]
27+
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 0
33+
34+
- name: Set up Python
35+
uses: actions/setup-python@v5
36+
with:
37+
python-version: '3.12'
38+
39+
- name: Install Cross-Compilation Toolchain
40+
run: |
41+
sudo apt update
42+
if [ "${{ matrix.architecture }}" == "arm" ]; then
43+
sudo apt install -y gcc-arm-linux-gnueabi g++-arm-linux-gnueabi
44+
elif [ "${{ matrix.architecture }}" == "arm64" ]; then
45+
sudo apt install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
46+
elif [ "${{ matrix.architecture }}" == "mips" ]; then
47+
sudo apt install -y gcc-mips-linux-gnu g++-mips-linux-gnu
48+
elif [ "${{ matrix.architecture }}" == "mipsel" ]; then
49+
sudo apt install -y gcc-mipsel-linux-gnu g++-mipsel-linux-gnu
50+
elif [ "${{ matrix.architecture }}" == "riscv64" ]; then
51+
sudo apt install -y gcc-riscv64-linux-gnu g++-riscv64-linux-gnu
52+
elif [ "${{ matrix.architecture }}" == "ppc" ]; then
53+
sudo apt install -y gcc-powerpc-linux-gnu g++-powerpc-linux-gnu
54+
elif [ "${{ matrix.architecture }}" == "ppc64le" ]; then
55+
sudo apt install -y gcc-powerpc64le-linux-gnu g++-powerpc64le-linux-gnu
56+
elif [ "${{ matrix.architecture }}" == "sparc64" ]; then
57+
sudo apt install -y gcc-sparc64-linux-gnu g++-sparc64-linux-gnu
58+
elif [ "${{ matrix.architecture }}" == "s390x" ]; then
59+
sudo apt install -y gcc-s390x-linux-gnu g++-s390x-linux-gnu
60+
fi
61+
62+
- name: Set Cross-Compilation Environment Variables
63+
run: |
64+
if [ "${{ matrix.architecture }}" == "arm" ]; then
65+
echo "CC=arm-linux-gnueabi-gcc" >> $GITHUB_ENV
66+
echo "CXX=arm-linux-gnueabi-g++" >> $GITHUB_ENV
67+
echo "CROSS_FILE=.github/crossfiles/arm.txt" >> $GITHUB_ENV
68+
elif [ "${{ matrix.architecture }}" == "arm64" ]; then
69+
echo "CC=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
70+
echo "CXX=aarch64-linux-gnu-g++" >> $GITHUB_ENV
71+
echo "CROSS_FILE=.github/crossfiles/arm64.txt" >> $GITHUB_ENV
72+
elif [ "${{ matrix.architecture }}" == "mips" ]; then
73+
echo "CC=mips-linux-gnu-gcc" >> $GITHUB_ENV
74+
echo "CXX=mips-linux-gnu-g++" >> $GITHUB_ENV
75+
echo "CROSS_FILE=.github/crossfiles/mips.txt" >> $GITHUB_ENV
76+
elif [ "${{ matrix.architecture }}" == "mipsel" ]; then
77+
echo "CC=mipsel-linux-gnu-gcc" >> $GITHUB_ENV
78+
echo "CXX=mipsel-linux-gnu-g++" >> $GITHUB_ENV
79+
echo "CROSS_FILE=.github/crossfiles/mipsel.txt" >> $GITHUB_ENV
80+
elif [ "${{ matrix.architecture }}" == "riscv64" ]; then
81+
echo "CC=riscv64-linux-gnu-gcc" >> $GITHUB_ENV
82+
echo "CXX=riscv64-linux-gnu-g++" >> $GITHUB_ENV
83+
echo "CROSS_FILE=.github/crossfiles/riscv64.txt" >> $GITHUB_ENV
84+
elif [ "${{ matrix.architecture }}" == "ppc" ]; then
85+
echo "CC=powerpc-linux-gnu-gcc" >> $GITHUB_ENV
86+
echo "CXX=powerpc-linux-gnu-g++" >> $GITHUB_ENV
87+
echo "CROSS_FILE=.github/crossfiles/ppc.txt" >> $GITHUB_ENV
88+
elif [ "${{ matrix.architecture }}" == "ppc64le" ]; then
89+
echo "CC=powerpc64le-linux-gnu-gcc" >> $GITHUB_ENV
90+
echo "CXX=powerpc64le-linux-gnu-g++" >> $GITHUB_ENV
91+
echo "CROSS_FILE=.github/crossfiles/ppc64le.txt" >> $GITHUB_ENV
92+
elif [ "${{ matrix.architecture }}" == "sparc64" ]; then
93+
echo "CC=sparc64-linux-gnu-gcc" >> $GITHUB_ENV
94+
echo "CXX=sparc64-linux-gnu-g++" >> $GITHUB_ENV
95+
echo "CROSS_FILE=.github/crossfiles/sparc64.txt" >> $GITHUB_ENV
96+
elif [ "${{ matrix.architecture }}" == "s390x" ]; then
97+
echo "CC=s390x-linux-gnu-gcc" >> $GITHUB_ENV
98+
echo "CXX=s390x-linux-gnu-g++" >> $GITHUB_ENV
99+
echo "CROSS_FILE=.github/crossfiles/s390x.txt" >> $GITHUB_ENV
100+
fi
101+
102+
- name: Install Meson
103+
run: |
104+
python -m pip install meson ninja
105+
106+
- name: Configure the Project
107+
run: |
108+
meson setup builddir --fatal-meson-warnings -Dwerror=true -Dwith_test=enabled -Dwarning_level=3 --cross-file $CROSS_FILE
109+
110+
- name: Build the Project
111+
run: |
112+
meson compile -C builddir
113+
114+
- name: Test the Project
115+
run: |
116+
meson test -C builddir -v --test-args='show --mode tree --verbose ci --result fail'

.github/workflows/meson_ci.yml

Lines changed: 3 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,8 @@ jobs:
6060
run: meson test -C builddir_msvc_${{ matrix.msvc_version }} -v --test-args='show --mode tree --verbose ci --result fail'
6161

6262
build_macosx:
63-
name: Building on macOS with Xcode ${{ matrix.xcode_version }}
63+
name: Building on macOS
6464
runs-on: macos-latest
65-
strategy:
66-
matrix:
67-
xcode_version: ["15.2", "15.3"]
6865
steps:
6966
- name: Checkout code
7067
uses: actions/checkout@v4
@@ -76,12 +73,8 @@ jobs:
7673
with:
7774
python-version: '3.12'
7875

79-
- name: Install Xcode
80-
run: sudo xcode-select --switch /Applications/Xcode_${{ matrix.xcode_version }}.app
81-
8276
- name: Install Meson and Ninja
83-
run: |
84-
python -m pip install meson ninja
77+
run: python -m pip install meson ninja
8578

8679
- name: Configure
8780
run: meson setup builddir --fatal-meson-warnings -Dwerror=true -Dwith_test=enabled -Dwarning_level=3
@@ -173,7 +166,7 @@ jobs:
173166

174167
strategy:
175168
matrix:
176-
distro: [ubuntu, fedora, archlinux, debian]
169+
distro: [ubuntu, fedora, archlinux, debian] # in a new experiment add alpine and opensuse
177170

178171
steps:
179172
- name: Checkout code
@@ -208,102 +201,3 @@ jobs:
208201
sudo apt update
209202
meson setup builddir --fatal-meson-warnings -Dwerror=true -Dwith_test=enabled -Dwarning_level=3
210203
meson test -C builddir -v --test-args='show --mode tree --verbose ci --result fail'"
211-
212-
build_cross:
213-
name: Building on Bedrock ${{ matrix.architecture }}
214-
runs-on: ubuntu-latest # Using Ubuntu as the base system for cross-compilation
215-
216-
strategy:
217-
matrix:
218-
architecture: [arm, arm64, mips, mipsel, riscv64, ppc, ppc64le, sparc64, s390x]
219-
220-
steps:
221-
- name: Checkout code
222-
uses: actions/checkout@v4
223-
with:
224-
fetch-depth: 0
225-
226-
- name: Set up Python
227-
uses: actions/setup-python@v5
228-
with:
229-
python-version: '3.12'
230-
231-
- name: Install Cross-Compilation Toolchain
232-
run: |
233-
sudo apt update
234-
if [ "${{ matrix.architecture }}" == "arm" ]; then
235-
sudo apt install -y gcc-arm-linux-gnueabi g++-arm-linux-gnueabi
236-
elif [ "${{ matrix.architecture }}" == "arm64" ]; then
237-
sudo apt install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
238-
elif [ "${{ matrix.architecture }}" == "mips" ]; then
239-
sudo apt install -y gcc-mips-linux-gnu g++-mips-linux-gnu
240-
elif [ "${{ matrix.architecture }}" == "mipsel" ]; then
241-
sudo apt install -y gcc-mipsel-linux-gnu g++-mipsel-linux-gnu
242-
elif [ "${{ matrix.architecture }}" == "riscv64" ]; then
243-
sudo apt install -y gcc-riscv64-linux-gnu g++-riscv64-linux-gnu
244-
elif [ "${{ matrix.architecture }}" == "ppc" ]; then
245-
sudo apt install -y gcc-powerpc-linux-gnu g++-powerpc-linux-gnu
246-
elif [ "${{ matrix.architecture }}" == "ppc64le" ]; then
247-
sudo apt install -y gcc-powerpc64le-linux-gnu g++-powerpc64le-linux-gnu
248-
elif [ "${{ matrix.architecture }}" == "sparc64" ]; then
249-
sudo apt install -y gcc-sparc64-linux-gnu g++-sparc64-linux-gnu
250-
elif [ "${{ matrix.architecture }}" == "s390x" ]; then
251-
sudo apt install -y gcc-s390x-linux-gnu g++-s390x-linux-gnu
252-
fi
253-
254-
- name: Set Cross-Compilation Environment Variables
255-
run: |
256-
if [ "${{ matrix.architecture }}" == "arm" ]; then
257-
echo "CC=arm-linux-gnueabi-gcc" >> $GITHUB_ENV
258-
echo "CXX=arm-linux-gnueabi-g++" >> $GITHUB_ENV
259-
echo "CROSS_FILE=.github/crossfiles/arm.txt" >> $GITHUB_ENV
260-
elif [ "${{ matrix.architecture }}" == "arm64" ]; then
261-
echo "CC=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
262-
echo "CXX=aarch64-linux-gnu-g++" >> $GITHUB_ENV
263-
echo "CROSS_FILE=.github/crossfiles/arm64.txt" >> $GITHUB_ENV
264-
elif [ "${{ matrix.architecture }}" == "mips" ]; then
265-
echo "CC=mips-linux-gnu-gcc" >> $GITHUB_ENV
266-
echo "CXX=mips-linux-gnu-g++" >> $GITHUB_ENV
267-
echo "CROSS_FILE=.github/crossfiles/mips.txt" >> $GITHUB_ENV
268-
elif [ "${{ matrix.architecture }}" == "mipsel" ]; then
269-
echo "CC=mipsel-linux-gnu-gcc" >> $GITHUB_ENV
270-
echo "CXX=mipsel-linux-gnu-g++" >> $GITHUB_ENV
271-
echo "CROSS_FILE=.github/crossfiles/mipsel.txt" >> $GITHUB_ENV
272-
elif [ "${{ matrix.architecture }}" == "riscv64" ]; then
273-
echo "CC=riscv64-linux-gnu-gcc" >> $GITHUB_ENV
274-
echo "CXX=riscv64-linux-gnu-g++" >> $GITHUB_ENV
275-
echo "CROSS_FILE=.github/crossfiles/riscv64.txt" >> $GITHUB_ENV
276-
elif [ "${{ matrix.architecture }}" == "ppc" ]; then
277-
echo "CC=powerpc-linux-gnu-gcc" >> $GITHUB_ENV
278-
echo "CXX=powerpc-linux-gnu-g++" >> $GITHUB_ENV
279-
echo "CROSS_FILE=.github/crossfiles/ppc.txt" >> $GITHUB_ENV
280-
elif [ "${{ matrix.architecture }}" == "ppc64le" ]; then
281-
echo "CC=powerpc64le-linux-gnu-gcc" >> $GITHUB_ENV
282-
echo "CXX=powerpc64le-linux-gnu-g++" >> $GITHUB_ENV
283-
echo "CROSS_FILE=.github/crossfiles/ppc64le.txt" >> $GITHUB_ENV
284-
elif [ "${{ matrix.architecture }}" == "sparc64" ]; then
285-
echo "CC=sparc64-linux-gnu-gcc" >> $GITHUB_ENV
286-
echo "CXX=sparc64-linux-gnu-g++" >> $GITHUB_ENV
287-
echo "CROSS_FILE=.github/crossfiles/sparc64.txt" >> $GITHUB_ENV
288-
elif [ "${{ matrix.architecture }}" == "s390x" ]; then
289-
echo "CC=s390x-linux-gnu-gcc" >> $GITHUB_ENV
290-
echo "CXX=s390x-linux-gnu-g++" >> $GITHUB_ENV
291-
echo "CROSS_FILE=.github/crossfiles/s390x.txt" >> $GITHUB_ENV
292-
fi
293-
294-
- name: Install Meson
295-
run: |
296-
python -m pip install meson ninja
297-
298-
- name: Configure the Project
299-
run: |
300-
meson setup builddir --fatal-meson-warnings -Dwerror=true -Dwith_test=enabled -Dwarning_level=3 --cross-file $CROSS_FILE
301-
302-
- name: Build the Project
303-
run: |
304-
meson compile -C builddir
305-
306-
- name: Test the Project
307-
run: |
308-
meson test -C builddir -v --test-args='show --mode tree --verbose ci --result fail'
309-

0 commit comments

Comments
 (0)