lame静态库制作

来源:互联网 发布:九云图软件 编辑:程序博客网 时间:2024/06/08 09:48

准备,在下面地址下载原料

http://sourceforge.net/projects/lame/files/lame

检查Xcode是否安装了命令行




在桌面建立一个lame文件夹后,打开终端

Last login: Sun Nov 27 19:35:16 on console

targetclouddeMacBook-Pro:~ targetcloud$ cd /Users/targetcloud/Desktop/lame 

targetclouddeMacBook-Pro:lame targetcloud$ touch build-lame.sh

targetclouddeMacBook-Pro:lame targetcloud$ open build-lame.sh

//在build-lame.sh中输入下面内容

#!/bin/shCONFIGURE_FLAGS="--disable-shared --disable-frontend"ARCHS="arm64 armv7s x86_64 i386 armv7"# directoriesSOURCE="lame"FAT="fat-lame"SCRATCH="scratch-lame"# must be an absolute pathTHIN=`pwd`/"thin-lame"COMPILE="y"LIPO="y"if [ "$*" ]thenif [ "$*" = "lipo" ]then# skip compileCOMPILE=elseARCHS="$*"if [ $# -eq 1 ]then# skip lipoLIPO=fififiif [ "$COMPILE" ]thenCWD=`pwd`for ARCH in $ARCHSdoecho "building $ARCH..."mkdir -p "$SCRATCH/$ARCH"cd "$SCRATCH/$ARCH"if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]thenPLATFORM="iPhoneSimulator"if [ "$ARCH" = "x86_64" ]thenSIMULATOR="-mios-simulator-version-min=7.0"HOST=x86_64-apple-darwinelseSIMULATOR="-mios-simulator-version-min=5.0"HOST=i386-apple-darwinfielsePLATFORM="iPhoneOS"SIMULATOR=HOST=arm-apple-darwinfiXCRUN_SDK=`echo $PLATFORM | tr '[:upper:]' '[:lower:]'`CC="xcrun -sdk $XCRUN_SDK clang -arch $ARCH"#AS="$CWD/$SOURCE/extras/gas-preprocessor.pl $CC"CFLAGS="-arch $ARCH $SIMULATOR"if ! xcodebuild -version | grep "Xcode [1-6]\."thenCFLAGS="$CFLAGS -fembed-bitcode"fiCXXFLAGS="$CFLAGS"LDFLAGS="$CFLAGS"CC=$CC $CWD/$SOURCE/configure \$CONFIGURE_FLAGS \--host=$HOST \--prefix="$THIN/$ARCH" \CC="$CC" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS"make -j3 installcd $CWDdonefiif [ "$LIPO" ]thenecho "building fat binaries..."mkdir -p $FAT/libset - $ARCHSCWD=`pwd`cd $THIN/$1/libfor LIB in *.adocd $CWDlipo -create `find $THIN -name $LIB` -output $FAT/lib/$LIBdonecd $CWDcp -rf $THIN/$1/include $FATfi

//回到终端输入下面命令

targetclouddeMacBook-Pro:lame targetcloud$ chmod a+x build-lame.sh

targetclouddeMacBook-Pro:lame targetcloud$ sudo -s

Password:

bash-3.2# ./build-lame.sh

...生成过程

targetclouddeMacBook-Pro:~ targetcloud$ lipo -info /Users/targetcloud/Desktop/lame/fat-lame/lib/libmp3lame.a 

Architectures in the fat file: /Users/targetcloud/Desktop/lame/fat-lame/lib/libmp3lame.a are: armv7 armv7s i386 x86_64 arm64 

targetclouddeMacBook-Pro:~ targetcloud$ 


0 0
原创粉丝点击