From 44979a970308679f363a7e1a153851acee29a2fe Mon Sep 17 00:00:00 2001 From: Dennis Heinze Date: Thu, 25 May 2023 08:21:08 +0200 Subject: [PATCH] Start ppc implementation --- .github/workflows/build-socat.yml | 70 ++++++++++++++++++++++++++++++- build/install_deps_alpine.sh | 2 + build/lib.sh | 22 ++++++++++ build/targets/build_socat.sh | 2 +- 4 files changed, 93 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-socat.yml b/.github/workflows/build-socat.yml index feef419..882a1a2 100644 --- a/.github/workflows/build-socat.yml +++ b/.github/workflows/build-socat.yml @@ -1,6 +1,8 @@ name: socat on: - workflow_dispatch + push: + branches: + - socat-ppc jobs: build-x86: name: Build socat x86 @@ -116,10 +118,74 @@ jobs: name: ${{ steps.build_socat.outputs.PACKAGED_NAME }} path: ${{ steps.build_socat.outputs.PACKAGED_NAME_PATH }} + build-ppc32: + name: Build socat powerpc32 + runs-on: ubuntu-latest + container: muslcc/x86_64:powerpc-linux-musl + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install dependencies + run: sudo apk update && sudo apk add bash && sudo bash build/install_deps_alpine.sh + + - name: Install testing dependencies + run: apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing yodl + + - name: Install build compiler + run: /bin/sh -c "apk update && apk upgrade && apk add --no-cache curl rsync sudo util-linux && cd / && curl -so ${ARCH}-cross.tgz ${HOST}/${ARCH}-cross.tgz && tar -xf ${ARCH}-cross.tgz && rm ${ARCH}-cross.tgz && cd ${ARCH}-cross" + env: + ARCH: x86_64-linux-musl + HOST: http://musl.cc/ + TEMP: /tmp + USER: 0 + + - name: Build socat + id: build_socat + run: $GITHUB_WORKSPACE/build/targets/build_socat.sh ppc32 + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.build_socat.outputs.PACKAGED_NAME }} + path: ${{ steps.build_socat.outputs.PACKAGED_NAME_PATH }} + + build-ppc64: + name: Build socat powerpc64 + runs-on: ubuntu-latest + container: muslcc/x86_64:powerpc64-linux-musl + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install dependencies + run: sudo apk update && sudo apk add bash && sudo bash build/install_deps_alpine.sh + + - name: Install testing dependencies + run: apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing yodl + + - name: Install build compiler + run: /bin/sh -c "apk update && apk upgrade && apk add --no-cache curl rsync sudo util-linux && cd / && curl -so ${ARCH}-cross.tgz ${HOST}/${ARCH}-cross.tgz && tar -xf ${ARCH}-cross.tgz && rm ${ARCH}-cross.tgz && cd ${ARCH}-cross" + env: + ARCH: x86_64-linux-musl + HOST: http://musl.cc/ + TEMP: /tmp + USER: 0 + + - name: Build socat + id: build_socat + run: $GITHUB_WORKSPACE/build/targets/build_socat.sh ppc64 + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.build_socat.outputs.PACKAGED_NAME }} + path: ${{ steps.build_socat.outputs.PACKAGED_NAME_PATH }} + create-release: name: Create socat Release runs-on: ubuntu-latest - needs: [build-x86, build-x86_64, build-armhf, build-aarch64] + needs: [build-x86, build-x86_64, build-armhf, build-aarch64, build-ppc32, build-ppc64] steps: - name: Checkout uses: actions/checkout@v2 diff --git a/build/install_deps_alpine.sh b/build/install_deps_alpine.sh index 3f916b0..15b52b7 100755 --- a/build/install_deps_alpine.sh +++ b/build/install_deps_alpine.sh @@ -13,6 +13,8 @@ apk add \ libtool \ qemu-arm \ qemu-aarch64 \ + qemu-ppc \ + qemu-ppc64 \ file \ texinfo \ zip \ diff --git a/build/lib.sh b/build/lib.sh index 8107faa..3d09984 100755 --- a/build/lib.sh +++ b/build/lib.sh @@ -47,6 +47,10 @@ get_host_triple(){ host="arm-linux-musleabihf" elif [ "$CURRENT_ARCH" == "aarch64" ];then host="aarch64-linux-musl" + elif [ "$CURRENT_ARCH" == "ppc32" ];then + host="powerpc-linux-musl" + elif [ "$CURRENT_ARCH" == "ppc64" ];then + host="powerpc64-linux-musl" fi echo $host } @@ -145,6 +149,20 @@ get_version(){ else echo "qemu-aarch64 not found, skipping AARCH64 version checks." >&2 fi + elif [ "$CURRENT_ARCH" == "ppc32" ];then + if which qemu-ppc 1>&2 2>/dev/null;then + cmd="qemu-ppc ${cmd}" + version+=$(eval "$cmd") + else + echo "qemu-ppc not found, skipping ppc32 version checks." >&2 + fi + elif [ "$CURRENT_ARCH" == "ppc64" ];then + if which qemu-ppc64 1>&2 2>/dev/null;then + cmd="qemu-ppc64 ${cmd}" + version+=$(eval "$cmd") + else + echo "qemu-ppc64 not found, skipping ppc64 version checks." >&2 + fi else version+=$(eval "$cmd") fi @@ -214,6 +232,10 @@ lib_build_openssl(){ openssl_arch="linux-x86_64" elif [ "${CURRENT_ARCH}" == "aarch64" ];then openssl_arch="linux-generic64" + elif [ "${CURRENT_ARCH}" == "ppc32" ];then + openssl_arch="linux-ppc" + elif [ "${CURRENT_ARCH}" == "ppc64" ];then + openssl_arch="linux-ppc" fi CFLAGS="${GCC_OPTS}" \ ./Configure \ diff --git a/build/targets/build_socat.sh b/build/targets/build_socat.sh index d09b841..5550a88 100755 --- a/build/targets/build_socat.sh +++ b/build/targets/build_socat.sh @@ -4,7 +4,7 @@ if [ -z "$GITHUB_WORKSPACE" ];then exit 1 fi if [ "$#" -ne 1 ];then - echo "Usage: ${0} [x86|x86_64|armhf|aarch64]" + echo "Usage: ${0} [x86|x86_64|armhf|aarch64|ppc32|ppc64]" echo "Example: ${0} x86_64" exit 1 fi