1、在 http://developer.android.com/tools/sdk/ndk/index.html
下载 android-ndk-r10e-linux-x86_64.bin
然后热行如下命令安装NDK,我是在ubuntu 14.04下安装的,在WIN下要装cygwin,会麻烦很多,不推荐。
它官方的安装提示如下:
On Linux and Mac OS X (Darwin):
1. Download the appropriate package from this page.
2. Open a terminal window.
3. Go to the directory to which you downloaded the package.
4. Run chmod a+x on the downloaded package.
5. Execute the package. For example:
ndk$ chmod a+x android-ndk-r10e-linux-x86_64.bin
ndk$ ./android-ndk-r10e-linux-x86_64.bin
更具体的安装与配置见《Ubuntu14.04下最新Android NDK安装》
2、进入X264的官网下载最新版本,http://www.videolan.org/developers/x264.html
下载最新版的x264。
进入x264文件目录:
$ cd x264
创建ndk_build_x264_config.sh
代码如下:
#!/bin/bash
NDK=/home/cxx/ndk/android-ndk-r10e
SYSROOT=$NDK/platforms/android-9/arch-arm/
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64
function build_one
{
./configure \
--prefix=$PREFIX \
--enable-shared \
--disable-asm \
--enable-pic \
--enable-strip \
--cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
--host=arm-linux-androideabi \
--sysroot=$SYSROOT \
--extra-cflags="-Os -fpic $ADDI_CFLAGS" \
--extra-ldflags="$ADDI_LDFLAGS" \
$ADDITIONAL_CONFIGURE_FLAG
}
CPU=arm
PREFIX=$(pwd)/android/$CPU
ADDI_CFLAGS=""
build_one
【保存并退出】
注意:
NDK=/home/cxx/ndk/android-ndk-r10e
这句要改你的ndk的安装目录;
另外修改.configure中
echo "SOSUFFIX=so" >> config.mak
echo "SONAME=libx264.so.$API" >> config.mak
echo "SOFLAGS=-shared -Wl,-soname,\$(SONAME) $SOFLAGS" >> config.mak
这一行 echo "SONAME=libx264.so.$API" >> config.mak ,
改成: echo "SONAME=libx264.so" >> config.mak
然后执行:
$ chmod a+x build_x264.sh
$ ./build_x264.sh
$ make
$ make install
阅读(6522) | 评论(0) | 转发(0) |