pjsip编译

来源:互联网 发布:黛堡嘉莱价格淘宝 编辑:程序博客网 时间:2024/06/11 03:32
pjsip编译主要是找到编译器路径,Xcode5开始所有版本,系统的gcc整合到xcrun中了,需要用参数来区分

--------------------------------------------------------------------------------------------------------------

在pjlib/include/pj/目录下增加config_site.h文件,内容如下:

#ifdef __LP_IOS  #define PJ_CONFIG_IPHONE 1  #include <pj/config_site_sample.h>  #define PJMEDIA_HAS_SRTP 0#elif defined(__LP_ANDROID)  #define PJ_CONFIG_ANDROID 1  #include <pj/config_site_sample.h>  #define PJMEDIA_HAS_SRTP 0  #undef PJMEDIA_AUDIO_DEV_HAS_OPENSL  #define PJMEDIA_AUDIO_DEV_HAS_OPENSL  0#endif

注:__LP_IOS、__LP_ANDROID是我编译时自己添加的,用来区分不同平台。

应用工程配置宏定义:PJ_AUTOCONF=1

-------------------------------------------------iPhone编译-------------------------------------------------------------

export CC="xcrun -sdk iphoneos clang"export DEVPATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer"export IPHONESDK="iPhoneOS8.2.sdk"export ARCH="-arch arm64"./configure-iphone --disable-resample --disable-sdl --disable-ffmpeg --disable-v4l2 --disable-speex-aec --disable-speex-codec --disable-l16-codec --disable-g722-codec --disable-g7221-codec --disable-gsm-codec --disable-ssl --disable-floating-point --disable-small-filter --disable-large-filter --disable-opencore-amr --disable-silk --disable-ilbc-codec --disable-sound --disable-ossmake install-iphoneos

----------------------------------------------------iPhone模拟器编译----------------------------------------------------------

export DEVPATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developerexport IPHONESDK="iPhoneSimulator8.2.sdk"export ARCH="-arch i386" export CFLAGS="-O2 -m32 -mios-simulator-version-min=5.0" export LDFLAGS="-O2 -m32 -mios-simulator-version-min=5.0" ./configure-iphone --disable-resample --disable-sdl --disable-ffmpeg --disable-v4l2 --disable-speex-aec --disable-speex-codec --disable-l16-codec --disable-g722-codec --disable-g7221-codec --disable-gsm-codec --disable-ssl --disable-floating-point --disable-small-filter --disable-large-filter --disable-opencore-amr --disable-silk --disable-ilbc-codec --disable-sound --disable-ossmake install-iphonesimulator

把相应的NDK路径改为自己的安装路径即可
------------------------------------------------------Android编译--------------------------------------------------------

export ANDROID_NDK_ROOT=~/Develop/Software/android-ndk-r9d./configure-android --disable-resample --disable-sdl --disable-ffmpeg --disable-v4l2 --disable-speex-aec --disable-speex-codec --disable-l16-codec --disable-g722-codec --disable-g7221-codec --disable-gsm-codec --disable-ssl --disable-floating-point --disable-small-filter --disable-large-filter --disable-opencore-amr --disable-silk --disable-ilbc-codec --disable-sound


一键编译脚本:

1.iPhone

