Browse Source

- Fix: gomobile.goCmd doesn't treat "-tags" arguments correctly (see: https://github.com/golang/mobile/blob/0ba4e6463d71334d91dfbe1e4a92bb4ab2091716/cmd/gomobile/build.go#L268)
- Remove redundant "openssl" go get in Android build script
- Add golang installer "go/bin" to iOS build script

Rod Hynes 9 years ago
parent
commit
1ff34f84b7

+ 4 - 0
MobileLibrary/Android/Dockerfile

@@ -92,6 +92,10 @@ RUN mkdir -p $GOPATH/pkg/gomobile/dl \
   && git clone https://github.com/golang/mobile \
   && cd mobile \
   && git checkout -b pinned $GOMOBILE_PINNED_REV \
+  && mv ./cmd/gomobile/build.go ./cmd/gomobile/build.go.orig \
+  && sed -e 's/"-tags="+strconv.Quote(strings.Join(ctx.BuildTags, ",")),/"-tags",strings.Join(ctx.BuildTags, " "),/g' ./cmd/gomobile/build.go.orig > ./cmd/gomobile/build.go \
+  && mv ./cmd/gomobile/build.go ./cmd/gomobile/build.go.orig \
+  && sed -e 's/"strconv"//g' ./cmd/gomobile/build.go.orig > ./cmd/gomobile/build.go \
   && echo "master: $(git rev-parse master)\npinned: $(git rev-parse pinned)" | tee $GOROOT/MOBILE \
   && go install golang.org/x/mobile/cmd/gomobile \
   && gomobile init -v

+ 0 - 5
MobileLibrary/Android/make.bash

@@ -16,11 +16,6 @@ BUILD_TAGS="OPENSSL ${PRIVATE_PLUGINS_TAG}"
 # the latest versions. Outside of Docker, be aware that these dependencies
 # will not be overridden w/ new versions if they already exist in $GOPATH
 
-GOOS=arm go get -d -v -tags "${BUILD_TAGS}" github.com/Psiphon-Inc/openssl
-if [ $? != 0 ]; then
-  echo "..'go get -d -v github.com/psiphon-inc/openssl' failed, exiting"
-  exit $?
-fi
 GOOS=arm go get -d -v -tags "${BUILD_TAGS}" github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon
 if [ $? != 0 ]; then
   echo "..'go get -d -v github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon' failed, exiting"

+ 5 - 1
MobileLibrary/iOS/build-psiphon-framework.sh

@@ -6,7 +6,7 @@ set -x -u -e
 
 # Reset the PATH to macOS default. This is mainly so we don't execute the wrong
 # gomobile executable.
-PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
+PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin
 
 BASE_DIR=$(cd "$(dirname "$0")" ; pwd -P)
 cd ${BASE_DIR}
@@ -162,6 +162,10 @@ if [[ $rc != 0 ]]; then
     cd ${GOPATH}/src/golang.org/x/mobile/cmd/gomobile
     git checkout master
     git checkout -b pinned ${GOMOBILE_PINNED_REV}
+    mv ./build.go ./build.go.orig
+    sed -e 's/"-tags="+strconv.Quote(strings.Join(ctx.BuildTags, ",")),/"-tags",strings.Join(ctx.BuildTags, " "),/g' ./build.go.orig > ./build.go
+    mv ./build.go ./build.go.orig
+    sed -e 's/"strconv"//g' ./build.go.orig > ./build.go
     go install
     ${GOPATH}/bin/gomobile init -v
     if [[ $? != 0 ]]; then