Skip to content

Commit

Permalink
update ios scripts to not clone dependencies at build time (#25)
Browse files Browse the repository at this point in the history
* update ios scripts to not clone dependencies at runtime
* fix ios build scripts
  • Loading branch information
MrCyjaneK authored Aug 1, 2024
1 parent 0737e1a commit f2e150b
Show file tree
Hide file tree
Showing 15 changed files with 54 additions and 81 deletions.
19 changes: 18 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,21 @@
url = https://github.com/leetal/ios-cmake
[submodule "external/wownero-seed"]
path = external/wownero-seed
url = https://github.com/wownero-mirror/wownero-seed
url = https://github.com/wownero-mirror/wownero-seed
[submodule "external/Apple-Boost-BuildScript"]
path = external/Apple-Boost-BuildScript
url = https://github.com/cake-tech/Apple-Boost-BuildScript.git
branch = build
[submodule "external/OpenSSL-for-iPhone"]
path = external/OpenSSL-for-iPhone
url = https://github.com/x2on/OpenSSL-for-iPhone.git
[submodule "external/libsodium"]
path = external/libsodium
url = https://github.com/jedisct1/libsodium.git
[submodule "external/unbound"]
path = external/unbound
url = https://github.com/NLnetLabs/unbound.git
branch = release-1.16.2
[submodule "external/libzmq"]
path = external/libzmq
url = https://github.com/zeromq/libzmq
1 change: 1 addition & 0 deletions external/Apple-Boost-BuildScript
1 change: 1 addition & 0 deletions external/OpenSSL-for-iPhone
Submodule OpenSSL-for-iPhone added at 394bac
18 changes: 4 additions & 14 deletions external/ios/build_boost.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,22 @@ set -e
. ./config.sh

MIN_IOS_VERSION=10.0
BOOST_URL="https://github.com/cake-tech/Apple-Boost-BuildScript.git"
BOOST_DIR_PATH="${EXTERNAL_IOS_SOURCE_DIR}/Apple-Boost-BuildScript"
BOOST_VERSION=1.84.0
BOOST_LIBS="random regex graph random chrono thread filesystem system date_time locale serialization program_options"

echo "============================ Boost ============================"

echo "Cloning Apple-Boost-BuildScript from - $BOOST_URL"

# Check if the directory already exists.
if [ -d "$BOOST_DIR_PATH" ]; then
echo "Boost directory already exists."
else
echo "Cloning Boost from $BOOST_URL"
git clone -b build $BOOST_URL $BOOST_DIR_PATH
fi

# Verify if the repository was cloned successfully.
if [ -d "$BOOST_DIR_PATH/.git" ]; then
echo "Boost repository cloned successfully."
cd $BOOST_DIR_PATH
git checkout build
else
echo "Failed to clone Boost repository. Exiting."
exit 1
mkdir -p $BOOST_DIR_PATH || true
rm -rf $BOOST_DIR_PATH || true
cp -r "${MONEROC_DIR}/external/Apple-Boost-BuildScript" $BOOST_DIR_PATH
fi
cd $BOOST_DIR_PATH

./boost.sh -ios \
--min-ios-version ${MIN_IOS_VERSION} \
Expand Down
16 changes: 0 additions & 16 deletions external/ios/build_libiconv.sh

This file was deleted.

4 changes: 4 additions & 0 deletions external/ios/build_monero_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ set -e
rm -rf build

. ./config.sh

rm -rf "$EXTERNAL_IOS_LIB_DIR"
rm -rf "$EXTERNAL_IOS_INCLUDE_DIR"

./install_missing_headers.sh
./build_openssl.sh
./build_boost.sh
Expand Down
21 changes: 7 additions & 14 deletions external/ios/build_openssl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ set -e

. ./config.sh

OPEN_SSL_URL="https://github.com/x2on/OpenSSL-for-iPhone.git"
OPEN_SSL_DIR_PATH="${EXTERNAL_IOS_SOURCE_DIR}/OpenSSL"

echo "============================ OpenSSL ============================"
Expand All @@ -15,21 +14,15 @@ echo "Cloning Open SSL from - $OPEN_SSL_URL"
if [ -d "$OPEN_SSL_DIR_PATH" ]; then
echo "OpenSSL directory already exists."
else
echo "Cloning OpenSSL from $OPEN_SSL_URL"
git clone $OPEN_SSL_URL $OPEN_SSL_DIR_PATH
fi

# Verify if the repository was cloned successfully.
if [ -d "$OPEN_SSL_DIR_PATH/.git" ]; then
echo "OpenSSL repository cloned successfully."
cd $OPEN_SSL_DIR_PATH
else
echo "Failed to clone OpenSSL repository. Exiting."
exit 1
mkdir -p "$OPEN_SSL_DIR_PATH" || true
rm -rf "$OPEN_SSL_DIR_PATH"
cp -r "${MONEROC_DIR}/external/OpenSSL-for-iPhone" $OPEN_SSL_DIR_PATH
fi
cd $OPEN_SSL_DIR_PATH

./build-libssl.sh --version=1.1.1q --targets="ios-cross-arm64" --deprecated


mv -f ${OPEN_SSL_DIR_PATH}/include/* $EXTERNAL_IOS_INCLUDE_DIR
mv ${OPEN_SSL_DIR_PATH}/lib/libcrypto-iOS.a ${EXTERNAL_IOS_LIB_DIR}/libcrypto.a
mv ${OPEN_SSL_DIR_PATH}/lib/libssl-iOS.a ${EXTERNAL_IOS_LIB_DIR}/libssl.a
mv -f ${OPEN_SSL_DIR_PATH}/lib/libcrypto-iOS.a ${EXTERNAL_IOS_LIB_DIR}/libcrypto.a
mv -f ${OPEN_SSL_DIR_PATH}/lib/libssl-iOS.a ${EXTERNAL_IOS_LIB_DIR}/libssl.a
15 changes: 4 additions & 11 deletions external/ios/build_sodium.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,12 @@ if [ -d "$SODIUM_PATH" ]; then
echo "Sodium directory already exists."
else
echo "Cloning Sodium from $SODIUM_URL"
git clone $SODIUM_URL $SODIUM_PATH
fi

# Verify if the repository was cloned successfully.
if [ -d "$SODIUM_PATH/.git" ]; then
echo "Sodium repository cloned successfully."
cd $SODIUM_PATH
git checkout 443617d7507498f7477703f0b51cb596d4539262
else
echo "Failed to clone Sodium repository. Exiting."
exit 1
mkdir -p $SODIUM_PATH || true
rm -rf $SODIUM_PATH
cp -r "${MONEROC_DIR}/external/libsodium" $SODIUM_PATH
fi

cd $SODIUM_PATH
../../../../libsodium_apple-ios.sh

mv -f ${SODIUM_PATH}/libsodium-apple/ios/include/* $EXTERNAL_IOS_INCLUDE_DIR
Expand Down
15 changes: 4 additions & 11 deletions external/ios/build_unbound.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,12 @@ if [ -d "$UNBOUND_DIR_PATH" ]; then
echo "Unbound directory already exists."
else
echo "Cloning Unbound from $Unbound_URL"
git clone $UNBOUND_GIT_URL -b ${UNBOUND_VERSION} ${UNBOUND_DIR_PATH}
mkdir -p ${UNBOUND_DIR_PATH} || true
rm -rf ${UNBOUND_DIR_PATH}
cp -r "${MONEROC_DIR}/external/unbound" ${UNBOUND_DIR_PATH}
fi

# Verify if the repository was cloned successfully.
if [ -d "$UNBOUND_DIR_PATH/.git" ]; then
echo "Unbound repository cloned successfully."
cd $UNBOUND_DIR_PATH
git checkout $UNBOUND_VERSION # Or UNBOUND_HASH.
test `git rev-parse HEAD` = ${UNBOUND_HASH} || exit 1
else
echo "Failed to clone Unbound repository. Exiting."
exit 1
fi
cd $UNBOUND_DIR_PATH

export IOS_SDK=iPhone
export IOS_CPU=arm64
Expand Down
7 changes: 3 additions & 4 deletions external/ios/build_wownero_seed.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ set -x -e

SEED_VERSION=0.3.0
SEED_SRC_DIR="${EXTERNAL_IOS_SOURCE_DIR}/seed"
SEED_URL="https://git.wownero.com/wowlet/wownero-seed.git"
SEED_SHA_HEAD="d3f68be347facfeebbd8f68fd74982c705cb917b"

rm -rf "$SEED_SRC_DIR" > /dev/null

echo "[*] cloning $SEED_URL"
git clone --branch ${SEED_VERSION} ${SEED_URL} ${SEED_SRC_DIR}
mkdir -p ${SEED_SRC_DIR} || true
rm -rf ${SEED_SRC_DIR}
cp -r "${MONEROC_DIR}/external/wownero-seed" ${SEED_SRC_DIR}
cd $SEED_SRC_DIR
git reset --hard $SEED_SHA_HEAD

patch -p1 < ../../../../../wownero-seed-0001-fix-duplicate-symbol-error.patch

Expand Down
14 changes: 4 additions & 10 deletions external/ios/build_zmq.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ set -e
. ./config.sh

ZMQ_PATH="${EXTERNAL_IOS_SOURCE_DIR}/libzmq"
ZMQ_URL="https://github.com/zeromq/libzmq.git"

echo "============================ ZMQ ============================"

Expand All @@ -16,17 +15,12 @@ if [ -d "$ZMQ_PATH" ]; then
echo "ZeroMQ directory already exists."
else
echo "Cloning ZeroMQ from $ZeroMQ_URL"
git clone $ZMQ_URL $ZMQ_PATH
mkdir -p $ZMQ_PATH || true
rm -rf $ZMQ_PATH
cp -r "${MONEROC_DIR}/external/libzmq" $ZMQ_PATH
fi

# Verify if the repository was cloned successfully.
if [ -d "$ZMQ_PATH/.git" ]; then
echo "ZeroMQ repository cloned successfully."
cd $ZMQ_PATH
else
echo "Failed to clone ZeroMQ repository. Exiting."
exit 1
fi
cd $ZMQ_PATH

mkdir -p cmake-build
cd cmake-build
Expand Down
1 change: 1 addition & 0 deletions external/ios/config.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/sh

export IOS_SCRIPTS_DIR="$(pwd)"
export MONEROC_DIR="$(pwd)/../.."
export CW_ROOT="${IOS_SCRIPTS_DIR}"
export EXTERNAL_DIR="${CW_ROOT}/build"
export EXTERNAL_IOS_DIR="${EXTERNAL_DIR}/ios"
Expand Down
1 change: 1 addition & 0 deletions external/libsodium
Submodule libsodium added at 443617
1 change: 1 addition & 0 deletions external/libzmq
Submodule libzmq added at 59c912
1 change: 1 addition & 0 deletions external/unbound
Submodule unbound added at cbed76

0 comments on commit f2e150b

Please sign in to comment.