#!/bin/bash############################################################################  Choose your pjproject version and your currently-installed iOS SDK version:#VERSION="2.2.1"SDKVERSION="9.0"############################################################################### Don't change anything under this line!############################################################################# No need to change this since xcode build will only compile in the# necessary bits from the libraries we createARCHS="armv7 armv7s arm64 i386 x86_64"DEVELOPER=`xcode-select -print-path`if [ ! -e "${DEVELOPER}" ]; thenecho "please install xcode!!!"exit 1;fiREPOROOT=$(pwd)# Where we'll end up storing things in the endBUILDDIR="${REPOROOT}/build"mkdir -p $BUILDDIR# where we will keep our sources and build from.#SRCDIR="${BUILDDIR}/src"#mkdir -p $SRCDIR# where we will store intermediary buildsINTERDIR="${BUILDDIR}/built"mkdir -p $INTERDIR#########################################cd $SRCDIR# Exit the script if an error happens#set -e#if [ ! -e "./pjproject-${VERSION}.tar.bz2" ]; then#echo "Downloading pjproject-${VERSION}.tar.bz2"#curl -LO http://pjproject.org/releases/pjproject-${VERSION}.tar.bz2#else#echo "Using pjproject-${VERSION}.tar.bz2"#fi#if [ ! -e "./pjproject" ]; then#tar zxf pjproject-${VERSION}.tar.bz2 -C ./#mv pjproject-${VERSION} pjproject#else#echo "Using existing pjproject dir"#fi#cd "./pjproject"# build and installfor iARCH in ${ARCHS}do    make clean >/dev/null && make distclean >/dev/null    rm build.mak    if [ "${iARCH}" = "i386" ] || [ "${iARCH}" = "x86_64" ];thenPLATFORM="iPhoneSimulator"        export CFLAGS="-O2 -m32 -mios-simulator-version-min=${SDKVERSION}"         export LDFLAGS="-O2 -m32 -mios-simulator-version-min=${SDKVERSION}"elsePLATFORM="iPhoneOS"        #export CFLAGS="-miphoneos-version-min=${SDKVERSION}"fi    mkdir -p "${INTERDIR}/ios-${iARCH}"    export CC="xcrun -sdk iphoneos clang"export DEVPATH="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer"export ARCH="-arch ${iARCH}"export IPHONESDK="${PLATFORM}${SDKVERSION}.sdk"./configure-iphone --prefix="${INTERDIR}/ios-${iARCH}" --disable-resample --disable-sdl --disable-ffmpeg --disable-v4l2 --disable-speex-aec --disable-speex-codec --disable-l16-codec --disable-g722-codec --disable-g7221-codec --disable-gsm-codec --disable-ssl --disable-floating-point --disable-small-filter --disable-large-filter --disable-opencore-amr --disable-silk --disable-sound --disable-oss --disable-ilbc-codec ##########    make dep && make && make install && make clean >/dev/null done###################build iphoneos#####################mkdir -p "${INTERDIR}/ios-iphoneos/lib"cd "${INTERDIR}/ios-armv7/lib"for file in *.adocd ${INTERDIR}xcrun -sdk iphoneos lipo -output ios-iphoneos/lib/$file  -create -arch armv7 ios-armv7/lib/$file -arch armv7s ios-armv7s/lib/$file -arch arm64 ios-arm64/lib/$fileecho "ios-iphoneos $file created."donecp -r ${INTERDIR}/ios-armv7/include ${INTERDIR}/ios-iphoneos/echo "iphoneos Done."        ###################build iphonesimulator#####################        mkdir -p "${INTERDIR}/ios-iphonesimulator/lib"cd "${INTERDIR}/ios-i386/lib"for file in *.adocd ${INTERDIR}xcrun -sdk iphoneos lipo -output ios-iphonesimulator/lib/$file  -create -arch i386 ios-i386/lib/$file -arch x86_64 ios-x86_64/lib/$fileecho "ios-iphonesimulator $file created."done#cp -r ${INTERDIR}/ios-i386/lib ${INTERDIR}/ios-iphonesimulator/cp -r ${INTERDIR}/ios-i386/include ${INTERDIR}/ios-iphonesimulator/echo "iphonesimulator Done."


2.Android
#!/bin/bash############################################################################  Choose your pjproject version and your currently-installed Android SDK version:#VERSION="2.2.1"SDKVERSION=android-19############################################################################### Don't change anything under this line!############################################################################# No need to change this since ndk build will only compile in the# necessary bits from the libraries we createABIS="armeabi armeabi-v7a arm64-v8a x86"NDKPATH=`which ndk-build`DEVELOPER=`dirname ${NDKPATH}`echo "NDK-PATH: $DEVELOPER"if [ "$DEVELOPER" == "" ]; thenecho "ERROR: not found ndk-build"exit 1;fiREPOROOT=$(pwd)# Where we'll end up storing things in the endBUILDDIR="${REPOROOT}/build"mkdir -p $BUILDDIR# where we will keep our sources and build from.#SRCDIR="${BUILDDIR}/src"#mkdir -p $SRCDIR# where we will store intermediary buildsINTERDIR="${BUILDDIR}/built"mkdir -p $INTERDIR######################################### build and installfor iABI in ${ABIS}do    make clean >/dev/null && make distclean >/dev/null    rm build.mak    export ANDROID_NDK_ROOT=${DEVELOPER}APP_PLATFORM=${SDKVERSION} TARGET_ABI=${iABI} ./configure-android --prefix="${INTERDIR}/android-${iABI}" --disable-resample --disable-sdl --disable-ffmpeg --disable-v4l2 --disable-speex-aec --disable-speex-codec --disable-l16-codec --disable-g722-codec --disable-g7221-codec --disable-gsm-codec --disable-ssl --disable-floating-point --disable-small-filter --disable-large-filter --disable-opencore-amr --disable-silk --disable-ilbc-codec --disable-soundmake dep && make && make install && make clean >/dev/null doneecho "android Done."





0 0
原创粉丝点击