@ -25,19 +25,32 @@
# Need to set the path or we won't find cmake
# Need to set the path or we won't find cmake
PATH = ${ PATH } :/usr/local/bin:/opt/homebrew/bin:/sbin/md5
PATH = ${ PATH } :/usr/local/bin:/opt/homebrew/bin:/sbin/md5
# Direct the output to a log file
# Ensure the build directory exists (in case we need it before XCode creates it)
exec > " ${ TARGET_BUILD_DIR } /libsession_util_output.log " 2>& 1
mkdir -p " ${ TARGET_BUILD_DIR } "
# Remove any old build errors
# Remove any old build errors
rm -rf " ${ TARGET_BUILD_DIR } /libsession_util_error.log "
rm -rf " ${ TARGET_BUILD_DIR } /libsession_util_error.log "
# First ensure cmake is installed (store the error in a log and exit with a success status - xcode will output the error)
# First ensure cmake is installed (store the error in a log and exit with a success status - xcode will output the error)
echo "info: Validating build requirements"
if ! which cmake > /dev/null; then
if ! which cmake > /dev/null; then
echo "error: cmake is required to build, please install (can install via homebrew with 'brew install cmake')." > " ${ TARGET_BUILD_DIR } /error.log "
touch " ${ TARGET_BUILD_DIR } /libsession_util_error.log "
echo "error: cmake is required to build, please install (can install via homebrew with 'brew install cmake')."
echo "error: cmake is required to build, please install (can install via homebrew with 'brew install cmake')." > " ${ TARGET_BUILD_DIR } /libsession_util_error.log "
exit 0
exit 0
fi
fi
if [ ! -d " ${ SRCROOT } /LibSession-Util " ] || [ ! -d " ${ SRCROOT } /LibSession-Util/src " ] ; then
touch " ${ TARGET_BUILD_DIR } /libsession_util_error.log "
echo "error: Need to fetch LibSession-Util submodule."
echo "error: Need to fetch LibSession-Util submodule." > " ${ TARGET_BUILD_DIR } /libsession_util_error.log "
exit 1
fi
# Generate a hash of the libSession-util source files and check if they differ from the last hash
# Generate a hash of the libSession-util source files and check if they differ from the last hash
echo "info: Checking for changes to source"
NEW_SOURCE_HASH = $( find " ${ SRCROOT } /LibSession-Util/src " -type f -exec md5 { } + | awk '{print $NF}' | sort | md5 | awk '{print $NF}' )
NEW_SOURCE_HASH = $( find " ${ SRCROOT } /LibSession-Util/src " -type f -exec md5 { } + | awk '{print $NF}' | sort | md5 | awk '{print $NF}' )
NEW_HEADER_HASH = $( find " ${ SRCROOT } /LibSession-Util/include " -type f -exec md5 { } + | awk '{print $NF}' | sort | md5 | awk '{print $NF}' )
NEW_HEADER_HASH = $( find " ${ SRCROOT } /LibSession-Util/include " -type f -exec md5 { } + | awk '{print $NF}' | sort | md5 | awk '{print $NF}' )
@ -62,13 +75,15 @@ if [ "${NEW_SOURCE_HASH}" != "${OLD_SOURCE_HASH}" ] || [ "${NEW_HEADER_HASH}" !=
rm -rf " ${ TARGET_BUILD_DIR } /libsession-util.a "
rm -rf " ${ TARGET_BUILD_DIR } /libsession-util.a "
rm -rf " ${ TARGET_BUILD_DIR } /libsession-util.xcframework "
rm -rf " ${ TARGET_BUILD_DIR } /libsession-util.xcframework "
rm -rf " ${ BUILD_DIR } /libsession-util.xcframework "
rm -rf " ${ BUILD_DIR } /libsession-util.xcframework "
# Trigger the new build
# Trigger the new build
cd " ${ SRCROOT } /LibSession-Util "
cd " ${ SRCROOT } /LibSession-Util "
result = $( ./utils/ios.sh "libsession-util" false )
result = $( ./utils/ios.sh "libsession-util" false )
if [ $? -ne 0 ] ; then
if [ $? -ne 0 ] ; then
echo " error: Failed to build libsession-util (See details in ' ${ TARGET_BUILD_DIR } /pre-action-output.log'). " > " ${ TARGET_BUILD_DIR } /error.log "
touch " ${ TARGET_BUILD_DIR } /libsession_util_error.log "
echo " error: Failed to build libsession-util (See details in ' ${ TARGET_BUILD_DIR } /pre-action-output.log'). "
echo " error: Failed to build libsession-util (See details in ' ${ TARGET_BUILD_DIR } /pre-action-output.log'). " > " ${ TARGET_BUILD_DIR } /libsession_util_error.log "
exit 0
exit 0
fi
fi
@ -76,6 +91,10 @@ if [ "${NEW_SOURCE_HASH}" != "${OLD_SOURCE_HASH}" ] || [ "${NEW_HEADER_HASH}" !=
echo " ${ NEW_SOURCE_HASH } " > " ${ TARGET_BUILD_DIR } /libsession_util_source_hash.log "
echo " ${ NEW_SOURCE_HASH } " > " ${ TARGET_BUILD_DIR } /libsession_util_source_hash.log "
echo " ${ NEW_HEADER_HASH } " > " ${ TARGET_BUILD_DIR } /libsession_util_header_hash.log "
echo " ${ NEW_HEADER_HASH } " > " ${ TARGET_BUILD_DIR } /libsession_util_header_hash.log "
echo " ${ ARCHS [*] } " > " ${ TARGET_BUILD_DIR } /libsession_util_archs.log "
echo " ${ ARCHS [*] } " > " ${ TARGET_BUILD_DIR } /libsession_util_archs.log "
echo ""
echo "info: Build complete"
else
echo "info: Build is up-to-date"
fi
fi
# Move the target-specific libSession-util build to the parent build directory (so XCode can have a reference to a single build)
# Move the target-specific libSession-util build to the parent build directory (so XCode can have a reference to a single build)