]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
ci: add OpenWrt SDK based CI jobs
authorThomas Weißschuh <thomas@t-8ch.de>
Fri, 19 May 2023 09:38:18 +0000 (11:38 +0200)
committerThomas Weißschuh <thomas@t-8ch.de>
Fri, 19 May 2023 21:16:48 +0000 (23:16 +0200)
This allows testing some more exotic architectures and libcs.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
.github/workflows/cibuild-setup-ubuntu.sh
.github/workflows/cibuild.sh
.github/workflows/cibuild.yml
.github/workflows/openwrt-sdk-env.sh [new file with mode: 0755]

index de9f8a85c52c9d4f71c51eeaebade251ed13389c..89780b464997868b4b56b0bb31f369daee715dcf 100755 (executable)
@@ -58,7 +58,9 @@ bash -c "echo 'deb-src http://archive.ubuntu.com/ubuntu/ $RELEASE main restricte
 # cov-build fails to compile util-linux when CC is set to gcc-*
 # so let's just install and use the default compiler
 if [[ "$COMPILER_VERSION" == "" ]]; then
-    PACKAGES+=("$COMPILER")
+    if [[ "$COMPILER" != "none" ]]; then
+       PACKAGES+=("$COMPILER")
+    fi
 elif [[ "$COMPILER" == clang ]]; then
     # Latest LLVM stack deb packages provided by https://apt.llvm.org/
     # Following snippet was borrowed from https://apt.llvm.org/llvm.sh
index 9c1ed5494ee7d1e7d64a932d2202f52d168e56a7..909126f48ab2673f61a8fe77ebfc34615c09dcc1 100755 (executable)
@@ -104,6 +104,10 @@ for phase in "${PHASES[@]}"; do
             CXXFLAGS+=(-shared-libasan)
         fi
 
+       if [[ "$HOST_TRIPLET" != "" ]]; then
+               opts+=(--host "$HOST_TRIPLET")
+       fi
+
         git clean -xdf
 
         ./autogen.sh
index 4372e05ccee1905cf9807c6af06cabe17e72be43..236083d5b13eee143f6b684828f3dbc2efc5b507 100644 (file)
@@ -133,3 +133,51 @@ jobs:
             .github/workflows/cibuild.sh CONFIGURE MAKE
             # Check
             .github/workflows/cibuild.sh CHECK
+  build-openwrt:
+    name: build (openwrt, ${{ matrix.target }})
+    runs-on: ubuntu-latest
+    strategy:
+      fail-fast: false
+      matrix:
+        include:
+          - target: ipq40xx
+            subtarget: generic
+            abi: musl_eabi
+          - target: ath79
+            subtarget: generic
+            abi: musl
+          - target: bcm63xx
+            subtarget: generic
+            abi: musl
+          - target: mpc85xx
+            subtarget: p2020
+            abi: musl
+          - target: archs38
+            subtarget: generic
+            abi: glibc
+    env:
+      COMPILER: none
+    steps:
+      - name: Repository checkout
+        uses: actions/checkout@v1
+      - name: Ubuntu setup
+        run: sudo -E .github/workflows/cibuild-setup-ubuntu.sh
+      - name: OpenWrt environment
+        run: |
+          OPENWRT_RELEASE=22.03.5
+          OPENWRT_SDK=openwrt-sdk-$OPENWRT_RELEASE-${{ matrix.target }}-${{ matrix.subtarget }}_gcc-11.2.0_${{ matrix.abi }}.Linux-x86_64
+          echo "COMPILER=$COMPILER" >> $GITHUB_ENV
+          echo "OPENWRT_RELEASE=$OPENWRT_RELEASE" >> $GITHUB_ENV
+          echo "OPENWRT_SDK=$OPENWRT_SDK" >> $GITHUB_ENV
+      - name: Download toolchain
+        run: |
+          curl -o ~/${{ env.OPENWRT_SDK }}.tar.xz -C - https://downloads.cdn.openwrt.org/releases/${{ env.OPENWRT_RELEASE }}/targets/${{ matrix.target }}/${{ matrix.subtarget }}/${{ env.OPENWRT_SDK }}.tar.xz
+          tar xf ~/${{ env.OPENWRT_SDK }}.tar.xz -C ~
+      - name: Configure
+        run: |
+          source .github/workflows/openwrt-sdk-env.sh  ~/${{ env.OPENWRT_SDK }}
+          .github/workflows/cibuild.sh CONFIGURE
+      - name: Make
+        run: |
+          source .github/workflows/openwrt-sdk-env.sh  ~/${{ env.OPENWRT_SDK }}
+          .github/workflows/cibuild.sh MAKE
diff --git a/.github/workflows/openwrt-sdk-env.sh b/.github/workflows/openwrt-sdk-env.sh
new file mode 100755 (executable)
index 0000000..c3d618d
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+sdk="$(realpath $1)"
+
+STAGING_DIR="$(echo "$sdk"/staging_dir/toolchain-*)"
+
+. "$STAGING_DIR/info.mk"
+
+PATH="$sdk/staging_dir/host/bin:$PATH"
+CC="$STAGING_DIR/bin/${TARGET_CROSS}gcc"
+BISON_PKGDATADIR="$sdk/staging_dir/host/share/bison"
+M4="$sdk/staging_dir/host/bin/m4"
+HOST_TRIPLET="$("$CC" -dumpmachine)"
+
+echo "Building for $HOST_TRIPLET from $sdk"
+
+export STAGING_DIR PATH CC BISON_PKGDATADIR M4 HOST_TRIPLET