summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorGonzalo Exequiel Pedone2019-04-03 18:14:38 -0300
committerGonzalo Exequiel Pedone2019-04-03 18:14:38 -0300
commitb2a8c127b98dccd4dcf77d95b01af382f282180b (patch)
treedba8d27e51c2d80b1e0ef591dd469b38292f8119
downloadaur-b2a8c127b98dccd4dcf77d95b01af382f282180b.tar.gz
Created android-ffmpeg package.
-rw-r--r--.SRCINFO29
-rw-r--r--PKGBUILD109
-rwxr-xr-xandroid-env.sh70
-rw-r--r--configure.patch32
4 files changed, 240 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..6a41d29c07b9
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,29 @@
+# Generated by mksrcinfo v8
+# miƩ abr 3 21:12:01 UTC 2019
+pkgbase = android-x86-ffmpeg
+ pkgdesc = Complete solution to record, convert and stream audio and video (android)
+ pkgver = 4.1.2
+ pkgrel = 1
+ url = http://ffmpeg.org/
+ arch = any
+ license = GPL3
+ makedepends = android-pkg-config
+ makedepends = git
+ makedepends = yasm
+ depends = apache-ant
+ depends = android-ndk>=r18.b
+ depends = android-platform-22
+ depends = android-sdk-25.2.5
+ depends = android-sdk-build-tools
+ depends = android-sdk-platform-tools
+ options = !strip
+ options = !buildflags
+ options = staticlibs
+ options = !emptydirs
+ source = git+https://git.ffmpeg.org/ffmpeg.git#tag=n4.1.2
+ source = configure.patch
+ sha256sums = SKIP
+ sha256sums = 574f234bd6e09c47e8435faffd464a3fe01dcfdfd939889e6608451f795a1701
+
+pkgname = android-x86-ffmpeg
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..f7028c79c669
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,109 @@
+# PKGBUILD for android-ffmpeg
+# Maintainer: Gonzalo Exequiel Pedone <hipersayan DOT x AT gmail DOT com>
+
+_android_arch=x86
+source android-env.sh ${_android_arch}
+
+pkgname=android-${_android_arch}-ffmpeg
+pkgver=4.1.2
+pkgrel=1
+pkgdesc="Complete solution to record, convert and stream audio and video (android)"
+arch=('any')
+url="http://ffmpeg.org/"
+license=('GPL3')
+depends=('apache-ant'
+ 'android-ndk>=r18.b'
+ "android-platform-$ANDROID_MINIMUM_PLATFORM"
+ 'android-sdk-25.2.5'
+ 'android-sdk-build-tools'
+ 'android-sdk-platform-tools')
+options=(!strip !buildflags staticlibs !emptydirs)
+makedepends=('android-pkg-config' 'git' 'yasm')
+source=("git+https://git.ffmpeg.org/ffmpeg.git#tag=n${pkgver}"
+ configure.patch)
+sha256sums=('SKIP'
+ '574f234bd6e09c47e8435faffd464a3fe01dcfdfd939889e6608451f795a1701')
+
+_pref=/opt/android-libs/$_android_arch
+
+prepare() {
+ cd ffmpeg
+ patch -Np1 -i ../configure.patch
+}
+
+build() {
+ cd ffmpeg
+
+ unset CC
+ unset CXX
+ unset CFLAGS
+ unset CXXFLAGS
+ unset LDFLAGS
+ unset CHOST
+ unset CARCH
+
+ case "$_android_arch" in
+ aarch64)
+ target_arch=aarch64
+ ;;
+ armv7a-eabi)
+ target_arch=arm
+ ;;
+ x86)
+ target_arch=x86_32
+ ;;
+ x86-64)
+ target_arch=x86_64
+ ;;
+ esac
+
+ configue_opts="
+ --prefix="${_pref}"
+ --enable-cross-compile
+ --cross-prefix="${ANDROID_CROSS_PREFIX}"
+ --target-os=android
+ --arch=${target_arch}
+ --sysroot="${ANDROID_SYSROOT}"
+ --pkg-config=${ANDROID_PKGCONFIG}
+ --cc=${ANDROID_CC}
+ --cxx=${ANDROID_CXX}
+ --ar=${ANDROID_AR}
+ --ranlib=${ANDROID_RANLIB}
+ --strip=${ANDROID_STRIP}
+ --nm=${ANDROID_NM}
+ --disable-debug
+ --enable-static
+ --disable-stripping
+ --enable-gpl
+ --enable-shared
+ --enable-version3
+ --enable-pic
+ --disable-doc
+ --disable-ffmpeg
+ --disable-ffprobe
+ --disable-libv4l2
+ --disable-v4l2-m2m
+ --disable-indev=v4l2
+ --disable-outdev=v4l2"
+
+ # Platform specific patches
+ case "$_android_arch" in
+ x86)
+ configue_opts+="
+ --disable-asm"
+ ;;
+ *)
+ ;;
+ esac
+
+ ./configure ${configue_opts}
+ make $MAKEFLAGS
+}
+
+package() {
+ cd ffmpeg
+ make DESTDIR="$pkgdir" install
+
+ ${ANDROID_STRIP} "${pkgdir}"/${_pref}/lib/*.a
+ ${ANDROID_STRIP} "${pkgdir}"/${_pref}/lib/*.so
+}
diff --git a/android-env.sh b/android-env.sh
new file mode 100755
index 000000000000..54e8330f8654
--- /dev/null
+++ b/android-env.sh
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+# Useful link to keep track of latest API changes:
+#
+# https://developer.android.com/ndk/downloads/revision_history
+
+_android_arch=$1
+
+# Minimum Android platform based on:
+#
+# https://developer.android.com/about/dashboards/
+if [ -z "${ANDROID_MINIMUM_PLATFORM}" ]; then
+ export ANDROID_MINIMUM_PLATFORM=22
+fi
+
+if [ -z "${ANDROID_NDK_ROOT}" ]; then
+ export ANDROID_NDK_ROOT=/opt/android-ndk
+fi
+
+if [ -z "${ANDROID_SDK_ROOT}" ]; then
+ export ANDROID_SDK_ROOT=/opt/android-sdk
+fi
+
+get_last() {
+ ls $1 | sort -V | tail -n 1
+}
+
+if [ -z "${ANDROID_BUILD_TOOLS_REVISION}" ]; then
+ export ANDROID_BUILD_TOOLS_REVISION=$(get_last ${ANDROID_SDK_ROOT}/build-tools)
+fi
+
+if [ -z "${ANDROID_API_VERSION}" ]; then
+ export ANDROID_API_VERSION=android-$ANDROID_MINIMUM_PLATFORM
+fi
+
+if [ -z "${ANDROID_NDK_PLATFORM}" ]; then
+ export ANDROID_NDK_PLATFORM=android-$ANDROID_MINIMUM_PLATFORM
+fi
+
+export ANDROID_PLATFORM=${ANDROID_NDK_ROOT}/platforms/$ANDROID_NDK_PLATFORM
+export ANDROID_TOOLCHAIN=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64
+export ANDROID_SYSROOT=${ANDROID_TOOLCHAIN}/sysroot
+export ANDROID_CROSS_PREFIX=$ANDROID_TOOLCHAIN/bin/
+export ANDROID_PKGCONFIG=android-$_android_arch-pkg-config
+
+case "$_android_arch" in
+ aarch64)
+ export ANDROID_TOOLS_COMPILER_PREFIX=${ANDROID_CROSS_PREFIX}aarch64-linux-android${ANDROID_MINIMUM_PLATFORM}-
+ export ANDROID_TOOLS_PREFIX=${ANDROID_CROSS_PREFIX}aarch64-linux-android-
+ ;;
+ armv7a-eabi)
+ export ANDROID_TOOLS_COMPILER_PREFIX=${ANDROID_CROSS_PREFIX}armv7a-linux-androideabi${ANDROID_MINIMUM_PLATFORM}-
+ export ANDROID_TOOLS_PREFIX=${ANDROID_CROSS_PREFIX}arm-linux-androideabi-
+ ;;
+ x86)
+ export ANDROID_TOOLS_COMPILER_PREFIX=${ANDROID_CROSS_PREFIX}i686-linux-android${ANDROID_MINIMUM_PLATFORM}-
+ export ANDROID_TOOLS_PREFIX=${ANDROID_CROSS_PREFIX}i686-linux-android-
+ ;;
+ x86-64)
+ export ANDROID_TOOLS_COMPILER_PREFIX=${ANDROID_CROSS_PREFIX}x86_64-linux-android${ANDROID_MINIMUM_PLATFORM}-
+ export ANDROID_TOOLS_PREFIX=${ANDROID_CROSS_PREFIX}x86_64-linux-android-
+ ;;
+esac
+
+export ANDROID_CC=${ANDROID_TOOLS_COMPILER_PREFIX}clang
+export ANDROID_CXX=${ANDROID_TOOLS_COMPILER_PREFIX}clang++
+export ANDROID_AR=${ANDROID_TOOLS_PREFIX}ar
+export ANDROID_NM=${ANDROID_TOOLS_PREFIX}nm
+export ANDROID_RANLIB=${ANDROID_TOOLS_PREFIX}ranlib
+export ANDROID_STRIP=${ANDROID_TOOLS_PREFIX}strip
diff --git a/configure.patch b/configure.patch
new file mode 100644
index 000000000000..b0d8e04143ca
--- /dev/null
+++ b/configure.patch
@@ -0,0 +1,32 @@
+diff -ruN ffmpeg-4.0/configure patched/configure
+--- ffmpeg-4.0/configure 2018-04-20 12:02:55.000000000 +0200
++++ patched/configure 2018-05-13 10:55:23.199869611 +0200
+@@ -3644,10 +3644,10 @@
+ SLIBSUF=".so"
+ SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
+ SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
+-SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
++SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
+ LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
+-SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
+-SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
++SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
++SLIB_INSTALL_LINKS='$(SLIBNAME)'
+ VERSION_SCRIPT_POSTPROCESS_CMD="cat"
+
+ asflags_filter=echo
+
+@@ -5101,10 +5101,10 @@
+ elif enabled aarch64; then
+ LIBTARGET="arm64"
+ fi
+- if enabled shared; then
++ #if enabled shared; then
+ # Cannot build both shared and static libs when using dllimport.
+- disable static
+- fi
++ # disable static
++ #fi
+ enabled shared && ! enabled small && test_cmd $windres --version && enable gnu_windres
+ enabled x86_32 && check_ldflags -Wl,--large-address-aware
+ shlibdir_default="$bindir_default"