Skip to content

Commit

Permalink
Add support for linux/ppc64le and linux/s390x archs (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
crazy-max committed Nov 8, 2020
1 parent 19fe328 commit 0aa08b3
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## base-2.2.0, go-1.13-r20, go-1.14-r15, go-1.15-r6 (2020/11/08)

* Add support for `linux/ppc64le` and `linux/s390x` archs (#18)

## go-1.14-r14, go-1.15-r5 (2020/11/06)

* Go 1.14.11, 1.15.4
Expand Down
2 changes: 1 addition & 1 deletion doc/usage/limit-build-targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ argument:
The supported targets are:

* Platforms: `darwin`, `linux`, `windows`
* Achitectures: `386`, `amd64`, `arm-5`, `arm-6`, `arm-7`, `arm64`, `mips`, `mipsle`, `mips64`, `mips64le`
* Achitectures: `386`, `amd64`, `arm-5`, `arm-6`, `arm-7`, `arm64`, `mips`, `mipsle`, `mips64`, `mips64le`, `ppc64le`, `s390x`
6 changes: 6 additions & 0 deletions docker/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ RUN apt-get update \
g++-*-mips64-linux-gnuabi64 \
g++-*-mips64el-linux-gnuabi64 \
g++-*-multilib \
g++-*-powerpc64le-linux-gnu \
g++-*-s390x-linux-gnu \
g++-mingw-w64 \
gcc-*-aarch64-linux-gnu \
gcc-*-arm-linux-gnueabi \
Expand All @@ -38,6 +40,8 @@ RUN apt-get update \
gcc-*-mips64-linux-gnuabi64 \
gcc-*-mips64el-linux-gnuabi64 \
gcc-*-multilib \
gcc-*-powerpc64le-linux-gnu \
gcc-*-s390x-linux-gnu \
gcc-mingw-w64 \
git \
help2man \
Expand All @@ -48,6 +52,8 @@ RUN apt-get update \
libc*-dev-mipsel-cross \
libc*-dev-mips64-cross \
libc*-dev-mips64el-cross \
libc*-dev-ppc64el-cross \
libc*-dev-s390x-cross \
libssl-dev \
libtool \
libxml2-dev \
Expand Down
6 changes: 6 additions & 0 deletions docker/base/bootstrap_pure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ if [ $GO_VERSION -ge 180 ]; then

echo "Bootstrapping linux/mipsle..."
GOOS=linux GOARCH=mipsle CGO_ENABLED=1 CC=mipsel-linux-gnu-gcc-$CC_CXX_VERSION go install std

echo "Bootstrapping linux/ppc64le..."
GOOS=linux GOARCH=ppc64le CGO_ENABLED=1 CC=powerpc64le-linux-gnu-gcc-$CC_CXX_VERSION go install std

echo "Bootstrapping linux/s390x..."
GOOS=linux GOARCH=s390x CGO_ENABLED=1 CC=s390x-linux-gnu-gcc-$CC_CXX_VERSION go install std
fi

echo "Bootstrapping windows/amd64..."
Expand Down
28 changes: 28 additions & 0 deletions docker/base/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,34 @@ for TARGET in $TARGETS; do
CC=mipsel-linux-gnu-gcc-$CC_CXX_VERSION CXX=mipsel-linux-gnu-g++-$CC_CXX_VERSION GOOS=linux GOARCH=mipsle CGO_ENABLED=1 go build $V $X $MOD "${T[@]}" --ldflags="$V $LD" $BM -o "/build/$NAME-linux-mipsle`extension linux`" $PACK_RELPATH
fi
fi
if ([ $XGOOS == "." ] || [ $XGOOS == "linux" ]) && ([ $XGOARCH == "." ] || [ $XGOARCH == "ppc64le" ]); then
if [ "$GO_VERSION" -lt 180 ]; then
echo "Go version too low, skipping linux/ppc64le..."
else
echo "Compiling for linux/ppc64le..."
CC=powerpc64le-linux-gnu-gcc-$CC_CXX_VERSION CXX=powerpc64le-linux-gnu-g++-$CC_CXX_VERSION HOST=powerpc64le-linux-gnu PREFIX=/usr/powerpc64le-linux-gnu $BUILD_DEPS /deps ${DEPS_ARGS[@]}
export PKG_CONFIG_PATH=/usr/powerpc64le-linux-gnu/lib/pkgconfig

if [[ "$USEMODULES" == false ]]; then
CC=powerpc64le-linux-gnu-gcc-$CC_CXX_VERSION CXX=powerpc64le-linux-gnu-g++-$CC_CXX_VERSION GOOS=linux GOARCH=ppc64le CGO_ENABLED=1 go get $V $X "${T[@]}" --ldflags="$V $LD" -d $PACK_RELPATH
fi
CC=powerpc64le-linux-gnu-gcc-$CC_CXX_VERSION CXX=powerpc64le-linux-gnu-g++-$CC_CXX_VERSION GOOS=linux GOARCH=ppc64le CGO_ENABLED=1 go build $V $X $MOD "${T[@]}" --ldflags="$V $LD" $BM -o "/build/$NAME-linux-ppc64le`extension linux`" $PACK_RELPATH
fi
fi
if ([ $XGOOS == "." ] || [ $XGOOS == "linux" ]) && ([ $XGOARCH == "." ] || [ $XGOARCH == "s390x" ]); then
if [ "$GO_VERSION" -lt 180 ]; then
echo "Go version too low, skipping linux/s390x..."
else
echo "Compiling for linux/s390x..."
CC=s390x-linux-gnu-gcc-$CC_CXX_VERSION CXX=s390x-linux-gnu-g++-$CC_CXX_VERSION HOST=s390x-linux-gnu PREFIX=/usr/s390x-linux-gnu $BUILD_DEPS /deps ${DEPS_ARGS[@]}
export PKG_CONFIG_PATH=/usr/s390x-linux-gnu/lib/pkgconfig

if [[ "$USEMODULES" == false ]]; then
CC=s390x-linux-gnu-gcc-$CC_CXX_VERSION CXX=s390x-linux-gnu-g++-$CC_CXX_VERSION GOOS=linux GOARCH=s390x CGO_ENABLED=1 go get $V $X "${T[@]}" --ldflags="$V $LD" -d $PACK_RELPATH
fi
CC=s390x-linux-gnu-gcc-$CC_CXX_VERSION CXX=s390x-linux-gnu-g++-$CC_CXX_VERSION GOOS=linux GOARCH=s390x CGO_ENABLED=1 go build $V $X $MOD "${T[@]}" --ldflags="$V $LD" $BM -o "/build/$NAME-linux-s390x`extension linux`" $PACK_RELPATH
fi
fi
# Check and build for Windows targets
if [ $XGOOS == "." ] || [[ $XGOOS == windows* ]]; then
# Split the platform version and configure the Windows NT version
Expand Down

0 comments on commit 0aa08b3

Please sign in to comment.