本文主要是介绍lame静态库制作,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
准备,在下面地址下载原料
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"# directories
SOURCE="lame"
FAT="fat-lame"SCRATCH="scratch-lame"
# must be an absolute path
THIN=`pwd`/"thin-lame"COMPILE="y"
LIPO="y"if [ "$*" ]
then
if [ "$*" = "lipo" ]
then
# skip compile
COMPILE=
else
ARCHS="$*"
if [ $# -eq 1 ]
then
# skip lipo
LIPO=
fi
fi
fiif [ "$COMPILE" ]
then
CWD=`pwd`
for ARCH in $ARCHS
do
echo "building $ARCH..."
mkdir -p "$SCRATCH/$ARCH"
cd "$SCRATCH/$ARCH"if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]
then
PLATFORM="iPhoneSimulator"
if [ "$ARCH" = "x86_64" ]
then
SIMULATOR="-mios-simulator-version-min=7.0"
HOST=x86_64-apple-darwin
else
SIMULATOR="-mios-simulator-version-min=5.0"
HOST=i386-apple-darwin
fi
else
PLATFORM="iPhoneOS"
SIMULATOR=
HOST=arm-apple-darwin
fiXCRUN_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]\."
then
CFLAGS="$CFLAGS -fembed-bitcode"
fi
CXXFLAGS="$CFLAGS"
LDFLAGS="$CFLAGS"CC=$CC $CWD/$SOURCE/configure \
$CONFIGURE_FLAGS \
--host=$HOST \
--prefix="$THIN/$ARCH" \
CC="$CC" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS"make -j3 install
cd $CWD
done
fiif [ "$LIPO" ]
then
echo "building fat binaries..."
mkdir -p $FAT/lib
set - $ARCHS
CWD=`pwd`
cd $THIN/$1/lib
for LIB in *.a
do
cd $CWD
lipo -create `find $THIN -name $LIB` -output $FAT/lib/$LIB
donecd $CWD
cp -rf $THIN/$1/include $FAT
fi
//回到终端输入下面命令
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$
这篇关于lame静态库制作的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!