From a5be0489881c53c5beabee62274eaa6e1442dae2 Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Thu, 24 Mar 2016 21:42:59 -0400 Subject: [PATCH] ffmpeg&libav: Remove custom strtod broken on arm Defining a custom strtod on arm when using hard float breaks since the function is marked in system headers as expecting a soft abi. Hopefully strtod works on Android 5.0+ so the strtod workaround is no longer needed. Fixes #179. --- packages/ffmpeg/build.sh | 23 +++++++++++++++++------ packages/ffmpeg/configure.patch | 19 +++++++++++++++++++ packages/libav/build.sh | 21 ++++++++++++++++----- packages/libav/configure.patch | 19 +++++++++++++++++++ 4 files changed, 71 insertions(+), 11 deletions(-) create mode 100644 packages/ffmpeg/configure.patch create mode 100644 packages/libav/configure.patch diff --git a/packages/ffmpeg/build.sh b/packages/ffmpeg/build.sh index 443ec9bd9..1ad2ee033 100644 --- a/packages/ffmpeg/build.sh +++ b/packages/ffmpeg/build.sh @@ -1,28 +1,38 @@ TERMUX_PKG_HOMEPAGE=https://www.ffmpeg.org/ TERMUX_PKG_DESCRIPTION="Tools and libraries to manipulate a wide range of multimedia formats and protocols" TERMUX_PKG_VERSION=3.0 -TERMUX_PKG_BUILD_REVISION=1 +TERMUX_PKG_BUILD_REVISION=2 TERMUX_PKG_SRCURL=https://github.com/FFmpeg/FFmpeg/releases/download/n${TERMUX_PKG_VERSION}/ffmpeg-${TERMUX_PKG_VERSION}.tar.xz TERMUX_PKG_FOLDERNAME=ffmpeg-$TERMUX_PKG_VERSION # libbz2 is used by matroska decoder: -TERMUX_PKG_DEPENDS="openssl, libbz2, libx264, xvidcore, libvorbis, libfaac, liblzma, libmp3lame" +TERMUX_PKG_DEPENDS="openssl, libbz2, libx264, xvidcore, libvorbis, libfaac, libmp3lame, liblzma" TERMUX_PKG_INCLUDE_IN_DEVPACKAGE="share/ffmpeg/examples" TERMUX_PKG_CONFLICTS="libav" termux_step_configure () { cd $TERMUX_PKG_BUILDDIR + + local _EXTRA_CONFIGURE_FLAGS="" if [ $TERMUX_ARCH = "arm" ]; then _ARCH="armeabi-v7a" + _EXTRA_CONFIGURE_FLAGS="--enable-neon" elif [ $TERMUX_ARCH = "i686" ]; then _ARCH="x86" - else + # Specify --disable-asm to prevent text relocations on i686, + # see https://trac.ffmpeg.org/ticket/4928 + _EXTRA_CONFIGURE_FLAGS="--disable-asm" + elif [ $TERMUX_ARCH = "aarch64" ]; then _ARCH=$TERMUX_ARCH + _EXTRA_CONFIGURE_FLAGS="--enable-neon" + else + echo "Unsupported arch $TERMUX_ARCH" + exit 1 fi - # --disable-asm to prevent text relocations + $TERMUX_PKG_SRCDIR/configure \ --arch=${_ARCH} \ --cross-prefix=${TERMUX_HOST_PLATFORM}- \ - --disable-asm \ + --disable-avdevice \ --disable-ffserver \ --disable-static \ --disable-symver \ @@ -37,6 +47,7 @@ termux_step_configure () { --enable-openssl \ --enable-shared \ --prefix=$TERMUX_PREFIX \ - --target-os=linux + --target-os=linux \ + $_EXTRA_CONFIGURE_FLAGS } diff --git a/packages/ffmpeg/configure.patch b/packages/ffmpeg/configure.patch new file mode 100644 index 000000000..48598fd2f --- /dev/null +++ b/packages/ffmpeg/configure.patch @@ -0,0 +1,19 @@ +Avoid issue with strtod on arm: + https://github.com/termux/termux-packages/issues/179 + +diff -u -r ../ffmpeg-3.0/configure ./configure +--- ../ffmpeg-3.0/configure 2016-02-14 21:29:37.000000000 -0500 ++++ ./configure 2016-03-24 20:44:33.472274113 -0400 +@@ -4814,12 +4814,6 @@ + probe_libc host_ + test -n "$host_libc_type" && enable host_libc_$host_libc_type + +-case $libc_type in +- bionic) +- add_compat strtod.o strtod=avpriv_strtod +- ;; +-esac +- + # hacks for compiler/libc/os combinations + + if enabled_all tms470 libc_glibc; then diff --git a/packages/libav/build.sh b/packages/libav/build.sh index 331d0d39c..b9c9f44ea 100644 --- a/packages/libav/build.sh +++ b/packages/libav/build.sh @@ -1,7 +1,7 @@ TERMUX_PKG_HOMEPAGE=http://libav.org/ TERMUX_PKG_DESCRIPTION="Tools and libraries to manipulate a wide range of multimedia formats and protocols" TERMUX_PKG_VERSION=11.6 -TERMUX_PKG_BUILD_REVISION=1 +TERMUX_PKG_BUILD_REVISION=3 TERMUX_PKG_SRCURL=http://libav.org/releases/libav-${TERMUX_PKG_VERSION}.tar.xz # libbz2 is used by matroska decoder: TERMUX_PKG_DEPENDS="openssl, libbz2, libx264, xvidcore, libvorbis, libfaac, libmp3lame" @@ -9,18 +9,28 @@ TERMUX_PKG_CONFLICTS="ffmpeg" termux_step_configure () { cd $TERMUX_PKG_BUILDDIR + + # Specify --disable-asm to prevent text relocations on i686, + # see https://trac.ffmpeg.org/ticket/4928 + # For libav we do it also for arm and aarch64 since text + # relocations happens there as well (while ffmpeg doesn't + # create text relocations even with asm for those). + local _EXTRA_CONFIGURE_FLAGS="--disable-asm" + if [ $TERMUX_ARCH = "arm" ]; then _ARCH="armeabi-v7a" elif [ $TERMUX_ARCH = "i686" ]; then _ARCH="x86" - else + elif [ $TERMUX_ARCH = "aarch64" ]; then _ARCH=$TERMUX_ARCH + else + echo "Unsupported arch $TERMUX_ARCH" + exit 1 fi - # --disable-asm to prevent text relocations + $TERMUX_PKG_SRCDIR/configure \ --arch=${_ARCH} \ --cross-prefix=${TERMUX_HOST_PLATFORM}- \ - --disable-asm \ --disable-avdevice \ --disable-avserver \ --disable-static \ @@ -36,6 +46,7 @@ termux_step_configure () { --enable-openssl \ --enable-shared \ --prefix=$TERMUX_PREFIX \ - --target-os=linux + --target-os=linux \ + $_EXTRA_CONFIGURE_FLAGS } diff --git a/packages/libav/configure.patch b/packages/libav/configure.patch new file mode 100644 index 000000000..faa289c0a --- /dev/null +++ b/packages/libav/configure.patch @@ -0,0 +1,19 @@ +Avoid issue with strtod on arm: + https://github.com/termux/termux-packages/issues/179 + +diff -u -r ../libav-11.6/configure ./configure +--- ../libav-11.6/configure 2016-02-26 18:05:55.000000000 -0500 ++++ ./configure 2016-03-24 20:59:15.095178594 -0400 +@@ -3673,12 +3673,6 @@ + probe_libc host_ + test -n "$host_libc_type" && enable host_libc_$host_libc_type + +-case $libc_type in +- bionic) +- add_compat strtod.o strtod=avpriv_strtod +- ;; +-esac +- + # hacks for compiler/libc/os combinations + + if enabled_all tms470 libc_glibc; then