From 554ea5114812c1764e9b8bd8946e9f69ed04e111 Mon Sep 17 00:00:00 2001 From: no92 Date: Mon, 18 Mar 2024 20:23:07 +0100 Subject: [PATCH] ci: add a CI job for compiling with clang --- .github/workflows/ci.yml | 10 +++++++++- ci/bootstrap.yml | 18 ++++++++++-------- ...cross-file => linux-aarch64-gcc.cross-file} | 0 ...cross-file => linux-riscv64-gcc.cross-file} | 0 ...x86.cross-file => linux-x86-gcc.cross-file} | 0 ci/linux-x86_64-clang.cross-file | 11 +++++++++++ ....cross-file => linux-x86_64-gcc.cross-file} | 0 7 files changed, 30 insertions(+), 9 deletions(-) rename ci/{linux-aarch64.cross-file => linux-aarch64-gcc.cross-file} (100%) rename ci/{linux-riscv64.cross-file => linux-riscv64-gcc.cross-file} (100%) rename ci/{linux-x86.cross-file => linux-x86-gcc.cross-file} (100%) create mode 100644 ci/linux-x86_64-clang.cross-file rename ci/{linux-x86_64.cross-file => linux-x86_64-gcc.cross-file} (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 77a3262679..23506ac1e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,6 +8,13 @@ jobs: matrix: arch: [x86_64, riscv64, aarch64, x86] builds: [mlibc, mlibc-static, mlibc-shared, mlibc-ansi-only, mlibc-headers-only] + compiler: [gcc, clang] + exclude: + - compiler: clang + include: + - arch: x86_64 + builds: mlibc + compiler: clang name: Build mlibc runs-on: ubuntu-20.04 container: @@ -18,7 +25,7 @@ jobs: apt-get update apt-get install -y ninja-build qemu-user \ python3-setuptools python3-jsonschema \ - python3-pexpect python3-pip netbase + python3-pexpect python3-pip netbase clang lld pip install --break-system-packages -U xbstrap pyexpect meson - name: Prepare directories run: | @@ -39,6 +46,7 @@ jobs: cat > bootstrap-site.yml << EOF define_options: arch: ${{matrix.arch}} + compiler: ${{matrix.compiler}} EOF xbstrap init ../src working-directory: build/ diff --git a/ci/bootstrap.yml b/ci/bootstrap.yml index f166bcc44c..4f353f2cd2 100644 --- a/ci/bootstrap.yml +++ b/ci/bootstrap.yml @@ -1,6 +1,8 @@ declare_options: - name: arch default: x86_64 + - name: compiler + default: gcc sources: - name: mlibc @@ -13,7 +15,7 @@ sources: format: 'tar.xz' version: '6.1.8' -tools: +tools: [] packages: - name: mlibc @@ -28,14 +30,14 @@ packages: - '--prefix=/usr' - '--libdir=lib' - '--buildtype=debugoptimized' - - "-Dc_args=['-Wno-error=maybe-uninitialized']" - - "-Dcpp_args=['-Wno-error=maybe-uninitialized']" + - "-Dc_args=['-Wno-error=maybe-uninitialized', '-Wno-unknown-warning-option']" + - "-Dcpp_args=['-Wno-error=maybe-uninitialized', '-Wno-unknown-warning-option']" - "-Dbuild_tests=true" - "-Db_sanitize=undefined" - "-Ddefault_library=both" - "-Dwerror=true" - '-Dlinux_kernel_headers=@BUILD_ROOT@/packages/linux-headers/usr/include' - - "--cross-file=@THIS_SOURCE_DIR@/ci/linux-@OPTION:arch@.cross-file" + - "--cross-file=@THIS_SOURCE_DIR@/ci/linux-@OPTION:arch@-@OPTION:compiler@.cross-file" - '@THIS_SOURCE_DIR@' environ: CFLAGS: '-Wno-error=maybe-uninitialized' @@ -66,7 +68,7 @@ packages: - "-Ddefault_library=static" - "-Dwerror=true" - '-Dlinux_kernel_headers=@BUILD_ROOT@/packages/linux-headers/usr/include' - - "--cross-file=@THIS_SOURCE_DIR@/ci/linux-@OPTION:arch@.cross-file" + - "--cross-file=@THIS_SOURCE_DIR@/ci/linux-@OPTION:arch@-@OPTION:compiler@.cross-file" - '@THIS_SOURCE_DIR@' build: - args: ['ninja'] @@ -93,7 +95,7 @@ packages: - "-Ddefault_library=shared" - "-Dwerror=true" - '-Dlinux_kernel_headers=@BUILD_ROOT@/packages/linux-headers/usr/include' - - "--cross-file=@THIS_SOURCE_DIR@/ci/linux-@OPTION:arch@.cross-file" + - "--cross-file=@THIS_SOURCE_DIR@/ci/linux-@OPTION:arch@-@OPTION:compiler@.cross-file" - '@THIS_SOURCE_DIR@' build: - args: ['ninja'] @@ -125,7 +127,7 @@ packages: - "-Ddisable_glibc_option=true" - "-Ddisable_bsd_option=true" - '-Dlinux_kernel_headers=@BUILD_ROOT@/packages/linux-headers/usr/include' - - "--cross-file=@THIS_SOURCE_DIR@/ci/linux-@OPTION:arch@.cross-file" + - "--cross-file=@THIS_SOURCE_DIR@/ci/linux-@OPTION:arch@-@OPTION:compiler@.cross-file" - '@THIS_SOURCE_DIR@' build: - args: ['ninja'] @@ -152,7 +154,7 @@ packages: - "-Dwerror=true" - "-Dheaders_only=true" - '-Dlinux_kernel_headers=@BUILD_ROOT@/packages/linux-headers/usr/include' - - "--cross-file=@THIS_SOURCE_DIR@/ci/linux-@OPTION:arch@.cross-file" + - "--cross-file=@THIS_SOURCE_DIR@/ci/linux-@OPTION:arch@-@OPTION:compiler@.cross-file" - '@THIS_SOURCE_DIR@' build: - args: ['ninja'] diff --git a/ci/linux-aarch64.cross-file b/ci/linux-aarch64-gcc.cross-file similarity index 100% rename from ci/linux-aarch64.cross-file rename to ci/linux-aarch64-gcc.cross-file diff --git a/ci/linux-riscv64.cross-file b/ci/linux-riscv64-gcc.cross-file similarity index 100% rename from ci/linux-riscv64.cross-file rename to ci/linux-riscv64-gcc.cross-file diff --git a/ci/linux-x86.cross-file b/ci/linux-x86-gcc.cross-file similarity index 100% rename from ci/linux-x86.cross-file rename to ci/linux-x86-gcc.cross-file diff --git a/ci/linux-x86_64-clang.cross-file b/ci/linux-x86_64-clang.cross-file new file mode 100644 index 0000000000..36492af397 --- /dev/null +++ b/ci/linux-x86_64-clang.cross-file @@ -0,0 +1,11 @@ +[binaries] +c = 'clang' +c_ld = 'lld' +cpp = 'clang++' +cpp_ld = 'lld' + +[host_machine] +system = 'linux' +cpu_family = 'x86_64' +cpu = 'x86_64' +endian = 'little' diff --git a/ci/linux-x86_64.cross-file b/ci/linux-x86_64-gcc.cross-file similarity index 100% rename from ci/linux-x86_64.cross-file rename to ci/linux-x86_64-gcc.cross-file