Просмотр исходного кода

Make all builds work with new OPENSSL tag

Adam Pritchard 9 лет назад
Родитель
Сommit
f2be0e3429

+ 35 - 30
ConsoleClient/README.md

@@ -1,42 +1,47 @@
-##Psiphon Console Client README
+## Psiphon Console Client README
 
 
-###Building with Docker
+### Building with Docker
 
 
 Note that you may need to use `sudo docker` below, depending on your OS.
 Note that you may need to use `sudo docker` below, depending on your OS.
 
 
-#####Create the build image:
-  1. Run the command: `docker build --no-cache=true -t psiclient .` (this may take some time to complete)
-  2. Once completed, verify that you see an image named `psiclient` when running: `docker images`
-
-#####Run the build:
-  *Ensure that the command below is run from within the `ConsoleClient` directory*
-
-  ```bash
-  cd .. && \
-    docker run \
-    --rm \
-    -v $PWD:/go/src/github.com/Psiphon-Labs/psiphon-tunnel-core \
-    psiclient \
-    /bin/bash -c './make.bash all' \
-  ; cd -
-  ```
+##### Create the build image:
+
+1. While in the `ConsoleClient` directory, run the command: `docker build --no-cache=true -t psiclient .`
+
+2. Once completed, verify that you see an image named `psiclient` when running: `docker images`
+
+##### Run the build:
+
+*Ensure that the command below is run from within the `ConsoleClient` directory*
+
+```bash
+cd .. && \
+  docker run \
+  --rm \
+  -v $PWD:/go/src/github.com/Psiphon-Labs/psiphon-tunnel-core \
+  psiclient \
+  /bin/bash -c './make.bash all' \
+; cd -
+```
+
 This command can also be modified by:
 This command can also be modified by:
  - replacing `all` with `windows`, `linux`, or `osx` as the first parameter to `make.bash` (as in `...&& ./make.bash windows`) to only build binaries for the operating system of choice
  - replacing `all` with `windows`, `linux`, or `osx` as the first parameter to `make.bash` (as in `...&& ./make.bash windows`) to only build binaries for the operating system of choice
    - if `windows` or `linux` is specified as the first parameter, the second parameter can be passed as either `32` or `64` (as in `...&& ./make.bash windows 32`)to limit the builds to just one or the other (no second parameter means both will build)
    - if `windows` or `linux` is specified as the first parameter, the second parameter can be passed as either `32` or `64` (as in `...&& ./make.bash windows 32`)to limit the builds to just one or the other (no second parameter means both will build)
 
 
 When that command completes, the compiled binaries will be located in the `bin` directory (`./bin`, and everything under it will likely be owned by root, so be sure to `chown` to an appropriate user) under the current directory. The structure will be:
 When that command completes, the compiled binaries will be located in the `bin` directory (`./bin`, and everything under it will likely be owned by root, so be sure to `chown` to an appropriate user) under the current directory. The structure will be:
-  ```
-  bin
-  ├── darwin
-  │   └── psiphon-tunnel-core-x86_64
-  ├── linux
-  │   └── psiphon-tunnel-core-i686
-  │   └── psiphon-tunnel-core-x86_64
-  └── windows
-      └── psiphon-tunnel-core-i686.exe
-      └── psiphon-tunnel-core-x86_64.exe
-
-  ```
+
+```
+bin
+├── darwin
+│   └── psiphon-tunnel-core-x86_64
+├── linux
+│   └── psiphon-tunnel-core-i686
+│   └── psiphon-tunnel-core-x86_64
+└── windows
+    └── psiphon-tunnel-core-i686.exe
+    └── psiphon-tunnel-core-x86_64.exe
+
+```
 
 
 ### Building without Docker
 ### Building without Docker
 
 

+ 15 - 9
ConsoleClient/make.bash

@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 #!/usr/bin/env bash
 
 
-set -e
+set -e -x
 
 
 if [ ! -f make.bash ]; then
 if [ ! -f make.bash ]; then
   echo "make.bash must be run from $GOPATH/src/github.com/Psiphon-Labs/psiphon-tunnel-core/ConsoleClient"
   echo "make.bash must be run from $GOPATH/src/github.com/Psiphon-Labs/psiphon-tunnel-core/ConsoleClient"
