diff --git a/README.md b/README.md index 1092f11f3..a8c22f7c2 100644 --- a/README.md +++ b/README.md @@ -4,19 +4,26 @@ ## Build prerequisite -Linphone for iPhone depends on liblinphone SDK. This SDK is generated from makefiles and shell scripts. Before building Linphone on iPhone, please read and execute [liblinphone README](submodule/linphone/README.macos.md). +Linphone for iPhone depends on liblinphone SDK. This SDK is generated from makefiles and shell scripts. -You will NOT be able to build the SDK if you did not read liblinphone README first! +* Xcode (download from apple or using appstore application) +* [Java SE](http://www.oracle.com/technetwork/java/javase/downloads/index.html) or openJDK + This is required to generate a C sourcefile from SIP grammar using [antlr3](http://www.antlr3.org/) generator. +* [HomeBrew](http://brew.sh) or [Macports](http://www.macports.org/). -### Additional dependencies + +### Install dependencies * Using HomeBrew: - brew install imagemagick yasm nasm + brew install autoconf automake pkg-config doxygen java nasm gettext wget yasm optipng imagemagick coreutils intltool + # antlr3.2 is faster than default homebrew version 3.4 - you can install official antlr3 though + brew tap Gui13/linphone + brew install antlr3.2 * Using MacPorts: - sudo port install ImageMagick optipng yasm nasm + sudo port install autoconf automake pkg-config doxygen antlr3 java nasm gettext wget yasm optipng ImageMagick coreutils intltool ### System linking @@ -30,13 +37,13 @@ You will NOT be able to build the SDK if you did not read liblinphone README fir export PATH=$LOCAL_BIN_DIR:$PATH -* Install [gas-preprosessor.pl](http://github.com/yuvi/gas-preprocessor/) (version above July 2013) into your `LOCAL_BIN_DIR` directory +* Install [gas-preprosessor.pl](http://github.com/yuvi/gas-preprocessor/) (version above July 2013) into your PATH. Suppose you use `LOCAL_BIN_DIR` directory: wget --no-check-certificate https://raw.github.com/yuvi/gas-preprocessor/master/gas-preprocessor.pl chmod +x gas-preprocessor.pl sudo mv gas-preprocessor.pl $LOCAL_BIN_DIR -* Link `libtoolize` to `glibtoolize` +* (HomeBrew only) Link `libtoolize` to `glibtoolize` sudo ln -s $LOCAL_BIN_DIR/glibtoolize $LOCAL_BIN_DIR/libtoolize diff --git a/Tools/check_tools.sh b/Tools/check_tools.sh new file mode 100755 index 000000000..32fd89a4a --- /dev/null +++ b/Tools/check_tools.sh @@ -0,0 +1,58 @@ +#!/bin/sh + +error_on_quit=0 + +echo_err() { + echo "$@" >&2 + error_on_quit=1 +} + +check_installed() { + if [ -z "$(which $1)" ]; then + echo_err "Could not find $1. Please install $2." + return 1 + fi + return 0 +} + +cd $(dirname $0)/.. + +#autoconf pkg-config java ant yasm nasm wget +for prog in autoconf automake pkg-config doxygen antlr3 java nasm gettext wget yasm optipng; do + check_installed "$prog" "it" +done + +check_installed "ginstall" "coreutils" +check_installed "intltoolize" "intltool" +check_installed "convert" "imagemagick" + +if ! check_installed "libtoolize" "libtool"; then + if [ ! -z "$(which glibtoolize)" ]; then + echo_err "Note: it seems that you are using HomeBrew. Please do a symbolic link from " \ + "glibtoolize to libtoolize: 'ln -s $(which glibtoolize) /usr/local/bin/libtoolize'" + fi +fi + +# needed by x264 +check_installed "gas-preprocessor.pl" "it following the README.md" + +if nasm -f elf32 2>&1 | grep -q "fatal: unrecognised output format"; then + echo_err "Invalid version of nasm: your version does not support elf32 output format. If you have installed nasm, please check that your PATH env variable is set correctly." +fi + +if ! (find submodules/linphone/mediastreamer2 -mindepth 1 2>/dev/null | grep -q . \ + || find submodules/linphone/oRTP -mindepth 1 2>/dev/null | grep -q .); then + echo_err "Missing some git submodules. Did you run 'git submodule update --init --recursive'?" +fi + +if ! xcrun --sdk iphoneos --show-sdk-path &>/dev/null; then + echo_err "iOS SDK not found, please install Xcode from AppStore or equivalent" +elif [ ! -f $(xcrun --sdk iphonesimulator --show-sdk-platform-path)/Developer/usr/bin/strings ]; then + echo_err "strings binary missing, please run 'sudo ln -s $(which strings) $(xcrun --sdk iphonesimulator --show-sdk-platform-path)/Developer/usr/bin/strings'" +fi + +if [ $error_on_quit != 0 ]; then + echo "Failed to detect required tools, aborting. Please run 'make very-clean' before rerunning 'make'" +fi + +exit $error_on_quit diff --git a/submodules/build/Makefile b/submodules/build/Makefile index 9c1e1499c..62e0509df 100644 --- a/submodules/build/Makefile +++ b/submodules/build/Makefile @@ -25,8 +25,16 @@ enable_ffmpeg=yes enable_opus=yes enable_debug=no -TUNNEL_AVAILABLE=$(shell git submodule status ../tunnel 2>/dev/null 1>/dev/null && echo yes) +# Checks +CHECK_MSG=$(shell ../../Tools/check_tools.sh) + +ifneq ($(CHECK_MSG),) + $(error Some tools are missing.) +endif + + +TUNNEL_AVAILABLE=$(shell git submodule status ../tunnel 2>/dev/null 1>/dev/null && echo yes) ifneq ($(TUNNEL_AVAILABLE),) enable_tunnel=yes enable_gpl_third_parties=no