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 [email protected])
一.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:
$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',
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',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>
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 [email protected]
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。