本篇记录我编译x264包的过程。概念在上一篇iOS上fdk-aac的交叉编译已经介绍了,所以这里简单粗暴的上configure:
export CC="xcrun -sdk iphoneos clang" export AS="gas-preprocessor.pl xcrun -sdk iphoneos clang" ./configure \ --enable-static \ --enable-pic \ --host=aarch64-apple-darwin \ --extra-cflags="-arch arm64" \ --extra-asflags="-arch arm64" \ --extra-ldflags="-arch arm64" \ --prefix="/Users/XXXXX/Desktop/x264/output/arm64" \ 此处XXXXX表示你的电脑名称
此处多了一个gas-preprocessor.pl文件,可以在github上搜索该文件,然后将此文件copy到/usr/local/bin文件夹下就可以了,这就是arm64架构的configure,对应的x64的configure文件如下:
export CC="xcrun -sdk iphonesimulator clang" export AS="gas-preprocessor.pl xcrun -sdk iphonesimulator clang" ./configure \ --enable-static \ --enable-pic \ --disable-asm \ --host=x86_64-apple-darwin \ --extra-cflags="-arch x86_64" \ --extra-asflags="-arch x86_64" \ --extra-ldflags="-arch x86_64" \ --prefix="/Users/XXXXX/Desktop/player/x264/output/x86_64" \ 此处XXXXX表示你的电脑名称
然后可以使用lipo命令将两个架构的包合成一个。具体可google或者baidu。
相对fdk-aac的交叉编译来说,x264的configure相对来说要简单直白很多。由于上篇博客并没有写fdk-aac关于x64的configure,所以这里补上:
./configure \ --enable-static \ --disable-shared \ --host=x86_64-apple-darwin \ CC="xcrun -sdk iphonesimulator clang " \ CXX="xcrun -sdk iphonesimulator clang" \ CPP="xcrun -sdk iphonesimulator clang -E" \ AS="xcrun -sdk iphonesimulator clang" \ CFLAGS="-arch x86_64 -mios-simulator-version-min=7.0 -fembed-bitcode" \ LDFLAGS="-arch x86_64 -mios-simulator-version-min=7.0 -fembed-bitcode" \ CPPFLAGS="-arch x86_64 -mios-simulator-version-min=7.0 -fembed-bitcode" \ --prefix="/Users/XXXXX/Desktop/player/fdk-aac-0.1.6/output/x86_64"