本文主要是介绍移植libjingle v0.5x for IOS(iphone device + iphone simulator),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
gtalk基本上可以算是非常好的聊天工具了,而它是如何工作的呢?我们如何在iphone上面为自己写一个gtalk玩一下呢?这一切都是基于libjingle这个库,这个Google Talk Voice and P2P interoperability Library.libjingle这个库是一个用c++写的跨平台的库,它能很好运行在win/mac os/linux(include android)/prosix 等平台,当然也能运行在iphone平台,毕竟ios也是unix系统,但是前面的几个平台可能并不需要对libjingle库做一些程序改动就可以很好的运行了,但是ios平台却不一样,因为libjingle库中对mac os的支持代码中,有一部分代码仅仅适用于mac os,并不适用于有众多限制的ios平台,所以其实如果想移植libjingle 到ios还是需要一些改动的,在下不才,顺利完成了这次移植,希望本文能够给你带来帮助,在些感谢libjingle project owner and ilibjingle project owner:
(转载请保留此文字:本文来源:移植libjingle v0.5x for IOS(iphone device + iphone simulator) http://blog.csdn.net/ipromiseu/archive/2011/01/14/6140115.aspx] write by Gray.Luo guohui.great@gmail.com)
一.environment setting:
---------------------------------------------------------------------------
<1> First, install Python 2.4 or later from http://www.python.org/
<2> Second ,install the stand alone scons-local package 2.0.0 or later from
http://www.scons.org/download.php and set an environment variable,
SCONS_DIR, to point to the directory containing SCons:
for example:
$vim /User/gray/.profile
Enter the following content:
- #set env of SCONS_DIR
- export SCONS_DIR=/Users/anson/Documents/work/scons-local-2.0.1/scons-local-2.0.1/
$sourece /User/gray/.profile
<3> Third, install swtoolkit from http://code.google.com/p/swtoolkit/.
We just download it into a place(eg:/User/gray/..../swtoolkit), It's a green tool.
<4>Finally, Libjingle depends on 3 open-source projects, expat , srtp and openssl.
Download expat from http://sourceforge.net/projects/expat/ to
talk/third_party/expat-2.0.1/.
Download srtp from http://libjingle.googlecode.com/files/srtp-cvs.zip to
talk/third_party/srtp/.
note:Don't download srtp from it's official website.only one google version can work for libjingle
Download openssl source code to
talk/third_party/openssl-1.0.0.
二. Modify Build Parameters
---------------------------------------------------------------------------
1.Modify main.scons
[iphone Simulator]:
(1) Change
'-isysroot', '/Developer/SDKs/MacOSX10.5.sdk',
to
'-isysroot', '/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.2.sdk',
(2)Add the following content into # M A C OSX Block
mac_env.Replace(CC = '/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2')
mac_env.Replace(CXX = '/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2')
(3)Add 'CoreAudio', 'QuickTime', 'Cocoa', and 'QTKit' to the FRAMEWORKS variable.
[iphone Device]:
(1) Change
'-isysroot', '/Developer/SDKs/MacOSX10.5.sdk',
to
'-isysroot', '/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.2.sdk',
(2)Add the following content into # M A C OSX Block
mac_env.Replace(CC='/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2')
mac_env.Replace(CXX='/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-4.2')
(3)Add 'CoreAudio', 'QuickTime', 'Cocoa', and 'QTKit' to the FRAMEWORKS variable.
(4)Change ['-arch','i386'] to ['-arch', 'armv6'] in mac env setting,
2.Modify libjingle.scons
(1)Comment out some files with "#",because IOS SDK is limited ,So some api is unsupport by IOS:
# "base/macutils.cc",
# "session/phone/devicemanager_mac.mm",
# "base/proxydetect.cc",
(2)Add some Header serach directory in includedirs.
like:
"third_party/openssl-1.0.0/include",
三.Building libjingle:
---------------------------------------------------------------------------
》》》How to build libjingle for iphone Simulator
1.
$ cd libjingle-0.5/talk/third_party/srtp
$ ./configure
2.
$ cd libjingle-0.5/talk/third_party/expat-2.0.1
$ ./configure
3.
$ cd libjingle-0.5/talk/third_party/openssl-1.0.0
$ ./config no-shared no-asm
4.
Build or Download openssl lib(libcrypto.a,libssl.a) for iphonesimulator to talk/build/dbg/lib
5.$/User/gray/..../swtoolkit/hammer.sh
》》》How to build libjingle for iphone
1.
$cd libjingle-0.5/talk/third_party/srtp
$./configure --host=arm CC=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 CXX=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-4.2
2.
$cd libjingle-0.5/talk/third_party/expat-2.0.1
$./configure --host=arm CC=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 CXX=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-4.2
3.
$cd libjingle-0.5/talk/third_party/openssl-1.0.0
$./config no-shared no-asm
4.
Build or Download openssl lib(libcrypto.a,libssl.a) for iphone device to talk/build/dbg/lib
5.$/User/gray/..../swtoolkit/hammer.sh
四.Modify libjingle source code
---------------------------------------------------------------------------
Refrence : http://code.google.com/p/ilibjingle/
五.XCode setting
You can refrence http://code.google.com/p/ilibjingle/
1.Add libjingle.a path in Library Search Paths
2.Add some Header path in Header Search Paths
like:
/..../talk/third_party/srtp/crypto/include/
/..../talk/third_party/srtp/include/
/..../talk/third_party/expat-2.0.1/
/..../talk/third_party/openssl-1.0.0/include/
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/ /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/ <Multiple values>
这里,我的修改结果为:
/..../talk/third_party/srtp/crypto/include/ --ok
/..../talk/third_party/srtp/include/ --ok
/..../talk/third_party/expat-2.0.1/ --ok
/..../talk/third_party/openssl-1.0.0/include/ --ok ----需要重命名
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/
--instead--/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/QuartzCore.framework/Headers
--instead--/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/
---comment --这里可以是5.0,没有试过,应该可以的
3.GCC_PREPROCESSOR_DEFINITIONS:
POSIX xOSX_USE_COCOA HAMMER_TIME=1 LOGGING=1 FEATURE_ENABLE_SSL FEATURE_ENABLE_VOICEMAIL FEATURE_ENABLE_PSTN HASHNAMESPACE=__gnu_cxx DISABLE_DYNAMIC_CAST HAVE_OPENSSL_SSL_H=1 OS_MACOSX=OS_MACOSX OSX _DEBUG FLAVOR_DBG ENABLE_DEBUG FEATURE_ENABLE_VOICEMAIL EXPAT_RELATIVE_PATH SRTP_RELATIVE_PATH XML_STATIC HAVE_EXPAT_CONFIG_H MAC_OS_X_VERSION_MIN_REQUIRED=1040
(转载请保留此文字:本文来源:移植libjingle v0.5x for IOS(iphone device + iphone simulator) http://blog.csdn.net/ipromiseu/archive/2011/01/14/6140115.aspx] write by Gray.Luo guohui.great@gmail.com
这篇关于移植libjingle v0.5x for IOS(iphone device + iphone simulator)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!