From c408ba579921c7998d8abf0cee68f1b13fb6821d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Wed, 1 Mar 2017 16:58:19 +0200 Subject: [PATCH] Add support for mips32 and mips32le cross builds too. --- README.md | 2 +- docker/base/Dockerfile | 2 ++ docker/base/bootstrap_pure.sh | 8 ++++++++ docker/base/build.sh | 24 ++++++++++++++++++++++++ 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ce362f2..c942926 100644 --- a/README.md +++ b/README.md @@ -192,7 +192,7 @@ argument: The supported targets are: * Platforms: `android`, `darwin`, `ios`, `linux`, `windows` - * Achitectures: `386`, `amd64`, `arm-5`, `arm-6`, `arm-7`, `arm64` + * Achitectures: `386`, `amd64`, `arm-5`, `arm-6`, `arm-7`, `arm64`, `mips`, `mipsle`, `mips64`, `mips64le` ### Platform versions diff --git a/docker/base/Dockerfile b/docker/base/Dockerfile index 1d66594..721637a 100644 --- a/docker/base/Dockerfile +++ b/docker/base/Dockerfile @@ -29,6 +29,8 @@ RUN \ gcc-5-arm-linux-gnueabi g++-5-arm-linux-gnueabi libc6-dev-armel-cross \ gcc-5-arm-linux-gnueabihf g++-5-arm-linux-gnueabihf libc6-dev-armhf-cross \ gcc-5-aarch64-linux-gnu g++-5-aarch64-linux-gnu libc6-dev-arm64-cross \ + gcc-5-mips-linux-gnu g++-5-mips-linux-gnu libc6-dev-mips-cross \ + gcc-5-mipsel-linux-gnu g++-5-mipsel-linux-gnu libc6-dev-mipsel-cross \ gcc-5-mips64-linux-gnuabi64 g++-5-mips64-linux-gnuabi64 libc6-dev-mips64-cross \ gcc-5-mips64el-linux-gnuabi64 g++-5-mips64el-linux-gnuabi64 libc6-dev-mips64el-cross \ gcc-5-multilib g++-5-multilib gcc-mingw-w64 g++-mingw-w64 clang llvm-dev \ diff --git a/docker/base/bootstrap_pure.sh b/docker/base/bootstrap_pure.sh index 92885cc..82be18d 100644 --- a/docker/base/bootstrap_pure.sh +++ b/docker/base/bootstrap_pure.sh @@ -41,6 +41,14 @@ if [ $GO_VERSION -ge 170 ]; then GOOS=linux GOARCH=mips64le CGO_ENABLED=1 CC=mips64el-linux-gnuabi64-gcc-5 go install std fi +if [ $GO_VERSION -ge 180 ]; then + echo "Bootstrapping linux/mips..." + GOOS=linux GOARCH=mips CGO_ENABLED=1 CC=mips-linux-gnu-gcc-5 go install std + + echo "Bootstrapping linux/mipsle..." + GOOS=linux GOARCH=mipsle CGO_ENABLED=1 CC=mipsel-linux-gnu-gcc-5 go install std +fi + echo "Bootstrapping windows/amd64..." GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc go install std diff --git a/docker/base/build.sh b/docker/base/build.sh index e0b5b59..daf1ce1 100644 --- a/docker/base/build.sh +++ b/docker/base/build.sh @@ -403,6 +403,30 @@ for TARGET in $TARGETS; do CC=mips64el-linux-gnuabi64-gcc-5 CXX=mips64el-linux-gnuabi64-g++-5 GOOS=linux GOARCH=mips64le CGO_ENABLED=1 go build $V $X "${T[@]}" --ldflags="$V $LD" $BM -o "/build/$NAME-linux-mips64le`extension linux`" ./$PACK fi fi + if ([ $XGOOS == "." ] || [ $XGOOS == "linux" ]) && ([ $XGOARCH == "." ] || [ $XGOARCH == "mips" ]); then + if [ "$GO_VERSION" -lt 180 ]; then + echo "Go version too low, skipping linux/mips..." + else + echo "Compiling for linux/mips..." + CC=mips-linux-gnu-gcc-5 CXX=mips-linux-gnu-g++-5 HOST=mips-linux-gnu PREFIX=/usr/mips-linux-gnu $BUILD_DEPS /deps ${DEPS_ARGS[@]} + export PKG_CONFIG_PATH=/usr/mips-linux-gnu/lib/pkgconfig + + CC=mips-linux-gnu-gcc-5 CXX=mips-linux-gnu-g++-5 GOOS=linux GOARCH=mips CGO_ENABLED=1 go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK + CC=mips-linux-gnu-gcc-5 CXX=mips-linux-gnu-g++-5 GOOS=linux GOARCH=mips CGO_ENABLED=1 go build $V $X "${T[@]}" --ldflags="$V $LD" $BM -o "/build/$NAME-linux-mips`extension linux`" ./$PACK + fi + fi + if ([ $XGOOS == "." ] || [ $XGOOS == "linux" ]) && ([ $XGOARCH == "." ] || [ $XGOARCH == "mipsle" ]); then + if [ "$GO_VERSION" -lt 180 ]; then + echo "Go version too low, skipping linux/mipsle..." + else + echo "Compiling for linux/mipsle..." + CC=mipsel-linux-gnu-gcc-5 CXX=mipsel-linux-gnu-g++-5 HOST=mipsel-linux-gnu PREFIX=/usr/mipsel-linux-gnu $BUILD_DEPS /deps ${DEPS_ARGS[@]} + export PKG_CONFIG_PATH=/usr/mipsle-linux-gnu/lib/pkgconfig + + CC=mipsel-linux-gnu-gcc-5 CXX=mipsel-linux-gnu-g++-5 GOOS=linux GOARCH=mipsle CGO_ENABLED=1 go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK + CC=mipsel-linux-gnu-gcc-5 CXX=mipsel-linux-gnu-g++-5 GOOS=linux GOARCH=mipsle CGO_ENABLED=1 go build $V $X "${T[@]}" --ldflags="$V $LD" $BM -o "/build/$NAME-linux-mipsle`extension linux`" ./$PACK + fi + fi # Check and build for Windows targets if [ $XGOOS == "." ] || [[ $XGOOS == windows* ]]; then # Split the platform version and configure the Windows NT version