libx264 for android编译(重点是看那个configure如何配置)
2016-03-21 16:57
507 查看
1.2 使用ndk编译x264
1. 下载源码并编译
$ cd /opt/android/ndk/android-ndk-r10e/resources
$ git clone http://git.videolan.org/git/x264.git
$ cd x264
修改configure文件
$ vim configure
将下面的这四句:
else
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
【保存并退出】
创建配置脚本
$ vim android_x264_configure.sh
#!/bin/bash
NDK=/opt/android/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 \
--enable-static \
--disable-gpac \
--disable-cli \
--cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
--host=arm-linux \
--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
【保存并退出】
$ chmod +x android_x264_configure.sh
$ ./android_x264_configure.sh
platform: ARM
byte order: little-endian
system: LINUX
cli: no
libx264: internal
shared: yes
static: yes
asm: yes
interlaced: yes
avs: avxsynth
lavf: no
ffms: no
mp4: no
gpl: yes
thread: posix
opencl: yes
filters: crop select_every
debug: no
gprof: no
strip: yes
PIC: yes
bit depth: 8
chroma format: all
You can run 'make' or 'make fprofiled' now.
$ make
$ make install
$ ls -R android
android:
arm
android/arm:
Android.mk bin include lib
android/arm/bin:
x264
android/arm/include:
x264_config.h x264.h
android/arm/lib:
libx264.a libx264.so pkgconfig
android/arm/lib/pkgconfig:
x264.pc
$ vim android/arm/Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VRS)
LOCAL_MODULE := libx264
LOCAL_SRC_FILES := lib/libx264.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY) 阅读更多
1. 下载源码并编译
$ cd /opt/android/ndk/android-ndk-r10e/resources
$ git clone http://git.videolan.org/git/x264.git
$ cd x264
修改configure文件
$ vim configure
将下面的这四句:
else
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
【保存并退出】
创建配置脚本
$ vim android_x264_configure.sh
#!/bin/bash
NDK=/opt/android/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 \
--enable-static \
--disable-gpac \
--disable-cli \
--cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
--host=arm-linux \
--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
【保存并退出】
$ chmod +x android_x264_configure.sh
$ ./android_x264_configure.sh
platform: ARM
byte order: little-endian
system: LINUX
cli: no
libx264: internal
shared: yes
static: yes
asm: yes
interlaced: yes
avs: avxsynth
lavf: no
ffms: no
mp4: no
gpl: yes
thread: posix
opencl: yes
filters: crop select_every
debug: no
gprof: no
strip: yes
PIC: yes
bit depth: 8
chroma format: all
You can run 'make' or 'make fprofiled' now.
$ make
$ make install
$ ls -R android
android:
arm
android/arm:
Android.mk bin include lib
android/arm/bin:
x264
android/arm/include:
x264_config.h x264.h
android/arm/lib:
libx264.a libx264.so pkgconfig
android/arm/lib/pkgconfig:
x264.pc
$ vim android/arm/Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VRS)
LOCAL_MODULE := libx264
LOCAL_SRC_FILES := lib/libx264.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY) 阅读更多
相关文章推荐
- 教你如何反编译Android apk获取java源代码,图片、XML配置、语言资源
- How to Configure Eclipse for Python --- 在eclipse中如何配置pydev
- 编译andorid kernel for moudle (android LKM)的配置
- 如何编译 chromium for android
- How to Configure Eclipse for Python --- 在eclipse中如何配置pydev
- 如何在Android设备中用NDK编译SQLite并且对SQLite进行操作(增删)-How to Compile SQLite for Android using NDK
- mac下配置Qt for Android编译环境
- 如何编译 Chrome for Android
- Qt for Android on Mac:源码编译及环境配置
- 如何自己配置和编译一个完整的Linux嵌入式开发环境?
- Android开发中Eclipse如何重新编译整个工程
- 如何配置Android开发环境2
- 如何编译Android的kernel
- 如何在Android平台下编译带STL的C++程序
- VS2005下如何安装配置编译并开发QT4.4.3程序
- 如何配置和编译ogre 1.7.0 + cegui 0.7.1
- android sdk 编译--如何将源代码加入android.jar
- VS2005下如何安装配置编译Qt4.5
- 配置android编译环境和源码下载
- 如何在Netbeans下配置Android开发环境 -- a platform target has to be selected