Skip to content

Commit

Permalink
github bot: port the build workflow to meson
Browse files Browse the repository at this point in the history
* Install meson and ninja
* Create a cross compilation file when cross compiling

Signed-off-by: Florian Fischer <[email protected]>
  • Loading branch information
fischerling committed Jun 28, 2022
1 parent 1e76ec6 commit b71c445
Showing 1 changed file with 44 additions and 7 deletions.
51 changes: 44 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,56 +28,64 @@ jobs:
cxx: clang++

# x86 (32-bit) gcc
- arch: i686
- arch: x86
cpu: i686
cc_pkg: gcc-i686-linux-gnu
cxx_pkg: g++-i686-linux-gnu
cc: i686-linux-gnu-gcc
cxx: i686-linux-gnu-g++

# aarch64 gcc
- arch: aarch64
cpu: aarch64
cc_pkg: gcc-aarch64-linux-gnu
cxx_pkg: g++-aarch64-linux-gnu
cc: aarch64-linux-gnu-gcc
cxx: aarch64-linux-gnu-g++

# arm (32-bit) gcc
- arch: arm
cpu: arm
cc_pkg: gcc-arm-linux-gnueabi
cxx_pkg: g++-arm-linux-gnueabi
cc: arm-linux-gnueabi-gcc
cxx: arm-linux-gnueabi-g++

# powerpc64
- arch: powerpc64
- arch: ppc64
cpu: ppc64
cc_pkg: gcc-powerpc64-linux-gnu
cxx_pkg: g++-powerpc64-linux-gnu
cc: powerpc64-linux-gnu-gcc
cxx: powerpc64-linux-gnu-g++

# powerpc
- arch: powerpc
- arch: ppc
cpu: ppc
cc_pkg: gcc-powerpc-linux-gnu
cxx_pkg: g++-powerpc-linux-gnu
cc: powerpc-linux-gnu-gcc
cxx: powerpc-linux-gnu-g++

# alpha
- arch: alpha
cpu: alpha
cc_pkg: gcc-alpha-linux-gnu
cxx_pkg: g++-alpha-linux-gnu
cc: alpha-linux-gnu-gcc
cxx: alpha-linux-gnu-g++

# mips64
- arch: mips64
cpu: mips64
cc_pkg: gcc-mips64-linux-gnuabi64
cxx_pkg: g++-mips64-linux-gnuabi64
cc: mips64-linux-gnuabi64-gcc
cxx: mips64-linux-gnuabi64-g++

# mips
- arch: mips
cpu: mips
cc_pkg: gcc-mips-linux-gnu
cxx_pkg: g++-mips-linux-gnu
cc: mips-linux-gnu-gcc
Expand All @@ -90,6 +98,15 @@ jobs:
- name: Checkout source
uses: actions/checkout@v2

- name: Install meson
run: |
sudo pip install meson;
- name: Install ninja
run: |
wget -qO /tmp/ninja.gz https://github.com/ninja-build/ninja/releases/latest/download/ninja-linux.zip;
sudo bash -c 'cd /tmp; gunzip /tmp/ninja.gz; install -m 755 ninja /usr/bin/ninja';
- name: Install Compilers
run: |
if [[ "${{matrix.cc_pkg}}" == "clang" ]]; then \
Expand All @@ -107,17 +124,37 @@ jobs:
${{matrix.cc}} --version;
${{matrix.cxx}} --version;
- name: Generate meson cross file
run: |
if [[ "${{matrix.arch}}" != "x86_64" ]]; then \
echo -e "[host_machine]\nsystem = 'linux'"; \
echo "cpu_family = '${{matrix.arch}}'"; \
echo "cpu = '${{matrix.arch}}'"; \
echo "endian = 'big'"; \
echo -e "[binaries]\nc = '/usr/bin/${{matrix.cc}}'"; \
echo "cpp = '/usr/bin/${{matrix.cxx}}'"; \
fi > /tmp/cross-env.txt;
- name: Build
run: |
./configure --cc=${{matrix.cc}} --cxx=${{matrix.cxx}};
make -j$(nproc) V=1 CPPFLAGS="-Werror" CFLAGS="$FLAGS" CXXFLAGS="$FLAGS";
if [[ "${{matrix.arch}}" == "x86_64" ]]; then \
if [[ "${{matrix.cc}}" == "clang" ]]; then \
make CC=${{matrix.cc}} CXX=${{matrix.cxx}} CPPFLAGS="-Werror" CFLAGS="$FLAGS" CXXFLAGS="$FLAGS"; \
else \
make CPPFLAGS="-Werror" CFLAGS="$FLAGS" CXXFLAGS="$FLAGS"; \
fi; \
else \
CPPFLAGS="-Werror" CFLAGS="$FLAGS" CXXFLAGS="$FLAGS" meson build --cross-file /tmp/cross-env.txt; \
ninja -C build -j$(nproc); \
fi;
- name: Build nolibc
run: |
if [[ "${{matrix.arch}}" == "x86_64" || "${{matrix.arch}}" == "i686" ]]; then \
make clean; \
./configure --cc=${{matrix.cc}} --cxx=${{matrix.cxx}} --nolibc; \
make -j$(nproc) V=1 CPPFLAGS="-Werror" CFLAGS="$FLAGS" CXXFLAGS="$FLAGS"; \
CC=${{matrix.cc}} CXX=${{matrix.cxx}} CPPFLAGS="-Werror" CFLAGS="$FLAGS" CXXFLAGS="$FLAGS" meson setup build -Dnolibc=true -Dtests=true -Dexamples=true; \
ninja -C build -j$(nproc); \
else \
echo "Skipping nolibc build, this arch doesn't support building liburing without libc"; \
fi;
Expand Down

0 comments on commit b71c445

Please sign in to comment.