Skip to content

Commit

Permalink
ppc support
Browse files Browse the repository at this point in the history
  • Loading branch information
rootTHC committed Mar 26, 2024
1 parent c1f4d96 commit 7f530e0
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 9 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/static-release-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ jobs:
Linux-Cross-Compile:
strategy:
matrix:
arch: [x86_64, aarch64, mips64, mips32, mipsel, i686, arm, armv6, armv7l]
arch: [x86_64, aarch64, mips64, mips32, mipsel, i686, arm, armv6, armv7l, ppc32, ppc64, ppc32le, ppc64le]
include:
- arch: x86_64
cc: x86_64-linux-musl
Expand Down Expand Up @@ -231,6 +231,18 @@ jobs:
- arch: armv7l
cc: armv7l-linux-musleabihf
ssl: linux-generic32
- arch: ppc32
cc: powerpc-linux-muslsf # Big Endian, 32bit
ssl: linux-ppc
- arch: ppc64
cc: powerpc64-linux-musl # Big Endian, 64bit
ssl: linux-generic64
- arch: ppc32le
cc: powerpcle-linux-muslsf # Little Endian, 32bit
ssl: linux-ppc
- arch: ppc64le
cc: powerpc64le-linux-muslsf # Little Endian, 64bit
ssl: linux-generic64
runs-on: ubuntu-latest
container:
image: muslcc/x86_64:${{ matrix.cc }}
Expand Down
40 changes: 32 additions & 8 deletions deploy/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# - Do not start gs-netcat (for testing purpose only)
# GS_NOINST=1
# - Do not install gsocket
# GS_OSARCH=x86_64-alpine
# GS_OSARCH=linux-x86_64
# - Force architecutre to a specific package (for testing purpose only)
# GS_PREFIX=
# - Use 'path' instead of '/' (needed for packaging/testing)
Expand Down Expand Up @@ -619,6 +619,14 @@ is_le()
return 255
}

# Return 0 (TRUE) if it is 64 bit arch. Default is FALSE (32bit)
is_64bit() {
command -v getconf >/dev/null && [[ "$(getconf LONG_BIT)" == "64" ]] && return 0
command -v lscpu >/dev/null && [[ "$(lscpu)" == *"64-bit"* ]] && return 0
command -v uname >/dev/null && [[ "$(uname -m)" == *"64"* ]] && return 0
return 255
}

init_vars()
{
# Select binary
Expand Down Expand Up @@ -660,7 +668,7 @@ init_vars()
if [[ -z "$OSARCH" ]]; then
if [[ $OSTYPE == *linux* ]]; then
if [[ "$arch" == "i686" ]] || [[ "$arch" == "i386" ]]; then
OSARCH="i386-alpine"
OSARCH="i386-linux"
SRC_PKG="gs-netcat_mini-linux-i686"
elif [[ "$arch" == *"armv6"* ]]; then
OSARCH="arm-linux"
Expand All @@ -675,20 +683,36 @@ init_vars()
OSARCH="aarch64-linux"
SRC_PKG="gs-netcat_mini-linux-aarch64"
elif [[ "$arch" == "mips64" ]]; then
OSARCH="mips64-alpine"
OSARCH="mips64-linux"
SRC_PKG="gs-netcat_mini-linux-mips64"
# Go 32-bit if Little Endian even if 64bit arch
is_le && {
OSARCH="mipsel32-alpine"
OSARCH="mipsel32-linux"
SRC_PKG="gs-netcat_mini-linux-mipsel"
}
elif [[ "$arch" == *mips* ]]; then
OSARCH="mips32-alpine"
OSARCH="mips32-linux"
SRC_PKG="gs-netcat_mini-linux-mips32"
is_le && {
OSARCH="mipsel32-alpine"
OSARCH="mipsel32-linux"
SRC_PKG="gs-netcat_mini-linux-mipsel"
}
elif [[ "$arch" == *"ppc"* ]]; then
if is_64bit; then
OSARCH="ppc64-linux"
SRC_PKG="gs-netcat_mini-linux-ppc64"
is_le && {
OSARCH="ppc64le-linux"
SRC_PKG="gs-netcat_mini-linux-ppc64le"
}
else
OS_ARCH="ppc32-linux"
SRC_PKG="gs-netcat_mini-linux-ppc32"
is_le && {
OSARCH="ppc32le-linux"
SRC_PKG="gs-netcat_mini-linux-ppc32le"
}
fi
fi
elif [[ $OSTYPE == *darwin* ]]; then
if [[ "$arch" == "arm64" ]]; then
Expand All @@ -715,7 +739,7 @@ init_vars()

[[ -z "$OSARCH" ]] && {
# Default: Try Alpine(muscl libc) 64bit
OSARCH="x86_64-alpine"
OSARCH="x86_64-linux"
SRC_PKG="gs-netcat_mini-linux-x86_64"
}
fi
Expand All @@ -728,7 +752,7 @@ init_vars()
try_encode "base64" "base64 -w0" "base64 -d"
try_encode "xxd" "xxd -ps -c1024" "xxd -r -ps"
DEBUGF "ENCODE_STR='${ENCODE_STR}'"
[[ -z "$SRC_PKG" ]] && SRC_PKG="gs-netcat_${OSARCH}.tar.gz"
[[ -z "$SRC_PKG" ]] && SRC_PKG="gs-netcat_mini-${OSARCH}.tar.gz"

# OSX's pkill matches the hidden name and not the original binary name.
# Because we hide as '-bash' we can not use pkill all -bash.
Expand Down

0 comments on commit 7f530e0

Please sign in to comment.