[关闭]
@khan-lau 2015-07-22T14:16:02.000000Z 字数 6189 阅读 2683

编译 pjsip 2.4 for iOS

pjsip iOS


1. download source code

下载源码
if wget not exists, run brew install wget

  1. wget http://www.pjsip.org/release/2.4/pjproject-2.4.zip
  2. unzip pjproject-2.4.zip

2. set project

if dos2unix not exists, run brew install dos2unix
准备编译环境

  1. cd pjproject-2.4
  2. chmod +x aconfigure
  3. chmod +x configure-iphone
  4. dos2unix configure-iphone
  1. echo '#define PJ_CONFIG_IPHONE 1' > ./pjlib/include/pj/config_site.h
  2. echo '#include <pj/config_site_sample.h>' >> ./pjlib/include/pj/config_site.h
  3. echo $'\n' >> ./pjlib/include/pj/config_site.h

vim configure-iphone
insert code

  1. if [ "$ARCH" = "-arch x86_64" ]; then
  2. DEVPATH="/Applications/XCode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer"
  3. echo "$F: Simulator 64bit, using ${DEVPATH}"
  4. fi
  5. if [ "$ARCH" = "-arch i386" ]; then
  6. DEVPATH="/Applications/XCode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer"
  7. echo "$F: Simulator 32bit, using ${DEVPATH}"
  8. fi

in line 25

3. build library

  1. mkdir sip
  1. sudo ARCH='-arch armv7' ./configure-iphone --prefix=/Users/Khan/Downloads/pjproject-2.4/sip/armv7
  2. make dep && make clean && make
  3. make install
  1. sudo ARCH='-arch armv7s' ./configure-iphone --prefix=/Users/Khan/Downloads/pjproject-2.4/sip/armv7s
  2. make dep && make clean && make
  3. make install
  1. sudo ARCH='-arch arm64' ./configure-iphone --prefix=/Users/Khan/Downloads/pjproject-2.4/sip/arm64
  2. make dep && make clean && make
  3. make install
  1. sudo ARCH="-arch i386" CFLAGS="-O2 -m64 -mios-simulator-version-min=6.0" LDFLAGS="-O2 -m64 -mios-simulator-version-min=6.0" ./configure-iphone --prefix=/Users/Khan/Downloads/pjproject-2.4/sip/x86
  2. make dep && make clean && make
  3. make install
  1. sudo ARCH="-arch x86_64" CFLAGS="-O2 -m64 -mios-simulator-version-min=6.0" LDFLAGS="-O2 -m64 -mios-simulator-version-min=6.0" ./configure-iphone --prefix=/Users/Khan/Downloads/pjproject-2.4/sip/x64
  2. make dep && make clean && make
  3. make install

