diff --git a/.gitmodules b/.gitmodules index adcac5915..3bff82fba 100644 --- a/.gitmodules +++ b/.gitmodules @@ -25,3 +25,6 @@ [submodule "submodules/msamr"] path = submodules/msamr url = git://git.linphone.org/msamr.git +[submodule "submodules/externals/zrtpcpp"] + path = submodules/externals/zrtpcpp + url = git://github.com/wernerd/ZRTPCPP.git diff --git a/Classes/LinphoneUI/LinphoneManager.h b/Classes/LinphoneUI/LinphoneManager.h index 2ba94ed2b..2ed3b0184 100644 --- a/Classes/LinphoneUI/LinphoneManager.h +++ b/Classes/LinphoneUI/LinphoneManager.h @@ -50,6 +50,7 @@ typedef enum _Connectivity { -(void) registerLogView:(id) view; -(void) startLibLinphone; +-(BOOL) isNotIphone3G; -(void) destroyLibLinphone; -(void) enterBackgroundMode; diff --git a/Classes/LinphoneUI/LinphoneManager.m b/Classes/LinphoneUI/LinphoneManager.m index 84beb8fd5..5da9509be 100644 --- a/Classes/LinphoneUI/LinphoneManager.m +++ b/Classes/LinphoneUI/LinphoneManager.m @@ -26,6 +26,8 @@ #import #import #import "FastAddressBook.h" +#include + static LinphoneCore* theLinphoneCore=nil; static LinphoneManager* theLinphoneManager=nil; @@ -379,16 +381,17 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach if (linphone_core_get_sip_transports(theLinphoneCore, &transportValue)) { ms_error("cannot get current transport"); } + // Only one port can be set at one time, the others's value is 0 if ([transport isEqualToString:@"tcp"]) { - if (transportValue.tcp_port == 0) transportValue.tcp_port=transportValue.udp_port; + if (transportValue.tcp_port == 0) transportValue.tcp_port=transportValue.udp_port + transportValue.tls_port; transportValue.udp_port=0; transportValue.tls_port=0; } else if ([transport isEqualToString:@"udp"]){ - if (transportValue.udp_port == 0) transportValue.udp_port=transportValue.tcp_port; + if (transportValue.udp_port == 0) transportValue.udp_port=transportValue.tcp_port + transportValue.tls_port; transportValue.tcp_port=0; transportValue.tls_port=0; } else if ([transport isEqualToString:@"tls"]){ - if (transportValue.tls_port == 0) transportValue.tls_port=transportValue.udp_port; + if (transportValue.tls_port == 0) transportValue.tls_port=transportValue.udp_port + transportValue.tcp_port; transportValue.tcp_port=0; transportValue.udp_port=0; } else { @@ -496,8 +499,14 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach } //read codecs from setting bundle and enable them one by one - [self configurePayloadType:"speex" fromPrefKey:@"speex_16k_preference" withRate:16000]; - [self configurePayloadType:"speex" fromPrefKey:@"speex_8k_preference" withRate:8000]; + if ([self isNotIphone3G]) { + [self configurePayloadType:"speex" fromPrefKey:@"speex_16k_preference" withRate:16000]; + [self configurePayloadType:"speex" fromPrefKey:@"speex_8k_preference" withRate:8000]; + } + else + { + ms_message("SPEEX codecs deactivated"); + } [self configurePayloadType:"AMR" fromPrefKey:@"amr_8k_preference" withRate:8000]; [self configurePayloadType:"GSM" fromPrefKey:@"gsm_8k_preference" withRate:8000]; [self configurePayloadType:"iLBC" fromPrefKey:@"ilbc_preference" withRate:8000]; @@ -516,6 +525,18 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach } } +- (BOOL)isNotIphone3G +{ + size_t size; + sysctlbyname("hw.machine", NULL, &size, NULL, 0); + char *machine = malloc(size); + sysctlbyname("hw.machine", machine, &size, NULL, 0); + NSString *platform = [NSString stringWithCString:machine]; + free(machine); + + return ![platform isEqualToString:@"iPhone1,2"]; +} + // no proxy configured alert - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { if (buttonIndex == 1) { @@ -644,6 +665,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach NSString* factoryConfig = [myBundle pathForResource:@"linphonerc"ofType:nil] ; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *confiFileName = [[paths objectAtIndex:0] stringByAppendingString:@"/.linphonerc"]; + NSString *zrtpSecretsFileName = [[paths objectAtIndex:0] stringByAppendingString:@"/zrtp_secrets"]; connectivity=none; signal(SIGPIPE, SIG_IGN); //log management @@ -670,7 +692,8 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach ,self); [[NSUserDefaults standardUserDefaults] synchronize];//sync before loading config - + + linphone_core_set_zrtp_secrets_file(theLinphoneCore, [zrtpSecretsFileName cStringUsingEncoding:[NSString defaultCStringEncoding]]); proxyReachability=SCNetworkReachabilityCreateWithName(nil, "linphone.org"); proxyReachabilityContext.info=self; diff --git a/README b/README index c846c7a2a..4c34e693f 100644 --- a/README +++ b/README @@ -8,6 +8,7 @@ Linphone for iPhone depends on liblinphone sdk. To build this sdk, you must inst -intltool -wget -pkgconfig +-cmake (for ZRTP support) Link macport libtoolize to glibtoolize (sudo ln -s /opt/local/bin/glibtoolize /opt/local/bin/libtoolize) diff --git a/linphone-Info.plist b/linphone-Info.plist index 44b4788bb..de193e695 100644 --- a/linphone-Info.plist +++ b/linphone-Info.plist @@ -19,11 +19,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 3.4.4 + 3.4.5 CFBundleSignature ???? CFBundleVersion - 1.0.6 + 1.0.7 NSMainNibFile PhoneMainView UIApplicationExitsOnSuspend diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index 5f286dc81..2e2f54bd2 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -85,6 +85,7 @@ 22F51EF6107FA66500F98953 /* untitled.plist in Resources */ = {isa = PBXBuildFile; fileRef = 22F51EF5107FA66500F98953 /* untitled.plist */; }; 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; }; 70571E1A13FABCB000CDD3C2 /* rootca.pem in Resources */ = {isa = PBXBuildFile; fileRef = 70571E1913FABCB000CDD3C2 /* rootca.pem */; }; + F0A486D91404FE53009EC0BE /* libsrtp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F0A486D71404FE53009EC0BE /* libsrtp.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -393,10 +394,12 @@ 22F254801073D99800AC9B3F /* ringback.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = ringback.wav; path = "liblinphone-sdk/apple-darwin/share/sounds/linphone/ringback.wav"; sourceTree = ""; }; 22F51EF5107FA66500F98953 /* untitled.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = untitled.plist; sourceTree = ""; }; 288765FC0DF74451002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = main.m; sourceTree = ""; }; 32CA4F630368D1EE00C91783 /* linphone_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = linphone_Prefix.pch; sourceTree = ""; }; 70571E1913FABCB000CDD3C2 /* rootca.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = rootca.pem; path = Resources/rootca.pem; sourceTree = ""; }; 8D1107310486CEB800E47090 /* linphone-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "linphone-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; + F0A486D71404FE53009EC0BE /* libsrtp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libsrtp.a; path = "liblinphone-sdk/apple-darwin/lib/libsrtp.a"; sourceTree = ""; }; + F0A486DB14050008009EC0BE /* libstdc++.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libstdc++.dylib"; path = "usr/lib/gcc/arm-apple-darwin10/4.0.1/libstdc++.dylib"; sourceTree = SDKROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -429,6 +432,7 @@ 226F2ED61344B0EF00F6EF27 /* libopencore-amrwb.a in Frameworks */, 226F2ED71344B0EF00F6EF27 /* libopencore-amrnb.a in Frameworks */, 226F2ED81344B0EF00F6EF27 /* libmsamr.a in Frameworks */, + F0A486D91404FE53009EC0BE /* libsrtp.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -784,6 +788,8 @@ 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { isa = PBXGroup; children = ( + F0A486DB14050008009EC0BE /* libstdc++.dylib */, + F0A486D71404FE53009EC0BE /* libsrtp.a */, 2214783B1386A2030020F8B8 /* Localizable.strings */, 22A10D9E11F88C1F00373793 /* liblinphone.xcodeproj */, 223148E51178A09900637D6A /* libmsilbc.a */, @@ -900,6 +906,9 @@ /* Begin PBXProject section */ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; + attributes = { + LastUpgradeCheck = 0410; + }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "linphone" */; compatibilityVersion = "Xcode 3.1"; developmentRegion = English; @@ -1042,9 +1051,12 @@ submodules/externals/osip/include, submodules/externals/exosip/include, submodules/externals/speex/include, + submodules/externals/srtp/include, + submodules/externals/srtp/crypto/include, + submodules/externals/zrtpcpp/src, ); INFOPLIST_FILE = "linphone-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 3.1; + IPHONEOS_DEPLOYMENT_TARGET = 3.1.2; LIBRARY_SEARCH_PATHS = ( "$(BUILT_PRODUCTS_DIR)", "\"$(SRCROOT)/liblinphone-sdk/apple-darwin/lib/mediastreamer/plugins\"", @@ -1055,6 +1067,8 @@ linphone, "-l", mediastreamer, + "-l", + srtp, ); PRODUCT_NAME = linphone; "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; @@ -1104,9 +1118,12 @@ submodules/externals/osip/include, submodules/externals/exosip/include, submodules/externals/speex/include, + submodules/externals/srtp/include, + submodules/externals/srtp/crypto/include, + submodules/externals/zrtpcpp/src, ); INFOPLIST_FILE = "linphone-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 3.1; + IPHONEOS_DEPLOYMENT_TARGET = 3.1.2; LIBRARY_SEARCH_PATHS = ( "$(BUILT_PRODUCTS_DIR)", "\"$(SRCROOT)/liblinphone-sdk/apple-darwin/lib/mediastreamer/plugins\"", @@ -1117,6 +1134,8 @@ linphone, "-l", mediastreamer, + "-l", + srtp, ); PRODUCT_NAME = linphone; "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; @@ -1166,9 +1185,12 @@ submodules/externals/osip/include, submodules/externals/exosip/include, submodules/externals/speex/include, + submodules/externals/srtp/include, + submodules/externals/srtp/crypto/include, + submodules/externals/zrtpcpp/src, ); INFOPLIST_FILE = "linphone-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 3.1; + IPHONEOS_DEPLOYMENT_TARGET = 3.1.2; LIBRARY_SEARCH_PATHS = ( "$(BUILT_PRODUCTS_DIR)", "\"$(SRCROOT)/liblinphone-sdk/apple-darwin/lib/mediastreamer/plugins\"", @@ -1179,6 +1201,8 @@ linphone, "-l", mediastreamer, + "-l", + srtp, ); PRODUCT_NAME = linphone; "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; diff --git a/submodules/build/Makefile b/submodules/build/Makefile index 9c2e11552..ee0e90abe 100644 --- a/submodules/build/Makefile +++ b/submodules/build/Makefile @@ -20,9 +20,9 @@ # ############################################################################ all: - make -f builder-iphone-simulator.mk all \ - && make -f builder-iphone-os.mk all \ - && make -f builder-iphone-os.mk host=armv7-apple-darwin all \ + make -f builder-iphone-os.mk all \ + && make -f builder-iphone-simulator.mk tc_proc=.i386 all \ + && make -f builder-iphone-os.mk host=armv7-apple-darwin all \ && make -f builder-iphone-os.mk delivery-sdk clean: make -f builder-iphone-simulator.mk clean \ diff --git a/submodules/build/builder-iphone-os.mk b/submodules/build/builder-iphone-os.mk index 0d65d3620..dfe132a06 100644 --- a/submodules/build/builder-iphone-os.mk +++ b/submodules/build/builder-iphone-os.mk @@ -21,6 +21,7 @@ ############################################################################ host?=armv6-apple-darwin +enable_zrtp=no config_site:=iphone-config.site library_mode:= --disable-shared --enable-static linphone_configure_controls= --disable-video \ @@ -28,18 +29,26 @@ linphone_configure_controls= --disable-video \ --disable-nls \ --with-readline=none \ --enable-gtk_ui=no \ + --enable-console_ui=no \ --enable-ssl-hmac=no \ --enable-ssl=yes \ --enable-macaqsnd=no \ --enable-macsnd=no \ --enable-iounit=yes \ --with-gsm=$(prefix) \ + LIBZRTPCPP_CFLAGS="-I$(prefix)/include" \ + LIBZRTPCPP_LIBS="-L$(prefix)/lib -lzrtpcpp -lcrypto" \ + SRTP_LIBS="-L$(prefix)/lib -lsrtp -lcrypto" \ SPEEX_CFLAGS="-I$(prefix)/include" \ SPEEXDSP_CFLAGS="-I$(prefix)/include" \ SPEEXDSP_LIBS="-L$(prefix)/lib -lspeexdsp" \ SPEEX_LIBS="-L$(prefix)/lib -lspeexdsp -lspeex " \ OPENSSL_CFLAGS="-I$(prefix)/include" \ OPENSSL_LIBS="-L$(prefix)/lib -lssl -lcrypto" +ifeq ($(enable_zrtp),yes) + linphone_configure_controls+= --with-srtp=$(prefix) --enable-zrtp=yes --disable-tests +endif + #path BUILDER_SRC_DIR?=$(shell pwd)/../ @@ -56,6 +65,10 @@ speex_dir?=externals/speex gsm_dir?=externals/gsm +srtp_dir?=externals/srtp + +zrtpcpp_dir?=externals/zrtpcpp + MSILBC_SRC_DIR:=$(BUILDER_SRC_DIR)/msilbc MSILBC_BUILD_DIR:=$(BUILDER_BUILD_DIR)/msilbc @@ -65,7 +78,6 @@ LIBILBC_BUILD_DIR:=$(BUILDER_BUILD_DIR)/libilbc-rfc3951 ifneq (,$(findstring arm,$(host))) SPEEX_CONFIGURE_OPTION := --enable-fixed-point --disable-float-api #SPEEX_CONFIGURE_OPTION := --enable-arm5e-asm --enable-fixed-point -else endif @@ -82,17 +94,17 @@ init: veryclean: veryclean-linphone rm -rf $(BUILDER_BUILD_DIR) -.NOTPARALLEL build-linphone: init build-openssl build-osip2 build-eXosip2 build-speex build-libgsm $(LINPHONE_BUILD_DIR)/Makefile +.NOTPARALLEL build-linphone: init build-openssl build-srtp build-zrtpcpp build-osip2 build-eXosip2 build-speex build-libgsm $(LINPHONE_BUILD_DIR)/Makefile cd $(LINPHONE_BUILD_DIR) && export PKG_CONFIG_PATH=$(prefix)/lib/pkgconfig export CONFIG_SITE=$(BUILDER_SRC_DIR)/build/$(config_site) make newdate && make && make install -clean-linphone: clean-osip2 clean-eXosip2 clean-speex clean-libgsm clean-msilbc clean-libilbc clean-openssl clean-msamr +clean-linphone: clean-osip2 clean-eXosip2 clean-speex clean-libgsm clean-srtp clean-zrtpcpp clean-msilbc clean-libilbc clean-openssl clean-msamr cd $(LINPHONE_BUILD_DIR) && make clean -veryclean-linphone: veryclean-osip2 veryclean-eXosip2 veryclean-speex veryclean-libgsm veryclean-msilbc veryclean-libilbc veryclean-openssl veryclean-msamr +veryclean-linphone: veryclean-osip2 veryclean-eXosip2 veryclean-speex veryclean-srtp veryclean-zrtpcpp veryclean-libgsm veryclean-msilbc veryclean-libilbc veryclean-openssl veryclean-msamr #-cd $(LINPHONE_BUILD_DIR) && make distclean -cd $(LINPHONE_SRC_DIR) && rm -f configure -clean-makefile-linphone: clean-makefile-osip2 clean-makefile-eXosip2 clean-makefile-speex clean-makefile-libilbc clean-makefile-msilbc clean-makefile-openssl clean-makefile-msamr +clean-makefile-linphone: clean-makefile-osip2 clean-makefile-eXosip2 clean-makefile-speex clean-makefile-srtp clean-makefile-zrtpcpp clean-makefile-libilbc clean-makefile-msilbc clean-makefile-openssl clean-makefile-msamr cd $(LINPHONE_BUILD_DIR) && rm -f Makefile && rm -f oRTP/Makefile && rm -f mediastreamer2/Makefile @@ -101,6 +113,9 @@ $(LINPHONE_SRC_DIR)/configure: $(LINPHONE_BUILD_DIR)/Makefile: $(LINPHONE_SRC_DIR)/configure mkdir -p $(LINPHONE_BUILD_DIR) + echo -e "\033[1mPKG_CONFIG_PATH=$(prefix)/lib/pkgconfig CONFIG_SITE=$(BUILDER_SRC_DIR)/build/$(config_site) \ + $(LINPHONE_SRC_DIR)/configure -prefix=$(prefix) --host=$(host) ${library_mode} \ + ${linphone_configure_controls}\033[0m" cd $(LINPHONE_BUILD_DIR) && \ PKG_CONFIG_PATH=$(prefix)/lib/pkgconfig CONFIG_SITE=$(BUILDER_SRC_DIR)/build/$(config_site) \ $(LINPHONE_SRC_DIR)/configure -prefix=$(prefix) --host=$(host) ${library_mode} \ @@ -177,18 +192,19 @@ $(BUILDER_BUILD_DIR)/$(speex_dir)/Makefile: $(BUILDER_SRC_DIR)/$(speex_dir)/conf $(BUILDER_SRC_DIR)/$(speex_dir)/configure -prefix=$(prefix) --host=$(host) ${library_mode} --disable-oggtest $(SPEEX_CONFIGURE_OPTION) build-speex: $(BUILDER_BUILD_DIR)/$(speex_dir)/Makefile - cd $(BUILDER_BUILD_DIR)/$(speex_dir)/libspeex && make && make install - cd $(BUILDER_BUILD_DIR)/$(speex_dir)/include && make && make install + cd $(BUILDER_BUILD_DIR)/$(speex_dir)/libspeex && make && make install + cd $(BUILDER_BUILD_DIR)/$(speex_dir)/include && make && make install clean-speex: - cd $(BUILDER_BUILD_DIR)/$(speex_dir) && make clean + cd $(BUILDER_BUILD_DIR)/$(speex_dir) && make clean veryclean-speex: # -cd $(BUILDER_BUILD_DIR)/$(speex_dir) && make distclean -rm -f $(BUILDER_SRC_DIR)/$(speex_dir)/configure clean-makefile-speex: - cd $(BUILDER_BUILD_DIR)/$(speex_dir) && rm -f Makefile + cd $(BUILDER_BUILD_DIR)/$(speex_dir) && rm -f Makefile + #GSM @@ -260,6 +276,8 @@ clean-makefile-libilbc: cd $(LIBILBC_BUILD_DIR) && rm -f Makefile #openssl +#srtp +#zrtp include builders.d/*.mk #sdk generation and distribution diff --git a/submodules/build/builders.d/openssl.mk b/submodules/build/builders.d/openssl.mk index 54a2b517e..0b2e5bf80 100644 --- a/submodules/build/builders.d/openssl.mk +++ b/submodules/build/builders.d/openssl.mk @@ -14,7 +14,7 @@ $(OPENSSL_BUILD_DIR)/Configure: && tar xvzf openssl-$(openssl_version).tar.gz \ && rm -f openssl-$(openssl_version).tar.gz \ && mv openssl-$(openssl_version) openssl \ - && cd openssl && patch -p0 < $(BUILDER_SRC_DIR)/build/openssl.patch + && cd openssl && patch -p0 < $(BUILDER_SRC_DIR)/build/builders.d/openssl.patch $(OPENSSL_BUILD_DIR)/Makefile: $(OPENSSL_BUILD_DIR)/Configure cd $(OPENSSL_BUILD_DIR) \ diff --git a/submodules/build/openssl.patch b/submodules/build/builders.d/openssl.patch similarity index 100% rename from submodules/build/openssl.patch rename to submodules/build/builders.d/openssl.patch diff --git a/submodules/build/builders.d/srtp.mk b/submodules/build/builders.d/srtp.mk new file mode 100644 index 000000000..85e338231 --- /dev/null +++ b/submodules/build/builders.d/srtp.mk @@ -0,0 +1,35 @@ +srtp_version?=1.4.4 +#srtp_url?=http://srtp.sourceforge.net/srtp-$(srtp_version).tgz +srtp_url=http://sourceforge.net/projects/srtp/files/srtp/$(srtp_version)/srtp-$(srtp_version).tgz/download +srtp_tgz_file=srtp-$(srtp_version).tgz + +$(BUILDER_SRC_DIR)/externals/$(srtp_tgz_file): + cd $(BUILDER_SRC_DIR)/externals \ + && wget $(srtp_url) -O $(srtp_tgz_file) + +$(BUILDER_SRC_DIR)/$(srtp_dir)/configure: $(BUILDER_SRC_DIR)/externals/$(srtp_tgz_file) + cd $(BUILDER_SRC_DIR)/externals \ + && tar zxvf $(srtp_tgz_file) \ + && cd srtp && patch -p0 < $(BUILDER_SRC_DIR)/build/builders.d/srtp.patch + +$(BUILDER_BUILD_DIR)/$(srtp_dir)/Makefile: $(BUILDER_SRC_DIR)/$(srtp_dir)/configure + mkdir -p $(BUILDER_BUILD_DIR)/$(srtp_dir) + cd $(BUILDER_BUILD_DIR)/$(srtp_dir)/\ + && CONFIG_SITE=$(BUILDER_SRC_DIR)/build/$(config_site) \ + $(BUILDER_SRC_DIR)/$(srtp_dir)/configure -prefix=$(prefix) --host=$(host) ${library_mode} + +build-srtp: $(BUILDER_BUILD_DIR)/$(srtp_dir)/Makefile + cp -rf $(BUILDER_SRC_DIR)/$(srtp_dir)/include $(BUILDER_BUILD_DIR)/$(srtp_dir) + cp -rf $(BUILDER_SRC_DIR)/$(srtp_dir)/crypto/include $(BUILDER_BUILD_DIR)/$(srtp_dir) + -cd $(BUILDER_BUILD_DIR)/$(srtp_dir) && make uninstall && make clean + cd $(BUILDER_BUILD_DIR)/$(srtp_dir) && make libsrtp.a && make install + +clean-srtp: + cd $(BUILDER_BUILD_DIR)/$(srtp_dir) && make clean + +veryclean-srtp: + -cd $(BUILDER_BUILD_DIR)/$(srtp_dir) && make distclean + +clean-makefile-srtp: + cd $(BUILDER_BUILD_DIR)/$(srtp_dir) && rm -f Makefile + diff --git a/submodules/build/builders.d/srtp.patch b/submodules/build/builders.d/srtp.patch new file mode 100644 index 000000000..c3d127b13 --- /dev/null +++ b/submodules/build/builders.d/srtp.patch @@ -0,0 +1,24 @@ +diff -rupN ../srtp_old/crypto/cipher/aes_icm.c ./crypto/cipher/aes_icm.c +--- ../srtp_old/crypto/cipher/aes_icm.c 2006-03-16 18:11:29.000000000 +0100 ++++ ./crypto/cipher/aes_icm.c 2011-09-06 10:19:16.000000000 +0200 +@@ -281,7 +281,7 @@ aes_icm_set_iv(aes_icm_ctx_t *c, void *i + * this is an internal, hopefully inlined function + */ + +-inline void ++static void + aes_icm_advance_ismacryp(aes_icm_ctx_t *c, uint8_t forIsmacryp) { + /* fill buffer with new keystream */ + v128_copy(&c->keystream_buffer, &c->counter); +diff -rupN ../srtp_old/crypto/math/datatypes.c ./crypto/math/datatypes.c +--- ../srtp_old/crypto/math/datatypes.c 2005-10-08 18:38:06.000000000 +0200 ++++ ./crypto/math/datatypes.c 2011-09-06 10:02:55.000000000 +0200 +@@ -124,7 +124,7 @@ octet_string_hex_string(const void *s, i + return bit_string; + } + +-inline int ++static int + hex_char_to_nibble(uint8_t c) { + switch(c) { + case ('0'): return 0x0; diff --git a/submodules/build/builders.d/zrtp.mk b/submodules/build/builders.d/zrtp.mk new file mode 100644 index 000000000..97a43f9e9 --- /dev/null +++ b/submodules/build/builders.d/zrtp.mk @@ -0,0 +1,36 @@ +$(BUILDER_SRC_DIR)/$(zrtpcpp_dir)/CMakeLists.txt.tracker: $(BUILDER_SRC_DIR)/build/builders.d/zrtpcpp.CMakeLists.txt + cp $(BUILDER_SRC_DIR)/build/builders.d/zrtpcpp.CMakeLists.txt $(BUILDER_SRC_DIR)/$(zrtpcpp_dir)/CMakeLists.txt + + +#I coudn't manage to crosscompile using only -D arguments to cmake +#Thus the use of a toolchain file. +TC = -DCMAKE_TOOLCHAIN_FILE=$(BUILDER_SRC_DIR)build/iphone-toolchain.cmake$(tc_proc) +$(BUILDER_BUILD_DIR)/$(zrtpcpp_dir)/Makefile: $(BUILDER_SRC_DIR)/$(zrtpcpp_dir)/CMakeLists.txt.tracker + mkdir -p $(BUILDER_BUILD_DIR)/$(zrtpcpp_dir) + cd $(BUILDER_BUILD_DIR)/$(zrtpcpp_dir)/\ + && host_alias=$(host) . $(BUILDER_SRC_DIR)/build/$(config_site) \ + && cmake $(BUILDER_SRC_DIR)/$(zrtpcpp_dir) -Denable-ccrtp=false $(TC) -LH -Wdev -DCMAKE_INSTALL_PREFIX=$(prefix) -DCMAKE_FIND_ROOT_PATH="$(prefix)" +# Used toolchain: $(TC) + +ifeq ($(enable_zrtp),yes) + +build-zrtpcpp: $(BUILDER_BUILD_DIR)/$(zrtpcpp_dir)/Makefile + echo "Build ZRTP - prefix $(prefix)" + cd $(BUILDER_BUILD_DIR)/$(zrtpcpp_dir) && make VERBOSE=1 && make install + +else +build-zrtpcpp: + echo "Build of zrtpcpp disabled" +endif + +clean-zrtpcpp: + -cd $(BUILDER_BUILD_DIR)/$(zrtpcpp_dir) && make clean + +clean-makefile-zrtpcpp: clean-zrtpcpp + -rm -f $(BUILDER_BUILD_DIR)/$(zrtpcpp_dir)/Makefile + -rm -f $(BUILDER_BUILD_DIR)/$(zrtpcpp_dir)/CMakeCache.txt + +veryclean-zrtpcpp: + -rm $(BUILDER_SRC_DIR)/$(zrtpcpp_dir) + + diff --git a/submodules/build/builders.d/zrtpcpp.CMakeLists.txt b/submodules/build/builders.d/zrtpcpp.CMakeLists.txt new file mode 100755 index 000000000..4f20891f6 --- /dev/null +++ b/submodules/build/builders.d/zrtpcpp.CMakeLists.txt @@ -0,0 +1,169 @@ +# Copyright (C) 2009 Werner Dittman +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +cmake_minimum_required(VERSION 2.6) + +PROJECT(libzrtpcpp) + +SET(CPACK_PACKAGE_VERSION_MAJOR 2) +SET(CPACK_PACKAGE_VERSION_MINOR 0) +SET(CPACK_PACKAGE_VERSION_PATCH 0) + +set (VERSION 2.0.0) +set (SOVERSION 2) +set (PACKAGE libzrtpcpp) + +if(MSVC60) + set(BUILD_STATIC ON CACHE BOOL "static linking only" FORCE) + MARK_AS_ADVANCED(BUILD_STATIC) +else() + option(BUILD_STATIC "Set to OFF to build shared libraries" ON) +endif() + +# set to true for debug and trace during CMakeLists development +set(CMAKE_VERBOSE_MAKEFILE FALSE) + +MESSAGE( STATUS "Configuring GNU ${PROJECT_NAME} ${VERSION}...") + +# include most of the fine stuff we need +include(cmake/Modules/FindGcryptConfig.cmake) +include(FindPkgConfig) +include(CheckLibraryExists) +include(CheckIncludeFiles) +include(cmake/Modules/AutoArgs.cmake) + +if(${PROJECT_NAME} STREQUAL ${CMAKE_PROJECT_NAME}) + include(cmake/Modules/GeneratePackage.cmake) + + GENERATE_PACKAGING(${PACKAGE} ${VERSION}) +endif() + +# check the -Denable-ccrtp setting, defaults to true +enable_arg(ccrtp true "Enable GNU ccRTP support for GNU ZRTP") +args_help() + +# this caused problems in debian where it has to always be lib.... +set(LIBDIRNAME "lib") +if (NOT EXISTS /etc/debian_version) + if ( "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64" ) + set(LIBDIRNAME "lib64") + endif() +endif() + +# setup the Thread include and lib +find_package(Threads) +if(CMAKE_HAVE_PTHREAD_H) + set(HAVE_PTHREAD_H TRUE) +endif() +set(LIBS ${LIBS} ${CMAKE_THREAD_LIBS_INIT}) + +if(enable_ccrtp) + if (USES_CCRTP_INCLUDE_DIRS) + message(STATUS " Using local commoncpp dependency") + else() + find_package(PkgConfig) + pkg_check_modules(USES_CCRTP libccrtp>=2.0.0) + endif() + include_directories(${USES_CCRTP_INCLUDE_DIRS}) + link_directories(${USES_CRTP_LIBRARY_DIRS}) + add_definitions(${USES_CCRTP_CFLAGS}) + set (LIBS ${LIBS} ${USES_CCRTP_LDFLAGS} ${USES_CCRTP_LIBRARIES}) +endif() + +if (CMAKE_CROSSCOMPILING) + include_directories(${CMAKE_INSTALL_PREFIX}/include) + link_directories(${CMAKE_INSTALL_PREFIX}/lib) + set(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES} ${CMAKE_INSTALL_PREFIX}/include") +## set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_INSTALL_PREFIX}/lib/*") +endif() + + +# now get info about crypto libraries +gcr_check(GCRYPT gcrypt) +#if(GCRYPT_FOUND) +# check_include_files(gcrypt.h HAVE_GCRYPT_H) +# set(LIBS ${LIBS} ${GCRYPT_LIBRARIES}) +# set(BUILD_REQ "libgcrypt-devel") +# set(CRYPTOBACKEND="") +# set(PACKAGE_REQ "libgcrypt") +#else() + pkg_check_modules(OPENSSL libcrypto>=0.9.8) + if (OPENSSL_FOUND) + check_include_files(openssl/bn.h HAVE_OPENSSL_BN_H) + check_include_files(openssl/aes.h HAVE_OPENSSL_AES_H) + check_include_files(openssl/sha.h HAVE_OPENSSL_SHA_H) + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -lcrypto") + check_library_exists(crypto EVP_CipherInit_ex "${CMAKE_INSTALL_PREFIX}/lib" HAVE_SSL_CRYPT) +# don't test HAVE_SSL_CRYPT_FOUND as it doesn't work + if (HAVE_OPENSSL_BN_H_FOUND) +# AND HAVE_OPENSSL_AES_H_FOUND AND HAVE_OPENSSL_SHA_H_FOUND)) + message(FATAL_ERROR "Openssl crypto library not found") + endif() + set(LIBS ${LIBS} -lcrypto) + set(CRYPTOBACKEND "libcrypto >= 0.9.8") + set(BUILD_REQ "libopenssl-devel >= 0.9.8") + set(PACKAGE_REQ "libopenssl >= 0.9.8") + else() + message(FATAL_ERROR "No crypto library found") + endif() +#endif() + +check_include_files(stdlib.h HAVE_STDLIB_H) +check_include_files(string.h HAVE_STRING_H) + +# necessary and required modules checked, ready to generate config.h +configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) + +# the following set(...) commands are only to have backward +# compatibility with autoconf stuff to generate the pc file +set(prefix ${CMAKE_INSTALL_PREFIX}) +set(exec_prefix ${prefix}/bin) +set(libdir ${prefix}/lib) +set(includedir ${prefix}/include) +set(PACKAGE pkgconfig) +configure_file(libzrtpcpp.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libzrtpcpp.pc @ONLY) + +configure_file(libzrtpcpp.spec.cmake ${CMAKE_CURRENT_BINARY_DIR}/libzrtpcpp.spec @ONLY) + +include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src) + +add_definitions(-g -O2 -fno-strict-aliasing) +if(CMAKE_COMPILER_IS_GNUCXX) + add_definitions(-Wno-long-long -Wno-char-subscripts) + add_definitions(-Wall -ansi -pedantic) + add_definitions(-DNEW_STDCPP) +# add_definitions(-D__EXPORT=) +endif() + +add_subdirectory(src) + +if (enable_ccrtp) + add_subdirectory(demo) +endif() + +if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/package/) + MESSAGE(STATUS "package dir not found") + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/package/) +endif() + +########### install files ############### +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libzrtpcpp.pc DESTINATION ${LIBDIRNAME}/pkgconfig) + +if(${PROJECT_NAME} STREQUAL ${CMAKE_PROJECT_NAME}) + + ########### Add uninstall target ############### + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" + IMMEDIATE @ONLY) + add_custom_target(uninstall + "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") + +endif() diff --git a/submodules/build/iphone-config.site b/submodules/build/iphone-config.site index fb13cfd87..14f86c1f8 100644 --- a/submodules/build/iphone-config.site +++ b/submodules/build/iphone-config.site @@ -3,16 +3,22 @@ GCC_VERSION=4.2 SDK_VERSION_MAJOR=4 SDK_VERSION=4.0 - +MCPU="" if test "${host_alias}" = "i386-apple-darwin" ; then PLATFORM=Simulator ARCH=i386 + CMAKE_OPTS="-DCMAKE_SYSTEM_PROCESSOR=i386" + MCPU="" elif test "${host_alias}" = "armv6-apple-darwin" ; then ARCH=armv6 PLATFORM=OS + CMAKE_OPTS="-DCMAKE_SYSTEM_PROCESSOR=arm" + MCPU="-mcpu=arm1176jzf-s" elif test "${host_alias}" = "armv7-apple-darwin" ; then ARCH=armv7 PLATFORM=OS + CMAKE_OPTS="-DCMAKE_SYSTEM_PROCESSOR=arm" + MCPU="-mcpu=cortex-a8" else echo "bad host ${host_alias} must be either i386-apple-darwin or armv6-apple-darwin" exit @@ -23,11 +29,28 @@ SDK_PATH_LIST=`ls -drt /Developer/Platforms/iPhone${PLATFORM}.platform/Developer SDK_BIN_PATH=/Developer/Platforms/iPhone${PLATFORM}.platform/Developer/usr/bin for SYSROOT_PATH in $SDK_PATH_LIST ; do echo $SYSROOT_PATH ; done ; echo "Selecting SDK path = ${SYSROOT_PATH}" -CC="${SDK_BIN_PATH}/gcc-${GCC_VERSION} -std=c99 -arch ${ARCH} -isysroot ${SYSROOT_PATH} -miphoneos-version-min=${SDK_VERSION} -DTARGET_OS_IPHONE" -CXX="${SDK_BIN_PATH}/g++-${GCC_VERSION} -arch ${ARCH} -isysroot ${SYSROOT_PATH} -miphoneos-version-min=${SDK_VERSION} -DTARGET_OS_IPHONE" +COMMON_FLAGS=" -arch ${ARCH} ${MCPU} -isysroot ${SYSROOT_PATH} -miphoneos-version-min=${SDK_VERSION} -DTARGET_OS_IPHONE" +CC="${SDK_BIN_PATH}/gcc-${GCC_VERSION} -std=c99 $COMMON_FLAGS" +CXX="${SDK_BIN_PATH}/g++-${GCC_VERSION} $COMMON_FLAGS" LD="${SDK_BIN_PATH}/ld-${GCC_VERSION} -arch ${ARCH}" AR=${SDK_BIN_PATH}/ar RANLIB=${SDK_BIN_PATH}/ranlib CPPFLAGS="-Dasm=__asm" LDFLAGS="-Wl,-syslibroot,${SYSROOT_PATH} -framework CFNetwork" + +export CC CXX LD CFLAGS="${COMMON_FLAGS} ${CFLAGS}" CXXFLAGS="${COMMON_FLAG} ${CPPFLAGS}" CPPFLAGS="${COMMON_FLAG} ${CPPFLAGS}" LDFLAGS="${LDFLAGS} ${COMMON_FLAGS}" + +# CMAKE options (not working right now so information duplicated in .cmake toolchains). +DEVROOT=/Developer/Platforms/iPhoneOS.platform/Developer +SDKVER=4.3 +export CMAKE_OPTS="${CMAKE_OPTS} \ + -DCMAKE_SYSTEM_NAME=Generic \ + -DSDKVER=${SDKVER} \ + -DDEVROOT=${DEVROOT} \ + -DSDKROOT=${DEVROOT}/SDKs/iPhoneOS${SDKVER}.sdk \ + -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \ + -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \ + -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \ + " + diff --git a/submodules/build/iphone-toolchain.cmake b/submodules/build/iphone-toolchain.cmake new file mode 100644 index 000000000..7f46ad8bb --- /dev/null +++ b/submodules/build/iphone-toolchain.cmake @@ -0,0 +1,13 @@ +SET (CMAKE_SYSTEM_NAME "Generic") +SET (CMAKE_SYSTEM_PROCESSOR "arm") + +SET (SDKVER "4.3") +SET (DEVROOT "/Developer/Platforms/iPhoneOS.platform/Developer") +SET (SDKROOT "${DEVROOT}/SDKs/iPhoneOS${SDKVER}.sdk") + +SET (CMAKE_FIND_ROOT_PATH "${CMAKE_INSTALL_PREFIX}" "${SDKROOT}" "${DEVROOT}") +SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + + diff --git a/submodules/build/iphone-toolchain.cmake.i386 b/submodules/build/iphone-toolchain.cmake.i386 new file mode 100644 index 000000000..0c7c1a5e5 --- /dev/null +++ b/submodules/build/iphone-toolchain.cmake.i386 @@ -0,0 +1,13 @@ +SET (CMAKE_SYSTEM_NAME "Generic") +SET (CMAKE_SYSTEM_PROCESSOR "i386") + +SET (SDKVER "4.3") +SET (DEVROOT "/Developer/Platforms/iPhoneOS.platform/Developer") +SET (SDKROOT "${DEVROOT}/SDKs/iPhoneOS${SDKVER}.sdk") + +SET (CMAKE_FIND_ROOT_PATH "${CMAKE_INSTALL_PREFIX}" "${SDKROOT}" "${DEVROOT}") +SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + + diff --git a/submodules/externals/zrtpcpp b/submodules/externals/zrtpcpp new file mode 160000 index 000000000..3cbbcf29f --- /dev/null +++ b/submodules/externals/zrtpcpp @@ -0,0 +1 @@ +Subproject commit 3cbbcf29f707adaaa00958c6e2c321e79a7b8e83 diff --git a/submodules/linphone b/submodules/linphone index f7bb65c20..20709fc5f 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit f7bb65c20e8809708b74ab73658a9ea1e154c8f0 +Subproject commit 20709fc5f1b06c04f2311e1f6ec4ff45f76f4de8