diff --git a/BUILDING.md b/BUILDING.md index fbf425c00..2135475cd 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -46,7 +46,20 @@ To build and configure the libraries Session uses, just run: pod install ``` -## 4. Xcode +## 4. libSession build dependencies + +The iOS project has a share C++ library called `libSession` which is built as one of the project dependencies, in order for this to compile the following dependencies need to be installed: +- cmake +- m4 +- pkg-config + +These can be installed with Homebrew via `brew install cmake m4 pkg-config` + +Additionally `xcode-select` needs to be setup correctly (depending on the order of installation it can point to the wrong directory and result in a build error similar to `tool '{name}' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance`), this can be setup correctly by running: + +`sudo xcode-select -s /Applications/Xcode.app/Contents/Developer` + +## 5. Xcode Open the `Session.xcworkspace` in Xcode. @@ -67,6 +80,9 @@ Build and Run and you are ready to go! ## Known issues +### Third-party Installation +The database for the app is stored within an `App Group` directory which is based on the app identifier, unfortunately the identifier cannot be retrieved at runtime so it's currently hard-coded in the code. In order to be able to run session on a device you will need to update the `UserDefaults.applicationGroup` variable in `SessionUtilitiesKit/General/SNUserDefaults` to match the value provided (You may also need to create the `App Group` on your Apple Developer account). + ### Push Notifications Features related to push notifications are known to be not working for third-party contributors since Apple's Push Notification service pushes diff --git a/Scripts/build_libSession_util.sh b/Scripts/build_libSession_util.sh index d3d5e4a2c..d248a2ab5 100755 --- a/Scripts/build_libSession_util.sh +++ b/Scripts/build_libSession_util.sh @@ -27,6 +27,7 @@ # Need to set the path or we won't find cmake PATH=${PATH}:/usr/local/bin:/opt/local/bin:/opt/homebrew/bin:/opt/homebrew/opt/m4/bin:/sbin/md5 +required_packages=("cmake" "m4" "pkg-config") exec 3>&1 # Save original stdout @@ -34,15 +35,23 @@ exec 3>&1 # Save original stdout mkdir -p "${TARGET_BUILD_DIR}/libSessionUtil" echo "Validating build requirements" +missing_packages=() -# Ensure the build directory exists (in case we need it before XCode creates it) -mkdir -p "${TARGET_BUILD_DIR}" +for package in "${required_packages[@]}"; do + if ! which "$package" > /dev/null; then + missing_packages+=("$package") + fi +done -if ! which cmake > /dev/null; then - echo "error: cmake is required to build, please install (can install via homebrew with 'brew install cmake')." - exit 0 +if [ ${#missing_packages[@]} -ne 0 ]; then + packages=$(echo "${missing_packages[@]}") + echo "error: Some build dependencies are not installed, please install them ('brew install ${packages}'):" + exit 1 fi +# Ensure the build directory exists (in case we need it before XCode creates it) +mkdir -p "${TARGET_BUILD_DIR}" + # Check if we have the `LibSession-Util` submodule checked out and if not (depending on the 'SHOULD_AUTO_INIT_SUBMODULES' argument) perform the checkout if [ ! -d "${SRCROOT}/LibSession-Util" ] || [ ! -d "${SRCROOT}/LibSession-Util/src" ] || [ ! "$(ls -A "${SRCROOT}/LibSession-Util")" ]; then echo "error: Need to fetch LibSession-Util submodule (git submodule update --init --recursive)." @@ -188,6 +197,8 @@ if [ "$CONFIGURATION" == "Debug" ]; then submodule_check=OFF fi +echo "CMake build logs: ${TARGET_BUILD_DIR}/libSessionUtil/libsession_util_output.log" + # Build the individual architectures for i in "${!TARGET_ARCHS[@]}"; do build="${TARGET_BUILD_DIR}/libSessionUtil/${TARGET_ARCHS[$i]}"