From b304b4f0f2bb98dbbf83f01b15e40e3b4fe9eee1 Mon Sep 17 00:00:00 2001 From: Tadas V Date: Mon, 27 Aug 2018 16:23:13 +0300 Subject: [PATCH 01/24] Migrate to ubuntu 17.10 and gcc 6 and friends --- docker/base/Dockerfile | 32 ++++++++++++++++---------------- docker/base/bootstrap_pure.sh | 10 +++++----- docker/go-1.9.2/Dockerfile | 2 +- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/docker/base/Dockerfile b/docker/base/Dockerfile index 721637a9..67ca9cbb 100644 --- a/docker/base/Dockerfile +++ b/docker/base/Dockerfile @@ -3,7 +3,7 @@ # # Released under the MIT license. -FROM ubuntu:16.04 +FROM ubuntu:17.10 MAINTAINER Péter Szilágyi @@ -26,16 +26,16 @@ RUN chmod +x $FETCH RUN \ apt-get update && \ apt-get install -y automake autogen build-essential ca-certificates \ - 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 \ + gcc-6-arm-linux-gnueabi g++-6-arm-linux-gnueabi libc6-dev-armel-cross \ + gcc-6-arm-linux-gnueabihf g++-6-arm-linux-gnueabihf libc6-dev-armhf-cross \ + gcc-6-aarch64-linux-gnu g++-6-aarch64-linux-gnu libc6-dev-arm64-cross \ + gcc-6-mips-linux-gnu g++-6-mips-linux-gnu libc6-dev-mips-cross \ + gcc-6-mipsel-linux-gnu g++-6-mipsel-linux-gnu libc6-dev-mipsel-cross \ + gcc-6-mips64-linux-gnuabi64 g++-6-mips64-linux-gnuabi64 libc6-dev-mips64-cross \ + gcc-6-mips64el-linux-gnuabi64 g++-6-mips64el-linux-gnuabi64 libc6-dev-mips64el-cross \ + gcc-6-multilib gcc-7-multilib g++-6-multilib gcc-mingw-w64 g++-mingw-w64 clang llvm-dev \ libtool libxml2-dev uuid-dev libssl-dev swig openjdk-8-jdk pkg-config patch \ - make xz-utils cpio wget zip unzip p7zip git mercurial bzr texinfo help2man \ + make xz-utils cpio wget zip unzip p7zip git mercurial bzr texinfo help2man \ --no-install-recommends # Fix any stock package issues @@ -70,12 +70,12 @@ ADD update_ios.sh /update_ios.sh ENV UPDATE_IOS /update_ios.sh RUN chmod +x $UPDATE_IOS -RUN \ - IOS_SDK_PATH=https://sdks.website/dl/iPhoneOS9.3.sdk.tbz2 && \ - $FETCH $IOS_SDK_PATH db5ecf91617abf26d3db99e769bd655b943905e5 && \ - mv `basename $IOS_SDK_PATH` iPhoneOS9.3.sdk.tar.bz2 && \ - $UPDATE_IOS /iPhoneOS9.3.sdk.tar.bz2 && \ - rm -rf /iPhoneOS9.3.sdk.tar.bz2 +#RUN \ +# IOS_SDK_PATH=https://sdks.website/dl/iPhoneOS9.3.sdk.tbz2 && \ +# $FETCH $IOS_SDK_PATH db5ecf91617abf26d3db99e769bd655b943905e5 && \ +# mv `basename $IOS_SDK_PATH` iPhoneOS9.3.sdk.tar.bz2 && \ +# $UPDATE_IOS /iPhoneOS9.3.sdk.tar.bz2 && \ +# rm -rf /iPhoneOS9.3.sdk.tar.bz2 # Configure the container for Android cross compilation ENV ANDROID_NDK android-ndk-r11c diff --git a/docker/base/bootstrap_pure.sh b/docker/base/bootstrap_pure.sh index 82be18d9..b61dbecc 100644 --- a/docker/base/bootstrap_pure.sh +++ b/docker/base/bootstrap_pure.sh @@ -31,22 +31,22 @@ echo "Bootstrapping linux/386..." GOOS=linux GOARCH=386 CGO_ENABLED=1 go install std echo "Bootstrapping linux/arm64..." -GOOS=linux GOARCH=arm64 CGO_ENABLED=1 CC=aarch64-linux-gnu-gcc-5 go install std +GOOS=linux GOARCH=arm64 CGO_ENABLED=1 CC=aarch64-linux-gnu-gcc-6 go install std if [ $GO_VERSION -ge 170 ]; then echo "Bootstrapping linux/mips64..." - GOOS=linux GOARCH=mips64 CGO_ENABLED=1 CC=mips64-linux-gnuabi64-gcc-5 go install std + GOOS=linux GOARCH=mips64 CGO_ENABLED=1 CC=mips64-linux-gnuabi64-gcc-6 go install std echo "Bootstrapping linux/mips64le..." - GOOS=linux GOARCH=mips64le CGO_ENABLED=1 CC=mips64el-linux-gnuabi64-gcc-5 go install std + GOOS=linux GOARCH=mips64le CGO_ENABLED=1 CC=mips64el-linux-gnuabi64-gcc-6 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 + GOOS=linux GOARCH=mips CGO_ENABLED=1 CC=mips-linux-gnu-gcc-6 go install std echo "Bootstrapping linux/mipsle..." - GOOS=linux GOARCH=mipsle CGO_ENABLED=1 CC=mipsel-linux-gnu-gcc-5 go install std + GOOS=linux GOARCH=mipsle CGO_ENABLED=1 CC=mipsel-linux-gnu-gcc-6 go install std fi echo "Bootstrapping windows/amd64..." diff --git a/docker/go-1.9.2/Dockerfile b/docker/go-1.9.2/Dockerfile index 120666ed..088527f3 100644 --- a/docker/go-1.9.2/Dockerfile +++ b/docker/go-1.9.2/Dockerfile @@ -3,7 +3,7 @@ # # Released under the MIT license. -FROM karalabe/xgo-base +FROM mysterium/xgo-base MAINTAINER Péter Szilágyi From 6f1a3985e86a34ca0f0263e53f20f2195f983744 Mon Sep 17 00:00:00 2001 From: Tadas V Date: Wed, 29 Aug 2018 09:15:55 +0300 Subject: [PATCH 02/24] Update iOS SDK to 10.3 --- docker/base/Dockerfile | 15 ++++++++------- docker/base/update_ios.sh | 5 +++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/docker/base/Dockerfile b/docker/base/Dockerfile index 67ca9cbb..b38f0a14 100644 --- a/docker/base/Dockerfile +++ b/docker/base/Dockerfile @@ -35,7 +35,7 @@ RUN \ gcc-6-mips64el-linux-gnuabi64 g++-6-mips64el-linux-gnuabi64 libc6-dev-mips64el-cross \ gcc-6-multilib gcc-7-multilib g++-6-multilib gcc-mingw-w64 g++-mingw-w64 clang llvm-dev \ libtool libxml2-dev uuid-dev libssl-dev swig openjdk-8-jdk pkg-config patch \ - make xz-utils cpio wget zip unzip p7zip git mercurial bzr texinfo help2man \ + make xz-utils cpio wget zip unzip p7zip git mercurial bzr texinfo help2man cmake \ --no-install-recommends # Fix any stock package issues @@ -70,12 +70,13 @@ ADD update_ios.sh /update_ios.sh ENV UPDATE_IOS /update_ios.sh RUN chmod +x $UPDATE_IOS -#RUN \ -# IOS_SDK_PATH=https://sdks.website/dl/iPhoneOS9.3.sdk.tbz2 && \ -# $FETCH $IOS_SDK_PATH db5ecf91617abf26d3db99e769bd655b943905e5 && \ -# mv `basename $IOS_SDK_PATH` iPhoneOS9.3.sdk.tar.bz2 && \ -# $UPDATE_IOS /iPhoneOS9.3.sdk.tar.bz2 && \ -# rm -rf /iPhoneOS9.3.sdk.tar.bz2 +RUN \ + IOS_SDK_FILE=iPhoneOS10.3.sdk.zip && \ + IOS_SDK_PATH=http://resources.airnativeextensions.com/ios/$IOS_SDK_FILE && \ + $FETCH $IOS_SDK_PATH 7745815cd13d9b44c4cb0a2a40715e5410330233300ce4ff0ce106da17a636e8 && \ + mv `basename $IOS_SDK_PATH` iPhoneOS10.3.sdk.tmp.zip && \ + $UPDATE_IOS /iPhoneOS10.3.sdk.tmp.zip && \ + rm -rf /iPhoneOS10.3.sdk.tmp.zip # Configure the container for Android cross compilation ENV ANDROID_NDK android-ndk-r11c diff --git a/docker/base/update_ios.sh b/docker/base/update_ios.sh index 53d0fb50..0b68dbee 100644 --- a/docker/base/update_ios.sh +++ b/docker/base/update_ios.sh @@ -24,6 +24,9 @@ function extract { *.tar.bz2) bzip2 -dc $1 | tar xf - ;; + *.zip) + unzip $1 + ;; esac } @@ -52,8 +55,6 @@ if [[ "`basename $1`" =~ ^iPhoneSimulator ]]; then mv /cctools-port/usage_examples/ios_toolchain/target $IOS_SIM_NDK_AMD64 else rm -rf $IOS_NDK_ARM_7 $IOS_NDK_ARM64 - /cctools-port/usage_examples/ios_toolchain/build.sh /tmp/$sdk.tar.gz armv7 - mv /cctools-port/usage_examples/ios_toolchain/target $IOS_NDK_ARM_7 /cctools-port/usage_examples/ios_toolchain/build.sh /tmp/$sdk.tar.gz arm64 mv /cctools-port/usage_examples/ios_toolchain/target $IOS_NDK_ARM64 fi From 902f17be78d5bba2d9f267a1e62e9bda7a67af98 Mon Sep 17 00:00:00 2001 From: Tadas V Date: Wed, 29 Aug 2018 15:44:49 +0300 Subject: [PATCH 03/24] iOS cross compilation kit successful setup --- docker/base/Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docker/base/Dockerfile b/docker/base/Dockerfile index b38f0a14..76ca7d33 100644 --- a/docker/base/Dockerfile +++ b/docker/base/Dockerfile @@ -76,7 +76,10 @@ RUN \ $FETCH $IOS_SDK_PATH 7745815cd13d9b44c4cb0a2a40715e5410330233300ce4ff0ce106da17a636e8 && \ mv `basename $IOS_SDK_PATH` iPhoneOS10.3.sdk.tmp.zip && \ $UPDATE_IOS /iPhoneOS10.3.sdk.tmp.zip && \ - rm -rf /iPhoneOS10.3.sdk.tmp.zip + rm -rf /iPhoneOS10.3.sdk.tmp.zip && \ + cp -r /usr/local/osx-ndk-x86/SDK/MacOSX10.11.sdk/usr/include/c++/v1 /usr/local/ios-ndk-arm64/SDK/iPhoneOS10.3.sdk/usr/include/c++ + +ENV PATH $IOS_NDK_ARM64/bin:$PATH # Configure the container for Android cross compilation ENV ANDROID_NDK android-ndk-r11c From c739ff20cc0305cc07cbc8b166ec528276d89eac Mon Sep 17 00:00:00 2001 From: Dmitry Shihovtsev Date: Thu, 27 Sep 2018 15:06:37 +0600 Subject: [PATCH 04/24] Added extra environment variables for new golang --- docker/base/Dockerfile | 1 + docker/go-1.11.0/Dockerfile | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docker/base/Dockerfile b/docker/base/Dockerfile index 76ca7d33..f0ccf8b1 100644 --- a/docker/base/Dockerfile +++ b/docker/base/Dockerfile @@ -80,6 +80,7 @@ RUN \ cp -r /usr/local/osx-ndk-x86/SDK/MacOSX10.11.sdk/usr/include/c++/v1 /usr/local/ios-ndk-arm64/SDK/iPhoneOS10.3.sdk/usr/include/c++ ENV PATH $IOS_NDK_ARM64/bin:$PATH +ENV LD_LIBRARY_PATH $IOS_NDK_ARM64/lib/:$LD_LIBRARY_PATH # Configure the container for Android cross compilation ENV ANDROID_NDK android-ndk-r11c diff --git a/docker/go-1.11.0/Dockerfile b/docker/go-1.11.0/Dockerfile index 3885afdc..d2efc2f9 100644 --- a/docker/go-1.11.0/Dockerfile +++ b/docker/go-1.11.0/Dockerfile @@ -3,12 +3,13 @@ # # Released under the MIT license. -FROM karalabe/xgo-base +FROM mysteriumnetwork/xgo:base MAINTAINER Péter Szilágyi # Configure the root Go distribution and bootstrap based on it ENV GO_VERSION 1110 +ENV CGO_LDFLAGS_ALLOW -fobjc-arc RUN \ export ROOT_DIST=https://storage.googleapis.com/golang/go1.11.linux-amd64.tar.gz && \ From 1b6c1b5710d6330e4f2a6d824baafd7943bb006b Mon Sep 17 00:00:00 2001 From: Tadas V Date: Tue, 23 Oct 2018 10:31:41 +0300 Subject: [PATCH 05/24] Add sample package for testing gomobile, setup ios/android tooling for gomobile, setup gomobile itself --- .gitignore | 1 + docker/base/Dockerfile | 24 +++++++++++++--- docker/base/bootstrap_pure.sh | 6 ++++ docker/base/xcrun | 54 +++++++++++++++++++++++++++++++++++ src/mobilepkg/mobile.go | 5 ++++ 5 files changed, 86 insertions(+), 4 deletions(-) create mode 100644 .gitignore create mode 100755 docker/base/xcrun create mode 100644 src/mobilepkg/mobile.go diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..62c89355 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea/ \ No newline at end of file diff --git a/docker/base/Dockerfile b/docker/base/Dockerfile index f0ccf8b1..760561c9 100644 --- a/docker/base/Dockerfile +++ b/docker/base/Dockerfile @@ -83,35 +83,51 @@ ENV PATH $IOS_NDK_ARM64/bin:$PATH ENV LD_LIBRARY_PATH $IOS_NDK_ARM64/lib/:$LD_LIBRARY_PATH # Configure the container for Android cross compilation -ENV ANDROID_NDK android-ndk-r11c +ENV ANDROID_NDK android-ndk-r13b ENV ANDROID_NDK_PATH http://dl.google.com/android/repository/$ANDROID_NDK-linux-x86_64.zip ENV ANDROID_NDK_ROOT /usr/local/$ANDROID_NDK ENV ANDROID_NDK_LIBC $ANDROID_NDK_ROOT/sources/cxx-stl/gnu-libstdc++/4.9 ENV ANDROID_PLATFORM 21 ENV ANDROID_CHAIN_ARM arm-linux-androideabi-4.9 ENV ANDROID_CHAIN_ARM64 aarch64-linux-android-4.9 +ENV ANDROID_CHAIN_AMD64 x86_64-4.9 ENV ANDROID_CHAIN_386 x86-4.9 RUN \ - $FETCH $ANDROID_NDK_PATH de5ce9bddeee16fb6af2b9117e9566352aa7e279 && \ + $FETCH $ANDROID_NDK_PATH 0600157c4ddf50ec15b8a037cfc474143f718fd0 && \ unzip `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/sources/cxx-stl/gnu-libstdc++/4.9/libs/arm64*/*" \ + "$ANDROID_NDK/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86_64/*" \ "$ANDROID_NDK/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/*" \ "$ANDROID_NDK/prebuilt/linux-x86_64/*" \ "$ANDROID_NDK/platforms/*/arch-arm/*" \ "$ANDROID_NDK/platforms/*/arch-arm64/*" \ + "$ANDROID_NDK/platforms/*/arch-x86_64/*" \ "$ANDROID_NDK/platforms/*/arch-x86/*" \ + "$ANDROID_NDK/toolchains/llvm/*" \ "$ANDROID_NDK/toolchains/$ANDROID_CHAIN_ARM/*" \ "$ANDROID_NDK/toolchains/$ANDROID_CHAIN_ARM64/*" \ - "$ANDROID_NDK/toolchains/$ANDROID_CHAIN_386/*" -d /usr/local > /dev/null && \ + "$ANDROID_NDK/toolchains/$ANDROID_CHAIN_386/*" \ + "$ANDROID_NDK/toolchains/$ANDROID_CHAIN_AMD64/*" -d /usr/local > /dev/null && \ rm -f `basename $ANDROID_NDK_PATH` ENV PATH /usr/$ANDROID_CHAIN_ARM/bin:$PATH ENV PATH /usr/$ANDROID_CHAIN_ARM64/bin:$PATH -ENV PATH /usr/$ANDROID_CHAIN_386/bin:$PATH +ENV PATH /usr/$ANDROID_CHAIN_AMD64/bin:$PATH + +# setup Android SDK tooling too +ENV ANDROID_SDK_PATH https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip +RUN \ + $FETCH $ANDROID_SDK_PATH 92ffee5a1d98d856634e8b71132e8a95d96c83a63fde1099be3d86df3106def9 && \ + unzip `basename $ANDROID_SDK_PATH` \ + -d /usr/local/android-sdk > /dev/null && \ + rm -f `basename $ANDROID_SDK_PATH` +ENV ANDROID_HOME /usr/local/android-sdk +#Fetch android versions required by go mobile (defined in ndk archs) (386 and arm requires android-16, arm64 requires android 21) +RUN echo "Y" | $ANDROID_HOME/tools/bin/sdkmanager "platforms;android-21" "platforms;android-16" # Inject the old Go package downloader and tool-chain bootstrapper ADD bootstrap.sh /bootstrap.sh diff --git a/docker/base/bootstrap_pure.sh b/docker/base/bootstrap_pure.sh index b61dbecc..6470e79e 100644 --- a/docker/base/bootstrap_pure.sh +++ b/docker/base/bootstrap_pure.sh @@ -65,3 +65,9 @@ GOOS=darwin GOARCH=386 CGO_ENABLED=1 CC=o32-clang go install std echo "Installing xgo-in-xgo..." go get -u github.com/karalabe/xgo ln -s /go/bin/xgo /usr/bin/xgo + +# Install gomobile tool for android/ios frameworks +echo "Installing gomobile..." +go get -u golang.org/x/mobile/cmd/gomobile +/go/bin/gomobile init -ndk /usr/local/android-ndk-r13b/ +/go/bin/gomobile version diff --git a/docker/base/xcrun b/docker/base/xcrun new file mode 100755 index 00000000..870a0720 --- /dev/null +++ b/docker/base/xcrun @@ -0,0 +1,54 @@ +#!/bin/bash +set -e + +function showSDK { + echo "$IOS_NDK_ARM64/SDK/iPhoneOS10.3.sdk" +} + +function findTool { + echo "$IOS_NDK_ARM64/bin/arm-apple-darwin11-$1" +} + +function runTool { + local cmd=$1 + shift + local tool=$(findTool $cmd) + $tool $@ + exit $? +} + +#parse args and do stuff +while [[ $# -gt 0 ]] +do +key="$1" +shift +case $key in + --sdk) + sdkType="$2" + shift + ;; + --find) + toolToFind="$1" + findTool "$toolToFind" + shift + exit 0 + ;; + --show-sdk-path) + showSDK + exit 0 + ;; + xcodebuild) + echo "xcrun wrapper v0.1" + exit 0 + ;; + --run) + cmd=$1 + shift + runTool "$cmd" $@ + ;; + *) + runTool "$key" $@ + ;; +esac +done +exit 0 diff --git a/src/mobilepkg/mobile.go b/src/mobilepkg/mobile.go new file mode 100644 index 00000000..191a10b6 --- /dev/null +++ b/src/mobilepkg/mobile.go @@ -0,0 +1,5 @@ +package mobilepkg + +func HelloWorld() { + //sample function for testing gomobile inside xgo +} \ No newline at end of file From 430127ee32ca5c54678951c3b346448960d3a0a9 Mon Sep 17 00:00:00 2001 From: Tadas V Date: Tue, 23 Oct 2018 14:12:42 +0300 Subject: [PATCH 06/24] xcrun emulator moved to hacks, gomobile script added for simplified running --- docker/base/Dockerfile | 18 +++++++++++++----- docker/base/gomobile.sh | 5 +++++ docker/base/{ => hacks}/xcrun | 0 3 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 docker/base/gomobile.sh rename docker/base/{ => hacks}/xcrun (100%) diff --git a/docker/base/Dockerfile b/docker/base/Dockerfile index 760561c9..c6ae8c54 100644 --- a/docker/base/Dockerfile +++ b/docker/base/Dockerfile @@ -120,14 +120,14 @@ ENV PATH /usr/$ANDROID_CHAIN_AMD64/bin:$PATH # setup Android SDK tooling too ENV ANDROID_SDK_PATH https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip +ENV ANDROID_HOME /usr/local/android-sdk + RUN \ $FETCH $ANDROID_SDK_PATH 92ffee5a1d98d856634e8b71132e8a95d96c83a63fde1099be3d86df3106def9 && \ unzip `basename $ANDROID_SDK_PATH` \ - -d /usr/local/android-sdk > /dev/null && \ - rm -f `basename $ANDROID_SDK_PATH` -ENV ANDROID_HOME /usr/local/android-sdk -#Fetch android versions required by go mobile (defined in ndk archs) (386 and arm requires android-16, arm64 requires android 21) -RUN echo "Y" | $ANDROID_HOME/tools/bin/sdkmanager "platforms;android-21" "platforms;android-16" + -d $ANDROID_HOME > /dev/null && \ + rm -f `basename $ANDROID_SDK_PATH` && \ + echo "Y" | $ANDROID_HOME/tools/bin/sdkmanager "platforms;android-21" "platforms;android-16" # Inject the old Go package downloader and tool-chain bootstrapper ADD bootstrap.sh /bootstrap.sh @@ -154,4 +154,12 @@ ADD build.sh /build.sh ENV BUILD /build.sh RUN chmod +x $BUILD +# Setup gomobile helper script (note: gomobile itself will be fetched later with go) +ADD hacks /hacks +RUN chmod -R +x /hacks/* + +ADD gomobile.sh /gomobile.sh +ENV GOMOBILE /gomobile.sh +RUN chmod +x $GOMOBILE + ENTRYPOINT ["/build.sh"] diff --git a/docker/base/gomobile.sh b/docker/base/gomobile.sh new file mode 100644 index 00000000..892282ea --- /dev/null +++ b/docker/base/gomobile.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -e + +custompath=/hacks:$PATH:/go/bin +PATH=$custompath gomobile $@ \ No newline at end of file diff --git a/docker/base/xcrun b/docker/base/hacks/xcrun similarity index 100% rename from docker/base/xcrun rename to docker/base/hacks/xcrun From 33447f23f6be9deea2768313c761862eb60dd5d4 Mon Sep 17 00:00:00 2001 From: Tadas V Date: Thu, 25 Oct 2018 11:27:58 +0300 Subject: [PATCH 07/24] Gomobile injected into xgo container and is used for mobile framework creation --- docker/base/bootstrap_pure.sh | 2 +- docker/base/build.sh | 263 +------------------------ docker/base/hacks/getGomobileFork.sh | 5 + {src/mobilepkg => mobilepkg}/mobile.go | 0 4 files changed, 12 insertions(+), 258 deletions(-) create mode 100644 docker/base/hacks/getGomobileFork.sh rename {src/mobilepkg => mobilepkg}/mobile.go (100%) diff --git a/docker/base/bootstrap_pure.sh b/docker/base/bootstrap_pure.sh index 6470e79e..5e29d727 100644 --- a/docker/base/bootstrap_pure.sh +++ b/docker/base/bootstrap_pure.sh @@ -68,6 +68,6 @@ ln -s /go/bin/xgo /usr/bin/xgo # Install gomobile tool for android/ios frameworks echo "Installing gomobile..." -go get -u golang.org/x/mobile/cmd/gomobile +/hacks/getGomobileFork.sh /go/bin/gomobile init -ndk /usr/local/android-ndk-r13b/ /go/bin/gomobile version diff --git a/docker/base/build.sh b/docker/base/build.sh index daf1ce11..13a43246 100644 --- a/docker/base/build.sh +++ b/docker/base/build.sh @@ -154,153 +154,9 @@ for TARGET in $TARGETS; do # Check and build for Android targets if ([ $XGOOS == "." ] || [[ $XGOOS == android* ]]); then - # Split the platform version and configure the linker options - PLATFORM=`echo $XGOOS | cut -d '-' -f 2` - if [ "$PLATFORM" == "" ] || [ "$PLATFORM" == "." ] || [ "$PLATFORM" == "android" ]; then - PLATFORM=16 # Jelly Bean 4.0.0 - fi - if [ "$PLATFORM" -ge 16 ]; then - CGO_CCPIE="-fPIE" - CGO_LDPIE="-fPIE" - EXT_LDPIE="-extldflags=-pie" - else - unset CGO_CCPIE CGO_LDPIE EXT_LDPIE - fi - mkdir -p /build-android-aar - - # Iterate over the requested architectures, bootstrap and build - if [ $XGOARCH == "." ] || [ $XGOARCH == "arm" ] || [ $XGOARCH == "aar" ]; then - if [ "$GO_VERSION" -lt 150 ]; then - echo "Go version too low, skipping android-$PLATFORM/arm..." - else - # Include a linker workaround for pre Go 1.6 releases - if [ "$GO_VERSION" -lt 160 ]; then - EXT_LDAMD="-extldflags=-Wl,--allow-multiple-definition" - fi - - 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 > /dev/null 2>&1 - - echo "Bootstrapping android-$PLATFORM/arm..." - 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 CXX=arm-linux-androideabi-g++ HOST=arm-linux-androideabi PREFIX=/usr/$ANDROID_CHAIN_ARM/arm-linux-androideabi $BUILD_DEPS /deps ${DEPS_ARGS[@]} - export PKG_CONFIG_PATH=/usr/$ANDROID_CHAIN_ARM/arm-linux-androideabi/lib/pkgconfig - - if [ $XGOARCH == "." ] || [ $XGOARCH == "arm" ]; then - 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 "${T[@]}" --ldflags="$V $LD" -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 $V $X "${T[@]}" --ldflags="$V $EXT_LDPIE $EXT_LDAMD $LD" $BM -o "/build/$NAME-android-$PLATFORM-arm`extension android`" ./$PACK - fi - if [ $XGOARCH == "." ] || [ $XGOARCH == "aar" ]; then - CC=arm-linux-androideabi-gcc CXX=arm-linux-androideabi-g++ GOOS=android GOARCH=arm GOARM=7 CGO_ENABLED=1 go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK - CC=arm-linux-androideabi-gcc CXX=arm-linux-androideabi-g++ GOOS=android GOARCH=arm GOARM=7 CGO_ENABLED=1 go build $V $X "${T[@]}" --ldflags="$V $EXT_LDAMD $LD" --buildmode=c-shared -o "/build-android-aar/$NAME-android-$PLATFORM-arm.so" ./$PACK - fi - fi - fi - if [ "$GO_VERSION" -lt 160 ]; then - echo "Go version too low, skipping android-$PLATFORM/386,arm64..." - else - if [ "$PLATFORM" -ge 9 ] && ([ $XGOARCH == "." ] || [ $XGOARCH == "386" ] || [ $XGOARCH == "aar" ]); then - echo "Assembling toolchain for android-$PLATFORM/386..." - $ANDROID_NDK_ROOT/build/tools/make-standalone-toolchain.sh --ndk-dir=$ANDROID_NDK_ROOT --install-dir=/usr/$ANDROID_CHAIN_386 --toolchain=$ANDROID_CHAIN_386 --arch=x86 > /dev/null 2>&1 - - echo "Bootstrapping android-$PLATFORM/386..." - CC=i686-linux-android-gcc GOOS=android GOARCH=386 CGO_ENABLED=1 CGO_CFLAGS="$CGO_CCPIE" CGO_LDFLAGS="$CGO_LDPIE" go install std - - echo "Compiling for android-$PLATFORM/386..." - CC=i686-linux-android-gcc CXX=i686-linux-android-g++ HOST=i686-linux-android PREFIX=/usr/$ANDROID_CHAIN_386/i686-linux-android $BUILD_DEPS /deps ${DEPS_ARGS[@]} - export PKG_CONFIG_PATH=/usr/$ANDROID_CHAIN_386/i686-linux-android/lib/pkgconfig - - if [ $XGOARCH == "." ] || [ $XGOARCH == "386" ]; then - CC=i686-linux-android-gcc CXX=i686-linux-android-g++ GOOS=android GOARCH=386 CGO_ENABLED=1 CGO_CFLAGS="$CGO_CCPIE" CGO_CXXFLAGS="$CGO_CCPIE" CGO_LDFLAGS="$CGO_LDPIE" go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK - CC=i686-linux-android-gcc CXX=i686-linux-android-g++ GOOS=android GOARCH=386 CGO_ENABLED=1 CGO_CFLAGS="$CGO_CCPIE" CGO_CXXFLAGS="$CGO_CCPIE" CGO_LDFLAGS="$CGO_LDPIE" go build $V $X "${T[@]}" --ldflags="$V $EXT_LDPIE $LD" $BM -o "/build/$NAME-android-$PLATFORM-386`extension android`" ./$PACK - fi - if [ $XGOARCH == "." ] || [ $XGOARCH == "aar" ]; then - CC=i686-linux-android-gcc CXX=i686-linux-android-g++ GOOS=android GOARCH=386 CGO_ENABLED=1 go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK - CC=i686-linux-android-gcc CXX=i686-linux-android-g++ GOOS=android GOARCH=386 CGO_ENABLED=1 go build $V $X "${T[@]}" --ldflags="$V $LD" --buildmode=c-shared -o "/build-android-aar/$NAME-android-$PLATFORM-386.so" ./$PACK - fi - fi - if [ "$PLATFORM" -ge 21 ] && ([ $XGOARCH == "." ] || [ $XGOARCH == "arm64" ] || [ $XGOARCH == "aar" ]); then - echo "Assembling toolchain for android-$PLATFORM/arm64..." - $ANDROID_NDK_ROOT/build/tools/make-standalone-toolchain.sh --ndk-dir=$ANDROID_NDK_ROOT --install-dir=/usr/$ANDROID_CHAIN_ARM64 --toolchain=$ANDROID_CHAIN_ARM64 --arch=arm64 > /dev/null 2>&1 - - echo "Bootstrapping android-$PLATFORM/arm64..." - CC=aarch64-linux-android-gcc GOOS=android GOARCH=arm64 CGO_ENABLED=1 CGO_CFLAGS="$CGO_CCPIE" CGO_LDFLAGS="$CGO_LDPIE" go install std - - echo "Compiling for android-$PLATFORM/arm64..." - CC=aarch64-linux-android-gcc CXX=aarch64-linux-android-g++ HOST=aarch64-linux-android PREFIX=/usr/$ANDROID_CHAIN_ARM64/aarch64-linux-android $BUILD_DEPS /deps ${DEPS_ARGS[@]} - export PKG_CONFIG_PATH=/usr/$ANDROID_CHAIN_ARM64/aarch64-linux-android/lib/pkgconfig - - if [ $XGOARCH == "." ] || [ $XGOARCH == "arm64" ]; then - CC=aarch64-linux-android-gcc CXX=aarch64-linux-android-g++ GOOS=android GOARCH=arm64 CGO_ENABLED=1 CGO_CFLAGS="$CGO_CCPIE" CGO_CXXFLAGS="$CGO_CCPIE" CGO_LDFLAGS="$CGO_LDPIE" go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK - CC=aarch64-linux-android-gcc CXX=aarch64-linux-android-g++ GOOS=android GOARCH=arm64 CGO_ENABLED=1 CGO_CFLAGS="$CGO_CCPIE" CGO_CXXFLAGS="$CGO_CCPIE" CGO_LDFLAGS="$CGO_LDPIE" go build $V $X "${T[@]}" --ldflags="$V $EXT_LDPIE $LD" $BM -o "/build/$NAME-android-$PLATFORM-arm64`extension android`" ./$PACK - fi - if [ $XGOARCH == "." ] || [ $XGOARCH == "aar" ]; then - CC=aarch64-linux-android-gcc CXX=aarch64-linux-android-g++ GOOS=android GOARCH=arm64 CGO_ENABLED=1 go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK - CC=aarch64-linux-android-gcc CXX=aarch64-linux-android-g++ GOOS=android GOARCH=arm64 CGO_ENABLED=1 go build $V $X "${T[@]}" --ldflags="$V $LD" --buildmode=c-shared -o "/build-android-aar/$NAME-android-$PLATFORM-arm64.so" ./$PACK - fi - fi - fi - # Assemble the Android Archive from the built shared libraries - if [ $XGOARCH == "." ] || [ $XGOARCH == "aar" ]; then - title=${NAME^} - archive=/build/$NAME-android-$PLATFORM-aar - bundle=/build/$NAME-android-$PLATFORM.aar - - # Generate the Java import path based on the Go one - package=`go list ./$PACK | tr '-' '_'` - package=$(for p in `echo ${package//\// }`; do echo $p | awk 'BEGIN{FS="."}{for (i=NF; i>0; i--){printf "%s.", $i;}}'; done | sed 's/.$//') - package=${package%.*} - - # Create a fresh empty Android archive - rm -rf $archive $bundle - mkdir -p $archive - - echo -e "\n \n" > $archive/AndroidManifest.xml - mkdir -p $archive/res - touch $archive/R.txt - - # Generate the JNI wrappers automatically with SWIG - jni=`mktemp -d` - header=`find /build-android-aar | grep '\.h$' | head -n 1` - if [ "$header" == "" ]; then - echo "No API C header specified, skipping android-$PLATFORM/aar..." - else - cp $header $jni/$NAME.h - sed -i -e 's|__complex|complex|g' $jni/$NAME.h - sed -i -e 's|_Complex|complex|g' $jni/$NAME.h - echo -e "%module $title\n%{\n#include \"$NAME.h\"\n%}\n%pragma(java) jniclasscode=%{\nstatic {\nSystem.loadLibrary(\"$NAME\");\n}\n%}\n%include \"$NAME.h\"" > $jni/$NAME.i - - mkdir -p $jni/${package//.//} - swig -java -package $package -outdir $jni/${package//.//} $jni/$NAME.i - - # Assemble the Go static libraries and the JNI interface into shared libraries - for lib in `find /build-android-aar | grep '\.so$'`; do - if [[ "$lib" = *-arm.so ]]; then cc=arm-linux-androideabi-gcc; abi="armeabi-v7a"; fi - if [[ "$lib" = *-arm64.so ]]; then cc=aarch64-linux-android-gcc; abi="arm64-v8a"; fi - if [[ "$lib" = *-386.so ]]; then cc=i686-linux-android-gcc; abi="x86"; fi - - mkdir -p $archive/jni/$abi - cp ${lib%.*}.h $jni/${NAME}.h - cp $lib $archive/jni/$abi/lib${NAME}raw.so - (cd $archive/jni/$abi && $cc -shared -fPIC -o lib${NAME}.so -I"$ANDROID_NDK_LIBC/include" -I"$ANDROID_NDK_LIBC/libs/$abi/include" -I"$jni" lib${NAME}raw.so $jni/${NAME}_wrap.c) - done - - # Compile the Java wrapper and assemble into a .jar file - mkdir -p $jni/build - javac -target 1.7 -source 1.7 -cp . -d $jni/build $jni/${package//.//}/*.java - (cd $jni/build && jar cvf $archive/classes.jar *) - - # Finally assemble the archive contents into an .aar and clean up - (cd $archive && zip -r $bundle *) - rm -rf $jni $archive - fi - fi - # Clean up the android builds, toolchains and runtimes - rm -rf /build-android-aar - rm -rf /usr/local/go/pkg/android_* - rm -rf /usr/$ANDROID_CHAIN_ARM /usr/$ANDROID_CHAIN_ARM64 /usr/$ANDROID_CHAIN_386 + #ignore architectures, android versions etc. build only archive and sources + #android api will be 21 + $GOMOBILE bind --target=android/arm64 $X $V "${T[@]}" -o "/build/$NAME.aar" ./$PACK fi # Check and build for Linux targets if ([ $XGOOS == "." ] || [ $XGOOS == "linux" ]) && ([ $XGOARCH == "." ] || [ $XGOARCH == "amd64" ]); then @@ -491,121 +347,14 @@ for TARGET in $TARGETS; do fi # Check and build for iOS targets if [ $XGOOS == "." ] || [[ $XGOOS == ios* ]]; then - # Split the platform version and configure the deployment target + # Split the platform version and configure the deployment target PLATFORM=`echo $XGOOS | cut -d '-' -f 2` if [ "$PLATFORM" == "" ] || [ "$PLATFORM" == "." ] || [ "$PLATFORM" == "ios" ]; then - PLATFORM=5.0 # first iPad and upwards + PLATFORM=10.3 #min ios version to build for fi - export IPHONEOS_DEPLOYMENT_TARGET=$PLATFORM - # Build the requested iOS binaries - if [ "$GO_VERSION" -lt 150 ]; then - echo "Go version too low, skipping ios..." - else - # Add the 'ios' tag to all builds, otherwise the std libs will fail - if [ "$FLAG_TAGS" != "" ]; then - IOSTAGS=(--tags "ios $FLAG_TAGS") - else - IOSTAGS=(--tags ios) - fi - mkdir -p /build-ios-fw + $GOMOBILE bind --target=ios/arm64 -iosversion=$PLATFORM $X $V "${T[@]}" -o "/build/$NAME.framework" ./$PACK - # Strip symbol table below Go 1.6 to prevent DWARF issues - LDSTRIP="" - if [ "$GO_VERSION" -lt 160 ]; then - LDSTRIP="-s" - fi - # Cross compile to all available iOS and simulator platforms - if [ -d "$IOS_NDK_ARM_7" ] && ([ $XGOARCH == "." ] || [ $XGOARCH == "arm-7" ] || [ $XGOARCH == "framework" ]); then - echo "Bootstrapping ios-$PLATFORM/arm-7..." - export PATH=$IOS_NDK_ARM_7/bin:$PATH - GOOS=darwin GOARCH=arm GOARM=7 CGO_ENABLED=1 CC=arm-apple-darwin11-clang go install --tags ios std - - echo "Compiling for ios-$PLATFORM/arm-7..." - CC=arm-apple-darwin11-clang CXX=arm-apple-darwin11-clang++ HOST=arm-apple-darwin11 PREFIX=/usr/local $BUILD_DEPS /deps ${DEPS_ARGS[@]} - CC=arm-apple-darwin11-clang CXX=arm-apple-darwin11-clang++ GOOS=darwin GOARCH=arm GOARM=7 CGO_ENABLED=1 go get $V $X "${IOSTAGS[@]}" --ldflags="$V $LD" -d ./$PACK - if [ $XGOARCH == "." ] || [ $XGOARCH == "arm-7" ]; then - CC=arm-apple-darwin11-clang CXX=arm-apple-darwin11-clang++ GOOS=darwin GOARCH=arm GOARM=7 CGO_ENABLED=1 go build $V $X "${IOSTAGS[@]}" --ldflags="$LDSTRIP $V $LD" $BM -o "/build/$NAME-ios-$PLATFORM-armv7`extension darwin`" ./$PACK - fi - if [ $XGOARCH == "." ] || [ $XGOARCH == "framework" ]; then - CC=arm-apple-darwin11-clang CXX=arm-apple-darwin11-clang++ GOOS=darwin GOARCH=arm GOARM=7 CGO_ENABLED=1 go build $V $X "${IOSTAGS[@]}" --ldflags="$V $LD" --buildmode=c-archive -o "/build-ios-fw/$NAME-ios-$PLATFORM-armv7.a" ./$PACK - fi - echo "Cleaning up Go runtime for ios-$PLATFORM/arm-7..." - rm -rf /usr/local/go/pkg/darwin_arm - fi - if [ -d "$IOS_NDK_ARM64" ] && ([ $XGOARCH == "." ] || [ $XGOARCH == "arm64" ] || [ $XGOARCH == "framework" ]); then - echo "Bootstrapping ios-$PLATFORM/arm64..." - export PATH=$IOS_NDK_ARM64/bin:$PATH - GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 CC=arm-apple-darwin11-clang go install --tags ios std - - echo "Compiling for ios-$PLATFORM/arm64..." - CC=arm-apple-darwin11-clang CXX=arm-apple-darwin11-clang++ HOST=arm-apple-darwin11 PREFIX=/usr/local $BUILD_DEPS /deps ${DEPS_ARGS[@]} - CC=arm-apple-darwin11-clang CXX=arm-apple-darwin11-clang++ GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 go get $V $X "${IOSTAGS[@]}" --ldflags="$V $LD" -d ./$PACK - if [ $XGOARCH == "." ] || [ $XGOARCH == "arm64" ]; then - CC=arm-apple-darwin11-clang CXX=arm-apple-darwin11-clang++ GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 go build $V $X "${IOSTAGS[@]}" --ldflags="$LDSTRIP $V $LD" $BM -o "/build/$NAME-ios-$PLATFORM-arm64`extension darwin`" ./$PACK - fi - if [ $XGOARCH == "." ] || [ $XGOARCH == "framework" ]; then - CC=arm-apple-darwin11-clang CXX=arm-apple-darwin11-clang++ GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 go build $V $X "${IOSTAGS[@]}" --ldflags="$V $LD" --buildmode=c-archive -o "/build-ios-fw/$NAME-ios-$PLATFORM-arm64.a" ./$PACK - fi - echo "Cleaning up Go runtime for ios-$PLATFORM/arm64..." - rm -rf /usr/local/go/pkg/darwin_arm64 - fi - if [ -d "$IOS_SIM_NDK_AMD64" ] && ([ $XGOARCH == "." ] || [ $XGOARCH == "amd64" ] || [ $XGOARCH == "framework" ]); then - echo "Bootstrapping ios-$PLATFORM/amd64..." - export PATH=$IOS_SIM_NDK_AMD64/bin:$PATH - mv /usr/local/go/pkg/darwin_amd64 /usr/local/go/pkg/darwin_amd64_bak - GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 CC=arm-apple-darwin11-clang go install --tags ios std - - echo "Compiling for ios-$PLATFORM/amd64..." - CC=arm-apple-darwin11-clang CXX=arm-apple-darwin11-clang++ HOST=arm-apple-darwin11 PREFIX=/usr/local $BUILD_DEPS /deps ${DEPS_ARGS[@]} - CC=arm-apple-darwin11-clang CXX=arm-apple-darwin11-clang++ GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go get $V $X "${IOSTAGS[@]}" --ldflags="$V $LD" -d ./$PACK - if [ $XGOARCH == "." ] || [ $XGOARCH == "amd64" ]; then - CC=arm-apple-darwin11-clang CXX=arm-apple-darwin11-clang++ GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build $V $X "${IOSTAGS[@]}" --ldflags="$LDSTRIP $V $LD" $BM -o "/build/$NAME-ios-$PLATFORM-x86_64`extension darwin`" ./$PACK - fi - if [ $XGOARCH == "." ] || [ $XGOARCH == "framework" ]; then - CC=arm-apple-darwin11-clang CXX=arm-apple-darwin11-clang++ GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build $V $X "${IOSTAGS[@]}" --ldflags="$V $LD" --buildmode=c-archive -o "/build-ios-fw/$NAME-ios-$PLATFORM-x86_64.a" ./$PACK - fi - echo "Cleaning up Go runtime for ios-$PLATFORM/amd64..." - rm -rf /usr/local/go/pkg/darwin_amd64 - mv /usr/local/go/pkg/darwin_amd64_bak /usr/local/go/pkg/darwin_amd64 - fi - # Assemble the iOS framework from the built binaries - if [ $XGOARCH == "." ] || [ $XGOARCH == "framework" ]; then - title=${NAME^} - framework=/build/$NAME-ios-$PLATFORM-framework/$title.framework - - rm -rf $framework - mkdir -p $framework/Versions/A - (cd $framework/Versions && ln -nsf A Current) - - arches=() - for lib in `ls /build-ios-fw | grep -e '\.a$'`; do - arches+=("-arch" "`echo ${lib##*-} | cut -d '.' -f 1`" "/build-ios-fw/$lib") - done - arm-apple-darwin11-lipo -create "${arches[@]}" -o $framework/Versions/A/$title - arm-apple-darwin11-ranlib $framework/Versions/A/$title - (cd $framework && ln -nsf Versions/A/$title $title) - - mkdir -p $framework/Versions/A/Headers - for header in `ls /build-ios-fw | grep -e '\.h$'`; do - cp -f /build-ios-fw/$header $framework/Versions/A/Headers/$title.h - done - (cd $framework && ln -nsf Versions/A/Headers Headers) - - mkdir -p $framework/Versions/A/Resources - echo -e "\n\n\n\n\n" > $framework/Versions/A/Resources/Info.plist - (cd $framework && ln -nsf Versions/A/Resources Resources) - - mkdir -p $framework/Versions/A/Modules - echo -e "framework module \"$title\" {\n header \"$title.h\"\n export *\n}" > $framework/Versions/A/Modules/module.modulemap - (cd $framework && ln -nsf Versions/A/Modules Modules) - - chmod 777 -R /build/$NAME-ios-$PLATFORM-framework - fi - rm -rf /build-ios-fw - fi - # Remove any automatically injected deployment target vars - unset IPHONEOS_DEPLOYMENT_TARGET fi done diff --git a/docker/base/hacks/getGomobileFork.sh b/docker/base/hacks/getGomobileFork.sh new file mode 100644 index 00000000..eb4a86b9 --- /dev/null +++ b/docker/base/hacks/getGomobileFork.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +#use this fork until https://github.com/golang/mobile/pull/24 is accepted +git clone https://github.com/tadovas/mobile.git /go/src/golang.org/x/mobile +go install golang.org/x/mobile/cmd/gomobile \ No newline at end of file diff --git a/src/mobilepkg/mobile.go b/mobilepkg/mobile.go similarity index 100% rename from src/mobilepkg/mobile.go rename to mobilepkg/mobile.go From 8c8152de3c837ce138780e17ab39a7f769bc65c0 Mon Sep 17 00:00:00 2001 From: Tadas V Date: Thu, 25 Oct 2018 11:38:58 +0300 Subject: [PATCH 08/24] Style fixes --- docker/base/gomobile.sh | 2 +- docker/base/hacks/getGomobileFork.sh | 4 ++-- mobilepkg/mobile.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docker/base/gomobile.sh b/docker/base/gomobile.sh index 892282ea..65f251c7 100644 --- a/docker/base/gomobile.sh +++ b/docker/base/gomobile.sh @@ -2,4 +2,4 @@ set -e custompath=/hacks:$PATH:/go/bin -PATH=$custompath gomobile $@ \ No newline at end of file +PATH=$custompath gomobile $@ diff --git a/docker/base/hacks/getGomobileFork.sh b/docker/base/hacks/getGomobileFork.sh index eb4a86b9..582e9155 100644 --- a/docker/base/hacks/getGomobileFork.sh +++ b/docker/base/hacks/getGomobileFork.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash - +set -e #use this fork until https://github.com/golang/mobile/pull/24 is accepted git clone https://github.com/tadovas/mobile.git /go/src/golang.org/x/mobile -go install golang.org/x/mobile/cmd/gomobile \ No newline at end of file +go install golang.org/x/mobile/cmd/gomobile diff --git a/mobilepkg/mobile.go b/mobilepkg/mobile.go index 191a10b6..11b8542e 100644 --- a/mobilepkg/mobile.go +++ b/mobilepkg/mobile.go @@ -2,4 +2,4 @@ package mobilepkg func HelloWorld() { //sample function for testing gomobile inside xgo -} \ No newline at end of file +} From 278bee0437ad41425d43d96580e6526031a8c553 Mon Sep 17 00:00:00 2001 From: Tadas V Date: Thu, 25 Oct 2018 13:22:40 +0300 Subject: [PATCH 09/24] Fix formatting, comments, etc. --- .gitignore | 2 +- docker/base/build.sh | 6 +++--- docker/base/hacks/xcrun | 6 ++---- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 62c89355..9f11b755 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -.idea/ \ No newline at end of file +.idea/ diff --git a/docker/base/build.sh b/docker/base/build.sh index 13a43246..24d76c4c 100644 --- a/docker/base/build.sh +++ b/docker/base/build.sh @@ -154,8 +154,8 @@ for TARGET in $TARGETS; do # Check and build for Android targets if ([ $XGOOS == "." ] || [[ $XGOOS == android* ]]); then - #ignore architectures, android versions etc. build only archive and sources - #android api will be 21 + # Ignore architectures, android versions etc. build only archive and sources + # Android api will be 21 $GOMOBILE bind --target=android/arm64 $X $V "${T[@]}" -o "/build/$NAME.aar" ./$PACK fi # Check and build for Linux targets @@ -347,7 +347,7 @@ for TARGET in $TARGETS; do fi # Check and build for iOS targets if [ $XGOOS == "." ] || [[ $XGOOS == ios* ]]; then - # Split the platform version and configure the deployment target + # Split the platform version and configure the deployment target PLATFORM=`echo $XGOOS | cut -d '-' -f 2` if [ "$PLATFORM" == "" ] || [ "$PLATFORM" == "." ] || [ "$PLATFORM" == "ios" ]; then PLATFORM=10.3 #min ios version to build for diff --git a/docker/base/hacks/xcrun b/docker/base/hacks/xcrun index 870a0720..cb77c1ba 100755 --- a/docker/base/hacks/xcrun +++ b/docker/base/hacks/xcrun @@ -30,12 +30,11 @@ case $key in --find) toolToFind="$1" findTool "$toolToFind" - shift exit 0 ;; --show-sdk-path) - showSDK - exit 0 + showSDK + exit 0 ;; xcodebuild) echo "xcrun wrapper v0.1" @@ -51,4 +50,3 @@ case $key in ;; esac done -exit 0 From 9c62298e32b58f12575854caaed20767148f0005 Mon Sep 17 00:00:00 2001 From: Tadas V Date: Fri, 26 Oct 2018 10:08:08 +0300 Subject: [PATCH 10/24] gomobile is ready - no fork needed --- docker/base/bootstrap_pure.sh | 2 +- docker/base/hacks/goGetForked.sh | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100755 docker/base/hacks/goGetForked.sh diff --git a/docker/base/bootstrap_pure.sh b/docker/base/bootstrap_pure.sh index 5e29d727..6470e79e 100644 --- a/docker/base/bootstrap_pure.sh +++ b/docker/base/bootstrap_pure.sh @@ -68,6 +68,6 @@ ln -s /go/bin/xgo /usr/bin/xgo # Install gomobile tool for android/ios frameworks echo "Installing gomobile..." -/hacks/getGomobileFork.sh +go get -u golang.org/x/mobile/cmd/gomobile /go/bin/gomobile init -ndk /usr/local/android-ndk-r13b/ /go/bin/gomobile version diff --git a/docker/base/hacks/goGetForked.sh b/docker/base/hacks/goGetForked.sh new file mode 100755 index 00000000..73c2b965 --- /dev/null +++ b/docker/base/hacks/goGetForked.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +#Usage: ./goGetForked.sh https://github.com/tadovas/mobile.git golang.org/x/mobile [optional subpackage to go install] +#Will checkout forked git repo to folder specified by second arg and will do go install on it + +set -e + +if [ ! -z "$3" ]; then subpackage="/$3"; fi + +git clone $1 $GOPATH/src/$2 +go install $2${subpackage} From 4f564c80588ecd967acc72df75894b75d631b5bb Mon Sep 17 00:00:00 2001 From: Tadas V Date: Fri, 26 Oct 2018 14:04:59 +0300 Subject: [PATCH 11/24] Fix failing dockerhub builds. Remove gomobile fork --- .gitignore | 3 +++ docker/base/Dockerfile | 3 +++ docker/base/hacks/getGomobileFork.sh | 5 ----- docker/base/patches/autogen.patch | 13 +++++++++++++ docker/base/update_ios.sh | 4 +++- run.sh | 22 ++++++++++++++++++++++ {mobilepkg => src/mobilepkg}/mobile.go | 0 7 files changed, 44 insertions(+), 6 deletions(-) delete mode 100644 docker/base/hacks/getGomobileFork.sh create mode 100644 docker/base/patches/autogen.patch create mode 100755 run.sh rename {mobilepkg => src/mobilepkg}/mobile.go (100%) diff --git a/.gitignore b/.gitignore index 9f11b755..70b86f13 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ .idea/ +artifacts/ +bin/ +pkg/ \ No newline at end of file diff --git a/docker/base/Dockerfile b/docker/base/Dockerfile index c6ae8c54..de82c8fc 100644 --- a/docker/base/Dockerfile +++ b/docker/base/Dockerfile @@ -41,6 +41,9 @@ RUN \ # Fix any stock package issues RUN ln -s /usr/include/asm-generic /usr/include/asm +# Add patches directory for patching later +ADD patches /patches + # Configure the container for OSX cross compilation ENV OSX_SDK MacOSX10.11.sdk ENV OSX_NDK_X86 /usr/local/osx-ndk-x86 diff --git a/docker/base/hacks/getGomobileFork.sh b/docker/base/hacks/getGomobileFork.sh deleted file mode 100644 index 582e9155..00000000 --- a/docker/base/hacks/getGomobileFork.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -set -e -#use this fork until https://github.com/golang/mobile/pull/24 is accepted -git clone https://github.com/tadovas/mobile.git /go/src/golang.org/x/mobile -go install golang.org/x/mobile/cmd/gomobile diff --git a/docker/base/patches/autogen.patch b/docker/base/patches/autogen.patch new file mode 100644 index 00000000..23265708 --- /dev/null +++ b/docker/base/patches/autogen.patch @@ -0,0 +1,13 @@ +diff --git a/cctools/autogen.sh b/cctools/autogen.sh +index 9258d0d..ca899f5 100755 +--- a/cctools/autogen.sh ++++ b/cctools/autogen.sh +@@ -19,7 +19,7 @@ fi + export LIBTOOLIZE + mkdir -p m4 + +-$LIBTOOLIZE -c -i ++$LIBTOOLIZE -c -i --force + aclocal -I m4 + autoconf + diff --git a/docker/base/update_ios.sh b/docker/base/update_ios.sh index 0b68dbee..90d6279c 100644 --- a/docker/base/update_ios.sh +++ b/docker/base/update_ios.sh @@ -25,7 +25,7 @@ function extract { bzip2 -dc $1 | tar xf - ;; *.zip) - unzip $1 + unzip $1 > /dev/null ;; esac } @@ -48,6 +48,8 @@ rm -rf $sdk # Pull the iOS cross compiler tool and build the toolchain git clone https://github.com/tpoechtrager/cctools-port.git +# Patch autogen.sh by forcing libtoolize to regen config files (until PR https://github.com/tpoechtrager/cctools-port/pull/56 is accepted) +patch /cctools-port/cctools/autogen.sh < /patches/autogen.patch if [[ "`basename $1`" =~ ^iPhoneSimulator ]]; then rm -rf $IOS_SIM_NDK_AMD64 diff --git a/run.sh b/run.sh new file mode 100755 index 00000000..d2c4bafa --- /dev/null +++ b/run.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +set -e + +function buildBase() { + echo "Building base..." + docker build -t mysteriumnetwork/xgo:base $@ docker/base/. +} + +function buildGo() { + echo "Building go..." + docker build -t mysteriumnetwork/xgo-1.11 $@ docker/go-1.11.0/. +} + +function xgoTest() { + echo "Running tests..." + xgo -image=mysteriumnetwork/xgo-1.11 -targets=ios/arm64,android/arm64 -x -v -out mobilepkg -dest `pwd`/artifacts `pwd`/src/mobilepkg +} + +cmd="$1" +shift +echo "Running $cmd ... with args $@" +$cmd $@ diff --git a/mobilepkg/mobile.go b/src/mobilepkg/mobile.go similarity index 100% rename from mobilepkg/mobile.go rename to src/mobilepkg/mobile.go From 4596420a42f9471b8796f4353bb8ec62d7e37f89 Mon Sep 17 00:00:00 2001 From: Tadas Valiukas Date: Fri, 26 Oct 2018 14:09:03 +0300 Subject: [PATCH 12/24] Add new line --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 70b86f13..6dac1714 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ .idea/ artifacts/ bin/ -pkg/ \ No newline at end of file +pkg/ From 94aa95fdb3d76dd6cfe91d03da3ca6fa6122c0a8 Mon Sep 17 00:00:00 2001 From: Tadas V Date: Fri, 26 Oct 2018 16:53:51 +0300 Subject: [PATCH 13/24] Cross compile clang with OSX min version 10.10 by default --- docker/base/Dockerfile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/docker/base/Dockerfile b/docker/base/Dockerfile index de82c8fc..6189f6d8 100644 --- a/docker/base/Dockerfile +++ b/docker/base/Dockerfile @@ -51,17 +51,22 @@ ENV OSX_NDK_X86 /usr/local/osx-ndk-x86 RUN \ OSX_SDK_PATH=https://s3.dockerproject.org/darwin/v2/$OSX_SDK.tar.xz && \ $FETCH $OSX_SDK_PATH dd228a335194e3392f1904ce49aff1b1da26ca62 && \ - \ + tar -xf `basename $OSX_SDK_PATH` && rm -f `basename $OSX_SDK_PATH` + +ADD patch.tar.xz $OSX_SDK/usr/include/c++ + +RUN tar -cf - $OSX_SDK/ | xz -c - > $OSX_SDK.tar.xz && rm -rf $OSX_SDK + +RUN \ git clone https://github.com/tpoechtrager/osxcross.git && \ - mv `basename $OSX_SDK_PATH` /osxcross/tarballs/ && \ + mv $OSX_SDK.tar.xz /osxcross/tarballs/ && \ \ sed -i -e 's|-march=native||g' /osxcross/build_clang.sh /osxcross/wrapper/build.sh && \ - UNATTENDED=yes OSX_VERSION_MIN=10.6 /osxcross/build.sh && \ + UNATTENDED=yes OSX_VERSION_MIN=10.10 /osxcross/build.sh && \ mv /osxcross/target $OSX_NDK_X86 && \ \ rm -rf /osxcross -ADD patch.tar.xz $OSX_NDK_X86/SDK/$OSX_SDK/usr/include/c++ ENV PATH $OSX_NDK_X86/bin:$PATH # Configure the container for iOS cross compilation From 2bc182c24d75546f48f126bc6b51f6d8df91693a Mon Sep 17 00:00:00 2001 From: Tadas V Date: Tue, 30 Oct 2018 10:57:35 +0200 Subject: [PATCH 14/24] Add build support for android simulator --- docker/base/build.sh | 5 +++-- run.sh | 12 ++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/docker/base/build.sh b/docker/base/build.sh index 24d76c4c..92eb416e 100644 --- a/docker/base/build.sh +++ b/docker/base/build.sh @@ -154,9 +154,10 @@ for TARGET in $TARGETS; do # Check and build for Android targets if ([ $XGOOS == "." ] || [[ $XGOOS == android* ]]); then - # Ignore architectures, android versions etc. build only archive and sources + # Ignore android versions etc. build only archive and sources # Android api will be 21 - $GOMOBILE bind --target=android/arm64 $X $V "${T[@]}" -o "/build/$NAME.aar" ./$PACK + # Archive will be for both amd64 and arm64 + $GOMOBILE bind --target=android/arm64,android/amd64 $X $V "${T[@]}" -o "/build/$NAME.aar" ./$PACK fi # Check and build for Linux targets if ([ $XGOOS == "." ] || [ $XGOOS == "linux" ]) && ([ $XGOARCH == "." ] || [ $XGOARCH == "amd64" ]); then diff --git a/run.sh b/run.sh index d2c4bafa..61924299 100755 --- a/run.sh +++ b/run.sh @@ -7,13 +7,17 @@ function buildBase() { } function buildGo() { - echo "Building go..." - docker build -t mysteriumnetwork/xgo-1.11 $@ docker/go-1.11.0/. + local tag=$1 + shift; + echo "Building go... will tag as $tag" + docker build -t mysteriumnetwork/xgo-$tag $@ docker/go-1.11.0/. } function xgoTest() { - echo "Running tests..." - xgo -image=mysteriumnetwork/xgo-1.11 -targets=ios/arm64,android/arm64 -x -v -out mobilepkg -dest `pwd`/artifacts `pwd`/src/mobilepkg + local tag=$1 + shift; + echo "Running tests... using tag: $tag" + xgo -image=mysteriumnetwork/xgo-$tag -targets=android/*,ios/* $@ -out mobilepkg -dest `pwd`/artifacts `pwd`/src/mobilepkg } cmd="$1" From 2a9b19095f0098931d052acc4033e5fda84ab145 Mon Sep 17 00:00:00 2001 From: Tadas V Date: Wed, 31 Oct 2018 15:44:13 +0200 Subject: [PATCH 15/24] Add x86 emulator support for android libs --- docker/base/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/base/build.sh b/docker/base/build.sh index 92eb416e..ed304699 100644 --- a/docker/base/build.sh +++ b/docker/base/build.sh @@ -157,7 +157,7 @@ for TARGET in $TARGETS; do # Ignore android versions etc. build only archive and sources # Android api will be 21 # Archive will be for both amd64 and arm64 - $GOMOBILE bind --target=android/arm64,android/amd64 $X $V "${T[@]}" -o "/build/$NAME.aar" ./$PACK + $GOMOBILE bind --target=android/arm64,android/amd64,android/386 $X $V "${T[@]}" -o "/build/$NAME.aar" ./$PACK fi # Check and build for Linux targets if ([ $XGOOS == "." ] || [ $XGOOS == "linux" ]) && ([ $XGOARCH == "." ] || [ $XGOARCH == "amd64" ]); then From e38f95875c84a18f35417b3245a1a9431b1c7a35 Mon Sep 17 00:00:00 2001 From: Tadas V Date: Mon, 19 Nov 2018 15:26:24 +0200 Subject: [PATCH 16/24] Android arm-a7v architecture support added --- docker/base/build.sh | 6 +++--- run.sh | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docker/base/build.sh b/docker/base/build.sh index ed304699..8f5e5a7e 100644 --- a/docker/base/build.sh +++ b/docker/base/build.sh @@ -155,9 +155,9 @@ for TARGET in $TARGETS; do # Check and build for Android targets if ([ $XGOOS == "." ] || [[ $XGOOS == android* ]]); then # Ignore android versions etc. build only archive and sources - # Android api will be 21 - # Archive will be for both amd64 and arm64 - $GOMOBILE bind --target=android/arm64,android/amd64,android/386 $X $V "${T[@]}" -o "/build/$NAME.aar" ./$PACK + # Android api will be 21 for arm64, 16 for arm-a7v + # Archive will be for both amd64,x86 and arm64, arm 7 + $GOMOBILE bind --target=android/arm64,android/arm,android/amd64,android/386 $X $V "${T[@]}" -o "/build/$NAME.aar" ./$PACK fi # Check and build for Linux targets if ([ $XGOOS == "." ] || [ $XGOOS == "linux" ]) && ([ $XGOARCH == "." ] || [ $XGOARCH == "amd64" ]); then diff --git a/run.sh b/run.sh index 61924299..87881764 100755 --- a/run.sh +++ b/run.sh @@ -20,6 +20,11 @@ function xgoTest() { xgo -image=mysteriumnetwork/xgo-$tag -targets=android/*,ios/* $@ -out mobilepkg -dest `pwd`/artifacts `pwd`/src/mobilepkg } +function listAarFiles() { + local file=$1 + unzip -l $file +} + cmd="$1" shift echo "Running $cmd ... with args $@" From f8cce5a139231555648e225864e17c4e5cca4770 Mon Sep 17 00:00:00 2001 From: Tadas V Date: Fri, 14 Dec 2018 12:21:58 +0200 Subject: [PATCH 17/24] Add passing ldflags arg to gomobile, fix arg passing issue --- docker/base/build.sh | 4 ++-- docker/base/gomobile.sh | 2 +- run.sh | 4 +++- src/mobilepkg/mobile.go | 5 ++++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/docker/base/build.sh b/docker/base/build.sh index 8f5e5a7e..f4a7441d 100644 --- a/docker/base/build.sh +++ b/docker/base/build.sh @@ -157,7 +157,7 @@ for TARGET in $TARGETS; do # Ignore android versions etc. build only archive and sources # Android api will be 21 for arm64, 16 for arm-a7v # Archive will be for both amd64,x86 and arm64, arm 7 - $GOMOBILE bind --target=android/arm64,android/arm,android/amd64,android/386 $X $V "${T[@]}" -o "/build/$NAME.aar" ./$PACK + $GOMOBILE bind --target=android/arm64,android/arm,android/amd64,android/386 $X $V "${T[@]}" --ldflags="$V $LD" -o "/build/$NAME.aar" ./$PACK fi # Check and build for Linux targets if ([ $XGOOS == "." ] || [ $XGOOS == "linux" ]) && ([ $XGOARCH == "." ] || [ $XGOARCH == "amd64" ]); then @@ -354,7 +354,7 @@ for TARGET in $TARGETS; do PLATFORM=10.3 #min ios version to build for fi - $GOMOBILE bind --target=ios/arm64 -iosversion=$PLATFORM $X $V "${T[@]}" -o "/build/$NAME.framework" ./$PACK + $GOMOBILE bind --target=ios/arm64 -iosversion=$PLATFORM $X $V "${T[@]}" --ldflags="$V $LD" -o "/build/$NAME.framework" ./$PACK fi done diff --git a/docker/base/gomobile.sh b/docker/base/gomobile.sh index 65f251c7..8d686234 100644 --- a/docker/base/gomobile.sh +++ b/docker/base/gomobile.sh @@ -2,4 +2,4 @@ set -e custompath=/hacks:$PATH:/go/bin -PATH=$custompath gomobile $@ +PATH=$custompath gomobile "$@" diff --git a/run.sh b/run.sh index 87881764..418c434e 100755 --- a/run.sh +++ b/run.sh @@ -17,7 +17,9 @@ function xgoTest() { local tag=$1 shift; echo "Running tests... using tag: $tag" - xgo -image=mysteriumnetwork/xgo-$tag -targets=android/*,ios/* $@ -out mobilepkg -dest `pwd`/artifacts `pwd`/src/mobilepkg + xgo -image=mysteriumnetwork/xgo-$tag -targets=android/*,ios/* $@ -out mobilepkg -dest `pwd`/artifacts \ + --ldflags="-w -s -X mobilepkg.Flag=success2" \ + `pwd`/src/mobilepkg } function listAarFiles() { diff --git a/src/mobilepkg/mobile.go b/src/mobilepkg/mobile.go index 11b8542e..f0479438 100644 --- a/src/mobilepkg/mobile.go +++ b/src/mobilepkg/mobile.go @@ -1,5 +1,8 @@ package mobilepkg -func HelloWorld() { +var Flag = "fail" + +func HelloWorld() string { //sample function for testing gomobile inside xgo + return Flag } From 2294b2767a50a197bbf2af60759d87bd07858718 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?And=C5=BEej=20Maciusovi=C4=8D?= Date: Mon, 28 Oct 2019 08:38:54 +0200 Subject: [PATCH 18/24] Add go 1.13.1 support --- docker/base/Dockerfile | 7 +++---- docker/base/bootstrap_pure.sh | 9 +++++++-- docker/go-1.13.1/Dockerfile | 17 +++++++++++++++++ 3 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 docker/go-1.13.1/Dockerfile diff --git a/docker/base/Dockerfile b/docker/base/Dockerfile index 6189f6d8..7de3f3e6 100644 --- a/docker/base/Dockerfile +++ b/docker/base/Dockerfile @@ -3,25 +3,22 @@ # # Released under the MIT license. -FROM ubuntu:17.10 +FROM ubuntu:18.04 MAINTAINER Péter Szilágyi # Mark the image as xgo enabled to support xgo-in-xgo ENV XGO_IN_XGO 1 - # Configure the Go environment, since it's not going to change ENV PATH /usr/local/go/bin:$PATH ENV GOPATH /go - # Inject the remote file fetcher and checksum verifier ADD fetch.sh /fetch.sh ENV FETCH /fetch.sh RUN chmod +x $FETCH - # Make sure apt-get is up to date and dependent packages are installed RUN \ apt-get update && \ @@ -68,6 +65,8 @@ RUN \ rm -rf /osxcross ENV PATH $OSX_NDK_X86/bin:$PATH +ENV LD_LIBRARY_PATH=$OSX_NDK_X86/lib/:$LD_LIBRARY_PATH + # Configure the container for iOS cross compilation ENV IOS_NDK_ARM_7 /usr/local/ios-ndk-arm-7 diff --git a/docker/base/bootstrap_pure.sh b/docker/base/bootstrap_pure.sh index 6470e79e..396a2dc4 100644 --- a/docker/base/bootstrap_pure.sh +++ b/docker/base/bootstrap_pure.sh @@ -69,5 +69,10 @@ ln -s /go/bin/xgo /usr/bin/xgo # Install gomobile tool for android/ios frameworks echo "Installing gomobile..." go get -u golang.org/x/mobile/cmd/gomobile -/go/bin/gomobile init -ndk /usr/local/android-ndk-r13b/ -/go/bin/gomobile version +cd /go/src/golang.org/x/mobile +git checkout a27dd33d354d004b2de14a791df5af8a00f68b8e +go build ./cmd/gobind && mv ./gobind /usr/bin/ +go build ./cmd/gomobile && mv ./gomobile /usr/bin/ + +/usr/bin/gomobile init -ndk /usr/local/android-ndk-r13b/ +/usr/bin/gomobile version diff --git a/docker/go-1.13.1/Dockerfile b/docker/go-1.13.1/Dockerfile new file mode 100644 index 00000000..487b2f2b --- /dev/null +++ b/docker/go-1.13.1/Dockerfile @@ -0,0 +1,17 @@ +# Go cross compiler (xgo): Go 1.13 +# Copyright (c) 2018 Péter Szilágyi. All rights reserved. +# +# Released under the MIT license. + +FROM mysteriumnetwork/xgo:base + +MAINTAINER Péter Szilágyi + +ENV CGO_LDFLAGS_ALLOW -fobjc-arc +ENV GO_VERSION 1131 + +RUN \ + export ROOT_DIST=https://dl.google.com/go/go1.13.1.linux-amd64.tar.gz && \ + export ROOT_DIST_SHA=94f874037b82ea5353f4061e543681a0e79657f787437974214629af8407d124 && \ + \ + $BOOTSTRAP_PURE From 1e937e658b5bdb5aa88feb03ec4a76f66ea94a49 Mon Sep 17 00:00:00 2001 From: anjmao Date: Wed, 22 Jan 2020 13:39:43 +0200 Subject: [PATCH 19/24] Add go 1.13.6 --- .gitignore | 1 + README.md | 319 +++++------------------------ docker/base/Dockerfile | 48 ----- docker/base/bootstrap.sh | 26 --- docker/base/bootstrap_pure.sh | 17 -- docker/go-1.10.0/Dockerfile | 17 -- docker/go-1.10.1/Dockerfile | 17 -- docker/go-1.10.2/Dockerfile | 17 -- docker/go-1.10.3/Dockerfile | 17 -- docker/go-1.10.4/Dockerfile | 17 -- docker/go-1.10.x/Dockerfile | 8 - docker/go-1.11.0/Dockerfile | 18 -- docker/go-1.11.1/Dockerfile | 17 -- docker/go-1.11.2/Dockerfile | 17 -- docker/go-1.11.3/Dockerfile | 17 -- docker/go-1.11.4/Dockerfile | 17 -- docker/go-1.11.5/Dockerfile | 17 -- docker/go-1.11.x/Dockerfile | 8 - docker/go-1.12.0/Dockerfile | 17 -- docker/go-1.12.x/Dockerfile | 8 - docker/go-1.13.1/Dockerfile | 10 +- docker/go-1.13.6/Dockerfile | 17 ++ docker/go-1.3.0/Dockerfile | 35 ---- docker/go-1.3.1/Dockerfile | 35 ---- docker/go-1.3.3/Dockerfile | 35 ---- docker/go-1.3.x/Dockerfile | 8 - docker/go-1.4.2/Dockerfile | 35 ---- docker/go-1.4.x/Dockerfile | 8 - docker/go-1.4/Dockerfile | 35 ---- docker/go-1.5.0/Dockerfile | 17 -- docker/go-1.5.1/Dockerfile | 17 -- docker/go-1.5.2/Dockerfile | 17 -- docker/go-1.5.3/Dockerfile | 17 -- docker/go-1.5.4/Dockerfile | 17 -- docker/go-1.5.x/Dockerfile | 8 - docker/go-1.6.0/Dockerfile | 17 -- docker/go-1.6.1/Dockerfile | 17 -- docker/go-1.6.2/Dockerfile | 17 -- docker/go-1.6.3/Dockerfile | 17 -- docker/go-1.6.x/Dockerfile | 8 - docker/go-1.7.0/Dockerfile | 17 -- docker/go-1.7.1/Dockerfile | 17 -- docker/go-1.7.3/Dockerfile | 17 -- docker/go-1.7.4/Dockerfile | 17 -- docker/go-1.7.5/Dockerfile | 17 -- docker/go-1.7.x/Dockerfile | 8 - docker/go-1.8.0/Dockerfile | 17 -- docker/go-1.8.1/Dockerfile | 17 -- docker/go-1.8.3/Dockerfile | 17 -- docker/go-1.8.x/Dockerfile | 8 - docker/go-1.9.0/Dockerfile | 17 -- docker/go-1.9.1/Dockerfile | 17 -- docker/go-1.9.2/Dockerfile | 17 -- docker/go-1.9.3/Dockerfile | 17 -- docker/go-1.9.4/Dockerfile | 17 -- docker/go-1.9.x/Dockerfile | 8 - docker/go-develop/Dockerfile | 12 -- docker/go-latest/Dockerfile | 8 - run.sh | 33 --- test.sh | 16 ++ testsuite.go | 86 -------- xgo.go | 373 ---------------------------------- 62 files changed, 86 insertions(+), 1714 deletions(-) delete mode 100644 docker/go-1.10.0/Dockerfile delete mode 100644 docker/go-1.10.1/Dockerfile delete mode 100644 docker/go-1.10.2/Dockerfile delete mode 100644 docker/go-1.10.3/Dockerfile delete mode 100644 docker/go-1.10.4/Dockerfile delete mode 100644 docker/go-1.10.x/Dockerfile delete mode 100644 docker/go-1.11.0/Dockerfile delete mode 100644 docker/go-1.11.1/Dockerfile delete mode 100644 docker/go-1.11.2/Dockerfile delete mode 100644 docker/go-1.11.3/Dockerfile delete mode 100644 docker/go-1.11.4/Dockerfile delete mode 100644 docker/go-1.11.5/Dockerfile delete mode 100644 docker/go-1.11.x/Dockerfile delete mode 100644 docker/go-1.12.0/Dockerfile delete mode 100644 docker/go-1.12.x/Dockerfile create mode 100644 docker/go-1.13.6/Dockerfile delete mode 100644 docker/go-1.3.0/Dockerfile delete mode 100644 docker/go-1.3.1/Dockerfile delete mode 100644 docker/go-1.3.3/Dockerfile delete mode 100644 docker/go-1.3.x/Dockerfile delete mode 100644 docker/go-1.4.2/Dockerfile delete mode 100644 docker/go-1.4.x/Dockerfile delete mode 100644 docker/go-1.4/Dockerfile delete mode 100644 docker/go-1.5.0/Dockerfile delete mode 100644 docker/go-1.5.1/Dockerfile delete mode 100644 docker/go-1.5.2/Dockerfile delete mode 100644 docker/go-1.5.3/Dockerfile delete mode 100644 docker/go-1.5.4/Dockerfile delete mode 100644 docker/go-1.5.x/Dockerfile delete mode 100644 docker/go-1.6.0/Dockerfile delete mode 100644 docker/go-1.6.1/Dockerfile delete mode 100644 docker/go-1.6.2/Dockerfile delete mode 100644 docker/go-1.6.3/Dockerfile delete mode 100644 docker/go-1.6.x/Dockerfile delete mode 100644 docker/go-1.7.0/Dockerfile delete mode 100644 docker/go-1.7.1/Dockerfile delete mode 100644 docker/go-1.7.3/Dockerfile delete mode 100644 docker/go-1.7.4/Dockerfile delete mode 100644 docker/go-1.7.5/Dockerfile delete mode 100644 docker/go-1.7.x/Dockerfile delete mode 100644 docker/go-1.8.0/Dockerfile delete mode 100644 docker/go-1.8.1/Dockerfile delete mode 100644 docker/go-1.8.3/Dockerfile delete mode 100644 docker/go-1.8.x/Dockerfile delete mode 100644 docker/go-1.9.0/Dockerfile delete mode 100644 docker/go-1.9.1/Dockerfile delete mode 100644 docker/go-1.9.2/Dockerfile delete mode 100644 docker/go-1.9.3/Dockerfile delete mode 100644 docker/go-1.9.4/Dockerfile delete mode 100644 docker/go-1.9.x/Dockerfile delete mode 100644 docker/go-develop/Dockerfile delete mode 100644 docker/go-latest/Dockerfile delete mode 100755 run.sh create mode 100755 test.sh delete mode 100644 testsuite.go delete mode 100644 xgo.go diff --git a/.gitignore b/.gitignore index 6dac1714..93e24c41 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ artifacts/ bin/ pkg/ +build/ \ No newline at end of file diff --git a/README.md b/README.md index ed4269c0..18e2d564 100644 --- a/README.md +++ b/README.md @@ -1,272 +1,47 @@ -# xgo - Go CGO cross compiler - -Although Go strives to be a cross platform language, cross compilation from one -platform to another is not as simple as it could be, as you need the Go sources -bootstrapped to each platform and architecture. - -The first step towards cross compiling was Dave Cheney's [golang-crosscompile](https://github.com/davecheney/golang-crosscompile) -package, which automatically bootstrapped the necessary sources based on your -existing Go installation. Although this was enough for a lot of cases, certain -drawbacks became apparent where the official libraries used CGO internally: any -dependency to third party platform code is unavailable, hence those parts don't -cross compile nicely (native DNS resolution, system certificate access, etc). - -A step forward in enabling cross compilation was Alan Shreve's [gonative](https://github.com/inconshreveable/gonative) -package, which instead of bootstrapping the different platforms based on the -existing Go installation, downloaded the official pre-compiled binaries from the -golang website and injected those into the local toolchain. Since the pre-built -binaries already contained the necessary platform specific code, the few missing -dependencies were resolved, and true cross compilation could commence... of pure -Go code. - -However, there was still one feature missing: cross compiling Go code that used -CGO itself, which isn't trivial since you need access to OS specific headers and -libraries. This becomes very annoying when you need access only to some trivial -OS specific functionality (e.g. query the CPU load), but need to configure and -maintain separate build environments to do it. - -## Enter xgo - -My solution to the challenge of cross compiling Go code with embedded C/C++ snippets -(i.e. CGO_ENABLED=1) is based on the concept of [lightweight Linux containers](http://en.wikipedia.org/wiki/LXC). -All the necessary Go tool-chains, C cross compilers and platform headers/libraries -have been assembled into a single Docker container, which can then be called as if -a single command to compile a Go package to various platforms and architectures. - -## Installation - -Although you could build the container manually, it is available as an automatic -trusted build from Docker's container registry (not insignificant in size): - - docker pull karalabe/xgo-latest - -To prevent having to remember a potentially complex Docker command every time, -a lightweight Go wrapper was written on top of it. - - go get github.com/karalabe/xgo - -## Usage - -Simply specify the import path you want to build, and xgo will do the rest: - - $ xgo github.com/project-iris/iris - ... - - $ ls -al - -rwxr-xr-x 1 root root 9995000 Nov 24 16:44 iris-android-16-arm - -rwxr-xr-x 1 root root 6776500 Nov 24 16:44 iris-darwin-10.6-386 - -rwxr-xr-x 1 root root 8755532 Nov 24 16:44 iris-darwin-10.6-amd64 - -rwxr-xr-x 1 root root 7114176 Nov 24 16:45 iris-ios-5.0-arm - -rwxr-xr-x 1 root root 10135248 Nov 24 16:44 iris-linux-386 - -rwxr-xr-x 1 root root 12598472 Nov 24 16:44 iris-linux-amd64 - -rwxr-xr-x 1 root root 10040464 Nov 24 16:44 iris-linux-arm - -rwxr-xr-x 1 root root 7516368 Nov 24 16:44 iris-windows-4.0-386.exe - -rwxr-xr-x 1 root root 9549416 Nov 24 16:44 iris-windows-4.0-amd64.exe - - -If the path is not a canonical import path, but rather a local path (starts with -a dot `.` or a dash `/`), xgo will use the local GOPATH contents for the cross -compilation. - - -### Build flags - -A handful of flags can be passed to `go build`. The currently supported ones are - - - `-v`: prints the names of packages as they are compiled - - `-x`: prints the build commands as compilation progresses - - `-race`: enables data race detection (supported only on amd64, rest built without) - - `-tags='tag list'`: list of build tags to consider satisfied during the build - - `-ldflags='flag list'`: arguments to pass on each go tool link invocation - - `-buildmode=mode`: binary type to produce by the compiler - - -### Go releases - -As newer versions of the language runtime, libraries and tools get released, -these will get incorporated into xgo too as extensions layers to the base cross -compilation image (only Go 1.3 and above will be supported). - -You can select which Go release to work with through the `-go` command line flag -to xgo and if the specific release was already integrated, it will automatically -be retrieved and installed. - - $ xgo -go 1.6.1 github.com/project-iris/iris - -Additionally, a few wildcard release strings are also supported: - - - `latest` will use the latest Go release (this is the default) - - `1.6.x` will use the latest point release of a specific Go version - - `1.6-develop` will use the develop branch of a specific Go version - - `develop` will use the develop branch of the entire Go repository - -### Output prefixing - -xgo by default uses the name of the package being cross compiled as the output -file prefix. This can be overridden with the `-out` flag. - - $ xgo -out iris-v0.3.2 github.com/project-iris/iris - ... - - $ ls -al - -rwxr-xr-x 1 root root 9995000 Nov 24 16:44 iris-v0.3.2-android-16-arm - -rwxr-xr-x 1 root root 6776500 Nov 24 16:44 iris-v0.3.2-darwin-10.6-386 - -rwxr-xr-x 1 root root 8755532 Nov 24 16:44 iris-v0.3.2-darwin-10.6-amd64 - -rwxr-xr-x 1 root root 7114176 Nov 24 16:45 iris-v0.3.2-ios-5.0-arm - -rwxr-xr-x 1 root root 10135248 Nov 24 16:44 iris-v0.3.2-linux-386 - -rwxr-xr-x 1 root root 12598472 Nov 24 16:44 iris-v0.3.2-linux-amd64 - -rwxr-xr-x 1 root root 10040464 Nov 24 16:44 iris-v0.3.2-linux-arm - -rwxr-xr-x 1 root root 7516368 Nov 24 16:44 iris-v0.3.2-windows-4.0-386.exe - -rwxr-xr-x 1 root root 9549416 Nov 24 16:44 iris-v0.3.2-windows-4.0-amd64.exe - - -### Branch selection - -Similarly to `go get`, xgo also uses the `master` branch of a repository during -source code retrieval. To switch to a different branch before compilation pass -the desired branch name through the `--branch` argument. - - $ xgo --branch release-branch.go1.4 golang.org/x/tools/cmd/goimports - ... - - $ ls -al - -rwxr-xr-x 1 root root 4171248 Nov 24 16:40 goimports-android-16-arm - -rwxr-xr-x 1 root root 4139868 Nov 24 16:40 goimports-darwin-10.6-386 - -rwxr-xr-x 1 root root 5186720 Nov 24 16:40 goimports-darwin-10.6-amd64 - -rwxr-xr-x 1 root root 3202364 Nov 24 16:40 goimports-ios-5.0-arm - -rwxr-xr-x 1 root root 4189456 Nov 24 16:40 goimports-linux-386 - -rwxr-xr-x 1 root root 5264136 Nov 24 16:40 goimports-linux-amd64 - -rwxr-xr-x 1 root root 4209416 Nov 24 16:40 goimports-linux-arm - -rwxr-xr-x 1 root root 4348416 Nov 24 16:40 goimports-windows-4.0-386.exe - -rwxr-xr-x 1 root root 5415424 Nov 24 16:40 goimports-windows-4.0-amd64.exe - - -### Remote selection - -Yet again similarly to `go get`, xgo uses the repository remote corresponding to -the import path being built. To switch to a different remote while preserving the -original import path, use the `--remote` argument. - - $ xgo --remote github.com/golang/tools golang.org/x/tools/cmd/goimports - ... - -### Package selection - -If you used the above *branch* or *remote* selection machanisms, it may happen -that the path you are trying to build is only present in the specific branch and -not the default repository, causing Go to fail at locating it. To circumvent this, -you may specify only the repository root for xgo, and use an additional `--pkg` -parameter to select the exact package within, honoring any prior *branch* and -*remote* selections. - - $ xgo --pkg cmd/goimports golang.org/x/tools - ... - - $ ls -al - -rwxr-xr-x 1 root root 4194956 Nov 24 16:38 goimports-android-16-arm - -rwxr-xr-x 1 root root 4164448 Nov 24 16:38 goimports-darwin-10.6-386 - -rwxr-xr-x 1 root root 5223584 Nov 24 16:38 goimports-darwin-10.6-amd64 - -rwxr-xr-x 1 root root 3222848 Nov 24 16:39 goimports-ios-5.0-arm - -rwxr-xr-x 1 root root 4217184 Nov 24 16:38 goimports-linux-386 - -rwxr-xr-x 1 root root 5295768 Nov 24 16:38 goimports-linux-amd64 - -rwxr-xr-x 1 root root 4233120 Nov 24 16:38 goimports-linux-arm - -rwxr-xr-x 1 root root 4373504 Nov 24 16:38 goimports-windows-4.0-386.exe - -rwxr-xr-x 1 root root 5450240 Nov 24 16:38 goimports-windows-4.0-amd64.exe - -This argument may at some point be integrated into the import path itself, but for -now it exists as an independent build parameter. Also, there is not possibility -for now to build mulitple commands in one go. - -### Limit build targets - -By default `xgo` will try and build the specified package to all platforms and -architectures supported by the underlying Go runtime. If you wish to restrict -the build to only a few target systems, use the comma separated `--targets` CLI -argument: - - * `--targets=linux/arm`: builds only the ARMv5 Linux binaries (`arm-6`/`arm-7` allowed) - * `--targets=windows/*,darwin/*`: builds all Windows and OSX binaries - * `--targets=*/arm`: builds ARM binaries for all platforms - * `--targets=*/*`: builds all suppoted targets (default) - -The supported targets are: - - * Platforms: `android`, `darwin`, `ios`, `linux`, `windows` - * Achitectures: `386`, `amd64`, `arm-5`, `arm-6`, `arm-7`, `arm64`, `mips`, `mipsle`, `mips64`, `mips64le` - -### Platform versions - -By default `xgo` tries to cross compile to the lowest possible versions of every -supported platform, in order to produce binaries that are portable among various -versions of the same operating system. This however can lead to issues if a used -dependency is only supported by more recent systems. As such, `xgo` supports the -selection of specific platform versions by appending them to the OS target string. - - * `--targets=ios-8.1/*`: cross compile to iOS 8.1 - * `--targets=android-16/*`: cross compile to Android Jelly Bean - * `--targets=darwin-10.9/*`: cross compile to Mac OS X Mavericks - * `--targets=windows-6.0/*`: cross compile to Windows Vista - -The supported platforms are: - - * All Android APIs up to Android Lollipop 5.0 ([API level ids](https://source.android.com/source/build-numbers.html)) - * All Windows APIs up to Windows 8.1 limited by `mingw-w64` ([API level ids](https://en.wikipedia.org/wiki/Windows_NT#Releases)) - * OSX APIs in the range of 10.6 - 10.11 - * All iOS APIs up to iOS 9.3 - -### Mobile libraries - -Apart from the usual runnable binaries, `xgo` also supports building library -archives for Android (`android/aar`) and iOS (`ios/framework`). Opposed to -`gomobile` however `xgo` does not derive library APIs from the Go code, so -proper CGO C external methods must be defined within the package. - -In the case of Android archives, all architectures will be bundled that are -supported by the requested Android platform version. For iOS frameworks `xgo` -will bundle armv7 and arm64 by default, and also the x86_64 simulator builds -if the iPhoneSimulator.sdk was injected by the user: - -* Create a new docker image based on xgo: `FROM karalabe/xgo-latest` -* Inject the simulator SDK: `ADD iPhoneSimulator9.3.sdk.tar.xz /iPhoneSimulator9.3.sdk.tar.xz` -* Bootstrap the simulator SDK: `$UPDATE_IOS /iPhoneSimulator9.3.sdk.tar.xz` - -### CGO dependencies - -The main differentiator of xgo versus other cross compilers is support for basic -embedded C/C++ code and target-platform specific OS SDK availability. The current -xgo release introduces an experimental CGO *dependency* cross compilation, enabling -building Go programs that require external C/C++ libraries. - -It is assumed that the dependent C/C++ library is `configure/make` based, was -properly prepared for cross compilation and is available as a tarball download -(`.tar`, `.tar.gz` or `.tar.bz2`). Further plans include extending this to cmake -based projects, if need arises (please open an issue if it's important to you). - -Such dependencies can be added via the `--deps` argument. They will be retrieved -prior to starting the cross compilation and the packages cached to save bandwidth -on subsequent calls. - -A complex sample for such a scenario is building the Ethereum CLI node, which has -the GNU Multiple Precision Arithmetic Library as it's dependency. - - $ xgo --deps=https://gmplib.org/download/gmp/gmp-6.1.0.tar.bz2 \ - --targets=windows/* github.com/ethereum/go-ethereum/cmd/geth - ... - - $ ls -al - -rwxr-xr-x 1 root root 16315679 Nov 24 16:39 geth-windows-4.0-386.exe - -rwxr-xr-x 1 root root 19452036 Nov 24 16:38 geth-windows-4.0-amd64.exe - -Some trivial arguments may be passed to the dependencies' configure script via -`--depsargs`. - - $ xgo --deps=https://gmplib.org/download/gmp/gmp-6.1.0.tar.bz2 \ - --targets=ios/* --depsargs=--disable-assembly \ - github.com/ethereum/go-ethereum/cmd/geth - ... - - $ ls -al - -rwxr-xr-x 1 root root 14804160 Nov 24 16:32 geth-ios-5.0-arm - -Note, that since xgo needs to cross compile the dependencies for each platform -and architecture separately, build time can increase significantly. +# xgomobile - Go CGO cross compiler for gomobile + +### Usage + +``` +docker run --rm \ + -v "$PWD"/build:/build \ + -v "$GOPATH"/.xgo-cache:/deps-cache:ro \ + -v "$PWD"/src:/ext-go/1/src:ro \ + -e OUT=Mysterium \ + -e FLAG_V=false \ + -e FLAG_X=false \ + -e FLAG_RACE=false \ + -e FLAG_BUILDMODE=default \ + -e TARGETS=android/. \ + -e EXT_GOPATH=/ext-go/1 \ + -e GO111MODULE=off \ + mysteriumnetwork/xgomobile:1.13.6 mobilepkg +``` + +Also see and run ./test.sh to build test examples. + +### Building image + +If you make changes in docker/base you need to rebuild base image. + +``` +docker build -t mysteriumnetwork/xgomobile:base -f ./docker/base/Dockerfile ./docker/base +docker push mysteriumnetwork/xgomobile:base +``` + +If you add new go version only when build and push. + +Build new image. +``` +docker build -t mysteriumnetwork/xgomobile:1.13.6 -f ./docker/go-1.13.6/Dockerfile . +``` + +Update and run tests. +``` +./test.sh +``` + +Push image +``` +docker push mysteriumnetwork/xgomobile:1.13.6 +``` \ No newline at end of file diff --git a/docker/base/Dockerfile b/docker/base/Dockerfile index 7de3f3e6..29dfb976 100644 --- a/docker/base/Dockerfile +++ b/docker/base/Dockerfile @@ -41,54 +41,6 @@ RUN ln -s /usr/include/asm-generic /usr/include/asm # Add patches directory for patching later ADD patches /patches -# Configure the container for OSX cross compilation -ENV OSX_SDK MacOSX10.11.sdk -ENV OSX_NDK_X86 /usr/local/osx-ndk-x86 - -RUN \ - OSX_SDK_PATH=https://s3.dockerproject.org/darwin/v2/$OSX_SDK.tar.xz && \ - $FETCH $OSX_SDK_PATH dd228a335194e3392f1904ce49aff1b1da26ca62 && \ - tar -xf `basename $OSX_SDK_PATH` && rm -f `basename $OSX_SDK_PATH` - -ADD patch.tar.xz $OSX_SDK/usr/include/c++ - -RUN tar -cf - $OSX_SDK/ | xz -c - > $OSX_SDK.tar.xz && rm -rf $OSX_SDK - -RUN \ - git clone https://github.com/tpoechtrager/osxcross.git && \ - mv $OSX_SDK.tar.xz /osxcross/tarballs/ && \ - \ - sed -i -e 's|-march=native||g' /osxcross/build_clang.sh /osxcross/wrapper/build.sh && \ - UNATTENDED=yes OSX_VERSION_MIN=10.10 /osxcross/build.sh && \ - mv /osxcross/target $OSX_NDK_X86 && \ - \ - rm -rf /osxcross - -ENV PATH $OSX_NDK_X86/bin:$PATH -ENV LD_LIBRARY_PATH=$OSX_NDK_X86/lib/:$LD_LIBRARY_PATH - - -# Configure the container for iOS cross compilation -ENV IOS_NDK_ARM_7 /usr/local/ios-ndk-arm-7 -ENV IOS_NDK_ARM64 /usr/local/ios-ndk-arm64 -ENV IOS_SIM_NDK_AMD64 /usr/local/ios-sim-ndk-amd64 - -ADD update_ios.sh /update_ios.sh -ENV UPDATE_IOS /update_ios.sh -RUN chmod +x $UPDATE_IOS - -RUN \ - IOS_SDK_FILE=iPhoneOS10.3.sdk.zip && \ - IOS_SDK_PATH=http://resources.airnativeextensions.com/ios/$IOS_SDK_FILE && \ - $FETCH $IOS_SDK_PATH 7745815cd13d9b44c4cb0a2a40715e5410330233300ce4ff0ce106da17a636e8 && \ - mv `basename $IOS_SDK_PATH` iPhoneOS10.3.sdk.tmp.zip && \ - $UPDATE_IOS /iPhoneOS10.3.sdk.tmp.zip && \ - rm -rf /iPhoneOS10.3.sdk.tmp.zip && \ - cp -r /usr/local/osx-ndk-x86/SDK/MacOSX10.11.sdk/usr/include/c++/v1 /usr/local/ios-ndk-arm64/SDK/iPhoneOS10.3.sdk/usr/include/c++ - -ENV PATH $IOS_NDK_ARM64/bin:$PATH -ENV LD_LIBRARY_PATH $IOS_NDK_ARM64/lib/:$LD_LIBRARY_PATH - # Configure the container for Android cross compilation ENV ANDROID_NDK android-ndk-r13b ENV ANDROID_NDK_PATH http://dl.google.com/android/repository/$ANDROID_NDK-linux-x86_64.zip diff --git a/docker/base/bootstrap.sh b/docker/base/bootstrap.sh index 8df8f265..9d4dc219 100644 --- a/docker/base/bootstrap.sh +++ b/docker/base/bootstrap.sh @@ -43,29 +43,3 @@ if [ "$DIST_LINUX_ARM" != "" ]; then GOOS=linux GOARCH=arm /usr/local/go/pkg/tool/linux_amd64/dist bootstrap rm -f `basename $DIST_LINUX_ARM` fi - -if [ "$DIST_OSX_64" != "" ]; then - tar -C /usr/local --wildcards -xzf `basename $DIST_OSX_64` go/pkg/darwin_amd64* - GOOS=darwin GOARCH=amd64 /usr/local/go/pkg/tool/linux_amd64/dist bootstrap - rm -f `basename $DIST_OSX_64` -fi -if [ "$DIST_OSX_32" != "" ]; then - tar -C /usr/local --wildcards -xzf `basename $DIST_OSX_32` go/pkg/darwin_386* - GOOS=darwin GOARCH=386 /usr/local/go/pkg/tool/linux_amd64/dist bootstrap - rm -f `basename $DIST_OSX_32` -fi - -if [ "$DIST_WIN_64" != "" ]; then - unzip -d /usr/local -q `basename $DIST_WIN_64` go/pkg/windows_amd64* - GOOS=windows GOARCH=amd64 /usr/local/go/pkg/tool/linux_amd64/dist bootstrap - rm -f `basename $DIST_WIN_64` -fi -if [ "$DIST_WIN_32" != "" ]; then - unzip -d /usr/local -q `basename $DIST_WIN_32` go/pkg/windows_386* - GOOS=windows GOARCH=386 /usr/local/go/pkg/tool/linux_amd64/dist bootstrap - rm -f `basename $DIST_WIN_32` -fi - -# Install xgo within the container to enable internal cross compilation -echo "Installing xgo-in-xgo..." -go get -u github.com/karalabe/xgo diff --git a/docker/base/bootstrap_pure.sh b/docker/base/bootstrap_pure.sh index 396a2dc4..98bd3f1d 100644 --- a/docker/base/bootstrap_pure.sh +++ b/docker/base/bootstrap_pure.sh @@ -49,23 +49,6 @@ if [ $GO_VERSION -ge 180 ]; then GOOS=linux GOARCH=mipsle CGO_ENABLED=1 CC=mipsel-linux-gnu-gcc-6 go install std fi -echo "Bootstrapping windows/amd64..." -GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc go install std - -echo "Bootstrapping windows/386..." -GOOS=windows GOARCH=386 CGO_ENABLED=1 CC=i686-w64-mingw32-gcc go install std - -echo "Bootstrapping darwin/amd64..." -GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 CC=o64-clang go install std - -echo "Bootstrapping darwin/386..." -GOOS=darwin GOARCH=386 CGO_ENABLED=1 CC=o32-clang go install std - -# Install xgo within the container to enable internal cross compilation -echo "Installing xgo-in-xgo..." -go get -u github.com/karalabe/xgo -ln -s /go/bin/xgo /usr/bin/xgo - # Install gomobile tool for android/ios frameworks echo "Installing gomobile..." go get -u golang.org/x/mobile/cmd/gomobile diff --git a/docker/go-1.10.0/Dockerfile b/docker/go-1.10.0/Dockerfile deleted file mode 100644 index fbd94674..00000000 --- a/docker/go-1.10.0/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.10 -# Copyright (c) 2018 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 1100 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.10.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=b5a64335f1490277b585832d1f6c7f8c6c11206cba5cd3f771dcb87b98ad1a33 && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.10.1/Dockerfile b/docker/go-1.10.1/Dockerfile deleted file mode 100644 index 5b08cc75..00000000 --- a/docker/go-1.10.1/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.10.1 -# Copyright (c) 2018 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 1101 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.10.1.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=72d820dec546752e5a8303b33b009079c15c2390ce76d67cf514991646c6127b && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.10.2/Dockerfile b/docker/go-1.10.2/Dockerfile deleted file mode 100644 index e7362b21..00000000 --- a/docker/go-1.10.2/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.10.2 -# Copyright (c) 2018 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 1102 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.10.2.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=4b677d698c65370afa33757b6954ade60347aaca310ea92a63ed717d7cb0c2ff && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.10.3/Dockerfile b/docker/go-1.10.3/Dockerfile deleted file mode 100644 index 09bf4bcd..00000000 --- a/docker/go-1.10.3/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.10.3 -# Copyright (c) 2018 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 1103 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.10.3.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=fa1b0e45d3b647c252f51f5e1204aba049cde4af177ef9f2181f43004f901035 && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.10.4/Dockerfile b/docker/go-1.10.4/Dockerfile deleted file mode 100644 index f082ed57..00000000 --- a/docker/go-1.10.4/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.10.4 -# Copyright (c) 2018 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 1104 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.10.4.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=fa04efdb17a275a0c6e137f969a1c4eb878939e91e1da16060ce42f02c2ec5ec && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.10.x/Dockerfile b/docker/go-1.10.x/Dockerfile deleted file mode 100644 index ef315af4..00000000 --- a/docker/go-1.10.x/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -# Go cross compiler (xgo): Go 1.10.x -# Copyright (c) 2018 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-1.10.4 - -MAINTAINER Péter Szilágyi diff --git a/docker/go-1.11.0/Dockerfile b/docker/go-1.11.0/Dockerfile deleted file mode 100644 index d2efc2f9..00000000 --- a/docker/go-1.11.0/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -# Go cross compiler (xgo): Go 1.11 -# Copyright (c) 2018 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM mysteriumnetwork/xgo:base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 1110 -ENV CGO_LDFLAGS_ALLOW -fobjc-arc - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.11.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=b3fcf280ff86558e0559e185b601c9eade0fd24c900b4c63cd14d1d38613e499 && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.11.1/Dockerfile b/docker/go-1.11.1/Dockerfile deleted file mode 100644 index 5cfeed5e..00000000 --- a/docker/go-1.11.1/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.11.1 -# Copyright (c) 2018 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 1111 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.11.1.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=2871270d8ff0c8c69f161aaae42f9f28739855ff5c5204752a8d92a1c9f63993 && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.11.2/Dockerfile b/docker/go-1.11.2/Dockerfile deleted file mode 100644 index 8730991e..00000000 --- a/docker/go-1.11.2/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.11.2 -# Copyright (c) 2018 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 1112 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.11.2.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=1dfe664fa3d8ad714bbd15a36627992effd150ddabd7523931f077b3926d736d && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.11.3/Dockerfile b/docker/go-1.11.3/Dockerfile deleted file mode 100644 index c02fbdfa..00000000 --- a/docker/go-1.11.3/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.11.3 -# Copyright (c) 2018 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 1113 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.11.3.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=d20a4869ffb13cee0f7ee777bf18c7b9b67ef0375f93fac1298519e0c227a07f && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.11.4/Dockerfile b/docker/go-1.11.4/Dockerfile deleted file mode 100644 index 801fe9a3..00000000 --- a/docker/go-1.11.4/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.11.4 -# Copyright (c) 2018 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 1114 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.11.4.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=fb26c30e6a04ad937bbc657a1b5bba92f80096af1e8ee6da6430c045a8db3a5b && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.11.5/Dockerfile b/docker/go-1.11.5/Dockerfile deleted file mode 100644 index 66f63be4..00000000 --- a/docker/go-1.11.5/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.11.5 -# Copyright (c) 2019 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 1115 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.11.5.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=ff54aafedff961eb94792487e827515da683d61a5f9482f668008832631e5d25 && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.11.x/Dockerfile b/docker/go-1.11.x/Dockerfile deleted file mode 100644 index 24d4f87c..00000000 --- a/docker/go-1.11.x/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -# Go cross compiler (xgo): Go 1.11.x -# Copyright (c) 2018 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-1.11.5 - -MAINTAINER Péter Szilágyi diff --git a/docker/go-1.12.0/Dockerfile b/docker/go-1.12.0/Dockerfile deleted file mode 100644 index 9523e95e..00000000 --- a/docker/go-1.12.0/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.12 -# Copyright (c) 2019 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 1120 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.12.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=750a07fef8579ae4839458701f4df690e0b20b8bcce33b437e4df89c451b6f13 && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.12.x/Dockerfile b/docker/go-1.12.x/Dockerfile deleted file mode 100644 index f51c3a02..00000000 --- a/docker/go-1.12.x/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -# Go cross compiler (xgo): Go 1.12.x -# Copyright (c) 2019 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-1.12 - -MAINTAINER Péter Szilágyi diff --git a/docker/go-1.13.1/Dockerfile b/docker/go-1.13.1/Dockerfile index 487b2f2b..13b8b5df 100644 --- a/docker/go-1.13.1/Dockerfile +++ b/docker/go-1.13.1/Dockerfile @@ -3,15 +3,15 @@ # # Released under the MIT license. -FROM mysteriumnetwork/xgo:base +FROM mysteriumnetwork/xgomobile:base MAINTAINER Péter Szilágyi ENV CGO_LDFLAGS_ALLOW -fobjc-arc -ENV GO_VERSION 1131 +ENV GO_VERSION 1136 RUN \ - export ROOT_DIST=https://dl.google.com/go/go1.13.1.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=94f874037b82ea5353f4061e543681a0e79657f787437974214629af8407d124 && \ + export ROOT_DIST=https://dl.google.com/go/go1.13.6.linux-amd64.tar.gz && \ + export ROOT_DIST_SHA=a1bc06deb070155c4f67c579f896a45eeda5a8fa54f35ba233304074c4abbbbd && \ \ - $BOOTSTRAP_PURE +$BOOTSTRAP_PURE \ No newline at end of file diff --git a/docker/go-1.13.6/Dockerfile b/docker/go-1.13.6/Dockerfile new file mode 100644 index 00000000..13b8b5df --- /dev/null +++ b/docker/go-1.13.6/Dockerfile @@ -0,0 +1,17 @@ +# Go cross compiler (xgo): Go 1.13 +# Copyright (c) 2018 Péter Szilágyi. All rights reserved. +# +# Released under the MIT license. + +FROM mysteriumnetwork/xgomobile:base + +MAINTAINER Péter Szilágyi + +ENV CGO_LDFLAGS_ALLOW -fobjc-arc +ENV GO_VERSION 1136 + +RUN \ + export ROOT_DIST=https://dl.google.com/go/go1.13.6.linux-amd64.tar.gz && \ + export ROOT_DIST_SHA=a1bc06deb070155c4f67c579f896a45eeda5a8fa54f35ba233304074c4abbbbd && \ + \ +$BOOTSTRAP_PURE \ No newline at end of file diff --git a/docker/go-1.3.0/Dockerfile b/docker/go-1.3.0/Dockerfile deleted file mode 100644 index 6872d83c..00000000 --- a/docker/go-1.3.0/Dockerfile +++ /dev/null @@ -1,35 +0,0 @@ -# Go cross compiler (xgo): Go 1.3.0 layer -# Copyright (c) 2014 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the Go packages and bootstrap them -RUN \ - export DIST_LINUX_64=https://storage.googleapis.com/golang/go1.3.linux-amd64.tar.gz && \ - export DIST_LINUX_64_SHA=b6b154933039987056ac307e20c25fa508a06ba6 && \ - \ - export DIST_LINUX_32=https://storage.googleapis.com/golang/go1.3.linux-386.tar.gz && \ - export DIST_LINUX_32_SHA=22db33b0c4e242ed18a77b03a60582f8014fd8a6 && \ - \ - export DIST_LINUX_ARM=http://dave.cheney.net/paste/go.1.3.linux-arm~armv5-1.tar.gz && \ - export DIST_LINUX_ARM_SHA=fc059c970a059757778b157b1140a3c56eb1a069 && \ - \ - export DIST_OSX_64=https://storage.googleapis.com/golang/go1.3.darwin-amd64-osx10.6.tar.gz && \ - export DIST_OSX_64_SHA=82ffcfb7962ca7114a1ee0a96cac51c53061ea05 && \ - \ - export DIST_OSX_32=https://storage.googleapis.com/golang/go1.3.darwin-386-osx10.6.tar.gz && \ - export DIST_OSX_32_SHA=159d2797bee603a80b829c4404c1fb2ee089cc00 && \ - \ - export DIST_WIN_64=https://storage.googleapis.com/golang/go1.3.windows-amd64.zip && \ - export DIST_WIN_64_SHA=1e4888e1494aed7f6934acb5c4a1ffb0e9a022b1 && \ - \ - export DIST_WIN_32=https://storage.googleapis.com/golang/go1.3.windows-386.zip && \ - export DIST_WIN_32_SHA=e4e5279ce7d8cafdf210a522a70677d5b9c7589d && \ - \ - $BOOTSTRAP - -ENV GO_VERSION 130 diff --git a/docker/go-1.3.1/Dockerfile b/docker/go-1.3.1/Dockerfile deleted file mode 100644 index 6422c3ef..00000000 --- a/docker/go-1.3.1/Dockerfile +++ /dev/null @@ -1,35 +0,0 @@ -# Go cross compiler (xgo): Go 1.3.1 layer -# Copyright (c) 2014 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the Go packages and bootstrap them -RUN \ - export DIST_LINUX_64=https://storage.googleapis.com/golang/go1.3.1.linux-amd64.tar.gz && \ - export DIST_LINUX_64_SHA=3af011cc19b21c7180f2604fd85fbc4ddde97143 && \ - \ - export DIST_LINUX_32=https://storage.googleapis.com/golang/go1.3.1.linux-386.tar.gz && \ - export DIST_LINUX_32_SHA=36f87ce21cdb4cb8920bb706003d8655b4e1fc81 && \ - \ - export DIST_LINUX_ARM= && \ - export DIST_LINUX_ARM_SHA= && \ - \ - export DIST_OSX_64=https://storage.googleapis.com/golang/go1.3.1.darwin-amd64-osx10.6.tar.gz && \ - export DIST_OSX_64_SHA=40716361d352c4b40252e79048e8bc084c3f3d1b && \ - \ - export DIST_OSX_32=https://storage.googleapis.com/golang/go1.3.1.darwin-386-osx10.6.tar.gz && \ - export DIST_OSX_32_SHA=84f70a4c83be24cea696654a5b55331ea32f8a3f && \ - \ - export DIST_WIN_64=https://storage.googleapis.com/golang/go1.3.1.windows-amd64.zip && \ - export DIST_WIN_64_SHA=4548785cfa3bc228d18d2d06e39f58f0e4e014f1 && \ - \ - export DIST_WIN_32=https://storage.googleapis.com/golang/go1.3.1.windows-386.zip && \ - export DIST_WIN_32_SHA=64f99e40e79e93a622e73d7d55a5b8340f07747f && \ - \ - $BOOTSTRAP - -ENV GO_VERSION 131 diff --git a/docker/go-1.3.3/Dockerfile b/docker/go-1.3.3/Dockerfile deleted file mode 100644 index 3b1cec6d..00000000 --- a/docker/go-1.3.3/Dockerfile +++ /dev/null @@ -1,35 +0,0 @@ -# Go cross compiler (xgo): Go 1.3.3 layer -# Copyright (c) 2014 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the Go packages and bootstrap them -RUN \ - export DIST_LINUX_64=https://storage.googleapis.com/golang/go1.3.3.linux-amd64.tar.gz && \ - export DIST_LINUX_64_SHA=14068fbe349db34b838853a7878621bbd2b24646 && \ - \ - export DIST_LINUX_32=https://storage.googleapis.com/golang/go1.3.3.linux-386.tar.gz && \ - export DIST_LINUX_32_SHA=9eb426d5505de55729e2656c03d85722795dd85e && \ - \ - export DIST_LINUX_ARM=http://dave.cheney.net/paste/go.1.3.3.linux-arm~armv5-1.tar.gz && \ - export DIST_LINUX_ARM_SHA=78789a5e3288d9e86e0cd667e6588775594eae87 && \ - \ - export DIST_OSX_64=https://storage.googleapis.com/golang/go1.3.3.darwin-amd64-osx10.6.tar.gz && \ - export DIST_OSX_64_SHA=dfe68de684f6e8d9c371d01e6d6a522efe3b8942 && \ - \ - export DIST_OSX_32=https://storage.googleapis.com/golang/go1.3.3.darwin-386-osx10.6.tar.gz && \ - export DIST_OSX_32_SHA=04b3e38549183e984f509c07ad40d8bcd577a702 && \ - \ - export DIST_WIN_64=https://storage.googleapis.com/golang/go1.3.3.windows-amd64.zip && \ - export DIST_WIN_64_SHA=5f0b3b104d3db09edd32ef1d086ba20bafe01ada && \ - \ - export DIST_WIN_32=https://storage.googleapis.com/golang/go1.3.3.windows-386.zip && \ - export DIST_WIN_32_SHA=ba99083b22e0b22b560bb2d28b9b99b405d01b6b && \ - \ - $BOOTSTRAP - -ENV GO_VERSION 133 diff --git a/docker/go-1.3.x/Dockerfile b/docker/go-1.3.x/Dockerfile deleted file mode 100644 index 439840ea..00000000 --- a/docker/go-1.3.x/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -# Go cross compiler (xgo): Wildcard layer to the latest 1.3 release -# Copyright (c) 2014 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-1.3.3 - -MAINTAINER Péter Szilágyi diff --git a/docker/go-1.4.2/Dockerfile b/docker/go-1.4.2/Dockerfile deleted file mode 100644 index 2604f85f..00000000 --- a/docker/go-1.4.2/Dockerfile +++ /dev/null @@ -1,35 +0,0 @@ -# Go cross compiler (xgo): Go 1.4.2 layer -# Copyright (c) 2014 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the Go packages and bootstrap them -RUN \ - export DIST_LINUX_64=https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz && \ - export DIST_LINUX_64_SHA=5020af94b52b65cc9b6f11d50a67e4bae07b0aff && \ - \ - export DIST_LINUX_32=https://storage.googleapis.com/golang/go1.4.2.linux-386.tar.gz && \ - export DIST_LINUX_32_SHA=50557248e89b6e38d395fda93b2f96b2b860a26a && \ - \ - export DIST_LINUX_ARM=http://dave.cheney.net/paste/go1.4.2.linux-arm~armv5-1.tar.gz && \ - export DIST_LINUX_ARM_SHA=1bcfc8ef9c2aa381722b71b8c8d83cb58e973116 && \ - \ - export DIST_OSX_64=https://storage.googleapis.com/golang/go1.4.2.darwin-amd64-osx10.6.tar.gz && \ - export DIST_OSX_64_SHA=00c3f9a03daff818b2132ac31d57f054925c60e7 && \ - \ - export DIST_OSX_32=https://storage.googleapis.com/golang/go1.4.2.darwin-386-osx10.6.tar.gz && \ - export DIST_OSX_32_SHA=fb3e6b30f4e1b1be47bbb98d79dd53da8dec24ec && \ - \ - export DIST_WIN_64=https://storage.googleapis.com/golang/go1.4.2.windows-amd64.zip && \ - export DIST_WIN_64_SHA=91b229a3ff0a1ce6e791c832b0b4670bfc5457b5 && \ - \ - export DIST_WIN_32=https://storage.googleapis.com/golang/go1.4.2.windows-386.zip && \ - export DIST_WIN_32_SHA=0e074e66a7816561d7947ff5c3514be96f347dc4 && \ - \ - $BOOTSTRAP - -ENV GO_VERSION 142 diff --git a/docker/go-1.4.x/Dockerfile b/docker/go-1.4.x/Dockerfile deleted file mode 100644 index 3fb82377..00000000 --- a/docker/go-1.4.x/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -# Go cross compiler (xgo): Wildcard layer to the latest 1.4 release -# Copyright (c) 2014 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-1.4.2 - -MAINTAINER Péter Szilágyi diff --git a/docker/go-1.4/Dockerfile b/docker/go-1.4/Dockerfile deleted file mode 100644 index 98f89a0f..00000000 --- a/docker/go-1.4/Dockerfile +++ /dev/null @@ -1,35 +0,0 @@ -# Go cross compiler (xgo): Go 1.4 layer -# Copyright (c) 2014 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the Go packages and bootstrap them -RUN \ - export DIST_LINUX_64=https://storage.googleapis.com/golang/go1.4.linux-amd64.tar.gz && \ - export DIST_LINUX_64_SHA=cd82abcb0734f82f7cf2d576c9528cebdafac4c6 && \ - \ - export DIST_LINUX_32=https://storage.googleapis.com/golang/go1.4.linux-386.tar.gz && \ - export DIST_LINUX_32_SHA=cb18d8122bfd3bbba20fa1a19b8f7566dcff795d && \ - \ - export DIST_LINUX_ARM=http://dave.cheney.net/paste/go1.4.linux-arm~armv5-1.tar.gz && \ - export DIST_LINUX_ARM_SHA=21039e81df30bf17fa5847d02892c425f0c37fc6 && \ - \ - export DIST_OSX_64=https://storage.googleapis.com/golang/go1.4.darwin-amd64-osx10.6.tar.gz && \ - export DIST_OSX_64_SHA=09621b9226abe12c2179778b015a33c1787b29d6 && \ - \ - export DIST_OSX_32=https://storage.googleapis.com/golang/go1.4.darwin-386-osx10.6.tar.gz && \ - export DIST_OSX_32_SHA=ee31cd0e26245d0e48f11667e4298e2e7f54f9b6 && \ - \ - export DIST_WIN_64=https://storage.googleapis.com/golang/go1.4.windows-amd64.zip && \ - export DIST_WIN_64_SHA=44f103d558b293919eb680041625c262dd00eb9a && \ - \ - export DIST_WIN_32=https://storage.googleapis.com/golang/go1.4.windows-386.zip && \ - export DIST_WIN_32_SHA=f44240a1750dd051476ae78e9ad0502bc5c7661d && \ - \ - $BOOTSTRAP - -ENV GO_VERSION 140 diff --git a/docker/go-1.5.0/Dockerfile b/docker/go-1.5.0/Dockerfile deleted file mode 100644 index 00b3c0e3..00000000 --- a/docker/go-1.5.0/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.5.0 layer -# Copyright (c) 2015 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 150 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.5.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=5817fa4b2252afdb02e11e8b9dc1d9173ef3bd5a && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.5.1/Dockerfile b/docker/go-1.5.1/Dockerfile deleted file mode 100644 index afa35faf..00000000 --- a/docker/go-1.5.1/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.5.1 layer -# Copyright (c) 2015 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 151 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.5.1.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=46eecd290d8803887dec718c691cc243f2175fe0 && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.5.2/Dockerfile b/docker/go-1.5.2/Dockerfile deleted file mode 100644 index 9fdcc270..00000000 --- a/docker/go-1.5.2/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.5.2 layer -# Copyright (c) 2015 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 152 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.5.2.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=cae87ed095e8d94a81871281d35da7829bd1234e && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.5.3/Dockerfile b/docker/go-1.5.3/Dockerfile deleted file mode 100644 index d1cec45e..00000000 --- a/docker/go-1.5.3/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.5.3 layer -# Copyright (c) 2015 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 153 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.5.3.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=43afe0c5017e502630b1aea4d44b8a7f059bf60d7f29dfd58db454d4e4e0ae53 && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.5.4/Dockerfile b/docker/go-1.5.4/Dockerfile deleted file mode 100644 index 58dfd0ec..00000000 --- a/docker/go-1.5.4/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.5.4 layer -# Copyright (c) 2016 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 154 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.5.4.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=a3358721210787dc1e06f5ea1460ae0564f22a0fbd91be9dcd947fb1d19b9560 && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.5.x/Dockerfile b/docker/go-1.5.x/Dockerfile deleted file mode 100644 index d1ae3b1a..00000000 --- a/docker/go-1.5.x/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -# Go cross compiler (xgo): Wildcard layer to the latest 1.5 release -# Copyright (c) 2015 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-1.5.4 - -MAINTAINER Péter Szilágyi diff --git a/docker/go-1.6.0/Dockerfile b/docker/go-1.6.0/Dockerfile deleted file mode 100644 index 0ce18b28..00000000 --- a/docker/go-1.6.0/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.6 -# Copyright (c) 2016 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 160 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.6.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=5470eac05d273c74ff8bac7bef5bad0b5abbd1c4052efbdbc8db45332e836b0b && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.6.1/Dockerfile b/docker/go-1.6.1/Dockerfile deleted file mode 100644 index 808915f2..00000000 --- a/docker/go-1.6.1/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.6.1 -# Copyright (c) 2016 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 161 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.6.1.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=6d894da8b4ad3f7f6c295db0d73ccc3646bce630e1c43e662a0120681d47e988 && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.6.2/Dockerfile b/docker/go-1.6.2/Dockerfile deleted file mode 100644 index 48937c46..00000000 --- a/docker/go-1.6.2/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.6.2 -# Copyright (c) 2016 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 162 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.6.2.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=e40c36ae71756198478624ed1bb4ce17597b3c19d243f3f0899bb5740d56212a && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.6.3/Dockerfile b/docker/go-1.6.3/Dockerfile deleted file mode 100644 index a09270c1..00000000 --- a/docker/go-1.6.3/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.6.3 -# Copyright (c) 2016 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 163 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.6.3.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=cdde5e08530c0579255d6153b08fdb3b8e47caabbe717bc7bcd7561275a87aeb && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.6.x/Dockerfile b/docker/go-1.6.x/Dockerfile deleted file mode 100644 index f6facd66..00000000 --- a/docker/go-1.6.x/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -# Go cross compiler (xgo): Wildcard layer to the latest 1.6 release -# Copyright (c) 2016 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-1.6.3 - -MAINTAINER Péter Szilágyi diff --git a/docker/go-1.7.0/Dockerfile b/docker/go-1.7.0/Dockerfile deleted file mode 100644 index 260f1707..00000000 --- a/docker/go-1.7.0/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.7 -# Copyright (c) 2016 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 170 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.7.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=702ad90f705365227e902b42d91dd1a40e48ca7f67a2f4b2fd052aaa4295cd95 && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.7.1/Dockerfile b/docker/go-1.7.1/Dockerfile deleted file mode 100644 index 206fcc7e..00000000 --- a/docker/go-1.7.1/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.7.1 -# Copyright (c) 2016 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 171 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.7.1.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=43ad621c9b014cde8db17393dc108378d37bc853aa351a6c74bf6432c1bbd182 && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.7.3/Dockerfile b/docker/go-1.7.3/Dockerfile deleted file mode 100644 index de31033d..00000000 --- a/docker/go-1.7.3/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.7.3 -# Copyright (c) 2016 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 173 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.7.3.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=508028aac0654e993564b6e2014bf2d4a9751e3b286661b0b0040046cf18028e && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.7.4/Dockerfile b/docker/go-1.7.4/Dockerfile deleted file mode 100644 index 5429c8de..00000000 --- a/docker/go-1.7.4/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.7.4 -# Copyright (c) 2017 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 174 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.7.4.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=47fda42e46b4c3ec93fa5d4d4cc6a748aa3f9411a2a2b7e08e3a6d80d753ec8b && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.7.5/Dockerfile b/docker/go-1.7.5/Dockerfile deleted file mode 100644 index e030bd3b..00000000 --- a/docker/go-1.7.5/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.7.5 -# Copyright (c) 2017 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 175 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.7.5.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=2e4dd6c44f0693bef4e7b46cc701513d74c3cc44f2419bf519d7868b12931ac3 && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.7.x/Dockerfile b/docker/go-1.7.x/Dockerfile deleted file mode 100644 index 34a99cca..00000000 --- a/docker/go-1.7.x/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -# Go cross compiler (xgo): Wildcard layer to the latest 1.7 release -# Copyright (c) 2016 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-1.7.5 - -MAINTAINER Péter Szilágyi diff --git a/docker/go-1.8.0/Dockerfile b/docker/go-1.8.0/Dockerfile deleted file mode 100644 index e27f3f18..00000000 --- a/docker/go-1.8.0/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.8 -# Copyright (c) 2017 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 180 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.8.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=53ab94104ee3923e228a2cb2116e5e462ad3ebaeea06ff04463479d7f12d27ca && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.8.1/Dockerfile b/docker/go-1.8.1/Dockerfile deleted file mode 100644 index 10f5476d..00000000 --- a/docker/go-1.8.1/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.8.1 -# Copyright (c) 2017 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 181 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=a579ab19d5237e263254f1eac5352efcf1d70b9dacadb6d6bb12b0911ede8994 && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.8.3/Dockerfile b/docker/go-1.8.3/Dockerfile deleted file mode 100644 index 14f1b3b9..00000000 --- a/docker/go-1.8.3/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.8.3 -# Copyright (c) 2017 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 183 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=1862f4c3d3907e59b04a757cfda0ea7aa9ef39274af99a784f5be843c80c6772 && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.8.x/Dockerfile b/docker/go-1.8.x/Dockerfile deleted file mode 100644 index 080dc8ca..00000000 --- a/docker/go-1.8.x/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -# Go cross compiler (xgo): Wildcard layer to the latest 1.8 release -# Copyright (c) 2017 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-1.8.3 - -MAINTAINER Péter Szilágyi diff --git a/docker/go-1.9.0/Dockerfile b/docker/go-1.9.0/Dockerfile deleted file mode 100644 index 392d91b6..00000000 --- a/docker/go-1.9.0/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.9 -# Copyright (c) 2017 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 190 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.9.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=d70eadefce8e160638a9a6db97f7192d8463069ab33138893ad3bf31b0650a79 && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.9.1/Dockerfile b/docker/go-1.9.1/Dockerfile deleted file mode 100644 index c5d5e11f..00000000 --- a/docker/go-1.9.1/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.9.1 -# Copyright (c) 2017 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 191 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.9.1.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=07d81c6b6b4c2dcf1b5ef7c27aaebd3691cdb40548500941f92b221147c5d9c7 && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.9.2/Dockerfile b/docker/go-1.9.2/Dockerfile deleted file mode 100644 index 088527f3..00000000 --- a/docker/go-1.9.2/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.9.2 -# Copyright (c) 2017 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM mysterium/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 192 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.9.2.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=de874549d9a8d8d8062be05808509c09a88a248e77ec14eb77453530829ac02b && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.9.3/Dockerfile b/docker/go-1.9.3/Dockerfile deleted file mode 100644 index 81fe4037..00000000 --- a/docker/go-1.9.3/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.9.3 -# Copyright (c) 2018 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 193 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.9.3.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=a4da5f4c07dfda8194c4621611aeb7ceaab98af0b38bfb29e1be2ebb04c3556c && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.9.4/Dockerfile b/docker/go-1.9.4/Dockerfile deleted file mode 100644 index c67a882e..00000000 --- a/docker/go-1.9.4/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Go cross compiler (xgo): Go 1.9.4 -# Copyright (c) 2018 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Configure the root Go distribution and bootstrap based on it -ENV GO_VERSION 194 - -RUN \ - export ROOT_DIST=https://storage.googleapis.com/golang/go1.9.4.linux-amd64.tar.gz && \ - export ROOT_DIST_SHA=15b0937615809f87321a457bb1265f946f9f6e736c563d6c5e0bd2c22e44f779 && \ - \ - $BOOTSTRAP_PURE diff --git a/docker/go-1.9.x/Dockerfile b/docker/go-1.9.x/Dockerfile deleted file mode 100644 index 5b8d04ee..00000000 --- a/docker/go-1.9.x/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -# Go cross compiler (xgo): Wildcard layer to the latest 1.9 release -# Copyright (c) 2017 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-1.9.4 - -MAINTAINER Péter Szilágyi diff --git a/docker/go-develop/Dockerfile b/docker/go-develop/Dockerfile deleted file mode 100644 index 858ee812..00000000 --- a/docker/go-develop/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -# Go cross compiler (xgo): Go develop layer -# Copyright (c) 2015 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-base - -MAINTAINER Péter Szilágyi - -# Clone and bootstrap the latest Go develop branch -RUN $BOOTSTRAP_REPO master -ENV GO_VERSION 999 diff --git a/docker/go-latest/Dockerfile b/docker/go-latest/Dockerfile deleted file mode 100644 index 5d26d0c7..00000000 --- a/docker/go-latest/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -# Go cross compiler (xgo): Wildcard layer to the latest Go release -# Copyright (c) 2017 Péter Szilágyi. All rights reserved. -# -# Released under the MIT license. - -FROM karalabe/xgo-1.12.x - -MAINTAINER Péter Szilágyi diff --git a/run.sh b/run.sh deleted file mode 100755 index 418c434e..00000000 --- a/run.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash -set -e - -function buildBase() { - echo "Building base..." - docker build -t mysteriumnetwork/xgo:base $@ docker/base/. -} - -function buildGo() { - local tag=$1 - shift; - echo "Building go... will tag as $tag" - docker build -t mysteriumnetwork/xgo-$tag $@ docker/go-1.11.0/. -} - -function xgoTest() { - local tag=$1 - shift; - echo "Running tests... using tag: $tag" - xgo -image=mysteriumnetwork/xgo-$tag -targets=android/*,ios/* $@ -out mobilepkg -dest `pwd`/artifacts \ - --ldflags="-w -s -X mobilepkg.Flag=success2" \ - `pwd`/src/mobilepkg -} - -function listAarFiles() { - local file=$1 - unzip -l $file -} - -cmd="$1" -shift -echo "Running $cmd ... with args $@" -$cmd $@ diff --git a/test.sh b/test.sh new file mode 100755 index 00000000..f35bdf73 --- /dev/null +++ b/test.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +set -e + +docker run --rm \ + -v "$PWD"/build:/build \ + -v "$GOPATH"/.xgo-cache:/deps-cache:ro \ + -v "$PWD"/src:/ext-go/1/src:ro \ + -e OUT=Mysterium \ + -e FLAG_V=false \ + -e FLAG_X=false \ + -e FLAG_RACE=false \ + -e FLAG_BUILDMODE=default \ + -e TARGETS=android/. \ + -e EXT_GOPATH=/ext-go/1 \ + -e GO111MODULE=off \ + mysteriumnetwork/xgomobile:1.13.6 mobilepkg \ No newline at end of file diff --git a/testsuite.go b/testsuite.go deleted file mode 100644 index b03b7fee..00000000 --- a/testsuite.go +++ /dev/null @@ -1,86 +0,0 @@ -// Go CGO cross compiler -// Copyright (c) 2016 Péter Szilágyi. All rights reserved. -// -// Released under the MIT license. - -// This is a manual test suite to run the cross compiler against various known -// projects, codebases and repositories to ensure at least a baseline guarantee -// that things work as they supposed to. -// -// Run as: go run testsuite.go - -// +build ignore - -package main - -import ( - "log" - "os" - "os/exec" - "path/filepath" -) - -// layers defines all the docker layers needed for the final xgo image. The last -// one will be used to run the test suite against. -var layers = []struct { - tag string - dir string -}{ - {"karalabe/xgo-base", "base"}, - {"karalabe/xgo-1.6.2", "go-1.6.2"}, - {"karalabe/xgo-1.6.x", "go-1.6.x"}, - {"karalabe/xgo-latest", "go-latest"}, - //{"karalabe/xgo-latest-ios", "go-latest-ios"}, // Non-public layer (XCode licensing) -} - -// tests defaines all the input test cases and associated arguments the cross -// compiler should be ran for and with which arguments. -var tests = []struct { - path string - args []string -}{ - // Tiny test cases to smoke test cross compilations - {"github.com/karalabe/xgo/tests/embedded_c", nil}, - {"github.com/karalabe/xgo/tests/embedded_cpp", nil}, - - // Baseline projects to ensure minimal requirements - //{"github.com/project-iris/iris", nil}, // Deps failed, disable - {"github.com/ethereum/go-ethereum/cmd/geth", []string{"--branch", "develop"}}, - - // Third party projects using xgo, smoke test that they don't break - {"github.com/rwcarlsen/cyan/cmd/cyan", nil}, - {"github.com/cockroachdb/cockroach", []string{"--targets", "darwin-10.11/amd64"}}, -} - -func main() { - // Retrieve the current working directory to locate the dockerfiles - pwd, err := os.Getwd() - if err != nil { - log.Fatalf("Failed to retrieve local working directory: %v", err) - } - if _, err := os.Stat(filepath.Join(pwd, "docker", "base")); err != nil { - log.Fatalf("Failed to locate docker image: %v", err) - } - // Assemble the multi-layered xgo docker image - for _, layer := range layers { - cmd := exec.Command("docker", "build", "--tag", layer.tag, filepath.Join(pwd, "docker", layer.dir)) - - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - - if err := cmd.Run(); err != nil { - log.Fatalf("Failed to build xgo layer: %v", err) - } - } - // Iterate over each of the test cases and run them - for i, test := range tests { - cmd := exec.Command("docker", append([]string{"run", "--entrypoint", "xgo", layers[len(layers)-1].tag, "-v"}, append(test.args, test.path)...)...) - - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - - if err := cmd.Run(); err != nil { - log.Fatalf("Test #%d: cross compilation failed: %v", i, err) - } - } -} diff --git a/xgo.go b/xgo.go deleted file mode 100644 index b2bae9ce..00000000 --- a/xgo.go +++ /dev/null @@ -1,373 +0,0 @@ -// Go CGO cross compiler -// Copyright (c) 2014 Péter Szilágyi. All rights reserved. -// -// Released under the MIT license. - -// Wrapper around the GCO cross compiler docker container. -package main - -import ( - "bytes" - "flag" - "fmt" - "go/build" - "io" - "log" - "net/http" - "os" - "os/exec" - "os/user" - "path/filepath" - "strconv" - "strings" -) - -// Path where to cache external dependencies -var depsCache string - -func init() { - // Initialize the external dependency cache path to a few possible locations - if home := os.Getenv("HOME"); home != "" { - depsCache = filepath.Join(home, ".xgo-cache") - return - } - if user, err := user.Current(); user != nil && err == nil && user.HomeDir != "" { - depsCache = filepath.Join(user.HomeDir, ".xgo-cache") - return - } - depsCache = filepath.Join(os.TempDir(), "xgo-cache") -} - -// Cross compilation docker containers -var dockerBase = "karalabe/xgo-base" -var dockerDist = "karalabe/xgo-" - -// Command line arguments to fine tune the compilation -var ( - goVersion = flag.String("go", "latest", "Go release to use for cross compilation") - srcPackage = flag.String("pkg", "", "Sub-package to build if not root import") - srcRemote = flag.String("remote", "", "Version control remote repository to build") - srcBranch = flag.String("branch", "", "Version control branch to build") - outPrefix = flag.String("out", "", "Prefix to use for output naming (empty = package name)") - outFolder = flag.String("dest", "", "Destination folder to put binaries in (empty = current)") - crossDeps = flag.String("deps", "", "CGO dependencies (configure/make based archives)") - crossArgs = flag.String("depsargs", "", "CGO dependency configure arguments") - targets = flag.String("targets", "*/*", "Comma separated targets to build for") - dockerImage = flag.String("image", "", "Use custom docker image instead of official distribution") -) - -// ConfigFlags is a simple set of flags to define the environment and dependencies. -type ConfigFlags struct { - Repository string // Root import path to build - Package string // Sub-package to build if not root import - Prefix string // Prefix to use for output naming - Remote string // Version control remote repository to build - Branch string // Version control branch to build - Dependencies string // CGO dependencies (configure/make based archives) - Arguments string // CGO dependency configure arguments - Targets []string // Targets to build for -} - -// Command line arguments to pass to go build -var ( - buildVerbose = flag.Bool("v", false, "Print the names of packages as they are compiled") - buildSteps = flag.Bool("x", false, "Print the command as executing the builds") - buildRace = flag.Bool("race", false, "Enable data race detection (supported only on amd64)") - buildTags = flag.String("tags", "", "List of build tags to consider satisfied during the build") - buildLdFlags = flag.String("ldflags", "", "Arguments to pass on each go tool link invocation") - buildMode = flag.String("buildmode", "default", "Indicates which kind of object file to build") -) - -// BuildFlags is a simple collection of flags to fine tune a build. -type BuildFlags struct { - Verbose bool // Print the names of packages as they are compiled - Steps bool // Print the command as executing the builds - Race bool // Enable data race detection (supported only on amd64) - Tags string // List of build tags to consider satisfied during the build - LdFlags string // Arguments to pass on each go tool link invocation - Mode string // Indicates which kind of object file to build -} - -func main() { - // Retrieve the CLI flags and the execution environment - flag.Parse() - - xgoInXgo := os.Getenv("XGO_IN_XGO") == "1" - if xgoInXgo { - depsCache = "/deps-cache" - } - // Only use docker images if we're not already inside out own image - image := "" - - if !xgoInXgo { - // Ensure docker is available - if err := checkDocker(); err != nil { - log.Fatalf("Failed to check docker installation: %v.", err) - } - // Validate the command line arguments - if len(flag.Args()) != 1 { - log.Fatalf("Usage: %s [options] ", os.Args[0]) - } - // Select the image to use, either official or custom - image = dockerDist + *goVersion - if *dockerImage != "" { - image = *dockerImage - } - // Check that all required images are available - found, err := checkDockerImage(image) - switch { - case err != nil: - log.Fatalf("Failed to check docker image availability: %v.", err) - case !found: - fmt.Println("not found!") - if err := pullDockerImage(image); err != nil { - log.Fatalf("Failed to pull docker image from the registry: %v.", err) - } - default: - fmt.Println("found.") - } - } - // Cache all external dependencies to prevent always hitting the internet - if *crossDeps != "" { - if err := os.MkdirAll(depsCache, 0751); err != nil { - log.Fatalf("Failed to create dependency cache: %v.", err) - } - // Download all missing dependencies - for _, dep := range strings.Split(*crossDeps, " ") { - if url := strings.TrimSpace(dep); len(url) > 0 { - path := filepath.Join(depsCache, filepath.Base(url)) - - if _, err := os.Stat(path); err != nil { - fmt.Printf("Downloading new dependency: %s...\n", url) - - out, err := os.Create(path) - if err != nil { - log.Fatalf("Failed to create dependency file: %v.", err) - } - res, err := http.Get(url) - if err != nil { - log.Fatalf("Failed to retrieve dependency: %v.", err) - } - defer res.Body.Close() - - if _, err := io.Copy(out, res.Body); err != nil { - log.Fatalf("Failed to download dependency: %v", err) - } - out.Close() - - fmt.Printf("New dependency cached: %s.\n", path) - } else { - fmt.Printf("Dependency already cached: %s.\n", path) - } - } - } - } - // Assemble the cross compilation environment and build options - config := &ConfigFlags{ - Repository: flag.Args()[0], - Package: *srcPackage, - Remote: *srcRemote, - Branch: *srcBranch, - Prefix: *outPrefix, - Dependencies: *crossDeps, - Arguments: *crossArgs, - Targets: strings.Split(*targets, ","), - } - flags := &BuildFlags{ - Verbose: *buildVerbose, - Steps: *buildSteps, - Race: *buildRace, - Tags: *buildTags, - LdFlags: *buildLdFlags, - Mode: *buildMode, - } - folder, err := os.Getwd() - if err != nil { - log.Fatalf("Failed to retrieve the working directory: %v.", err) - } - if *outFolder != "" { - folder, err = filepath.Abs(*outFolder) - if err != nil { - log.Fatalf("Failed to resolve destination path (%s): %v.", *outFolder, err) - } - } - // Execute the cross compilation, either in a container or the current system - if !xgoInXgo { - err = compile(image, config, flags, folder) - } else { - err = compileContained(config, flags, folder) - } - if err != nil { - log.Fatalf("Failed to cross compile package: %v.", err) - } -} - -// Checks whether a docker installation can be found and is functional. -func checkDocker() error { - fmt.Println("Checking docker installation...") - if err := run(exec.Command("docker", "version")); err != nil { - return err - } - fmt.Println() - return nil -} - -// Checks whether a required docker image is available locally. -func checkDockerImage(image string) (bool, error) { - fmt.Printf("Checking for required docker image %s... ", image) - out, err := exec.Command("docker", "images", "--no-trunc").Output() - if err != nil { - return false, err - } - return bytes.Contains(out, []byte(image)), nil -} - -// Pulls an image from the docker registry. -func pullDockerImage(image string) error { - fmt.Printf("Pulling %s from docker registry...\n", image) - return run(exec.Command("docker", "pull", image)) -} - -// compile cross builds a requested package according to the given build specs -// using a specific docker cross compilation image. -func compile(image string, config *ConfigFlags, flags *BuildFlags, folder string) error { - // If a local build was requested, find the import path and mount all GOPATH sources - locals, mounts, paths := []string{}, []string{}, []string{} - if strings.HasPrefix(config.Repository, string(filepath.Separator)) || strings.HasPrefix(config.Repository, ".") { - // Resolve the repository import path from the file path - config.Repository = resolveImportPath(config.Repository) - - // Iterate over all the local libs and export the mount points - if os.Getenv("GOPATH") == "" { - log.Fatalf("No $GOPATH is set or forwarded to xgo") - } - for _, gopath := range strings.Split(os.Getenv("GOPATH"), string(os.PathListSeparator)) { - // Since docker sandboxes volumes, resolve any symlinks manually - sources := filepath.Join(gopath, "src") - filepath.Walk(sources, func(path string, info os.FileInfo, err error) error { - // Skip any folders that errored out - if err != nil { - log.Printf("Failed to access GOPATH element %s: %v", path, err) - return nil - } - // Skip anything that's not a symlink - if info.Mode()&os.ModeSymlink == 0 { - return nil - } - // Resolve the symlink and skip if it's not a folder - target, err := filepath.EvalSymlinks(path) - if err != nil { - return nil - } - if info, err = os.Stat(target); err != nil || !info.IsDir() { - return nil - } - // Skip if the symlink points within GOPATH - if filepath.HasPrefix(target, sources) { - return nil - } - // Folder needs explicit mounting due to docker symlink security - locals = append(locals, target) - mounts = append(mounts, filepath.Join("/ext-go", strconv.Itoa(len(locals)), "src", strings.TrimPrefix(path, sources))) - paths = append(paths, filepath.Join("/ext-go", strconv.Itoa(len(locals)))) - return nil - }) - // Export the main mount point for this GOPATH entry - locals = append(locals, sources) - mounts = append(mounts, filepath.Join("/ext-go", strconv.Itoa(len(locals)), "src")) - paths = append(paths, filepath.Join("/ext-go", strconv.Itoa(len(locals)))) - } - } - // Assemble and run the cross compilation command - fmt.Printf("Cross compiling %s...\n", config.Repository) - - args := []string{ - "run", "--rm", - "-v", folder + ":/build", - "-v", depsCache + ":/deps-cache:ro", - "-e", "REPO_REMOTE=" + config.Remote, - "-e", "REPO_BRANCH=" + config.Branch, - "-e", "PACK=" + config.Package, - "-e", "DEPS=" + config.Dependencies, - "-e", "ARGS=" + config.Arguments, - "-e", "OUT=" + config.Prefix, - "-e", fmt.Sprintf("FLAG_V=%v", flags.Verbose), - "-e", fmt.Sprintf("FLAG_X=%v", flags.Steps), - "-e", fmt.Sprintf("FLAG_RACE=%v", flags.Race), - "-e", fmt.Sprintf("FLAG_TAGS=%s", flags.Tags), - "-e", fmt.Sprintf("FLAG_LDFLAGS=%s", flags.LdFlags), - "-e", fmt.Sprintf("FLAG_BUILDMODE=%s", flags.Mode), - "-e", "TARGETS=" + strings.Replace(strings.Join(config.Targets, " "), "*", ".", -1), - } - for i := 0; i < len(locals); i++ { - args = append(args, []string{"-v", fmt.Sprintf("%s:%s:ro", locals[i], mounts[i])}...) - } - args = append(args, []string{"-e", "EXT_GOPATH=" + strings.Join(paths, ":")}...) - - args = append(args, []string{image, config.Repository}...) - return run(exec.Command("docker", args...)) -} - -// compileContained cross builds a requested package according to the given build -// specs using the current system opposed to running in a container. This is meant -// to be used for cross compilation already from within an xgo image, allowing the -// inheritance and bundling of the root xgo images. -func compileContained(config *ConfigFlags, flags *BuildFlags, folder string) error { - // If a local build was requested, resolve the import path - local := strings.HasPrefix(config.Repository, string(filepath.Separator)) || strings.HasPrefix(config.Repository, ".") - if local { - config.Repository = resolveImportPath(config.Repository) - } - // Fine tune the original environment variables with those required by the build script - env := []string{ - "REPO_REMOTE=" + config.Remote, - "REPO_BRANCH=" + config.Branch, - "PACK=" + config.Package, - "DEPS=" + config.Dependencies, - "ARGS=" + config.Arguments, - "OUT=" + config.Prefix, - fmt.Sprintf("FLAG_V=%v", flags.Verbose), - fmt.Sprintf("FLAG_X=%v", flags.Steps), - fmt.Sprintf("FLAG_RACE=%v", flags.Race), - fmt.Sprintf("FLAG_TAGS=%s", flags.Tags), - fmt.Sprintf("FLAG_LDFLAGS=%s", flags.LdFlags), - fmt.Sprintf("FLAG_BUILDMODE=%s", flags.Mode), - "TARGETS=" + strings.Replace(strings.Join(config.Targets, " "), "*", ".", -1), - } - if local { - env = append(env, "EXT_GOPATH=/non-existent-path-to-signal-local-build") - } - // Assemble and run the local cross compilation command - fmt.Printf("Cross compiling %s...\n", config.Repository) - - cmd := exec.Command("/build.sh", config.Repository) - cmd.Env = append(os.Environ(), env...) - - return run(cmd) -} - -// resolveImportPath converts a package given by a relative path to a Go import -// path using the local GOPATH environment. -func resolveImportPath(path string) string { - abs, err := filepath.Abs(path) - if err != nil { - log.Fatalf("Failed to locate requested package: %v.", err) - } - stat, err := os.Stat(abs) - if err != nil || !stat.IsDir() { - log.Fatalf("Requested path invalid.") - } - pack, err := build.ImportDir(abs, build.FindOnly) - if err != nil { - log.Fatalf("Failed to resolve import path: %v.", err) - } - return pack.ImportPath -} - -// Executes a command synchronously, redirecting its output to stdout. -func run(cmd *exec.Cmd) error { - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - - return cmd.Run() -} From 5020308e14f75d2a6a779e2845ef303143a9d895 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?And=C5=BEej=20Maciusovi=C4=8D?= Date: Thu, 27 Feb 2020 09:27:19 +0200 Subject: [PATCH 20/24] Add Go runtime patches for time (#14) --- docker/base/Dockerfile | 10 -- docker/base/bootstrap.sh | 45 ----- docker/base/bootstrap_pure.sh | 2 + docker/base/bootstrap_repo.sh | 35 ---- ...untime-boottime-over-monotonic-darwin.diff | 87 ++++++++++ ...runtime-boottime-over-monotonic-linux.diff | 161 ++++++++++++++++++ docker/go-1.13.1/Dockerfile | 4 +- docker/go-1.13.8/Dockerfile | 17 ++ test.sh | 2 +- tests/embedded_c/main.go | 17 -- tests/embedded_cpp/main.go | 13 -- tests/embedded_cpp/snippet.cpp | 11 -- tests/embedded_cpp/snippet.h | 14 -- 13 files changed, 270 insertions(+), 148 deletions(-) delete mode 100644 docker/base/bootstrap.sh delete mode 100644 docker/base/bootstrap_repo.sh create mode 100644 docker/base/patches/goruntime-boottime-over-monotonic-darwin.diff create mode 100644 docker/base/patches/goruntime-boottime-over-monotonic-linux.diff create mode 100644 docker/go-1.13.8/Dockerfile delete mode 100644 tests/embedded_c/main.go delete mode 100644 tests/embedded_cpp/main.go delete mode 100644 tests/embedded_cpp/snippet.cpp delete mode 100644 tests/embedded_cpp/snippet.h diff --git a/docker/base/Dockerfile b/docker/base/Dockerfile index 29dfb976..c7ea5d3b 100644 --- a/docker/base/Dockerfile +++ b/docker/base/Dockerfile @@ -88,21 +88,11 @@ RUN \ rm -f `basename $ANDROID_SDK_PATH` && \ echo "Y" | $ANDROID_HOME/tools/bin/sdkmanager "platforms;android-21" "platforms;android-16" -# Inject the old Go package downloader and tool-chain bootstrapper -ADD bootstrap.sh /bootstrap.sh -ENV BOOTSTRAP /bootstrap.sh -RUN chmod +x $BOOTSTRAP - # Inject the new Go root distribution downloader and bootstrapper ADD bootstrap_pure.sh /bootstrap_pure.sh ENV BOOTSTRAP_PURE /bootstrap_pure.sh RUN chmod +x $BOOTSTRAP_PURE -# Inject the Go source distribution downloader and bootstrapper -ADD bootstrap_repo.sh /bootstrap_repo.sh -ENV BOOTSTRAP_REPO /bootstrap_repo.sh -RUN chmod +x $BOOTSTRAP_REPO - # Inject the C dependency cross compiler ADD build_deps.sh /build_deps.sh ENV BUILD_DEPS /build_deps.sh diff --git a/docker/base/bootstrap.sh b/docker/base/bootstrap.sh deleted file mode 100644 index 9d4dc219..00000000 --- a/docker/base/bootstrap.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -# -# Contains the Go tool-chain bootstrapper, that retrieves all the configured -# distribution packages, extracts the binaries and deletes anything not needed. -# -# Usage: bootstrap.sh -# -# Needed environment variables: -# FETCH - Remote file fetcher and checksum verifier (injected by image) -# DIST_LINUX_64, DIST_LINUX_64_SHA - 64 bit Linux Go binaries and checksum -# DIST_LINUX_32, DIST_LINUX_32_SHA - 32 bit Linux Go binaries and checksum -# DIST_LINUX_ARM, DIST_LINUX_ARM_SHA - ARM v5 Linux Go binaries and checksum -# DIST_OSX_64, DIST_OSX_64_SHA - 64 bit Mac OSX Go binaries and checksum -# DIST_OSX_32, DIST_OSX_32_SHA - 32 bit Mac OSX Go binaries and checksum -# DIST_WIN_64, DIST_WIN_64_SHA - 64 bit Windows Go binaries and checksum -# DIST_WIN_32, DIST_WIN_32_SHA - 32 bit Windows Go binaries and checksum -set -e - -# Download and verify all the binary packages -$FETCH $DIST_LINUX_64 $DIST_LINUX_64_SHA -$FETCH $DIST_LINUX_32 $DIST_LINUX_32_SHA -$FETCH $DIST_LINUX_ARM $DIST_LINUX_ARM_SHA -$FETCH $DIST_OSX_64 $DIST_OSX_64_SHA -$FETCH $DIST_OSX_32 $DIST_OSX_32_SHA -$FETCH $DIST_WIN_64 $DIST_WIN_64_SHA -$FETCH $DIST_WIN_32 $DIST_WIN_32_SHA - -# Extract the 64 bit Linux package as the primary Go SDK -tar -C /usr/local -xzf `basename $DIST_LINUX_64` -rm -f `basename $DIST_LINUX_64` - -export GOROOT=/usr/local/go -export GOROOT_BOOTSTRAP=$GOROOT - -# Extract all other packages as secondary ones, keeping only the binaries -if [ "$DIST_LINUX_32" != "" ]; then - tar -C /usr/local --wildcards -xzf `basename $DIST_LINUX_32` go/pkg/linux_386* - GOOS=linux GOARCH=386 /usr/local/go/pkg/tool/linux_amd64/dist bootstrap - rm -f `basename $DIST_LINUX_32` -fi -if [ "$DIST_LINUX_ARM" != "" ]; then - tar -C /usr/local --wildcards -xzf `basename $DIST_LINUX_ARM` go/pkg/linux_arm* - GOOS=linux GOARCH=arm /usr/local/go/pkg/tool/linux_amd64/dist bootstrap - rm -f `basename $DIST_LINUX_ARM` -fi diff --git a/docker/base/bootstrap_pure.sh b/docker/base/bootstrap_pure.sh index 98bd3f1d..e53ea385 100644 --- a/docker/base/bootstrap_pure.sh +++ b/docker/base/bootstrap_pure.sh @@ -23,6 +23,8 @@ if [ "$GOROOT" == "" ]; then rm -f `basename $ROOT_DIST` export GOROOT=/usr/local/go + + cat /patches/goruntime-*.diff | patch -p1 -f -N -r- -d "$GOROOT" fi export GOROOT_BOOTSTRAP=$GOROOT diff --git a/docker/base/bootstrap_repo.sh b/docker/base/bootstrap_repo.sh deleted file mode 100644 index 44e3e5fe..00000000 --- a/docker/base/bootstrap_repo.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# -# Contains the Go tool-chain source repository bootstrapper, that builds and -# bootstraps a Go environment from the official GitHub repository, opposed to -# using pre-build packages. -# -# Usage: bootstrap_repo.sh -# -# Needed environment variables: -# FETCH - Remote file fetcher and checksum verifier (injected by image) -set -e - -# Define the paths to deploy the bootstrapper and the final distribution -export GOROOT=/usr/local/go -export GOROOT_BOOTSTRAP=${GOROOT}-boot - -# Download and install the Go bootstrap distribution -BOOT_DIST=https://storage.googleapis.com/golang/go1.4.3.linux-amd64.tar.gz -BOOT_DIST_SHA=332b64236d30a8805fc8dd8b3a269915b4c507fe - -$FETCH $BOOT_DIST $BOOT_DIST_SHA - -tar -C /usr/local -xzf `basename $BOOT_DIST` -rm -f `basename $BOOT_DIST` -mv $GOROOT $GOROOT_BOOTSTRAP - -# Download, build and install the requesed Go sources -(cd /usr/local && git clone https://go.googlesource.com/go) -(cd $GOROOT && git checkout $1) -(cd $GOROOT/src && ./make.bash) - -rm -rf $GOROOT_BOOTSTRAP -export GOROOT_BOOTSTRAP=$GOROOT - -$BOOTSTRAP_PURE diff --git a/docker/base/patches/goruntime-boottime-over-monotonic-darwin.diff b/docker/base/patches/goruntime-boottime-over-monotonic-darwin.diff new file mode 100644 index 00000000..71b4ebf6 --- /dev/null +++ b/docker/base/patches/goruntime-boottime-over-monotonic-darwin.diff @@ -0,0 +1,87 @@ +From 04f5695b83cd221e99e9fa6171b57e45177d5ad3 Mon Sep 17 00:00:00 2001 +From: "Jason A. Donenfeld" +Date: Wed, 27 Feb 2019 05:33:01 +0100 +Subject: [PATCH] runtime: use libc_mach_continuous_time in nanotime on Darwin + +This makes timers account for having expired while a computer was +asleep, which is quite common on mobile devices. Note that +continuous_time absolute_time, except that it takes into account +time spent in suspend. + +Fixes #24595 +--- + src/runtime/sys_darwin.go | 2 +- + src/runtime/sys_darwin_386.s | 2 +- + src/runtime/sys_darwin_amd64.s | 2 +- + src/runtime/sys_darwin_arm.s | 2 +- + src/runtime/sys_darwin_arm64.s | 2 +- + 5 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/runtime/sys_darwin.go b/src/runtime/sys_darwin.go +index 376f76dbc5..a0677a83f6 100644 +--- a/src/runtime/sys_darwin.go ++++ b/src/runtime/sys_darwin.go +@@ -431,7 +431,7 @@ func setNonblock(fd int32) { + //go:cgo_import_dynamic libc_usleep usleep "/usr/lib/libSystem.B.dylib" + + //go:cgo_import_dynamic libc_mach_timebase_info mach_timebase_info "/usr/lib/libSystem.B.dylib" +-//go:cgo_import_dynamic libc_mach_absolute_time mach_absolute_time "/usr/lib/libSystem.B.dylib" ++//go:cgo_import_dynamic libc_mach_continuous_time mach_continuous_time "/usr/lib/libSystem.B.dylib" + //go:cgo_import_dynamic libc_gettimeofday gettimeofday "/usr/lib/libSystem.B.dylib" + //go:cgo_import_dynamic libc_sigaction sigaction "/usr/lib/libSystem.B.dylib" + //go:cgo_import_dynamic libc_pthread_sigmask pthread_sigmask "/usr/lib/libSystem.B.dylib" +diff --git a/src/runtime/sys_darwin_386.s b/src/runtime/sys_darwin_386.s +index e653c54f61..5a43fcbdc1 100644 +--- a/src/runtime/sys_darwin_386.s ++++ b/src/runtime/sys_darwin_386.s +@@ -199,7 +199,7 @@ TEXT runtime·nanotime_trampoline(SB),NOSPLIT,$0 + PUSHL BP + MOVL SP, BP + SUBL $8+(machTimebaseInfo__size+15)/16*16, SP +- CALL libc_mach_absolute_time(SB) ++ CALL libc_mach_continuous_time(SB) + MOVL 16+(machTimebaseInfo__size+15)/16*16(SP), CX + MOVL AX, 0(CX) + MOVL DX, 4(CX) +diff --git a/src/runtime/sys_darwin_amd64.s b/src/runtime/sys_darwin_amd64.s +index 87c8db8c82..f962f24339 100644 +--- a/src/runtime/sys_darwin_amd64.s ++++ b/src/runtime/sys_darwin_amd64.s +@@ -97,7 +97,7 @@ TEXT runtime·nanotime_trampoline(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + MOVQ DI, BX +- CALL libc_mach_absolute_time(SB) ++ CALL libc_mach_continuous_time(SB) + MOVQ AX, 0(BX) + MOVL timebase<>+machTimebaseInfo_numer(SB), SI + MOVL timebase<>+machTimebaseInfo_denom(SB), DI // atomic read +diff --git a/src/runtime/sys_darwin_arm.s b/src/runtime/sys_darwin_arm.s +index 996f8028a3..5bd34b51be 100644 +--- a/src/runtime/sys_darwin_arm.s ++++ b/src/runtime/sys_darwin_arm.s +@@ -126,7 +126,7 @@ GLOBL timebase<>(SB),NOPTR,$(machTimebaseInfo__size) + + TEXT runtime·nanotime_trampoline(SB),NOSPLIT,$0 + MOVW R0, R8 +- BL libc_mach_absolute_time(SB) ++ BL libc_mach_continuous_time(SB) + MOVW R0, 0(R8) + MOVW R1, 4(R8) + MOVW timebase<>+machTimebaseInfo_numer(SB), R6 +diff --git a/src/runtime/sys_darwin_arm64.s b/src/runtime/sys_darwin_arm64.s +index ac3ca74f63..5e91540f94 100644 +--- a/src/runtime/sys_darwin_arm64.s ++++ b/src/runtime/sys_darwin_arm64.s +@@ -121,7 +121,7 @@ GLOBL timebase<>(SB),NOPTR,$(machTimebaseInfo__size) + + TEXT runtime·nanotime_trampoline(SB),NOSPLIT,$40 + MOVD R0, R19 +- BL libc_mach_absolute_time(SB) ++ BL libc_mach_continuous_time(SB) + MOVD R0, 0(R19) + MOVW timebase<>+machTimebaseInfo_numer(SB), R20 + MOVD $timebase<>+machTimebaseInfo_denom(SB), R21 +-- +2.23.0 + diff --git a/docker/base/patches/goruntime-boottime-over-monotonic-linux.diff b/docker/base/patches/goruntime-boottime-over-monotonic-linux.diff new file mode 100644 index 00000000..5fd02397 --- /dev/null +++ b/docker/base/patches/goruntime-boottime-over-monotonic-linux.diff @@ -0,0 +1,161 @@ +From b19623e7673a4d6743745382d5d38751b64e011d Mon Sep 17 00:00:00 2001 +From: "Jason A. Donenfeld" +Date: Wed, 27 Feb 2019 05:05:44 +0100 +Subject: [PATCH] runtime: use CLOCK_BOOTTIME in nanotime on Linux + +This makes timers account for having expired while a computer was +asleep, which is quite common on mobile devices. Note that BOOTTIME is +identical to MONOTONIC, except that it takes into account time spent +in suspend. In Linux 4.17, the kernel will actually make MONOTONIC act +like BOOTTIME anyway, so this switch will additionally unify the +timer behavior across kernels. + +BOOTTIME was introduced into Linux 2.6.39-rc1 with 70a08cca1227d in +2011. + +Fixes #24595 + +Change-Id: I7b2a6ca0c5bc5fce57ec0eeafe7b68270b429321 +--- + src/runtime/sys_linux_386.s | 4 ++-- + src/runtime/sys_linux_amd64.s | 2 +- + src/runtime/sys_linux_arm.s | 4 ++-- + src/runtime/sys_linux_arm64.s | 4 ++-- + src/runtime/sys_linux_mips64x.s | 2 +- + src/runtime/sys_linux_mipsx.s | 2 +- + src/runtime/sys_linux_ppc64x.s | 2 +- + src/runtime/sys_linux_s390x.s | 2 +- + 8 files changed, 11 insertions(+), 11 deletions(-) + +diff --git a/src/runtime/sys_linux_386.s b/src/runtime/sys_linux_386.s +index 72c43bd9da..daadfe32a9 100644 +--- a/src/runtime/sys_linux_386.s ++++ b/src/runtime/sys_linux_386.s +@@ -288,13 +288,13 @@ noswitch: + + LEAL 8(SP), BX // &ts (struct timespec) + MOVL BX, 4(SP) +- MOVL $1, 0(SP) // CLOCK_MONOTONIC ++ MOVL $7, 0(SP) // CLOCK_BOOTTIME + CALL AX + JMP finish + + fallback: + MOVL $SYS_clock_gettime, AX +- MOVL $1, BX // CLOCK_MONOTONIC ++ MOVL $7, BX // CLOCK_BOOTTIME + LEAL 8(SP), CX + INVOKE_SYSCALL + +diff --git a/src/runtime/sys_linux_amd64.s b/src/runtime/sys_linux_amd64.s +index 5c300f553d..e4a6f12ec6 100644 +--- a/src/runtime/sys_linux_amd64.s ++++ b/src/runtime/sys_linux_amd64.s +@@ -261,7 +261,7 @@ noswitch: + MOVQ runtime·vdsoClockgettimeSym(SB), AX + CMPQ AX, $0 + JEQ fallback +- MOVL $1, DI // CLOCK_MONOTONIC ++ MOVL $7, DI // CLOCK_BOOTTIME + LEAQ 0(SP), SI + CALL AX + MOVQ 0(SP), AX // sec +diff --git a/src/runtime/sys_linux_arm.s b/src/runtime/sys_linux_arm.s +index 9c7398451c..61b6cd91f6 100644 +--- a/src/runtime/sys_linux_arm.s ++++ b/src/runtime/sys_linux_arm.s +@@ -11,7 +11,7 @@ + #include "textflag.h" + + #define CLOCK_REALTIME 0 +-#define CLOCK_MONOTONIC 1 ++#define CLOCK_BOOTTIME 7 + + // for EABI, as we don't support OABI + #define SYS_BASE 0x0 +@@ -291,7 +291,7 @@ noswitch: + SUB $24, R13 // Space for results + BIC $0x7, R13 // Align for C code + +- MOVW $CLOCK_MONOTONIC, R0 ++ MOVW $CLOCK_BOOTTIME, R0 + MOVW $8(R13), R1 // timespec + MOVW runtime·vdsoClockgettimeSym(SB), R11 + CMP $0, R11 +diff --git a/src/runtime/sys_linux_arm64.s b/src/runtime/sys_linux_arm64.s +index 2835b6ca1c..346ca9cfce 100644 +--- a/src/runtime/sys_linux_arm64.s ++++ b/src/runtime/sys_linux_arm64.s +@@ -13,7 +13,7 @@ + #define AT_FDCWD -100 + + #define CLOCK_REALTIME 0 +-#define CLOCK_MONOTONIC 1 ++#define CLOCK_BOOTTIME 7 + + #define SYS_exit 93 + #define SYS_read 63 +@@ -247,7 +247,7 @@ noswitch: + BIC $15, R1 + MOVD R1, RSP + +- MOVW $CLOCK_MONOTONIC, R0 ++ MOVW $CLOCK_BOOTTIME, R0 + MOVD runtime·vdsoClockgettimeSym(SB), R2 + CBZ R2, fallback + BL (R2) +diff --git a/src/runtime/sys_linux_mips64x.s b/src/runtime/sys_linux_mips64x.s +index 33ed1050c2..59a5be179c 100644 +--- a/src/runtime/sys_linux_mips64x.s ++++ b/src/runtime/sys_linux_mips64x.s +@@ -189,7 +189,7 @@ TEXT runtime·walltime(SB),NOSPLIT,$16 + RET + + TEXT runtime·nanotime(SB),NOSPLIT,$16 +- MOVW $1, R4 // CLOCK_MONOTONIC ++ MOVW $7, R4 // CLOCK_BOOTTIME + MOVV $0(R29), R5 + MOVV $SYS_clock_gettime, R2 + SYSCALL +diff --git a/src/runtime/sys_linux_mipsx.s b/src/runtime/sys_linux_mipsx.s +index 6e539fbc6f..55b2bf7156 100644 +--- a/src/runtime/sys_linux_mipsx.s ++++ b/src/runtime/sys_linux_mipsx.s +@@ -194,7 +194,7 @@ TEXT runtime·walltime(SB),NOSPLIT,$8-12 + RET + + TEXT runtime·nanotime(SB),NOSPLIT,$8-8 +- MOVW $1, R4 // CLOCK_MONOTONIC ++ MOVW $7, R4 // CLOCK_BOOTTIME + MOVW $4(R29), R5 + MOVW $SYS_clock_gettime, R2 + SYSCALL +diff --git a/src/runtime/sys_linux_ppc64x.s b/src/runtime/sys_linux_ppc64x.s +index 13d23156bd..f67e5062aa 100644 +--- a/src/runtime/sys_linux_ppc64x.s ++++ b/src/runtime/sys_linux_ppc64x.s +@@ -204,7 +204,7 @@ fallback: + JMP finish + + TEXT runtime·nanotime(SB),NOSPLIT,$16 +- MOVD $1, R3 // CLOCK_MONOTONIC ++ MOVD $7, R3 // CLOCK_BOOTTIME + + MOVD R1, R15 // R15 is unchanged by C code + MOVD g_m(g), R21 // R21 = m +diff --git a/src/runtime/sys_linux_s390x.s b/src/runtime/sys_linux_s390x.s +index 58b36dff0a..cb92e9a402 100644 +--- a/src/runtime/sys_linux_s390x.s ++++ b/src/runtime/sys_linux_s390x.s +@@ -180,7 +180,7 @@ TEXT runtime·walltime(SB),NOSPLIT,$16 + RET + + TEXT runtime·nanotime(SB),NOSPLIT,$16 +- MOVW $1, R2 // CLOCK_MONOTONIC ++ MOVW $7, R2 // CLOCK_BOOTTIME + MOVD $tp-16(SP), R3 + MOVW $SYS_clock_gettime, R1 + SYSCALL +-- +2.23.0 + diff --git a/docker/go-1.13.1/Dockerfile b/docker/go-1.13.1/Dockerfile index 13b8b5df..d4f00c3e 100644 --- a/docker/go-1.13.1/Dockerfile +++ b/docker/go-1.13.1/Dockerfile @@ -8,10 +8,10 @@ FROM mysteriumnetwork/xgomobile:base MAINTAINER Péter Szilágyi ENV CGO_LDFLAGS_ALLOW -fobjc-arc -ENV GO_VERSION 1136 +ENV GO_VERSION 1131 RUN \ - export ROOT_DIST=https://dl.google.com/go/go1.13.6.linux-amd64.tar.gz && \ + export ROOT_DIST=https://dl.google.com/go/go1.13.1.linux-amd64.tar.gz && \ export ROOT_DIST_SHA=a1bc06deb070155c4f67c579f896a45eeda5a8fa54f35ba233304074c4abbbbd && \ \ $BOOTSTRAP_PURE \ No newline at end of file diff --git a/docker/go-1.13.8/Dockerfile b/docker/go-1.13.8/Dockerfile new file mode 100644 index 00000000..06f3079c --- /dev/null +++ b/docker/go-1.13.8/Dockerfile @@ -0,0 +1,17 @@ +# Go cross compiler (xgo): Go 1.14 +# Copyright (c) 2018 Péter Szilágyi. All rights reserved. +# +# Released under the MIT license. + +FROM mysteriumnetwork/xgomobile:base + +MAINTAINER Péter Szilágyi + +ENV CGO_LDFLAGS_ALLOW -fobjc-arc +ENV GO_VERSION 1138 + +RUN \ + export ROOT_DIST=https://dl.google.com/go/go1.13.8.linux-amd64.tar.gz && \ + export ROOT_DIST_SHA=0567734d558aef19112f2b2873caa0c600f1b4a5827930eb5a7f35235219e9d8 && \ + \ +$BOOTSTRAP_PURE \ No newline at end of file diff --git a/test.sh b/test.sh index f35bdf73..240da18e 100755 --- a/test.sh +++ b/test.sh @@ -13,4 +13,4 @@ docker run --rm \ -e TARGETS=android/. \ -e EXT_GOPATH=/ext-go/1 \ -e GO111MODULE=off \ - mysteriumnetwork/xgomobile:1.13.6 mobilepkg \ No newline at end of file + mysteriumnetwork/xgomobile:1.13.8 mobilepkg \ No newline at end of file diff --git a/tests/embedded_c/main.go b/tests/embedded_c/main.go deleted file mode 100644 index ac04721c..00000000 --- a/tests/embedded_c/main.go +++ /dev/null @@ -1,17 +0,0 @@ -// Go cross compiler (xgo): Test file for embedded C snippets. -// Copyright (c) 2015 Péter Szilágyi. All rights reserved. -// -// Released under the MIT license. - -package main - -// #include -// -// void sayHi() { -// printf("Hello, embedded C!\n"); -// } -import "C" - -func main() { - C.sayHi() -} diff --git a/tests/embedded_cpp/main.go b/tests/embedded_cpp/main.go deleted file mode 100644 index 26a2b917..00000000 --- a/tests/embedded_cpp/main.go +++ /dev/null @@ -1,13 +0,0 @@ -// Go cross compiler (xgo): Test file for embedded C++ snippets. -// Copyright (c) 2015 Péter Szilágyi. All rights reserved. -// -// Released under the MIT license. - -package main - -// #include "snippet.h" -import "C" - -func main() { - C.sayHi() -} diff --git a/tests/embedded_cpp/snippet.cpp b/tests/embedded_cpp/snippet.cpp deleted file mode 100644 index 194ff17c..00000000 --- a/tests/embedded_cpp/snippet.cpp +++ /dev/null @@ -1,11 +0,0 @@ -// Go cross compiler (xgo): Test implementation for embedded C++ snippets. -// Copyright (c) 2015 Péter Szilágyi. All rights reserved. -// -// Released under the MIT license. - -#include -#include "snippet.h" - -void sayHi() { - std::cout << "Hello, embedded C++!" << std::endl; -} diff --git a/tests/embedded_cpp/snippet.h b/tests/embedded_cpp/snippet.h deleted file mode 100644 index e8602730..00000000 --- a/tests/embedded_cpp/snippet.h +++ /dev/null @@ -1,14 +0,0 @@ -// Go cross compiler (xgo): Test header for embedded C++ snippets. -// Copyright (c) 2015 Péter Szilágyi. All rights reserved. -// -// Released under the MIT license. - -#ifdef __cplusplus -extern "C" { -#endif - -void sayHi(); - -#ifdef __cplusplus -} -#endif From db36438a7e7e1089be8c02822d588ea0ec620343 Mon Sep 17 00:00:00 2001 From: Antanas Masevicius Date: Wed, 4 Mar 2020 11:00:24 +0200 Subject: [PATCH 21/24] Update ndk and gomobile --- README.md | 8 ++++---- docker/base/Dockerfile | 15 ++++++++------- docker/base/bootstrap_pure.sh | 5 +++-- test.sh | 2 +- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 18e2d564..84feacdc 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ docker run --rm \ -e TARGETS=android/. \ -e EXT_GOPATH=/ext-go/1 \ -e GO111MODULE=off \ - mysteriumnetwork/xgomobile:1.13.6 mobilepkg + mysteriumnetwork/xgomobile:1.13.8 mobilepkg ``` Also see and run ./test.sh to build test examples. @@ -33,7 +33,7 @@ If you add new go version only when build and push. Build new image. ``` -docker build -t mysteriumnetwork/xgomobile:1.13.6 -f ./docker/go-1.13.6/Dockerfile . +docker build -t mysteriumnetwork/xgomobile:1.13.8 -f ./docker/go-1.13.8/Dockerfile . ``` Update and run tests. @@ -43,5 +43,5 @@ Update and run tests. Push image ``` -docker push mysteriumnetwork/xgomobile:1.13.6 -``` \ No newline at end of file +docker push mysteriumnetwork/xgomobile:1.13.8 +``` diff --git a/docker/base/Dockerfile b/docker/base/Dockerfile index c7ea5d3b..80948461 100644 --- a/docker/base/Dockerfile +++ b/docker/base/Dockerfile @@ -42,9 +42,10 @@ RUN ln -s /usr/include/asm-generic /usr/include/asm ADD patches /patches # Configure the container for Android cross compilation -ENV ANDROID_NDK android-ndk-r13b +ENV ANDROID_NDK android-ndk-r19c ENV ANDROID_NDK_PATH http://dl.google.com/android/repository/$ANDROID_NDK-linux-x86_64.zip ENV ANDROID_NDK_ROOT /usr/local/$ANDROID_NDK +ENV ANDROID_NDK_HOME $ANDROID_NDK_ROOT ENV ANDROID_NDK_LIBC $ANDROID_NDK_ROOT/sources/cxx-stl/gnu-libstdc++/4.9 ENV ANDROID_PLATFORM 21 ENV ANDROID_CHAIN_ARM arm-linux-androideabi-4.9 @@ -53,14 +54,14 @@ ENV ANDROID_CHAIN_AMD64 x86_64-4.9 ENV ANDROID_CHAIN_386 x86-4.9 RUN \ - $FETCH $ANDROID_NDK_PATH 0600157c4ddf50ec15b8a037cfc474143f718fd0 && \ + $FETCH $ANDROID_NDK_PATH fd94d0be6017c6acbd193eb95e09cf4b6f61b834 && \ unzip `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/sources/cxx-stl/gnu-libstdc++/4.9/libs/arm64*/*" \ - "$ANDROID_NDK/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86_64/*" \ - "$ANDROID_NDK/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/*" \ + "$ANDROID_NDK/sources/cxx-stl/llvm-libc++/include/*" \ + "$ANDROID_NDK/sources/cxx-stl/llvm-libc++/libs/armeabi*/*" \ + "$ANDROID_NDK/sources/cxx-stl/llvm-libc++/libs/arm64*/*" \ + "$ANDROID_NDK/sources/cxx-stl/llvm-libc++/libs/x86_64/*" \ + "$ANDROID_NDK/sources/cxx-stl/llvm-libc++/libs/x86/*" \ "$ANDROID_NDK/prebuilt/linux-x86_64/*" \ "$ANDROID_NDK/platforms/*/arch-arm/*" \ "$ANDROID_NDK/platforms/*/arch-arm64/*" \ diff --git a/docker/base/bootstrap_pure.sh b/docker/base/bootstrap_pure.sh index e53ea385..1f826a50 100644 --- a/docker/base/bootstrap_pure.sh +++ b/docker/base/bootstrap_pure.sh @@ -55,9 +55,10 @@ fi echo "Installing gomobile..." go get -u golang.org/x/mobile/cmd/gomobile cd /go/src/golang.org/x/mobile -git checkout a27dd33d354d004b2de14a791df5af8a00f68b8e +git checkout 3c8601c510d0503ac84d1e5cb8e24de550201dea go build ./cmd/gobind && mv ./gobind /usr/bin/ go build ./cmd/gomobile && mv ./gomobile /usr/bin/ -/usr/bin/gomobile init -ndk /usr/local/android-ndk-r13b/ +# use prebuilt toolchains +# /usr/bin/gomobile init -ndk /usr/local/android-ndk-r13b/ /usr/bin/gomobile version diff --git a/test.sh b/test.sh index 240da18e..269bb741 100755 --- a/test.sh +++ b/test.sh @@ -13,4 +13,4 @@ docker run --rm \ -e TARGETS=android/. \ -e EXT_GOPATH=/ext-go/1 \ -e GO111MODULE=off \ - mysteriumnetwork/xgomobile:1.13.8 mobilepkg \ No newline at end of file + mysteriumnetwork/xgomobile:1.13.8 mobilepkg From 992d3bf9cf4649d3d7811354b9d3bf8cbb3d7658 Mon Sep 17 00:00:00 2001 From: anjmao Date: Wed, 4 Mar 2020 17:30:51 +0200 Subject: [PATCH 22/24] Add support for go modules --- docker/base/build.sh | 278 +--------------------------------------- go.mod | 5 + go.sum | 26 ++++ src/mobilepkg/mobile.go | 8 -- test.sh | 8 +- testlib/mobile.go | 13 ++ 6 files changed, 51 insertions(+), 287 deletions(-) create mode 100644 go.mod create mode 100644 go.sum delete mode 100644 src/mobilepkg/mobile.go create mode 100644 testlib/mobile.go diff --git a/docker/base/build.sh b/docker/base/build.sh index f4a7441d..68ea3364 100644 --- a/docker/base/build.sh +++ b/docker/base/build.sh @@ -7,11 +7,6 @@ # Usage: build.sh # # Needed environment variables: -# REPO_REMOTE - Optional VCS remote if not the primary repository is needed -# REPO_BRANCH - Optional VCS branch to use, if not the master branch -# DEPS - Optional list of C dependency packages to build -# ARGS - Optional arguments to pass to C dependency configure scripts -# PACK - Optional sub-package, if not the import path is being built # OUT - Optional output prefix to override the package name # FLAG_V - Optional verbosity flag to set on the Go builder # FLAG_X - Optional flag to print the build progress commands @@ -21,7 +16,6 @@ # FLAG_BUILDMODE - Optional buildmode flag to set on the Go builder # TARGETS - Comma separated list of build targets to compile for # GO_VERSION - Bootstrapped version of Go to disable uncupported targets -# EXT_GOPATH - GOPATH elements mounted from the host filesystem # Define a function that figures out the binary extension function extension { @@ -46,89 +40,12 @@ function extension { fi } -# Either set a local build environemnt, or pull any remote imports -if [ "$EXT_GOPATH" != "" ]; then - # If local builds are requested, inject the sources - echo "Building locally $1..." - export GOPATH=$GOPATH:$EXT_GOPATH - set -e - - # Find and change into the package folder - cd `go list -e -f {{.Dir}} $1` - export GOPATH=$GOPATH:`pwd`/Godeps/_workspace -else - # Inject all possible Godep paths to short circuit go gets - GOPATH_ROOT=$GOPATH/src - IMPORT_PATH=$1 - while [ "$IMPORT_PATH" != "." ]; do - export GOPATH=$GOPATH:$GOPATH_ROOT/$IMPORT_PATH/Godeps/_workspace - IMPORT_PATH=`dirname $IMPORT_PATH` - done - - # Otherwise download the canonical import path (may fail, don't allow failures beyond) - echo "Fetching main repository $1..." - go get -v -d $1 - set -e - - cd $GOPATH_ROOT/$1 - - # Switch over the code-base to another checkout if requested - if [ "$REPO_REMOTE" != "" ] || [ "$REPO_BRANCH" != "" ]; then - # Detect the version control system type - IMPORT_PATH=$1 - while [ "$IMPORT_PATH" != "." ] && [ "$REPO_TYPE" == "" ]; do - if [ -d "$GOPATH_ROOT/$IMPORT_PATH/.git" ]; then - REPO_TYPE="git" - elif [ -d "$GOPATH_ROOT/$IMPORT_PATH/.hg" ]; then - REPO_TYPE="hg" - fi - IMPORT_PATH=`dirname $IMPORT_PATH` - done - - if [ "$REPO_TYPE" == "" ]; then - echo "Unknown version control system type, cannot switch remotes and branches." - exit -1 - fi - # If we have a valid VCS, execute the switch operations - if [ "$REPO_REMOTE" != "" ]; then - echo "Switching over to remote $REPO_REMOTE..." - if [ "$REPO_TYPE" == "git" ]; then - git remote set-url origin $REPO_REMOTE - git fetch --all - git reset --hard origin/HEAD - git clean -dxf - elif [ "$REPO_TYPE" == "hg" ]; then - echo -e "[paths]\ndefault = $REPO_REMOTE\n" >> .hg/hgrc - hg pull - fi - fi - if [ "$REPO_BRANCH" != "" ]; then - echo "Switching over to branch $REPO_BRANCH..." - if [ "$REPO_TYPE" == "git" ]; then - git reset --hard origin/$REPO_BRANCH - git clean -dxf - elif [ "$REPO_TYPE" == "hg" ]; then - hg checkout $REPO_BRANCH - fi - fi - fi -fi - -# Download all the C dependencies -mkdir /deps -DEPS=($DEPS) && for dep in "${DEPS[@]}"; do - if [ "${dep##*.}" == "tar" ]; then cat "/deps-cache/`basename $dep`" | tar -C /deps -x; fi - if [ "${dep##*.}" == "gz" ]; then cat "/deps-cache/`basename $dep`" | tar -C /deps -xz; fi - if [ "${dep##*.}" == "bz2" ]; then cat "/deps-cache/`basename $dep`" | tar -C /deps -xj; fi -done - -DEPS_ARGS=($ARGS) - # Save the contents of the pre-build /usr/local folder for post cleanup USR_LOCAL_CONTENTS=`ls /usr/local` # Configure some global build parameters -NAME=`basename $1/$PACK` +PACK_RELPATH=$1 +NAME=`basename $1/$PACK_RELPATH` if [ "$OUT" != "" ]; then NAME=$OUT fi @@ -157,195 +74,9 @@ for TARGET in $TARGETS; do # Ignore android versions etc. build only archive and sources # Android api will be 21 for arm64, 16 for arm-a7v # Archive will be for both amd64,x86 and arm64, arm 7 - $GOMOBILE bind --target=android/arm64,android/arm,android/amd64,android/386 $X $V "${T[@]}" --ldflags="$V $LD" -o "/build/$NAME.aar" ./$PACK - fi - # Check and build for Linux targets - if ([ $XGOOS == "." ] || [ $XGOOS == "linux" ]) && ([ $XGOARCH == "." ] || [ $XGOARCH == "amd64" ]); then - echo "Compiling for linux/amd64..." - HOST=x86_64-linux PREFIX=/usr/local $BUILD_DEPS /deps ${DEPS_ARGS[@]} - GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK - GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build $V $X "${T[@]}" --ldflags="$V $LD" $R $BM -o "/build/$NAME-linux-amd64$R`extension linux`" ./$PACK - fi - if ([ $XGOOS == "." ] || [ $XGOOS == "linux" ]) && ([ $XGOARCH == "." ] || [ $XGOARCH == "386" ]); then - echo "Compiling for linux/386..." - HOST=i686-linux PREFIX=/usr/local $BUILD_DEPS /deps ${DEPS_ARGS[@]} - GOOS=linux GOARCH=386 CGO_ENABLED=1 go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK - GOOS=linux GOARCH=386 CGO_ENABLED=1 go build $V $X "${T[@]}" --ldflags="$V $LD" $BM -o "/build/$NAME-linux-386`extension linux`" ./$PACK - fi - if ([ $XGOOS == "." ] || [ $XGOOS == "linux" ]) && ([ $XGOARCH == "." ] || [ $XGOARCH == "arm" ] || [ $XGOARCH == "arm-5" ]); then - if [ "$GO_VERSION" -ge 150 ]; then - echo "Bootstrapping linux/arm-5..." - CC=arm-linux-gnueabi-gcc-5 GOOS=linux GOARCH=arm GOARM=5 CGO_ENABLED=1 CGO_CFLAGS="-march=armv5" CGO_CXXFLAGS="-march=armv5" go install std - fi - echo "Compiling for linux/arm-5..." - CC=arm-linux-gnueabi-gcc-5 CXX=arm-linux-gnueabi-g++-5 HOST=arm-linux-gnueabi PREFIX=/usr/arm-linux-gnueabi CFLAGS="-march=armv5" CXXFLAGS="-march=armv5" $BUILD_DEPS /deps ${DEPS_ARGS[@]} - export PKG_CONFIG_PATH=/usr/arm-linux-gnueabi/lib/pkgconfig - - CC=arm-linux-gnueabi-gcc-5 CXX=arm-linux-gnueabi-g++-5 GOOS=linux GOARCH=arm GOARM=5 CGO_ENABLED=1 CGO_CFLAGS="-march=armv5" CGO_CXXFLAGS="-march=armv5" go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK - CC=arm-linux-gnueabi-gcc-5 CXX=arm-linux-gnueabi-g++-5 GOOS=linux GOARCH=arm GOARM=5 CGO_ENABLED=1 CGO_CFLAGS="-march=armv5" CGO_CXXFLAGS="-march=armv5" go build $V $X "${T[@]}" --ldflags="$V $LD" $BM -o "/build/$NAME-linux-arm-5`extension linux`" ./$PACK - if [ "$GO_VERSION" -ge 150 ]; then - echo "Cleaning up Go runtime for linux/arm-5..." - rm -rf /usr/local/go/pkg/linux_arm - fi - fi - if ([ $XGOOS == "." ] || [ $XGOOS == "linux" ]) && ([ $XGOARCH == "." ] || [ $XGOARCH == "arm-6" ]); then - if [ "$GO_VERSION" -lt 150 ]; then - echo "Go version too low, skipping linux/arm-6..." - else - echo "Bootstrapping linux/arm-6..." - CC=arm-linux-gnueabi-gcc-5 GOOS=linux GOARCH=arm GOARM=6 CGO_ENABLED=1 CGO_CFLAGS="-march=armv6" CGO_CXXFLAGS="-march=armv6" go install std - - echo "Compiling for linux/arm-6..." - CC=arm-linux-gnueabi-gcc-5 CXX=arm-linux-gnueabi-g++-5 HOST=arm-linux-gnueabi PREFIX=/usr/arm-linux-gnueabi CFLAGS="-march=armv6" CXXFLAGS="-march=armv6" $BUILD_DEPS /deps ${DEPS_ARGS[@]} - export PKG_CONFIG_PATH=/usr/arm-linux-gnueabi/lib/pkgconfig - - CC=arm-linux-gnueabi-gcc-5 CXX=arm-linux-gnueabi-g++-5 GOOS=linux GOARCH=arm GOARM=6 CGO_ENABLED=1 CGO_CFLAGS="-march=armv6" CGO_CXXFLAGS="-march=armv6" go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK - CC=arm-linux-gnueabi-gcc-5 CXX=arm-linux-gnueabi-g++-5 GOOS=linux GOARCH=arm GOARM=6 CGO_ENABLED=1 CGO_CFLAGS="-march=armv6" CGO_CXXFLAGS="-march=armv6" go build $V $X "${T[@]}" --ldflags="$V $LD" $BM -o "/build/$NAME-linux-arm-6`extension linux`" ./$PACK - - echo "Cleaning up Go runtime for linux/arm-6..." - rm -rf /usr/local/go/pkg/linux_arm - fi + $GOMOBILE bind --target=android/arm64,android/arm,android/amd64,android/386 $X $V "${T[@]}" --ldflags="$V $LD" -o "/build/$NAME.aar" ./$PACK_RELPATH fi - if ([ $XGOOS == "." ] || [ $XGOOS == "linux" ]) && ([ $XGOARCH == "." ] || [ $XGOARCH == "arm-7" ]); then - if [ "$GO_VERSION" -lt 150 ]; then - echo "Go version too low, skipping linux/arm-7..." - else - echo "Bootstrapping linux/arm-7..." - CC=arm-linux-gnueabihf-gcc-5 GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=1 CGO_CFLAGS="-march=armv7-a" CGO_CXXFLAGS="-march=armv7-a" go install std - - echo "Compiling for linux/arm-7..." - CC=arm-linux-gnueabihf-gcc-5 CXX=arm-linux-gnueabihf-g++-5 HOST=arm-linux-gnueabihf PREFIX=/usr/arm-linux-gnueabihf CFLAGS="-march=armv7-a -fPIC" CXXFLAGS="-march=armv7-a -fPIC" $BUILD_DEPS /deps ${DEPS_ARGS[@]} - export PKG_CONFIG_PATH=/usr/arm-linux-gnueabihf/lib/pkgconfig - - CC=arm-linux-gnueabihf-gcc-5 CXX=arm-linux-gnueabihf-g++-5 GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=1 CGO_CFLAGS="-march=armv7-a -fPIC" CGO_CXXFLAGS="-march=armv7-a -fPIC" go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK - CC=arm-linux-gnueabihf-gcc-5 CXX=arm-linux-gnueabihf-g++-5 GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=1 CGO_CFLAGS="-march=armv7-a -fPIC" CGO_CXXFLAGS="-march=armv7-a -fPIC" go build $V $X "${T[@]}" --ldflags="$V $LD" $BM -o "/build/$NAME-linux-arm-7`extension linux`" ./$PACK - echo "Cleaning up Go runtime for linux/arm-7..." - rm -rf /usr/local/go/pkg/linux_arm - fi - fi - if ([ $XGOOS == "." ] || [ $XGOOS == "linux" ]) && ([ $XGOARCH == "." ] || [ $XGOARCH == "arm64" ]); then - if [ "$GO_VERSION" -lt 150 ]; then - echo "Go version too low, skipping linux/arm64..." - else - echo "Compiling for linux/arm64..." - CC=aarch64-linux-gnu-gcc-5 CXX=aarch64-linux-gnu-g++-5 HOST=aarch64-linux-gnu PREFIX=/usr/aarch64-linux-gnu $BUILD_DEPS /deps ${DEPS_ARGS[@]} - export PKG_CONFIG_PATH=/usr/aarch64-linux-gnu/lib/pkgconfig - - CC=aarch64-linux-gnu-gcc-5 CXX=aarch64-linux-gnu-g++-5 GOOS=linux GOARCH=arm64 CGO_ENABLED=1 go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK - CC=aarch64-linux-gnu-gcc-5 CXX=aarch64-linux-gnu-g++-5 GOOS=linux GOARCH=arm64 CGO_ENABLED=1 go build $V $X "${T[@]}" --ldflags="$V $LD" $BM -o "/build/$NAME-linux-arm64`extension linux`" ./$PACK - fi - fi - if ([ $XGOOS == "." ] || [ $XGOOS == "linux" ]) && ([ $XGOARCH == "." ] || [ $XGOARCH == "mips64" ]); then - if [ "$GO_VERSION" -lt 170 ]; then - echo "Go version too low, skipping linux/mips64..." - else - echo "Compiling for linux/mips64..." - CC=mips64-linux-gnuabi64-gcc-5 CXX=mips64-linux-gnuabi64-g++-5 HOST=mips64-linux-gnuabi64 PREFIX=/usr/mips64-linux-gnuabi64 $BUILD_DEPS /deps ${DEPS_ARGS[@]} - export PKG_CONFIG_PATH=/usr/mips64-linux-gnuabi64/lib/pkgconfig - - CC=mips64-linux-gnuabi64-gcc-5 CXX=mips64-linux-gnuabi64-g++-5 GOOS=linux GOARCH=mips64 CGO_ENABLED=1 go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK - CC=mips64-linux-gnuabi64-gcc-5 CXX=mips64-linux-gnuabi64-g++-5 GOOS=linux GOARCH=mips64 CGO_ENABLED=1 go build $V $X "${T[@]}" --ldflags="$V $LD" $BM -o "/build/$NAME-linux-mips64`extension linux`" ./$PACK - fi - fi - if ([ $XGOOS == "." ] || [ $XGOOS == "linux" ]) && ([ $XGOARCH == "." ] || [ $XGOARCH == "mips64le" ]); then - if [ "$GO_VERSION" -lt 170 ]; then - echo "Go version too low, skipping linux/mips64le..." - else - echo "Compiling for linux/mips64le..." - CC=mips64el-linux-gnuabi64-gcc-5 CXX=mips64el-linux-gnuabi64-g++-5 HOST=mips64el-linux-gnuabi64 PREFIX=/usr/mips64el-linux-gnuabi64 $BUILD_DEPS /deps ${DEPS_ARGS[@]} - export PKG_CONFIG_PATH=/usr/mips64le-linux-gnuabi64/lib/pkgconfig - - CC=mips64el-linux-gnuabi64-gcc-5 CXX=mips64el-linux-gnuabi64-g++-5 GOOS=linux GOARCH=mips64le CGO_ENABLED=1 go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK - 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 - PLATFORM=`echo $XGOOS | cut -d '-' -f 2` - if [ "$PLATFORM" == "" ] || [ "$PLATFORM" == "." ] || [ "$PLATFORM" == "windows" ]; then - PLATFORM=4.0 # Windows NT - fi - - MAJOR=`echo $PLATFORM | cut -d '.' -f 1` - if [ "${PLATFORM/.}" != "$PLATFORM" ] ; then - MINOR=`echo $PLATFORM | cut -d '.' -f 2` - fi - CGO_NTDEF="-D_WIN32_WINNT=0x`printf "%02d" $MAJOR``printf "%02d" $MINOR`" - - # Build the requested windows binaries - if [ $XGOARCH == "." ] || [ $XGOARCH == "amd64" ]; then - echo "Compiling for windows-$PLATFORM/amd64..." - CC=x86_64-w64-mingw32-gcc-posix CXX=x86_64-w64-mingw32-g++-posix HOST=x86_64-w64-mingw32 PREFIX=/usr/x86_64-w64-mingw32 $BUILD_DEPS /deps ${DEPS_ARGS[@]} - export PKG_CONFIG_PATH=/usr/x86_64-w64-mingw32/lib/pkgconfig - - CC=x86_64-w64-mingw32-gcc-posix CXX=x86_64-w64-mingw32-g++-posix GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CGO_CFLAGS="$CGO_NTDEF" CGO_CXXFLAGS="$CGO_NTDEF" go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK - CC=x86_64-w64-mingw32-gcc-posix CXX=x86_64-w64-mingw32-g++-posix GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CGO_CFLAGS="$CGO_NTDEF" CGO_CXXFLAGS="$CGO_NTDEF" go build $V $X "${T[@]}" --ldflags="$V $LD" $R $BM -o "/build/$NAME-windows-$PLATFORM-amd64$R`extension windows`" ./$PACK - fi - if [ $XGOARCH == "." ] || [ $XGOARCH == "386" ]; then - echo "Compiling for windows-$PLATFORM/386..." - CC=i686-w64-mingw32-gcc-posix CXX=i686-w64-mingw32-g++-posix HOST=i686-w64-mingw32 PREFIX=/usr/i686-w64-mingw32 $BUILD_DEPS /deps ${DEPS_ARGS[@]} - export PKG_CONFIG_PATH=/usr/i686-w64-mingw32/lib/pkgconfig - - CC=i686-w64-mingw32-gcc-posix CXX=i686-w64-mingw32-g++-posix GOOS=windows GOARCH=386 CGO_ENABLED=1 CGO_CFLAGS="$CGO_NTDEF" CGO_CXXFLAGS="$CGO_NTDEF" go get $V $X "${T[@]}" --ldflags="$V $LD" -d ./$PACK - CC=i686-w64-mingw32-gcc-posix CXX=i686-w64-mingw32-g++-posix GOOS=windows GOARCH=386 CGO_ENABLED=1 CGO_CFLAGS="$CGO_NTDEF" CGO_CXXFLAGS="$CGO_NTDEF" go build $V $X "${T[@]}" --ldflags="$V $LD" $BM -o "/build/$NAME-windows-$PLATFORM-386`extension windows`" ./$PACK - fi - fi - # Check and build for OSX targets - if [ $XGOOS == "." ] || [[ $XGOOS == darwin* ]]; then - # Split the platform version and configure the deployment target - PLATFORM=`echo $XGOOS | cut -d '-' -f 2` - if [ "$PLATFORM" == "" ] || [ "$PLATFORM" == "." ] || [ "$PLATFORM" == "darwin" ]; then - PLATFORM=10.6 # OS X Snow Leopard - fi - export MACOSX_DEPLOYMENT_TARGET=$PLATFORM - - # Strip symbol table below Go 1.6 to prevent DWARF issues - LDSTRIP="" - if [ "$GO_VERSION" -lt 160 ]; then - LDSTRIP="-s" - fi - # Build the requested darwin binaries - if [ $XGOARCH == "." ] || [ $XGOARCH == "amd64" ]; then - echo "Compiling for darwin-$PLATFORM/amd64..." - CC=o64-clang CXX=o64-clang++ HOST=x86_64-apple-darwin15 PREFIX=/usr/local $BUILD_DEPS /deps ${DEPS_ARGS[@]} - CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go get $V $X "${T[@]}" --ldflags="$LDSTRIP $V $LD" -d ./$PACK - CC=o64-clang CXX=o64-clang++ GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build $V $X "${T[@]}" --ldflags="$LDSTRIP $V $LD" $R $BM -o "/build/$NAME-darwin-$PLATFORM-amd64$R`extension darwin`" ./$PACK - fi - if [ $XGOARCH == "." ] || [ $XGOARCH == "386" ]; then - echo "Compiling for darwin-$PLATFORM/386..." - CC=o32-clang CXX=o32-clang++ HOST=i386-apple-darwin15 PREFIX=/usr/local $BUILD_DEPS /deps ${DEPS_ARGS[@]} - CC=o32-clang CXX=o32-clang++ GOOS=darwin GOARCH=386 CGO_ENABLED=1 go get $V $X "${T[@]}" --ldflags="$LDSTRIP $V $LD" -d ./$PACK - CC=o32-clang CXX=o32-clang++ GOOS=darwin GOARCH=386 CGO_ENABLED=1 go build $V $X "${T[@]}" --ldflags="$LDSTRIP $V $LD" $BM -o "/build/$NAME-darwin-$PLATFORM-386`extension darwin`" ./$PACK - fi - # Remove any automatically injected deployment target vars - unset MACOSX_DEPLOYMENT_TARGET - fi # Check and build for iOS targets if [ $XGOOS == "." ] || [[ $XGOOS == ios* ]]; then # Split the platform version and configure the deployment target @@ -354,8 +85,7 @@ for TARGET in $TARGETS; do PLATFORM=10.3 #min ios version to build for fi - $GOMOBILE bind --target=ios/arm64 -iosversion=$PLATFORM $X $V "${T[@]}" --ldflags="$V $LD" -o "/build/$NAME.framework" ./$PACK - + $GOMOBILE bind --target=ios/arm64 -iosversion=$PLATFORM $X $V "${T[@]}" --ldflags="$V $LD" -o "/build/$NAME.framework" ./$PACK_RELPATH fi done diff --git a/go.mod b/go.mod new file mode 100644 index 00000000..3fc5e141 --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module mysterium.network/xgomobile + +go 1.13 + +require golang.org/x/mobile v0.0.0-20200222142934-3c8601c510d0 // indirect diff --git a/go.sum b/go.sum new file mode 100644 index 00000000..cfbb7ddf --- /dev/null +++ b/go.sum @@ -0,0 +1,26 @@ +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20200222142934-3c8601c510d0 h1:nZASbxDuz7CO3227BWCCf0MC6ynyvKh6eMDoLcNXAk0= +golang.org/x/mobile v0.0.0-20200222142934-3c8601c510d0/go.mod h1:skQtrUTUwhdJvXM/2KKJzY8pDgNr9I/FOMqDVRPBUS4= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200117012304-6edc0a871e69 h1:yBHHx+XZqXJBm6Exke3N7V9gnlsyXxoCPEb1yVenjfk= +golang.org/x/tools v0.0.0-20200117012304-6edc0a871e69/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/src/mobilepkg/mobile.go b/src/mobilepkg/mobile.go deleted file mode 100644 index f0479438..00000000 --- a/src/mobilepkg/mobile.go +++ /dev/null @@ -1,8 +0,0 @@ -package mobilepkg - -var Flag = "fail" - -func HelloWorld() string { - //sample function for testing gomobile inside xgo - return Flag -} diff --git a/test.sh b/test.sh index 269bb741..e76eb7e8 100755 --- a/test.sh +++ b/test.sh @@ -3,14 +3,12 @@ set -e docker run --rm \ -v "$PWD"/build:/build \ - -v "$GOPATH"/.xgo-cache:/deps-cache:ro \ - -v "$PWD"/src:/ext-go/1/src:ro \ + -v "$PWD":/app \ + -w /app \ -e OUT=Mysterium \ -e FLAG_V=false \ -e FLAG_X=false \ -e FLAG_RACE=false \ -e FLAG_BUILDMODE=default \ -e TARGETS=android/. \ - -e EXT_GOPATH=/ext-go/1 \ - -e GO111MODULE=off \ - mysteriumnetwork/xgomobile:1.13.8 mobilepkg + mysteriumnetwork/xgomobile:1.13.8 ./testlib diff --git a/testlib/mobile.go b/testlib/mobile.go new file mode 100644 index 00000000..13f678fc --- /dev/null +++ b/testlib/mobile.go @@ -0,0 +1,13 @@ +package testlib + +// #include +// +// void sayHi() { +// printf("Hello, embedded C!\n"); +// } +import "C" + +func HelloWorld() string { + C.sayHi() + return "Hello" +} From 9619dfdb5345c8c50fc65856110c5b797f898540 Mon Sep 17 00:00:00 2001 From: anjmao Date: Wed, 4 Mar 2020 17:50:50 +0200 Subject: [PATCH 23/24] Add test example with failing go-openvpn build --- go.mod | 5 +++- go.sum | 67 +++++++++++++++++++++++++++++++++++++++++++++++ testlib/mobile.go | 14 +++++----- 3 files changed, 78 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 3fc5e141..3361d1dc 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,7 @@ module mysterium.network/xgomobile go 1.13 -require golang.org/x/mobile v0.0.0-20200222142934-3c8601c510d0 // indirect +require ( + github.com/mysteriumnetwork/go-openvpn v0.0.22 + golang.org/x/mobile v0.0.0-20200222142934-3c8601c510d0 // indirect +) diff --git a/go.sum b/go.sum index cfbb7ddf..31fc398a 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,47 @@ +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs= +github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/emirpasic/gods v1.9.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= +github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= +github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= +github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-github/v28 v28.1.1/go.mod h1:bsqJWQX05omyWVmc00nEUql9mhQyv38lDZ8kPZcQVoM= +github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= +github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= +github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/kevinburke/ssh_config v0.0.0-20180830205328-81db2a75821e/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/magefile/mage v1.8.0/go.mod h1:IUDi13rsHje59lecXokTfGX0QIzO45uVPlXnJYsXepA= +github.com/magefile/mage v1.9.0 h1:t3AU2wNwehMCW97vuqQLtw6puppWXHO+O2MHo5a50XE= +github.com/magefile/mage v1.9.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mysteriumnetwork/go-ci v0.0.0-20200121125840-b99aac3d815c h1:8LI4spVFC7pcYxSaVkW2pB9y1UjdLBdYLwfG14tIXg0= +github.com/mysteriumnetwork/go-ci v0.0.0-20200121125840-b99aac3d815c/go.mod h1:GlJmsQDFyRmV9psEs/Mt/humLALu8xmZ7blXQ6Rc9Rs= +github.com/mysteriumnetwork/go-openvpn v0.0.22 h1:r7nbXrDLy4NDDvhfvSlgF5gmJ3ffMTfcTLhcQFZkJ7M= +github.com/mysteriumnetwork/go-openvpn v0.0.22/go.mod h1:YDjnxC/3sGNecq/f6GM0BGz7nnGPTPIGtQjHaoLf8UE= +github.com/pelletier/go-buffruneio v0.2.0/go.mod h1:JkE26KsDizTr40EUHkXVtNPvgGtbSNq5BcowyYOWdKo= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/src-d/gcfg v1.4.0/go.mod h1:p/UMsR43ujA89BJY9duynAwIpvqEujIH/jFlfL7jWoI= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/xanzy/ssh-agent v0.2.0/go.mod h1:0NyE30eGUDliuLEHJgYte/zncp2zdTStcOnWhgSqHD8= +github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= @@ -11,16 +52,42 @@ golang.org/x/mobile v0.0.0-20200222142934-3c8601c510d0/go.mod h1:skQtrUTUwhdJvXM golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180903190138-2b024373dcd9/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190911022129-16c5e0f7d110/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200117012304-6edc0a871e69 h1:yBHHx+XZqXJBm6Exke3N7V9gnlsyXxoCPEb1yVenjfk= golang.org/x/tools v0.0.0-20200117012304-6edc0a871e69/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/src-d/go-billy.v4 v4.2.1/go.mod h1:tm33zBoOwxjYHZIE+OV8bxTWFMJLrconzFMd38aARFk= +gopkg.in/src-d/go-billy.v4 v4.3.1/go.mod h1:tm33zBoOwxjYHZIE+OV8bxTWFMJLrconzFMd38aARFk= +gopkg.in/src-d/go-git-fixtures.v3 v3.1.1/go.mod h1:dLBcvytrw/TYZsNTWCnkNF2DSIlzWYqTe3rJR56Ac7g= +gopkg.in/src-d/go-git.v4 v4.11.0/go.mod h1:Vtut8izDyrM8BUVQnzJ+YvmNcem2J89EmfZYCkLokZk= +gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= diff --git a/testlib/mobile.go b/testlib/mobile.go index 13f678fc..b9115e67 100644 --- a/testlib/mobile.go +++ b/testlib/mobile.go @@ -1,13 +1,13 @@ package testlib -// #include -// -// void sayHi() { -// printf("Hello, embedded C!\n"); -// } -import "C" +import ( + "fmt" + + "github.com/mysteriumnetwork/go-openvpn/openvpn3" +) func HelloWorld() string { - C.sayHi() + config := openvpn3.NewConfig("test") + fmt.Println(config) return "Hello" } From a7834c36fa1f2cd31948f23a7024286551609011 Mon Sep 17 00:00:00 2001 From: anjmao Date: Tue, 12 May 2020 16:50:10 +0300 Subject: [PATCH 24/24] Update test example --- testlib/mobile.go | 8 -------- 1 file changed, 8 deletions(-) diff --git a/testlib/mobile.go b/testlib/mobile.go index b9115e67..17bec370 100644 --- a/testlib/mobile.go +++ b/testlib/mobile.go @@ -1,13 +1,5 @@ package testlib -import ( - "fmt" - - "github.com/mysteriumnetwork/go-openvpn/openvpn3" -) - func HelloWorld() string { - config := openvpn3.NewConfig("test") - fmt.Println(config) return "Hello" }