From 1f52e837150bd8e8f7635e2d72a47985432f8569 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Mon, 25 Jul 2016 10:58:30 +0200 Subject: [PATCH] xcode: add sdk_download.sh script and use it in xcode if sdk is not yet built --- .gitignore | 1 + .../CAAnimationBlocks/CAAnimation+Blocks.m | 4 +- README.md | 27 ++++++++------ Tools/sdk_download.sh | 37 +++++++++++++++++++ linphone.xcodeproj/project.pbxproj | 2 +- 5 files changed, 56 insertions(+), 15 deletions(-) create mode 100755 Tools/sdk_download.sh diff --git a/.gitignore b/.gitignore index b4e10e869..41684545a 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ linphone-iphone.ipa TutorialHellowWorld/hello-world.xcodeproj/project.xcworkspace/ diff-format.patch *.xcscmblueprint +liblinphone-iphone-sdk-* diff --git a/Classes/Utils/CAAnimationBlocks/CAAnimation+Blocks.m b/Classes/Utils/CAAnimationBlocks/CAAnimation+Blocks.m index dea588a21..34ee9cfb9 100755 --- a/Classes/Utils/CAAnimationBlocks/CAAnimation+Blocks.m +++ b/Classes/Utils/CAAnimationBlocks/CAAnimation+Blocks.m @@ -65,7 +65,7 @@ #if __IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_10_0 self.delegate = delegate; #else - self.delegate = (id)delegate; + self.delegate = (id)delegate; #endif } } @@ -86,7 +86,7 @@ #if __IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_10_0 self.delegate = delegate; #else - self.delegate = (id)delegate; + self.delegate = (id)delegate; #endif } } diff --git a/README.md b/README.md index 68709cef6..e03562bc0 100644 --- a/README.md +++ b/README.md @@ -6,18 +6,11 @@ Linphone is a free VoIP and video softphone based on the SIP protocol. # Getting started -Here's how to launch Linphone for iPhone (more details below): +Here's how to launch Linphone for iPhone (more details below) in the most straightforward way: 1. Install [Xcode from AppStore](https://itunes.apple.com/us/app/Xcode/id497799835?mt=12#). -2. Install [HomeBrew, a package manager for OS X](http://brew.sh) (MacPorts is supported but deprecated). -3. Install Linphone dependencies: open iTerm.app in the current directory and list dependencies to install using: - `./prepare.py` -4. Reorder your path so that brew tools are used instead of Apple's ones which are obsolete: - `export PATH=/usr/local/bin:$PATH` -5. Build SDK (see below for options and explanations): - `./prepare.py -c && ./prepare.py && make` -6. Open linphone.xcodeproj in Xcode: `open linphone.xcodeproj` -7. Press `⌘R` and voilà! +2. Open linphone.xcodeproj in Xcode: `open linphone.xcodeproj` +3. Press `⌘R` and voilà! # How can I contribute? @@ -36,11 +29,21 @@ Interested in helping translate Linphone? Contribute [on Transifex](https://www. If you want to dig through Linphone code or report a bug, please read `CONTRIBUTING.md` first. You should also read this `README` entirely ;-). -# Building the SDK +# Building and customizing the SDK Linphone for iPhone depends on liblinphone SDK. This SDK is generated from makefiles and shell scripts. - To generate the liblinphone multi-arch SDK in GPL mode, simply invoke: + Steps to customize the liblinphone SDK options are: + + 1. Install [HomeBrew, a package manager for OS X](http://brew.sh) (MacPorts is supported but deprecated). + 2. Install Linphone dependencies: open iTerm.app in the current directory and list dependencies to install using: + `./prepare.py` + 3. Reorder your path so that brew tools are used instead of Apple's ones which are obsolete: + `export PATH=/usr/local/bin:$PATH` + 4. Build SDK (see below for options and explanations): + `./prepare.py -c && ./prepare.py && make` + + For instance to generate the liblinphone multi-arch SDK in GPL mode, simply invoke: ./prepare.py [options] && make diff --git a/Tools/sdk_download.sh b/Tools/sdk_download.sh new file mode 100755 index 000000000..dbb3f872d --- /dev/null +++ b/Tools/sdk_download.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +function die { + echo "$@" + exit 1 +} + +if [ $# != 1 ]; then + die "error: please provide liblinphone SDK version to download (for instance 3.13.9)" + exit 1 +fi + +root_path="$(dirname $0)/.." +# only download SDK if it has not yet been built +if [ ! -d "$root_path"/liblinphone-sdk ]; then + sdk_version=liblinphone-iphone-sdk-$1 + sdk_path="$root_path/$sdk_version" + if [ -L "$root_path/liblinphone-sdk" ]; then + rm "$root_path/liblinphone-sdk" + fi + + if [ ! -d "$sdk_path" ]; then + if ! which wget &>/dev/null; then + wget https://www.linphone.org/releases/ios/$sdk_version.zip -O "$sdk_path".zip + elif which curl &>/dev/null; then + curl -# https://www.linphone.org/releases/ios/$sdk_version.zip > "$sdk_path".zip + else + return 1 + fi || die "error: cannot download liblinphone SDK from linphone.org. Please check the README.md" + + echo "info: liblinphone SDK successfully downloaded." + fi + + unzip -x $sdk_path.zip + mv liblinphone-sdk $sdk_path + ln -s $sdk_path liblinphone-sdk +fi diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index 905e453c3..fb0ef9ef8 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -3741,7 +3741,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "if [ ! -f \"$SRCROOT/liblinphone-sdk/apple-darwin/share/linphone/rootca.pem\" ]; then\necho '****************************************************************'\necho 'error: Liblinphone SDK missing!'\necho 'Missing rootca.pem from liblinphone SDK.'\necho 'Did you compile it (./prepare.py && make or read the README.md).'\necho 'Aborting for now.'\necho '****************************************************************'\nexit 1\nfi"; + shellScript = "if [ ! -f \"$SRCROOT/liblinphone-sdk/apple-darwin/share/linphone/rootca.pem\" ]; then\necho '********************************************************************'\necho 'warning: Liblinphone SDK missing! Downloading it (latest release)...'\n$SRCROOT/Tools/sdk_download.sh \"latest\"\necho '********************************************************************'\nexit 1\nfi"; }; 63DCC71D1A07B08E00916627 /* Run Script */ = { isa = PBXShellScriptBuildPhase;