xcode: add sdk_download.sh script and use it in xcode if sdk is not yet built

This commit is contained in:
Gautier Pelloux-Prayer 2016-07-25 10:58:30 +02:00
parent 0f0a99562d
commit 1f52e83715
5 changed files with 56 additions and 15 deletions

1
.gitignore vendored
View file

@ -18,3 +18,4 @@ linphone-iphone.ipa
TutorialHellowWorld/hello-world.xcodeproj/project.xcworkspace/
diff-format.patch
*.xcscmblueprint
liblinphone-iphone-sdk-*

View file

@ -65,7 +65,7 @@
#if __IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_10_0
self.delegate = delegate;
#else
self.delegate = (id<CAAnimationDelegate>)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<CAAnimationDelegate>)delegate;
self.delegate = (id)delegate;
#endif
}
}

View file

@ -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

37
Tools/sdk_download.sh Executable file
View file

@ -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

View file

@ -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;