From e318741c4f9a61f3718dad85bb02af3bd3ceb3af Mon Sep 17 00:00:00 2001 From: Hitesh Sondhi Date: Fri, 5 Sep 2014 07:17:40 -0400 Subject: [PATCH 1/2] make modifications to scripts for x86 support #NoTesting --- abi_settings.sh | 20 ++++++++++++++------ ffmpeg_build.sh | 13 +++++++++++-- libass_build.sh | 1 + libpng_build.sh | Bin 465 -> 439 bytes settings.sh | 4 ++-- x264_build.sh | 5 +++++ 6 files changed, 33 insertions(+), 10 deletions(-) diff --git a/abi_settings.sh b/abi_settings.sh index 7819376..590aa8e 100755 --- a/abi_settings.sh +++ b/abi_settings.sh @@ -8,15 +8,23 @@ case $1 in armeabi-v7a) NDK_ABI='arm' NDK_TOOLCHAIN_ABI='arm-linux-androideabi' - ARCH_CPU='armv7-a' - CFLAGS="$CFLAGS_LIBS -march=$ARCH_CPU" + NDK_CROSS_PREFIX="${NDK_TOOLCHAIN_ABI}" + CFLAGS="$CFLAGS -march=armv7-a" + CFLAGS_LIBS="$CFLAGS_LIBS -mcpu=cortex-a8 -marm -mfloat-abi=softfp" ;; armeabi-v7a-neon) NDK_ABI='arm' NDK_TOOLCHAIN_ABI='arm-linux-androideabi' - ARCH_CPU='armv7-a' - CFLAGS="$CFLAGS -march=$ARCH_CPU -mfpu=neon" - CFLAGS_LIBS="$CFLAGS_LIBS -mfpu=neon" + NDK_CROSS_PREFIX="${NDK_TOOLCHAIN_ABI}" + CFLAGS="$CFLAGS -march=armv7-a -mfpu=neon" + CFLAGS_LIBS="$CFLAGS_LIBS -mcpu=cortex-a8 -marm -mfloat-abi=softfp -mfpu=neon" + ;; + x86) + NDK_ABI='x86' + NDK_TOOLCHAIN_ABI='x86' + NDK_CROSS_PREFIX="i686-linux-android" + CFLAGS="$CFLAGS -march=i686" + CFLAGS_LIBS="$CFLAGS_LIBS -march=i686" ;; esac @@ -24,7 +32,7 @@ TOOLCHAIN_PREFIX=${BASEDIR}/toolchain-android if [ ! -d "$TOOLCHAIN_PREFIX" ]; then ${ANDROID_NDK_ROOT_PATH}/build/tools/make-standalone-toolchain.sh --toolchain=${NDK_TOOLCHAIN_ABI}-${NDK_TOOLCHAIN_ABI_VERSION} --platform=android-${ANDROID_API_VERSION} --install-dir=${TOOLCHAIN_PREFIX} fi -CROSS_PREFIX=${TOOLCHAIN_PREFIX}/bin/${NDK_TOOLCHAIN_ABI}- +CROSS_PREFIX=${TOOLCHAIN_PREFIX}/bin/${NDK_CROSS_PREFIX}- NDK_SYSROOT=${TOOLCHAIN_PREFIX}/sysroot export PKG_CONFIG_LIBDIR="${TOOLCHAIN_PREFIX}/lib/pkgconfig" diff --git a/ffmpeg_build.sh b/ffmpeg_build.sh index 95f3ff3..07fd796 100755 --- a/ffmpeg_build.sh +++ b/ffmpeg_build.sh @@ -4,13 +4,22 @@ pushd ffmpeg +case $1 in + armeabi-v7a | armeabi-v7a-neon ) + CPU='armv7-a' + ;; + x86) + CPU='i686' + ;; +esac + make clean ./configure \ --target-os="$TARGET_OS" \ --cross-prefix="$CROSS_PREFIX" \ --arch="$NDK_ABI" \ ---cpu=armv7-a \ +--cpu="$CPU" \ --enable-runtime-cpudetect \ --sysroot="$NDK_SYSROOT" \ --enable-pic \ @@ -35,7 +44,7 @@ make clean --prefix="${2}/build/${1}" \ --extra-cflags="-I${TOOLCHAIN_PREFIX}/include $CFLAGS" \ --extra-ldflags="-L${TOOLCHAIN_PREFIX}/lib $LDFLAGS" \ ---extra-libs="-lpng -lexpat" \ +--extra-libs="-lpng -lexpat -lm" \ --extra-cxxflags="$CXX_FLAGS" || exit 1 make -j${NUMBER_OF_CORES} && make install || exit 1 diff --git a/libass_build.sh b/libass_build.sh index 02ec712..402eef6 100755 --- a/libass_build.sh +++ b/libass_build.sh @@ -13,6 +13,7 @@ make clean --with-pic \ --host="$NDK_TOOLCHAIN_ABI" \ --disable-enca \ + --disable-asm \ --enable-fontconfig \ --disable-harfbuzz \ --enable-static \ diff --git a/libpng_build.sh b/libpng_build.sh index bece48dd8aca975a771b5ee6e437c4b5e3284ce1..63b414b0d58f10b2bf7d26260ea06f0f35e56c25 100755 GIT binary patch delta 27 icmcb}yq$T17q4TGZ@izYzn`sAUcS;qPpgfq)ffSOgb3OI delta 45 zcmdnae35yA*Te`*c?E^UqTJNPq)gp1^F&Q91t4$?@{RX%_4l(?%FEx_q0a~aN>2^F diff --git a/settings.sh b/settings.sh index b218123..5a1698e 100755 --- a/settings.sh +++ b/settings.sh @@ -1,6 +1,6 @@ #!/bin/bash -SUPPORTED_ARCHITECTURES=(armeabi-v7a armeabi-v7a-neon) +SUPPORTED_ARCHITECTURES=(armeabi-v7a armeabi-v7a-neon x86) ANDROID_NDK_ROOT_PATH=${ANDROID_NDK} if [[ -z "$ANDROID_NDK_ROOT_PATH" ]]; then echo "You need to set ANDROID_NDK environment variable, please check instructions" @@ -16,5 +16,5 @@ TARGET_OS=linux CFLAGS='-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' LDFLAGS='-Wl,-z,relro -Wl,-z,now -pie' -CFLAGS_LIBS="-std=gnu99 -mcpu=cortex-a8 -marm -mfloat-abi=softfp" +CFLAGS_LIBS="-std=gnu99" FFMPEG_PKG_CONFIG="$(pwd)/ffmpeg-pkg-config" diff --git a/x264_build.sh b/x264_build.sh index 46d1d5b..59ccae1 100755 --- a/x264_build.sh +++ b/x264_build.sh @@ -10,8 +10,13 @@ case $1 in armeabi-v7a | armeabi-v7a-neon) HOST=arm-linux ;; + x86) + HOST=i686-linux + ;; esac +echo $CFLAGS + ./configure \ --cross-prefix="$CROSS_PREFIX" \ --sysroot="$NDK_SYSROOT" \ From f914e9b595bfbed8c9044d0feb80656a13af7ece Mon Sep 17 00:00:00 2001 From: Hitesh Sondhi Date: Mon, 8 Sep 2014 14:47:34 -0400 Subject: [PATCH 2/2] Added x86 support #WithTesting --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b788df3..7099c90 100755 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ FFmpeg-Android Supported Architecture ---- * armv7 +* x86 Instructions ----