diff --git a/wrappers/ios/ci/build.sh b/wrappers/ios/ci/build.sh index 878f904c34..534d421a17 100755 --- a/wrappers/ios/ci/build.sh +++ b/wrappers/ios/ci/build.sh @@ -12,6 +12,7 @@ OUTPUT_DIR=/tmp/artifacts setup() { echo "ios/ci/build.sh: running setup()" + echo "Setup rustup" rustup default 1.65.0 rustup component add rls-preview rust-analysis rust-src @@ -41,8 +42,6 @@ setup() { which automake &>/dev/null || brew install automake which autoconf &>/dev/null || brew install autoconf which cmake &>/dev/null || brew install cmake - which wget &>/dev/null || brew install wget - which g++ &>/dev/null || brew install gcc mkdir -p $OUTPUT_DIR/libs mkdir -p $OUTPUT_DIR/arch_libs @@ -50,6 +49,7 @@ setup() { build_crypto() { echo "ios/ci/build.sh: running build_crypto()" + if [ ! -d $OUTPUT_DIR/OpenSSL-for-iPhone ]; then git clone https://github.com/x2on/OpenSSL-for-iPhone.git $OUTPUT_DIR/OpenSSL-for-iPhone @@ -69,6 +69,8 @@ build_crypto() { } extract_crypto_lib() { + echo "ios/ci/build.sh: running extract_crypto_lib()" + ARCH=$1 LIBS="libcrypto libssl" echo "ios/ci/build.sh: running extract_crypto_lib()" @@ -124,6 +126,7 @@ build_libvcx() { combine_static_libs() { echo "ios/ci/build.sh: running combine_static_libs()" + COMBINED_LIB=$1 ARCH=$2 combined_libs_paths="" @@ -141,6 +144,8 @@ combine_static_libs() { } make_fat_library() { + echo "ios/ci/build.sh: running make_fat_library()" + COMBINED_LIB=$1 ARCHS="arm64 x86_64" COMBINED_LIB_PATHS="" @@ -162,6 +167,7 @@ make_fat_library() { build_vcx_framework() { echo "ios/ci/build.sh: running build_vcx_framework() COMBINED_LIB=${COMBINED_LIB}" + COMBINED_LIB=$1 ARCHS="arm64 x86_64" @@ -226,23 +232,26 @@ build_vcx_framework() { popd } +# Initial setup and OpenSSL building setup build_crypto +########### iOS ARM64 ########### extract_crypto_lib "arm64" build_libsodium "arm64" build_libzmq "arm64" build_libvcx "arm64" "aarch64-apple-ios" - combine_static_libs "libvcx_all" "arm64" +########### iOS x86_64 Simulator ########### extract_crypto_lib "x86_64" build_libsodium "x86_64" build_libzmq "x86_64" build_libvcx "x86_64" "x86_64-apple-ios" - combine_static_libs "libvcx_all" "x86_64" +# Combine each arch libvcx lib into one fat lib make_fat_library "libvcx_all" +# Build Xcode framework build_vcx_framework "libvcx_all" \ No newline at end of file diff --git a/wrappers/ios/ci/build_libsodium.sh b/wrappers/ios/ci/build_libsodium.sh index ed2bed7203..d211b21d27 100755 --- a/wrappers/ios/ci/build_libsodium.sh +++ b/wrappers/ios/ci/build_libsodium.sh @@ -38,6 +38,7 @@ OTHER_CFLAGS="-Os -Qunused-arguments -fembed-bitcode" setup() { rm -rf ${BUILD_DIR} + # Don't download the package again if it's already present if [ ! -d ${PKG_NAME} ]; then PKG_ARCHIVE="${PKG_NAME}.tar.gz" @@ -74,7 +75,7 @@ build() { ./configure --prefix=${ARCH_BUILD_DIR} --disable-shared --enable-static --host=${HOST} make clean - make -j`nproc` V=0 + make -j`sysctl -n hw.ncpu` V=0 make install rm -f ${LIB_OUTPUT_DIR}/${LIBNAME} diff --git a/wrappers/ios/ci/build_libzmq.sh b/wrappers/ios/ci/build_libzmq.sh index 4d0481518d..c26be15460 100755 --- a/wrappers/ios/ci/build_libzmq.sh +++ b/wrappers/ios/ci/build_libzmq.sh @@ -46,6 +46,7 @@ OTHER_CPPFLAGS="-Os -fembed-bitcode" setup() { rm -rf ${BUILD_DIR} + # Don't download the package again if it's already present if [ ! -d ${PKG_NAME} ]; then PKG_ARCHIVE="${PKG_NAME}.tar.gz" @@ -90,7 +91,7 @@ build() { cp ${SCRIPT_DIR}/platform-patched.hpp ./src/platform.hpp make clean - make -j`nproc` V=0 + make -j`sysctl -n hw.ncpu` V=0 make install rm -f ${LIB_OUTPUT_DIR}/${LIBNAME} diff --git a/wrappers/ios/ci/platform-patched.hpp b/wrappers/ios/ci/platform-patched.hpp index c5f2a2fd5c..990122e206 100644 --- a/wrappers/ios/ci/platform-patched.hpp +++ b/wrappers/ios/ci/platform-patched.hpp @@ -1,3 +1,8 @@ +/* +Workaround to disable clock_gettime since it is only available on iOS 10+. +Taken from https://github.com/evernym/libzmq-ios +*/ + /* src/platform.hpp. Generated from platform.hpp.in by configure. */ /* src/platform.hpp.in. Generated from configure.ac by autoheader. */