@@ -9,6 +9,12 @@ fi
 
 
 EXE_BASENAME="psiphon-tunnel-core"
 EXE_BASENAME="psiphon-tunnel-core"
 
 
+# The "OPENSSL" tag enables support of OpenSSL for use by IndistinguishableTLS.
+# This needs to be outside of prepare_build because it's used by go-get.
+WINDOWS_BUILD_TAGS="OPENSSL"
+LINUX_BUILD_TAGS=
+OSX_BUILD_TAGS=
+
 prepare_build () {
 prepare_build () {
   BUILDINFOFILE="${EXE_BASENAME}_buildinfo.txt"
   BUILDINFOFILE="${EXE_BASENAME}_buildinfo.txt"
   BUILDDATE=$(date --iso-8601=seconds)
   BUILDDATE=$(date --iso-8601=seconds)
@@ -49,7 +55,7 @@ fi
 
 
 build_for_windows () {
 build_for_windows () {
   echo "...Getting project dependencies (via go get) for Windows. Parameter is: '$1'"
   echo "...Getting project dependencies (via go get) for Windows. Parameter is: '$1'"
-  GOOS=windows go get -d -v ./...
+  GOOS=windows go get -d -v -tags "$WINDOWS_BUILD_TAGS" ./...
   prepare_build
   prepare_build
   if [ $? != 0 ]; then
   if [ $? != 0 ]; then
     echo "....'go get' failed, exiting"
     echo "....'go get' failed, exiting"
@@ -66,7 +72,7 @@ build_for_windows () {
     CGO_CFLAGS="-I $PKG_CONFIG_PATH/include/" \
     CGO_CFLAGS="-I $PKG_CONFIG_PATH/include/" \
     CGO_LDFLAGS="-L $PKG_CONFIG_PATH -L /usr/i686-w64-mingw32/lib/ -lssl -lcrypto -lwsock32 -lcrypt32 -lgdi32" \
     CGO_LDFLAGS="-L $PKG_CONFIG_PATH -L /usr/i686-w64-mingw32/lib/ -lssl -lcrypto -lwsock32 -lcrypt32 -lgdi32" \
     CC=/usr/bin/i686-w64-mingw32-gcc \
     CC=/usr/bin/i686-w64-mingw32-gcc \
-    gox -verbose -ldflags "$LDFLAGS" -osarch windows/386 -output bin/windows/${EXE_BASENAME}-i686
+    gox -verbose -ldflags "$LDFLAGS" -osarch windows/386 -tags "$WINDOWS_BUILD_TAGS" -output bin/windows/${EXE_BASENAME}-i686
     RETVAL=$?
     RETVAL=$?
     echo ".....gox completed, exit code: $?"
     echo ".....gox completed, exit code: $?"
     if [ $RETVAL != 0 ]; then
     if [ $RETVAL != 0 ]; then
@@ -89,7 +95,7 @@ build_for_windows () {
     CGO_CFLAGS="-I $PKG_CONFIG_PATH/include/" \
     CGO_CFLAGS="-I $PKG_CONFIG_PATH/include/" \
     CGO_LDFLAGS="-L $PKG_CONFIG_PATH -L /usr/x86_64-w64-mingw32/lib/ -lssl -lcrypto -lwsock32 -lcrypt32 -lgdi32" \
     CGO_LDFLAGS="-L $PKG_CONFIG_PATH -L /usr/x86_64-w64-mingw32/lib/ -lssl -lcrypto -lwsock32 -lcrypt32 -lgdi32" \
     CC=/usr/bin/x86_64-w64-mingw32-gcc \
     CC=/usr/bin/x86_64-w64-mingw32-gcc \
-    gox -verbose -ldflags "$LDFLAGS" -osarch windows/amd64 -output bin/windows/${EXE_BASENAME}-x86_64
+    gox -verbose -ldflags "$LDFLAGS" -osarch windows/amd64 -tags "$WINDOWS_BUILD_TAGS" -output bin/windows/${EXE_BASENAME}-x86_64
     RETVAL=$?
     RETVAL=$?
     if [ $RETVAL != 0 ]; then
     if [ $RETVAL != 0 ]; then
       echo ".....gox failed, exiting"
       echo ".....gox failed, exiting"
@@ -104,7 +110,7 @@ build_for_windows () {
 
 
 build_for_linux () {
 build_for_linux () {
   echo "Getting project dependencies (via go get) for Linux. Parameter is: '$1'"
   echo "Getting project dependencies (via go get) for Linux. Parameter is: '$1'"
-  GOOS=linux go get -d -v ./...
+  GOOS=linux go get -d -v -tags "$LINUX_BUILD_TAGS" ./...
   prepare_build
   prepare_build
   if [ $? != 0 ]; then
   if [ $? != 0 ]; then
     echo "...'go get' failed, exiting"
     echo "...'go get' failed, exiting"
@@ -113,7 +119,7 @@ build_for_linux () {
 
 
   if [ -z $1 ] || [ "$1" == "32" ]; then
   if [ -z $1 ] || [ "$1" == "32" ]; then
     echo "...Building linux-i686"
     echo "...Building linux-i686"
-    CFLAGS=-m32 gox -verbose -ldflags "$LDFLAGS" -osarch linux/386 -output bin/linux/${EXE_BASENAME}-i686
+    CFLAGS=-m32 gox -verbose -ldflags "$LDFLAGS" -osarch linux/386 -tags "$LINUX_BUILD_TAGS" -output bin/linux/${EXE_BASENAME}-i686
     RETVAL=$?
     RETVAL=$?
     if [ $RETVAL != 0 ]; then
     if [ $RETVAL != 0 ]; then
       echo ".....gox failed, exiting"
       echo ".....gox failed, exiting"
@@ -133,7 +139,7 @@ build_for_linux () {
 
 
   if [ -z $1 ] || [ "$1" == "64" ]; then
   if [ -z $1 ] || [ "$1" == "64" ]; then
     echo "...Building linux-x86_64"
     echo "...Building linux-x86_64"
-    gox -verbose -ldflags "$LDFLAGS" -osarch linux/amd64 -output bin/linux/${EXE_BASENAME}-x86_64
+    gox -verbose -ldflags "$LDFLAGS" -osarch linux/amd64 -tags "$LINUX_BUILD_TAGS" -output bin/linux/${EXE_BASENAME}-x86_64
     RETVAL=$?
     RETVAL=$?
     if [ $RETVAL != 0 ]; then
     if [ $RETVAL != 0 ]; then
       echo "....gox failed, exiting"
       echo "....gox failed, exiting"
@@ -154,7 +160,7 @@ build_for_linux () {
 
 
 build_for_osx () {
 build_for_osx () {
   echo "Getting project dependencies (via go get) for OSX"
   echo "Getting project dependencies (via go get) for OSX"
-  GOOS=darwin go get -d -v ./...
+  GOOS=darwin go get -d -v -tags "$OSX_BUILD_TAGS" ./...
   prepare_build
   prepare_build
   if [ $? != 0 ]; then
   if [ $? != 0 ]; then
     echo "..'go get' failed, exiting"
     echo "..'go get' failed, exiting"
@@ -163,7 +169,7 @@ build_for_osx () {
 
 
   echo "Building darwin-x86_64..."
   echo "Building darwin-x86_64..."
   echo "..Disabling CGO for this build"
   echo "..Disabling CGO for this build"
-  CGO_ENABLED=0 gox -verbose -ldflags "$LDFLAGS" -osarch darwin/amd64 -output bin/darwin/${EXE_BASENAME}-x86_64
+  CGO_ENABLED=0 gox -verbose -ldflags "$LDFLAGS" -osarch darwin/amd64 -tags "$OSX_BUILD_TAGS" -output bin/darwin/${EXE_BASENAME}-x86_64
   # Darwin binaries don't seem to be UPXable when built this way
   # Darwin binaries don't seem to be UPXable when built this way
   echo "..No UPX for this build"
   echo "..No UPX for this build"
 }
 }

+ 24 - 22
MobileLibrary/Android/README.md

@@ -1,38 +1,40 @@
-##Psiphon Android Library README
+## Psiphon Android Library README
 
 
-###Overview
+### Overview
 
 
 Psiphon Library for Android enables you to easily embed Psiphon in your Android
 Psiphon Library for Android enables you to easily embed Psiphon in your Android
 app. The Psiphon Library for Android is implemented in Go and follows the standard
 app. The Psiphon Library for Android is implemented in Go and follows the standard
 conventions for using a Go library in an Android app.
 conventions for using a Go library in an Android app.
 
 
-###Building with Docker
+### Building with Docker
 
 
 Note that you may need to use `sudo docker` below, depending on your OS.
 Note that you may need to use `sudo docker` below, depending on your OS.
 
 
-#####Create the build image:
+##### Create the build image:
 
 
-  1. Run the command: `docker build --no-cache=true -t psiandroid .` (this may take some time to complete)
-  2. Once completed, verify that you see an image named `psiandroid` when running: `docker images`
+1. While in the `MobileLibrary/Android` directory, run the command: `docker build --no-cache=true -t psiandroid .`
 
 
-#####Run the build:
+2. Once completed, verify that you see an image named `psiandroid` when running: `docker images`
 
 
-  *Ensure that the command below is run from within the `AndroidLibrary` directory*
+##### Run the build:
+
+*Ensure that the command below is run from within the `MobileLibrary/Android` directory*
+
+```bash
+cd ../.. && \
+  docker run \
+  --rm \
+  -v $(pwd):/go/src/github.com/Psiphon-Labs/psiphon-tunnel-core \
+  psiandroid \
+  /bin/bash -c 'source /tmp/setenv-android.sh && cd /go/src/github.com/Psiphon-Labs/psiphon-tunnel-core/MobileLibrary/Android && ./make.bash' \
+; cd -
+```
 
 
-  ```bash
-  cd ../.. && \
-    docker run \
-    --rm \
-    -v $(pwd):/go/src/github.com/Psiphon-Labs/psiphon-tunnel-core \
-    psiandroid \
-    /bin/bash -c 'source /tmp/setenv-android.sh && cd /go/src/github.com/Psiphon-Labs/psiphon-tunnel-core/MobileLibrary/Android && ./make.bash' \
-  ; cd -
-  ```
 When that command completes, the compiled `.aar` files (suitable for use in an Android Studio project) will be located in the current directory (it will likely be owned by root, so be sure to `chown` to an appropriate user).
 When that command completes, the compiled `.aar` files (suitable for use in an Android Studio project) will be located in the current directory (it will likely be owned by root, so be sure to `chown` to an appropriate user).
 
 
-###Building without Docker (from source)
+### Building without Docker (from source)
 
 
-#####Prerequisites:
+##### Prerequisites:
 
 
  - The `build-essential` package (on Debian based systems - or its equivalent for your platform)
  - The `build-essential` package (on Debian based systems - or its equivalent for your platform)
  - Go 1.5 or later
  - Go 1.5 or later
@@ -42,17 +44,17 @@ When that command completes, the compiled `.aar` files (suitable for use in an A
  - OpenSSL (tested against the version [here](../../openssl))
  - OpenSSL (tested against the version [here](../../openssl))
   - Follow its [README](../../openssl/README.md) to prepare the environment before you follow the steps below
   - Follow its [README](../../openssl/README.md) to prepare the environment before you follow the steps below
 
 
-#####Steps:
+##### Steps:
 
 
  1. Follow Go Android documentation ([gomobile documentation](https://godoc.org/golang.org/x/mobile/cmd/gomobile))
  1. Follow Go Android documentation ([gomobile documentation](https://godoc.org/golang.org/x/mobile/cmd/gomobile))
  2. Run `make.bash`
  2. Run `make.bash`
 
 
-###Using the Library
+### Using the Library
 
 
  1. Build `ca.psiphon.aar` from via the docker container, from source, or use the [binary release](https://github.com/Psiphon-Labs/psiphon-tunnel-core/releases)
  1. Build `ca.psiphon.aar` from via the docker container, from source, or use the [binary release](https://github.com/Psiphon-Labs/psiphon-tunnel-core/releases)
  2. Add `ca.psiphon.aar` to your Android Studio project as described in the [gomobile documentation](https://godoc.org/golang.org/x/mobile/cmd/gomobile)
  2. Add `ca.psiphon.aar` to your Android Studio project as described in the [gomobile documentation](https://godoc.org/golang.org/x/mobile/cmd/gomobile)
  3. Example usage in [TunneledWebView sample app](./SampleApps/TunneledWebView/README.md)
  3. Example usage in [TunneledWebView sample app](./SampleApps/TunneledWebView/README.md)
 
 
-#####Limitations
+##### Limitations
 
 
  - Only supports one concurrent instance of Psiphon.
  - Only supports one concurrent instance of Psiphon.

+ 8 - 5
MobileLibrary/Android/make.bash

@@ -1,22 +1,25 @@
 #!/usr/bin/env bash
 #!/usr/bin/env bash
 
 
-set -e
+set -e -x
 
 
 if [ ! -f make.bash ]; then
 if [ ! -f make.bash ]; then
   echo "make.bash must be run from $GOPATH/src/github.com/Psiphon-Labs/psiphon-tunnel-core/MobileLibrary/Android"
   echo "make.bash must be run from $GOPATH/src/github.com/Psiphon-Labs/psiphon-tunnel-core/MobileLibrary/Android"
   exit 1
   exit 1
 fi
 fi
 
 
+# The "OPENSSL" tag enables support of OpenSSL for use by IndistinguishableTLS.
+BUILD_TAGS="OPENSSL"
+
 # Don't use '-u' to force updates because the docker builds always pull
 # Don't use '-u' to force updates because the docker builds always pull
 # the latest versions. Outside of Docker, be aware that these dependencies
 # the latest versions. Outside of Docker, be aware that these dependencies
 # will not be overridden w/ new versions if they already exist in $GOPATH
 # will not be overridden w/ new versions if they already exist in $GOPATH
 
 
-GOOS=arm go get -d -v github.com/Psiphon-Inc/openssl
+GOOS=arm go get -d -v -tags "${BUILD_TAGS}" github.com/Psiphon-Inc/openssl
 if [ $? != 0 ]; then
 if [ $? != 0 ]; then
   echo "..'go get -d -v github.com/psiphon-inc/openssl' failed, exiting"
   echo "..'go get -d -v github.com/psiphon-inc/openssl' failed, exiting"
   exit $?
   exit $?
 fi
 fi
-GOOS=arm go get -d -v github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon
+GOOS=arm go get -d -v -tags "${BUILD_TAGS}" github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon
 if [ $? != 0 ]; then
 if [ $? != 0 ]; then
   echo "..'go get -d -v github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon' failed, exiting"
   echo "..'go get -d -v github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon' failed, exiting"
   exit $?
   exit $?
@@ -55,7 +58,7 @@ echo " Gomobile version: ${GOMOBILEVERSION}"
 echo " Dependencies: ${DEPENDENCIES}"
 echo " Dependencies: ${DEPENDENCIES}"
 echo ""
 echo ""
 
 
-gomobile bind -v -target=android/arm -tags="OPENSSL" -ldflags="$LDFLAGS" github.com/Psiphon-Labs/psiphon-tunnel-core/MobileLibrary/psi
+gomobile bind -v -target=android/arm -tags "${BUILD_TAGS}" -ldflags="$LDFLAGS" github.com/Psiphon-Labs/psiphon-tunnel-core/MobileLibrary/psi
 if [ $? != 0 ]; then
 if [ $? != 0 ]; then
   echo "..'gomobile bind' failed, exiting"
   echo "..'gomobile bind' failed, exiting"
   exit $?
   exit $?
@@ -66,7 +69,7 @@ unzip -o psi.aar -d build-tmp/psi
 yes | cp -f PsiphonTunnel/AndroidManifest.xml build-tmp/psi/AndroidManifest.xml
 yes | cp -f PsiphonTunnel/AndroidManifest.xml build-tmp/psi/AndroidManifest.xml
 yes | cp -f PsiphonTunnel/libs/libtun2socks.so build-tmp/psi/jni/armeabi-v7a/libtun2socks.so
 yes | cp -f PsiphonTunnel/libs/libtun2socks.so build-tmp/psi/jni/armeabi-v7a/libtun2socks.so
 
 
-javac -d build-tmp -bootclasspath $ANDROID_HOME/platforms/android-23/android.jar -source 1.7 -target 1.7 -classpath build-tmp/psi/classes.jar:$ANDROID_HOME/platforms/android-23/optional/org.apache.http.legacy.jar PsiphonTunnel/PsiphonTunnel.java 
+javac -d build-tmp -bootclasspath $ANDROID_HOME/platforms/android-23/android.jar -source 1.7 -target 1.7 -classpath build-tmp/psi/classes.jar:$ANDROID_HOME/platforms/android-23/optional/org.apache.http.legacy.jar PsiphonTunnel/PsiphonTunnel.java
 if [ $? != 0 ]; then
 if [ $? != 0 ]; then
   echo "..'javac' compiling PsiphonTunnel failed, exiting"
   echo "..'javac' compiling PsiphonTunnel failed, exiting"
   exit $?
   exit $?

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

@@ -28,6 +28,9 @@ INTERMEDIATE_OUPUT_DIR="${BASE_DIR}/PsiphonTunnel/PsiphonTunnel"
 INTERMEDIATE_OUPUT_FILE="${FRAMEWORK}.framework"
 INTERMEDIATE_OUPUT_FILE="${FRAMEWORK}.framework"
 FRAMEWORK_BINARY="${INTERMEDIATE_OUPUT_DIR}/${INTERMEDIATE_OUPUT_FILE}/Versions/A/${FRAMEWORK}"
 FRAMEWORK_BINARY="${INTERMEDIATE_OUPUT_DIR}/${INTERMEDIATE_OUPUT_FILE}/Versions/A/${FRAMEWORK}"
 
 
+# The "OPENSSL" tag enables support of OpenSSL for use by IndistinguishableTLS.
+BUILD_TAGS="OPENSSL IOS"
+
 LIBSSL=${BASE_DIR}/OpenSSL-for-iPhone/lib/libssl.a
 LIBSSL=${BASE_DIR}/OpenSSL-for-iPhone/lib/libssl.a
 LIBCRYPTO=${BASE_DIR}/OpenSSL-for-iPhone/lib/libcrypto.a
 LIBCRYPTO=${BASE_DIR}/OpenSSL-for-iPhone/lib/libcrypto.a
 OPENSSL_INCLUDE=${BASE_DIR}/OpenSSL-for-iPhone/include/
 OPENSSL_INCLUDE=${BASE_DIR}/OpenSSL-for-iPhone/include/
@@ -116,16 +119,16 @@ cd OpenSSL-for-iPhone && ./build-libssl.sh; cd -
 strip_architectures "${LIBSSL}"
 strip_architectures "${LIBSSL}"
 strip_architectures "${LIBCRYPTO}"
 strip_architectures "${LIBCRYPTO}"
 
 
-go get -d -u -v github.com/Psiphon-Inc/openssl
+go get -d -u -v -tags "${BUILD_TAGS}" github.com/Psiphon-Inc/openssl
 if [[ $? != 0 ]]; then
 if [[ $? != 0 ]]; then
-  echo "FAILURE: go get -d -u -v github.com/Psiphon-Inc/openssl"
+  echo "FAILURE: go get -d -u -v -tags "${BUILD_TAGS}" github.com/Psiphon-Inc/openssl"
   exit 1
   exit 1
 fi
 fi
 
 
 # Don't use -u, because this path points to our local repo, and we don't want it overridden.
 # Don't use -u, because this path points to our local repo, and we don't want it overridden.
-go get -d -v github.com/Psiphon-Labs/psiphon-tunnel-core/MobileLibrary/psi
+go get -d -v -tags "${BUILD_TAGS}" github.com/Psiphon-Labs/psiphon-tunnel-core/MobileLibrary/psi
 if [[ $? != 0 ]]; then
 if [[ $? != 0 ]]; then
-  echo "FAILURE: go get -d -v github.com/Psiphon-Labs/psiphon-tunnel-core/MobileLibrary/psi"
+  echo "FAILURE: go get -d -v -tags "${BUILD_TAGS}" github.com/Psiphon-Labs/psiphon-tunnel-core/MobileLibrary/psi"
   exit 1
   exit 1
 fi
 fi
 
 
@@ -200,7 +203,7 @@ 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"
 
 
-${GOPATH}/bin/gomobile bind -v -x -target ios -tags="OPENSSL IOS" -ldflags="${LDFLAGS}" -o "${INTERMEDIATE_OUPUT_DIR}/${INTERMEDIATE_OUPUT_FILE}" github.com/Psiphon-Labs/psiphon-tunnel-core/MobileLibrary/psi
+${GOPATH}/bin/gomobile bind -v -x -target ios -tags "${BUILD_TAGS}" -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: ${GOPATH}/bin/gomobile bind -target ios -ldflags="${LDFLAGS}" -o "${INTERMEDIATE_OUPUT_DIR}/${INTERMEDIATE_OUPUT_FILE}" github.com/Psiphon-Labs/psiphon-tunnel-core/MobileLibrary/psi"
   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