Build Opus Codec for iOS
来源:互联网 发布:唐安琪 知乎 编辑:程序博客网 时间:2024/06/04 18:35
项目中需要使用Opus Codec for iOS, 在github 上找了一个不错的脚本, 对其稍作修改, 编译非常顺利。 如下为脚本代码。
#!/bin/bashVERSION="1.1.2" #Opus VersionSDKVERSION="9.2"MINIOSVERSION="7.0"# by default, we won't build for debugging purposesif [ "${DEBUG}" == "true" ]; then echo "Compiling for debugging ..." OPT_CFLAGS="-O0 -fno-inline -g" OPT_LDFLAGS="" OPT_CONFIG_ARGS="--enable-assertions --disable-asm"else OPT_CFLAGS="-Ofast -flto -g" OPT_LDFLAGS="-flto" OPT_CONFIG_ARGS=""fiARCHS="i386 x86_64 armv7 armv7s arm64"DEVELOPER=`xcode-select -print-path`cd "`dirname \"$0\"`"REPOROOT=$(pwd)OUTPUTDIR="${REPOROOT}/out"mkdir -p ${OUTPUTDIR}/includemkdir -p ${OUTPUTDIR}/libBUILDDIR="${REPOROOT}/build"echo $REPOROOTecho $OUTPUTDIRecho $BUILDDIRSRCDIR=$REPOROOTINTERDIR="${BUILDDIR}/built"mkdir -p $INTERDIRset +eCCACHE=`which ccache`if [ $? == "0" ]; then echo "Building with ccache: $CCACHE" CCACHE="${CCACHE} "else echo "Building without ccache" CCACHE=""fiset -eexport ORIGINALPATH=$PATHfor ARCH in ${ARCHS}do if [ "${ARCH}" == "i386" ] || [ "${ARCH}" == "x86_64" ]; then PLATFORM="iPhoneSimulator" EXTRA_CFLAGS="-arch ${ARCH}" EXTRA_CONFIG="" else PLATFORM="iPhoneOS" EXTRA_CFLAGS="-arch ${ARCH}" EXTRA_CONFIG="--host=arm-apple-darwin" fi mkdir -p "${INTERDIR}/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" ./configure --enable-float-approx --disable-shared --enable-static --with-pic --disable-extra-programs --disable-doc ${EXTRA_CONFIG} \ --prefix="${INTERDIR}/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" \ LDFLAGS="$LDFLAGS ${OPT_LDFLAGS} -fPIE -miphoneos-version-min=${MINIOSVERSION} -L${OUTPUTDIR}/lib" \ CFLAGS="$CFLAGS ${EXTRA_CFLAGS} ${OPT_CFLAGS} -fPIE -miphoneos-version-min=${MINIOSVERSION} -I${OUTPUTDIR}/include -isysroot ${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDKVERSION}.sdk" \ # Build the application and install it to the fake SDK intermediary dir # we have set up. Make sure to clean up afterward because we will re-use # this source tree to cross-compile other targets. make -j4 make install make cleandone########################################echo "Build library..."# These are the libs that comprise libopus.OUTPUT_LIBS="libopus.a"for OUTPUT_LIB in ${OUTPUT_LIBS}; do INPUT_LIBS="" for ARCH in ${ARCHS}; do if [ "${ARCH}" == "i386" ] || [ "${ARCH}" == "x86_64" ]; then PLATFORM="iPhoneSimulator" else PLATFORM="iPhoneOS" fi INPUT_ARCH_LIB="${INTERDIR}/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/lib/${OUTPUT_LIB}" if [ -e $INPUT_ARCH_LIB ]; then INPUT_LIBS="${INPUT_LIBS} ${INPUT_ARCH_LIB}" fi done # Combine the three architectures into a universal library. if [ -n "$INPUT_LIBS" ]; then lipo -create $INPUT_LIBS \ -output "${OUTPUTDIR}/lib/${OUTPUT_LIB}" else echo "$OUTPUT_LIB does not exist, skipping (are the dependencies installed?)" fidonefor ARCH in ${ARCHS}; do if [ "${ARCH}" == "i386" ] || [ "${ARCH}" == "x86_64" ]; then PLATFORM="iPhoneSimulator" else PLATFORM="iPhoneOS" fi cp -R ${INTERDIR}/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/include/* ${OUTPUTDIR}/include/ if [ $? == "0" ]; then # We only need to copy the headers over once. (So break out of forloop # once we get first success.) break fidone####################echo "Building done."echo "Cleaning up..."rm -fr ${INTERDIR}echo "Done."
Reference:
很棒的Opus iOS编译脚本,上面的代码大多从次复制。 https://github.com/chrisballinger/Opus-iOS
2 0
- Build Opus Codec for iOS
- Build Opus Codec for Android
- Opus codec
- Opus codec
- Build/Run Instructions for Codec Engine Examples
- build lame for ios
- Build OpenSSL for iOS
- Build WebRTC For iOS
- ios的opus编译
- Live555 compile for iOS build error
- how to build DLIB for iOS
- Qt for IOS:build from source
- Build/Run Codec Engine Examples
- 开篇:Codec for life
- iOS开发 - Warning: Multiple build commands for output file
- ios build时,Undefined symbols for architecture xxx问题
- # iOS Build Fail: library not found for -lAFNetworking #151
- ios使用opus压缩和解压缩PCM文件
- 有序链表的合并操作
- Ubuntu 16.04下安装Tensorflow(GPU)
- C语言中的进制转换 itoa & sprintf
- C#控制台 用继承输出hello world
- C++类构造函数初始化列表
- Build Opus Codec for iOS
- HDU1166 敌兵布阵
- python系列笔记1
- 官方文档之Cookie
- Make管理器及Makefile的tips
- 剑指offer-机器人的运动范围
- 实现一个so库文件名称为listupper.so,so文件中实现一个函数
- 毕业季,大公司?还是创业公司?
- POJ 3069 Saruman's Army(贪心)