Skip to content

Commit

Permalink
Added some comments to build scripts and passing logical cores num to…
Browse files Browse the repository at this point in the history
… make

Signed-off-by: Bogdan Mircea <mirceapetrebogdan@gmail.com>
  • Loading branch information
bobozaur committed May 9, 2023
1 parent 3277bb1 commit 094d372
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
17 changes: 13 additions & 4 deletions wrappers/ios/ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -41,15 +42,14 @@ 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
}

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

Expand All @@ -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()"
Expand Down Expand Up @@ -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=""
Expand All @@ -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=""
Expand All @@ -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"

Expand Down Expand Up @@ -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"
3 changes: 2 additions & 1 deletion wrappers/ios/ci/build_libsodium.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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}
Expand Down
3 changes: 2 additions & 1 deletion wrappers/ios/ci/build_libzmq.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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}
Expand Down
5 changes: 5 additions & 0 deletions wrappers/ios/ci/platform-patched.hpp
Original file line number Diff line number Diff line change
@@ -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. */

Expand Down

0 comments on commit 094d372

Please sign in to comment.