|
@@ -36,8 +36,9 @@ rc=$?; if [[ $rc != 0 ]]; then
|
|
|
exit $rc
|
|
exit $rc
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
-# Not exporting this breaks go commands later if run via jenkins
|
|
|
|
|
-export GOPATH=${PWD}/go-ios-build
|
|
|
|
|
|
|
+# If this is needed in the Jenkins script, we'll have to export it.
|
|
|
|
|
+GOPATH=${PWD}/go-ios-build
|
|
|
|
|
+rm -rf ${GOPATH}
|
|
|
|
|
|
|
|
# When updating the pinned rev, you will have to manually delete go-ios-build
|
|
# When updating the pinned rev, you will have to manually delete go-ios-build
|
|
|
GOMOBILE_PINNED_REV=aa9922ad4c79ee8a56cd45bf433f2aa943712b09
|
|
GOMOBILE_PINNED_REV=aa9922ad4c79ee8a56cd45bf433f2aa943712b09
|
|
@@ -55,6 +56,19 @@ rc=$?; if [[ $rc != 0 ]]; then
|
|
|
exit $rc
|
|
exit $rc
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
|
|
+# Symlink the current source directory into GOPATH, so that we're building the
|
|
|
|
|
+# code in this local repo, rather than pulling from Github and building that.
|
|
|
|
|
+mkdir -p ${GOPATH}/src/github.com/Psiphon-Labs
|
|
|
|
|
+rc=$?; if [[ $rc != 0 ]]; then
|
|
|
|
|
+ echo "mkdir -p ${GOPATH}/src/github.com/Psiphon-Labs"
|
|
|
|
|
+ exit $rc
|
|
|
|
|
+fi
|
|
|
|
|
+ln -s "${BASE_DIR}/../.." "${GOPATH}/src/github.com/Psiphon-Labs/psiphon-tunnel-core"
|
|
|
|
|
+rc=$?; if [[ $rc != 0 ]]; then
|
|
|
|
|
+ echo "ln -s ../.. ${GOPATH}/src/github.com/Psiphon-Labs/psiphon-tunnel-core"
|
|
|
|
|
+ exit $rc
|
|
|
|
|
+fi
|
|
|
|
|
+
|
|
|
mkdir -p ${INTERMEDIATE_OUPUT_DIR}
|
|
mkdir -p ${INTERMEDIATE_OUPUT_DIR}
|
|
|
rc=$?; if [[ $rc != 0 ]]; then
|
|
rc=$?; if [[ $rc != 0 ]]; then
|
|
|
echo "FAILURE: mkdir -p ${INTERMEDIATE_OUPUT_DIR}"
|
|
echo "FAILURE: mkdir -p ${INTERMEDIATE_OUPUT_DIR}"
|
|
@@ -99,9 +113,10 @@ rc=$?; if [[ $rc != 0 ]]; then
|
|
|
exit $rc
|
|
exit $rc
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
-go get -d -u -v github.com/Psiphon-Labs/psiphon-tunnel-core/MobileLibrary/psi
|
|
|
|
|
|
|
+# Don't use -u, because this path points to our local repo, and we don't want it overridden.
|
|
|
|
|
+go get -d -v -u github.com/Psiphon-Labs/psiphon-tunnel-core/MobileLibrary/psi
|
|
|
rc=$?; if [[ $rc != 0 ]]; then
|
|
rc=$?; if [[ $rc != 0 ]]; then
|
|
|
- echo "FAILURE: go get -d -u -v github.com/Psiphon-Labs/psiphon-tunnel-core/MobileLibrary/psi"
|
|
|
|
|
|
|
+ echo "FAILURE: go get -d -v github.com/Psiphon-Labs/psiphon-tunnel-core/MobileLibrary/psi"
|
|
|
exit $rc
|
|
exit $rc
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
@@ -132,7 +147,11 @@ if [ $? -ne 0 ]; then
|
|
|
git branch -d pinned
|
|
git branch -d pinned
|
|
|
git checkout -b pinned ${GOMOBILE_PINNED_REV}
|
|
git checkout -b pinned ${GOMOBILE_PINNED_REV}
|
|
|
go install
|
|
go install
|
|
|
- gomobile init -v
|
|
|
|
|
|
|
+ ${GOPATH}/bin/gomobile init -v
|
|
|
|
|
+ if [ $? -ne 0 ]; then
|
|
|
|
|
+ echo "FAILURE: ${GOPATH}/bin/gomobile init -v"
|
|
|
|
|
+ exit 1
|
|
|
|
|
+ fi
|
|
|
check_pinned_version
|
|
check_pinned_version
|
|
|
if [ $? -ne 0 ]; then
|
|
if [ $? -ne 0 ]; then
|
|
|
echo "gomobile not found, aborting"
|
|
echo "gomobile not found, aborting"
|
|
@@ -144,7 +163,7 @@ BUILDDATE=$(date +%Y-%m-%dT%H:%M:%S%z)
|
|
|
BUILDREPO=$(git config --get remote.origin.url)
|
|
BUILDREPO=$(git config --get remote.origin.url)
|
|
|
BUILDREV=$(git rev-parse --short HEAD)
|
|
BUILDREV=$(git rev-parse --short HEAD)
|
|
|
GOVERSION=$(go version | perl -ne '/go version (.*?) / && print $1')
|
|
GOVERSION=$(go version | perl -ne '/go version (.*?) / && print $1')
|
|
|
-GOMOBILEVERSION=$(gomobile version | perl -ne '/gomobile version (.*?) / && print $1')
|
|
|
|
|
|
|
+GOMOBILEVERSION=$(${GOPATH}/bin/gomobile version | perl -ne '/gomobile version (.*?) / && print $1')
|
|
|
|
|
|
|
|
LDFLAGS="\
|
|
LDFLAGS="\
|
|
|
-X github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common.buildDate=${BUILDDATE} \
|
|
-X github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common.buildDate=${BUILDDATE} \
|
|
@@ -173,9 +192,9 @@ IOS_CGO_BUILD_FLAGS='// #cgo darwin CFLAGS: -I'"${OPENSSL_INCLUDE}"'\
|
|
|
|
|
|
|
|
LC_ALL=C sed -i -- "s|// #cgo pkg-config: libssl|${IOS_CGO_BUILD_FLAGS}|" "${OPENSSL_SRC_DIR}/build.go"
|
|
LC_ALL=C sed -i -- "s|// #cgo pkg-config: libssl|${IOS_CGO_BUILD_FLAGS}|" "${OPENSSL_SRC_DIR}/build.go"
|
|
|
|
|
|
|
|
-gomobile bind -target ios -ldflags="${LDFLAGS}" -o "${INTERMEDIATE_OUPUT_DIR}/${INTERMEDIATE_OUPUT_FILE}" github.com/Psiphon-Labs/psiphon-tunnel-core/MobileLibrary/psi
|
|
|
|
|
|
|
+${GOPATH}/bin/gomobile bind -target ios -ldflags="${LDFLAGS}" -o "${INTERMEDIATE_OUPUT_DIR}/${INTERMEDIATE_OUPUT_FILE}" github.com/Psiphon-Labs/psiphon-tunnel-core/MobileLibrary/psi
|
|
|
rc=$?; if [[ $rc != 0 ]]; then
|
|
rc=$?; if [[ $rc != 0 ]]; then
|
|
|
- echo "FAILURE: gomobile bind"
|
|
|
|
|
|
|
+ echo "FAILURE: ${GOPATH}/bin/gomobile bind -target ios -ldflags="${LDFLAGS}" -o "${INTERMEDIATE_OUPUT_DIR}/${INTERMEDIATE_OUPUT_FILE}" github.com/Psiphon-Labs/psiphon-tunnel-core/MobileLibrary/psi"
|
|
|
exit $rc
|
|
exit $rc
|
|
|
fi
|
|
fi
|
|
|
|
|
|