Categories: 技术原创

编译opencore-amr for iOS9 并支持 bitcode

不多说,直接上干货

可以打包下载,直接 ./Script.sh 编译

#!/bin/sh

#  Script.sh

#  ios-arm

##  Created by 龚杰洪 on 16/4/7.

set -xe

VERSION=”0.1.3″

SDKVERSION=”9.3″

LIBSRCNAME=”opencore-amr”

CURRENTPATH=`pwd`

mkdir -p “${CURRENTPATH}/src”

tar zxvf ${LIBSRCNAME}-${VERSION}.tar.gz -C “${CURRENTPATH}/src”

cd “${CURRENTPATH}/src/${LIBSRCNAME}-${VERSION}”

DEVELOPER=`xcode-select -print-path`

DEST=”${CURRENTPATH}/lib-ios”

mkdir -p “${DEST}”

ARCHS=”armv7 armv7s arm64 i386 x86_64″

# ARCHS=”armv7″

LIBS=”libopencore-amrnb.a libopencore-amrwb.a”

DEVELOPER=`xcode-select -print-path`

for arch in $ARCHS; do

case $arch in

arm*)

IOSV=”-miphoneos-version-min=7.0″

if [ $arch == “arm64″ ]

then

IOSV=”-miphoneos-version-min=7.0″

fi

echo “Building for iOS $arch ****************”

SDKROOT=”$(xcrun –sdk iphoneos –show-sdk-path)”

CC=”$(xcrun –sdk iphoneos -f clang)”

CXX=”$(xcrun –sdk iphoneos -f clang++)”

CPP=”$(xcrun -sdk iphonesimulator -f clang++)”

CFLAGS=”-isysroot $SDKROOT -arch $arch $IOSV -isystem $SDKROOT/usr/include -fembed-bitcode”

CXXFLAGS=$CFLAGS

CPPFLAGS=$CFLAGS

export CC CXX CFLAGS CXXFLAGS CPPFLAGS

./configure \

–host=arm-apple-darwin \

–prefix=$DEST \

–disable-shared –enable-static

;;

*)

IOSV=”-mios-simulator-version-min=7.0″

echo “Building for iOS $arch*****************”

SDKROOT=`xcodebuild -version -sdk iphonesimulator Path`

CC=”$(xcrun -sdk iphoneos -f clang)”

CXX=”$(xcrun -sdk iphonesimulator -f clang++)”

CPP=”$(xcrun -sdk iphonesimulator -f clang++)”

CFLAGS=”-isysroot $SDKROOT -arch $arch $IOSV -isystem $SDKROOT/usr/include -fembed-bitcode”

CXXFLAGS=$CFLAGS

CPPFLAGS=$CFLAGS

export CC CXX CFLAGS CXXFLAGS CPPFLAGS

./configure \

–prefix=$DEST \

–disable-shared

;;

esac

make > /dev/null

make install

make clean

for i in $LIBS; do

mv $DEST/lib/$i $DEST/lib/$i.$arch

done

done

for i in $LIBS; do

input=””

for arch in $ARCHS; do

input=”$input $DEST/lib/$i.$arch”

done

lipo -create -output $DEST/lib/$i $input

done

龚杰洪

Recent Posts

GOLANG面试八股文-并发控制

背景 协程A执行过程中需要创建…

1 年 ago

MYSQL面试八股文-常见面试问题和答案整理二

索引B+树的理解和坑 MYSQ…

1 年 ago

MYSQL面试八股文-InnoDB的MVCC实现机制

背景 什么是MVCC? MVC…

1 年 ago

MYSQL面试八股文-索引类型和使用相关总结

什么是索引? 索引是一种用于加…

1 年 ago

MYSQL面试八股文-索引优化之全文索引(解决文本搜索问题)

背景:为什么要有全文索引 在当…

1 年 ago