diff --git a/docker/base/Dockerfile b/docker/base/Dockerfile index 5d89119..697dd8a 100644 --- a/docker/base/Dockerfile +++ b/docker/base/Dockerfile @@ -22,10 +22,10 @@ RUN chmod +x $FETCH RUN \ apt-get update && \ apt-get install -y automake autogen build-essential ca-certificates \ - gcc-arm-linux-gnueabi libc6-dev-armel-cross gcc-multilib gcc-mingw-w64 \ - clang llvm-dev libtool libxml2-dev uuid-dev libssl-dev pkg-config \ - patch make xz-utils cpio wget unzip p7zip git mercurial bzr \ - --no-install-recommends + gcc-arm-linux-gnueabi g++-arm-linux-gnueabi libc6-dev-armel-cross \ + gcc-multilib g++-multilib gcc-mingw-w64 g++-mingw-w64 clang llvm-dev \ + libtool libxml2-dev uuid-dev libssl-dev pkg-config patch make xz-utils \ + cpio wget unzip p7zip git mercurial bzr --no-install-recommends # Configure the container for OSX cross compilation ENV OSX_SDK_PATH https://github.com/trevd/android_platform_build2/raw/master/osxsdks10.6.tar.gz @@ -44,33 +44,24 @@ RUN \ ENV PATH /osxcross/target/bin:$PATH # Configure the container for Android cross compilation -ENV ANDROID_NDK_PATH http://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin -ENV ANDROID_NDK android-ndk-r10e -ENV ANDROID_PLATROOT /usr/local/$ANDROID_NDK/platforms -ENV ANDROID_PLATFORM 21 +ENV ANDROID_NDK android-ndk-r10e +ENV ANDROID_NDK_PATH http://dl.google.com/android/ndk/$ANDROID_NDK-linux-x86_64.bin +ENV ANDROID_NDK_ROOT /usr/local/$ANDROID_NDK +ENV ANDROID_PLATFORM 21 +ENV ANDROID_CHAIN_ARM arm-linux-androideabi-4.9 RUN \ $FETCH $ANDROID_NDK_PATH c685e5f106f8daa9b5449d0a4f21ee8c0afcb2f6 && \ - 7zr x `basename $ANDROID_NDK_PATH` "$ANDROID_NDK/platforms/*/arch-arm/*" -o/usr/local > /dev/null && \ - 7zr x `basename $ANDROID_NDK_PATH` "$ANDROID_NDK/toolchains/arm-linux-androideabi-4.9" -o/usr/local > /dev/null && \ + 7zr x `basename $ANDROID_NDK_PATH` \ + "$ANDROID_NDK/build" \ + "$ANDROID_NDK/sources/cxx-stl/gnu-libstdc++/4.9/include" \ + "$ANDROID_NDK/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi*" \ + "$ANDROID_NDK/prebuilt/linux-x86_64" \ + "$ANDROID_NDK/platforms/*/arch-arm" \ + "$ANDROID_NDK/toolchains/$ANDROID_CHAIN_ARM" -o/usr/local > /dev/null && \ rm -f `basename $ANDROID_NDK_PATH` - # Add these back as further Android support is added to Go - #7zr x `basename $ANDROID_NDK_PATH` "$ANDROID_NDK/toolchains/x86-4.9" -o/usr/local > /dev/null && \ - #7zr x `basename $ANDROID_NDK_PATH` "$ANDROID_NDK/toolchains/mipsel-linux-android-4.9" -o/usr/local > /dev/null && \ - #7zr x `basename $ANDROID_NDK_PATH` "$ANDROID_NDK/toolchains/aarch64-linux-android-4.9" -o/usr/local > /dev/null && \ - #7zr x `basename $ANDROID_NDK_PATH` "$ANDROID_NDK/toolchains/x86_64-4.9" -o/usr/local > /dev/null && \ - #7zr x `basename $ANDROID_NDK_PATH` "$ANDROID_NDK/toolchains/mips64el-linux-android-4.9" -o/usr/local > /dev/null && \ - -ENV PATH /usr/local/$ANDROID_NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:$PATH - -# Add these back as further Android support is added to Go -# ENV PATH /usr/local/$ANDROID_NDK/toolchains/x86-4.9/prebuilt/linux-x86_64/bin:$PATH -# ENV PATH /usr/local/$ANDROID_NDK/toolchains/mipsel-linux-android-4.9/prebuilt/linux-x86_64/bin:$PATH -# ENV PATH /usr/local/$ANDROID_NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin:$PATH -# ENV PATH /usr/local/$ANDROID_NDK/toolchains/x86_64-4.9/prebuilt/linux-x86_64/bin:$PATH -# ENV PATH /usr/local/$ANDROID_NDK/toolchains/mips64el-linux-android-4.9/prebuilt/linux-x86_64/bin:$PATH - +ENV PATH /usr/$ANDROID_CHAIN_ARM/bin:$PATH # Inject the old Go package downloader and tool-chain bootstrapper ADD bootstrap.sh /bootstrap.sh diff --git a/docker/base/build.sh b/docker/base/build.sh index b3e267c..15c32a9 100644 --- a/docker/base/build.sh +++ b/docker/base/build.sh @@ -96,95 +96,16 @@ for TARGET in $TARGETS; do if [ "$GO_VERSION" -lt 150 ]; then echo "Go version too low, skipping android-$PLATFORM/arm..." else - export ANDROID_SYSROOT=$ANDROID_PLATROOT/android-$PLATFORM/arch-arm + echo "Assembling toolchain for android-$PLATFORM/arm..." + $ANDROID_NDK_ROOT/build/tools/make-standalone-toolchain.sh --ndk-dir=$ANDROID_NDK_ROOT --install-dir=/usr/$ANDROID_CHAIN_ARM --toolchain=$ANDROID_CHAIN_ARM --arch=arm --system=linux-x86_64 echo "Bootstrapping android-$PLATFORM/arm..." - CC=arm-linux-androideabi-gcc GOOS=android GOARCH=arm GOARM=7 CGO_ENABLED=1 CGO_CFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_CCPIE" CGO_LDFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_LDPIE" go install std + CC=arm-linux-androideabi-gcc GOOS=android GOARCH=arm GOARM=7 CGO_ENABLED=1 CGO_CFLAGS="$CGO_CCPIE" CGO_LDFLAGS="$CGO_LDPIE" go install std echo "Compiling for android-$PLATFORM/arm..." - CC="arm-linux-androideabi-gcc --sysroot=$ANDROID_SYSROOT" HOST=arm-linux-androideabi PREFIX=$ANDROID_SYSROOT/usr $BUILD_DEPS /deps - CC=arm-linux-androideabi-gcc GOOS=android GOARCH=arm GOARM=7 CGO_ENABLED=1 CGO_CFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_CCPIE" CGO_LDFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_LDPIE" go get $V $X -d ./$PACK - CC=arm-linux-androideabi-gcc GOOS=android GOARCH=arm GOARM=7 CGO_ENABLED=1 CGO_CFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_CCPIE" CGO_LDFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_LDPIE" go build --ldflags="$EXT_LDPIE" $V $X $R -o $NAME-android-$PLATFORM-arm$R ./$PACK - builds=$((builds+1)) - fi - fi - if ([ $XGOARCH == "." ] || [ $XGOARCH == "386" ]) && [ "$PLATFORM" -ge 9 ]; then - if [ "$GO_VERSION" -lt 160 ]; then - echo "Go version too low, skipping android-$PLATFORM/386..." - else - export ANDROID_SYSROOT=$ANDROID_PLATROOT/android-$PLATFORM/arch-x86 - - echo "Bootstrapping android-$PLATFORM/386..." - CC=i686-linux-android-gcc GOOS=android GOARCH=386 CGO_ENABLED=1 CGO_CFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_CCPIE" CGO_LDFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_LDPIE" go install std - - echo "Compiling for android-$PLATFORM/386..." - CC="i686-linux-android-gcc --sysroot=$ANDROID_SYSROOT" HOST=i686-linux-android PREFIX=$ANDROID_SYSROOT/usr $BUILD_DEPS /deps - CC=i686-linux-android-gcc GOOS=android GOARCH=386 CGO_ENABLED=1 CGO_CFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_CCPIE" CGO_LDFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_LDPIE" go get $V $X -d ./$PACK - CC=i686-linux-android-gcc GOOS=android GOARCH=386 CGO_ENABLED=1 CGO_CFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_CCPIE" CGO_LDFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_LDPIE" go build --ldflags="$EXT_LDPIE" $V $X $R -o $NAME-android-$PLATFORM-386$R ./$PACK - builds=$((builds+1)) - fi - fi - if ([ $XGOARCH == "." ] || [ $XGOARCH == "mips" ]) && [ "$PLATFORM" -ge 9 ]; then - if [ "$GO_VERSION" -lt 160 ]; then - echo "Go version too low, skipping android-$PLATFORM/mips..." - else - export ANDROID_SYSROOT=$ANDROID_PLATROOT/android-$PLATFORM/arch-mips - - echo "Bootstrapping android-$PLATFORM/mips..." - CC==mipsel-linux-android-gcc GOOS=android GOARCH=mips CGO_ENABLED=1 CGO_CFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_CCPIE" CGO_LDFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_LDPIE" go install std - - echo "Compiling for android-$PLATFORM/mips..." - CC="mipsel-linux-android-gcc --sysroot=$ANDROID_SYSROOT" HOST=mipsel-linux-android PREFIX=$ANDROID_SYSROOT/usr $BUILD_DEPS /deps - CC=mipsel-linux-android-gcc GOOS=android GOARCH=mips CGO_ENABLED=1 CGO_CFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_CCPIE" CGO_LDFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_LDPIE" go get $V $X -d ./$PACK - CC=mipsel-linux-android-gcc GOOS=android GOARCH=mips CGO_ENABLED=1 CGO_CFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_CCPIE" CGO_LDFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_LDPIE" go build --ldflags="$EXT_LDPIE" $V $X $R -o $NAME-android-$PLATFORM-mips$R ./$PACK - builds=$((builds+1)) - fi - fi - if ([ $XGOARCH == "." ] || [ $XGOARCH == "arm64" ]) && [ "$PLATFORM" -ge 21 ]; then - if [ "$GO_VERSION" -lt 160 ]; then - echo "Go version too low, skipping android-$PLATFORM/arm64..." - else - export ANDROID_SYSROOT=$ANDROID_PLATROOT/android-$PLATFORM/arch-arm64 - - echo "Bootstrapping android-$PLATFORM/arm64..." - CC===aarch64-linux-android-gcc GOOS=android GOARCH=arm GOARM=7 CGO_ENABLED=1 CGO_CFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_CCPIE" CGO_LDFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_LDPIE" go install std - - echo "Compiling for android-$PLATFORM/arm64..." - CC="aarch64-linux-android-gcc --sysroot=$ANDROID_SYSROOT" HOST=aarch64-linux-android PREFIX=$ANDROID_SYSROOT/usr $BUILD_DEPS /deps - CC=aarch64-linux-android-gcc GOOS=android GOARCH=arm64 GOARM=7 CGO_ENABLED=1 CGO_CFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_CCPIE" CGO_LDFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_LDPIE" go get $V $X -d ./$PACK - CC=aarch64-linux-android-gcc GOOS=android GOARCH=arm64 GOARM=7 CGO_ENABLED=1 CGO_CFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_CCPIE" CGO_LDFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_LDPIE" go build --ldflags="$EXT_LDPIE" $V $X $R -o $NAME-android-$PLATFORM-arm64$R ./$PACK - builds=$((builds+1)) - fi - fi - if ([ $XGOARCH == "." ] || [ $XGOARCH == "amd64" ]) && [ "$PLATFORM" -ge 21 ]; then - if [ "$GO_VERSION" -lt 160 ]; then - echo "Go version too low, skipping android-$PLATFORM/amd64..." - else - export ANDROID_SYSROOT=$ANDROID_PLATROOT/android-$PLATFORM/arch-x86_64 - - echo "Bootstrapping android-$PLATFORM/amd64..." - CC=x86_64-linux-android-gcc GOOS=android GOARCH=amd64 CGO_ENABLED=1 CGO_CFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_CCPIE" CGO_LDFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_LDPIE" go install std - - echo "Compiling for android-$PLATFORM/amd64..." - CC="x86_64-linux-android-gcc --sysroot=$ANDROID_SYSROOT" HOST=x86_64-linux-android PREFIX=$ANDROID_SYSROOT/usr $BUILD_DEPS /deps - CC=x86_64-linux-android-gcc GOOS=android GOARCH=amd64 CGO_ENABLED=1 CGO_CFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_CCPIE" CGO_LDFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_LDPIE" go get $V $X -d ./$PACK - CC=x86_64-linux-android-gcc GOOS=android GOARCH=amd64 CGO_ENABLED=1 CGO_CFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_CCPIE" CGO_LDFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_LDPIE" go build --ldflags="$EXT_LDPIE" $V $X $R -o $NAME-android-$PLATFORM-amd64$R ./$PACK - builds=$((builds+1)) - fi - fi - if ([ $XGOARCH == "." ] || [ $XGOARCH == "mips64" ]) && [ "$PLATFORM" -ge 21 ]; then - if [ "$GO_VERSION" -lt 160 ]; then - echo "Go version too low, skipping android-$PLATFORM/mips64..." - else - export ANDROID_SYSROOT=$ANDROID_PLATROOT/android-$PLATFORM/arch-mips64 - - echo "Bootstrapping android-$PLATFORM/mips64..." - CC=mips64el-linux-android-gcc GOOS=android GOARCH=mips64 CGO_ENABLED=1 CGO_CFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_CCPIE" CGO_LDFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_LDPIE" go install std - - echo "Compiling for android-$PLATFORM/mips64..." - CC="mips64el-linux-android-gcc --sysroot=$ANDROID_SYSROOT" HOST=mips64el-linux-android PREFIX=$ANDROID_SYSROOT/usr $BUILD_DEPS /deps - CC=mips64el-linux-android-gcc GOOS=android GOARCH=mips64 CGO_ENABLED=1 CGO_CFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_CCPIE" CGO_LDFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_LDPIE" go get $V $X -d ./$PACK - CC=mips64el-linux-android-gcc GOOS=android GOARCH=mips64 CGO_ENABLED=1 CGO_CFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_CCPIE" CGO_LDFLAGS="--sysroot=$ANDROID_SYSROOT $CGO_LDPIE" go build --ldflags="$EXT_LDPIE" $V $X $R -o $NAME-android-$PLATFORM-mips64$R ./$PACK + CC=arm-linux-androideabi-gcc CXX=arm-linux-androideabi-g++ HOST=arm-linux-androideabi PREFIX=/usr/$ANDROID_CHAIN_ARM $BUILD_DEPS /deps + CC=arm-linux-androideabi-gcc CXX=arm-linux-androideabi-g++ GOOS=android GOARCH=arm GOARM=7 CGO_ENABLED=1 CGO_CFLAGS="$CGO_CCPIE" CGO_CXXFLAGS="$CGO_CCPIE" CGO_LDFLAGS="$CGO_LDPIE" go get $V $X -d ./$PACK + CC=arm-linux-androideabi-gcc CXX=arm-linux-androideabi-g++ GOOS=android GOARCH=arm GOARM=7 CGO_ENABLED=1 CGO_CFLAGS="$CGO_CCPIE" CGO_CXXFLAGS="$CGO_CCPIE" CGO_LDFLAGS="$CGO_LDPIE" go build --ldflags="$EXT_LDPIE" $V $X $R -o $NAME-android-$PLATFORM-arm$R ./$PACK builds=$((builds+1)) fi fi @@ -206,39 +127,39 @@ for TARGET in $TARGETS; do fi if ([ $XGOOS == "." ] || [ $XGOOS == "linux" ]) && ([ $XGOARCH == "." ] || [ $XGOARCH == "arm" ]); then echo "Compiling for linux/arm..." - CC=arm-linux-gnueabi-gcc HOST=arm-linux PREFIX=/usr/local/arm $BUILD_DEPS /deps - CC=arm-linux-gnueabi-gcc GOOS=linux GOARCH=arm CGO_ENABLED=1 GOARM=5 go get $V $X -d ./$PACK - CC=arm-linux-gnueabi-gcc GOOS=linux GOARCH=arm CGO_ENABLED=1 GOARM=5 go build $V $X -o $NAME-linux-arm ./$PACK + CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnueabi-g++ HOST=arm-linux PREFIX=/usr/local/arm $BUILD_DEPS /deps + CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnueabi-g++ GOOS=linux GOARCH=arm CGO_ENABLED=1 GOARM=5 go get $V $X -d ./$PACK + CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnueabi-g++ GOOS=linux GOARCH=arm CGO_ENABLED=1 GOARM=5 go build $V $X -o $NAME-linux-arm ./$PACK builds=$((builds+1)) fi # Check and build for Windows targets if ([ $XGOOS == "." ] || [ $XGOOS == "windows" ]) && ([ $XGOARCH == "." ] || [ $XGOARCH == "amd64" ]); then echo "Compiling for windows/amd64..." - CC=x86_64-w64-mingw32-gcc HOST=x86_64-w64-mingw32 PREFIX=/usr/x86_64-w64-mingw32 $BUILD_DEPS /deps - CC=x86_64-w64-mingw32-gcc GOOS=windows GOARCH=amd64 CGO_ENABLED=1 go get $V $X -d ./$PACK - CC=x86_64-w64-mingw32-gcc GOOS=windows GOARCH=amd64 CGO_ENABLED=1 go build $V $X $R -o $NAME-windows-amd64$R.exe ./$PACK + CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ HOST=x86_64-w64-mingw32 PREFIX=/usr/x86_64-w64-mingw32 $BUILD_DEPS /deps + CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ GOOS=windows GOARCH=amd64 CGO_ENABLED=1 go get $V $X -d ./$PACK + CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ GOOS=windows GOARCH=amd64 CGO_ENABLED=1 go build $V $X $R -o $NAME-windows-amd64$R.exe ./$PACK builds=$((builds+1)) fi if ([ $XGOOS == "." ] || [ $XGOOS == "windows" ]) && ([ $XGOARCH == "." ] || [ $XGOARCH == "386" ]); then echo "Compiling for windows/386..." - CC=i686-w64-mingw32-gcc HOST=i686-w64-mingw32 PREFIX=/usr/i686-w64-mingw32 $BUILD_DEPS /deps - CC=i686-w64-mingw32-gcc GOOS=windows GOARCH=386 CGO_ENABLED=1 go get $V $X -d ./$PACK - CC=i686-w64-mingw32-gcc GOOS=windows GOARCH=386 CGO_ENABLED=1 go build $V $X -o $NAME-windows-386.exe ./$PACK + CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ HOST=i686-w64-mingw32 PREFIX=/usr/i686-w64-mingw32 $BUILD_DEPS /deps + CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ GOOS=windows GOARCH=386 CGO_ENABLED=1 go get $V $X -d ./$PACK + CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ GOOS=windows GOARCH=386 CGO_ENABLED=1 go build $V $X -o $NAME-windows-386.exe ./$PACK builds=$((builds+1)) fi # Check and build for OSX targets if ([ $XGOOS == "." ] || [ $XGOOS == "darwin" ]) && ([ $XGOARCH == "." ] || [ $XGOARCH == "amd64" ]); then echo "Compiling for darwin/amd64..." - CC=o64-clang HOST=x86_64-apple-darwin10 PREFIX=/usr/local $BUILD_DEPS /deps - CC=o64-clang GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go get $V $X -d ./$PACK - CC=o64-clang GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build -ldflags=-s $V $X $R -o $NAME-darwin-amd64$R ./$PACK + CC=o64-clang CXX=o64-clang++ HOST=x86_64-apple-darwin10 PREFIX=/usr/local $BUILD_DEPS /deps + CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go get $V $X -d ./$PACK + CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build -ldflags=-s $V $X $R -o $NAME-darwin-amd64$R ./$PACK builds=$((builds+1)) fi if ([ $XGOOS == "." ] || [ $XGOOS == "darwin" ]) && ([ $XGOARCH == "." ] || [ $XGOARCH == "386" ]); then echo "Compiling for darwin/386..." - CC=o32-clang HOST=i386-apple-darwin10 PREFIX=/usr/local $BUILD_DEPS /deps - CC=o32-clang GOOS=darwin GOARCH=386 CGO_ENABLED=1 go get $V $X -d ./$PACK - CC=o32-clang GOOS=darwin GOARCH=386 CGO_ENABLED=1 go build -ldflags=-s $V $X -o $NAME-darwin-386 ./$PACK + CC=o32-clang CXX=o32-clang++ HOST=i386-apple-darwin10 PREFIX=/usr/local $BUILD_DEPS /deps + CC=o32-clang CXX=o32-clang++ GOOS=darwin GOARCH=386 CGO_ENABLED=1 go get $V $X -d ./$PACK + CC=o32-clang CXX=o32-clang++ GOOS=darwin GOARCH=386 CGO_ENABLED=1 go build -ldflags=-s $V $X -o $NAME-darwin-386 ./$PACK builds=$((builds+1)) fi done