移植libjingle v0.5x for IOS(iphone device + iphone simulator)
2011年01月14日
本Blog用于备忘记录,请尊重转载与原创作品之作者的劳动果实。 本人专注于嵌入式Linux开发,iphone与Android手机软件开发。 gmail(gtalk):guohui.great@gmail.com
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:
-------------------------------------------------- -------------------------
First, install Python 2.4 or later from http://www.python.org/
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 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. 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/Dev eloper/SDKs/iPhoneSimulator3.1.2.sdk', (2)Add the following content into # M A C OSX Block mac_env.Replace(CC = '/Developer/Platforms/iPhoneSimulator.platform/Dev eloper/usr/bin/gcc-4.2') mac_env.Replace(CXX = '/Developer/Platforms/iPhoneSimulator.platform/Dev eloper/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. 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/Develope r/usr/bin/gcc-4.2 CXX=/Developer/Platforms/iPhoneOS.platform/Develop er/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/Develope r/usr/bin/gcc-4.2 CXX=/Developer/Platforms/iPhoneOS.platform/Develop er/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/S DKs/iPhoneOS3.0.sdk/System/Library/Frameworks/Quart zCore.framework/Headers/ /Developer/Platforms/iPhoneSimulator.platform/Deve loper/SDKs/iPhoneSimulator3.0.sdk/System/Library/Fr ameworks/QuartzCore.framework/Headers/
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
2011年01月14日
本Blog用于备忘记录,请尊重转载与原创作品之作者的劳动果实。 本人专注于嵌入式Linux开发,iphone与Android手机软件开发。 gmail(gtalk):guohui.great@gmail.com
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:
-------------------------------------------------- -------------------------
First, install Python 2.4 or later from http://www.python.org/
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 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. 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/Dev eloper/SDKs/iPhoneSimulator3.1.2.sdk', (2)Add the following content into # M A C OSX Block mac_env.Replace(CC = '/Developer/Platforms/iPhoneSimulator.platform/Dev eloper/usr/bin/gcc-4.2') mac_env.Replace(CXX = '/Developer/Platforms/iPhoneSimulator.platform/Dev eloper/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. 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/Develope r/usr/bin/gcc-4.2 CXX=/Developer/Platforms/iPhoneOS.platform/Develop er/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/Develope r/usr/bin/gcc-4.2 CXX=/Developer/Platforms/iPhoneOS.platform/Develop er/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/S DKs/iPhoneOS3.0.sdk/System/Library/Frameworks/Quart zCore.framework/Headers/ /Developer/Platforms/iPhoneSimulator.platform/Deve loper/SDKs/iPhoneSimulator3.0.sdk/System/Library/Fr ameworks/QuartzCore.framework/Headers/
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