4. lipo library

  1. mkdir sip/all
  2. mkdir sip/all/lib
  1. cd pjproject-2.4/sip
  1. lipo -create arm64/lib/libg7221codec-arm-apple-darwin9.a armv7/lib/libg7221codec-arm-apple-darwin9.a armv7s/lib/libg7221codec-arm-apple-darwin9.a x64/lib/libg7221codec-arm-apple-darwin9.a x86/lib/libg7221codec-arm-apple-darwin9.a -output all/lib/libg7221codec.a
  2. lipo -create arm64/lib/libgsmcodec-arm-apple-darwin9.a armv7/lib/libgsmcodec-arm-apple-darwin9.a armv7s/lib/libgsmcodec-arm-apple-darwin9.a x64/lib/libgsmcodec-arm-apple-darwin9.a x86/lib/libgsmcodec-arm-apple-darwin9.a -output all/lib/libgsmcodec.a
  3. lipo -create arm64/lib/libilbccodec-arm-apple-darwin9.a armv7/lib/libilbccodec-arm-apple-darwin9.a armv7s/lib/libilbccodec-arm-apple-darwin9.a x64/lib/libilbccodec-arm-apple-darwin9.a x86/lib/libilbccodec-arm-apple-darwin9.a -output all/lib/libilbccodec.a
  4. lipo -create arm64/lib/libpj-arm-apple-darwin9.a armv7/lib/libpj-arm-apple-darwin9.a armv7s/lib/libpj-arm-apple-darwin9.a x64/lib/libpj-arm-apple-darwin9.a x86/lib/libpj-arm-apple-darwin9.a -output all/lib/libpj.a
  5. lipo -create arm64/lib/libpjlib-util-arm-apple-darwin9.a armv7/lib/libpjlib-util-arm-apple-darwin9.a armv7s/lib/libpjlib-util-arm-apple-darwin9.a x64/lib/libpjlib-util-arm-apple-darwin9.a x86/lib/libpjlib-util-arm-apple-darwin9.a -output all/lib/libpjlib-util.a
  6. lipo -create arm64/lib/libpjmedia-arm-apple-darwin9.a armv7/lib/libpjmedia-arm-apple-darwin9.a armv7s/lib/libpjmedia-arm-apple-darwin9.a x64/lib/libpjmedia-arm-apple-darwin9.a x86/lib/libpjmedia-arm-apple-darwin9.a -output all/lib/libpjmedia.a
  7. lipo -create arm64/lib/libpjmedia-audiodev-arm-apple-darwin9.a armv7/lib/libpjmedia-audiodev-arm-apple-darwin9.a armv7s/lib/libpjmedia-audiodev-arm-apple-darwin9.a x64/lib/libpjmedia-audiodev-arm-apple-darwin9.a x86/lib/libpjmedia-audiodev-arm-apple-darwin9.a -output all/lib/libpjmedia-audiodev.a
  8. lipo -create arm64/lib/libpjmedia-codec-arm-apple-darwin9.a armv7/lib/libpjmedia-codec-arm-apple-darwin9.a armv7s/lib/libpjmedia-codec-arm-apple-darwin9.a x64/lib/libpjmedia-codec-arm-apple-darwin9.a x86/lib/libpjmedia-codec-arm-apple-darwin9.a -output all/lib/libpjmedia-codec.a
  9. lipo -create arm64/lib/libpjmedia-videodev-arm-apple-darwin9.a armv7/lib/libpjmedia-videodev-arm-apple-darwin9.a armv7s/lib/libpjmedia-videodev-arm-apple-darwin9.a x64/lib/libpjmedia-videodev-arm-apple-darwin9.a x86/lib/libpjmedia-videodev-arm-apple-darwin9.a -output all/lib/libpjmedia-videodev.a
  10. lipo -create arm64/lib/libpjnath-arm-apple-darwin9.a armv7/lib/libpjnath-arm-apple-darwin9.a armv7s/lib/libpjnath-arm-apple-darwin9.a x64/lib/libpjnath-arm-apple-darwin9.a x86/lib/libpjnath-arm-apple-darwin9.a -output all/lib/libpjnath.a
  11. lipo -create arm64/lib/libpjsip-arm-apple-darwin9.a armv7/lib/libpjsip-arm-apple-darwin9.a armv7s/lib/libpjsip-arm-apple-darwin9.a x64/lib/libpjsip-arm-apple-darwin9.a x86/lib/libpjsip-arm-apple-darwin9.a -output all/lib/libpjsip.a
  12. lipo -create arm64/lib/libpjsip-simple-arm-apple-darwin9.a armv7/lib/libpjsip-simple-arm-apple-darwin9.a armv7s/lib/libpjsip-simple-arm-apple-darwin9.a x64/lib/libpjsip-simple-arm-apple-darwin9.a x86/lib/libpjsip-simple-arm-apple-darwin9.a -output all/lib/libpjsip-simple.a
  13. lipo -create arm64/lib/libpjsip-ua-arm-apple-darwin9.a armv7/lib/libpjsip-ua-arm-apple-darwin9.a armv7s/lib/libpjsip-ua-arm-apple-darwin9.a x64/lib/libpjsip-ua-arm-apple-darwin9.a x86/lib/libpjsip-ua-arm-apple-darwin9.a -output all/lib/libpjsip-ua.a
  14. lipo -create arm64/lib/libpjsua-arm-apple-darwin9.a armv7/lib/libpjsua-arm-apple-darwin9.a armv7s/lib/libpjsua-arm-apple-darwin9.a x64/lib/libpjsua-arm-apple-darwin9.a x86/lib/libpjsua-arm-apple-darwin9.a -output all/lib/libpjsua.a
  15. lipo -create arm64/lib/libpjsua2-arm-apple-darwin9.a armv7/lib/libpjsua2-arm-apple-darwin9.a armv7s/lib/libpjsua2-arm-apple-darwin9.a x64/lib/libpjsua2-arm-apple-darwin9.a x86/lib/libpjsua2-arm-apple-darwin9.a -output all/lib/libpjsua2.a
  16. lipo -create arm64/lib/libresample-arm-apple-darwin9.a armv7/lib/libresample-arm-apple-darwin9.a armv7s/lib/libresample-arm-apple-darwin9.a x64/lib/libresample-arm-apple-darwin9.a x86/lib/libresample-arm-apple-darwin9.a -output all/lib/libresample.a
  17. lipo -create arm64/lib/libspeex-arm-apple-darwin9.a armv7/lib/libspeex-arm-apple-darwin9.a armv7s/lib/libspeex-arm-apple-darwin9.a x64/lib/libspeex-arm-apple-darwin9.a x86/lib/libspeex-arm-apple-darwin9.a -output all/lib/libspeex.a
  18. lipo -create arm64/lib/libsrtp-arm-apple-darwin9.a armv7/lib/libsrtp-arm-apple-darwin9.a armv7s/lib/libsrtp-arm-apple-darwin9.a x64/lib/libsrtp-arm-apple-darwin9.a x86/lib/libsrtp-arm-apple-darwin9.a -output all/lib/libsrtp.a
  1. cp arm64/include all/

5. 附录:安装 brew 环境

参考文章- OSX 10.10上编译安装 pyside 组件

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注