Commit 3facadc7 authored by Romain Bertozzi's avatar Romain Bertozzi

Android x86 : update ffmpeg & vpx src rules

This patch updates the ffmpeg and vpx contribs rules. It is necessary to
support the x86 architecture for Android and prevent Text Relocations in
the built libringjni.so

This patches uses code from VLC, please see :
https://github.com/videolan/vlc/commit/ac17dc8a

Change-Id: I4d55e1dc4b1436629e95676f2a76cdd61d3a2632
Tuleap: #508
parent 22f7be8c
......@@ -33,9 +33,11 @@ FFMPEGCONF += \
--enable-parser=vp8
#librairies
ifndef HAVE_ANDROID
FFMPEGCONF += \
--enable-libx264 \
--enable-libvpx
endif
#encoders/decoders
FFMPEGCONF += \
......@@ -88,6 +90,18 @@ FFMPEGCONF += \
DEPS_ffmpeg = iconv zlib x264 vpx opus speex $(DEPS_vpx)
# Linux
ifdef HAVE_LINUX
FFMPEGCONF += --target-os=linux --enable-pic
ifndef HAVE_ANDROID
FFMPEGCONF += --enable-indev=v4l2 --enable-indev=x11grab --enable-x11grab
else
# used to avoid Text Relocations
FFMPEGCONF += --extra-cxxflags=-fPIC --extra-cflags=-fPIC
FFMPEGCONF += --disable-asm
endif
endif
ifdef HAVE_CROSS_COMPILE
FFMPEGCONF += --cross-prefix=$(HOST)-
endif
......@@ -101,6 +115,25 @@ ifeq ($(ARCH),x86_64)
FFMPEGCONF += --arch=x86_64
endif
# ARM stuff
ifeq ($(ARCH),arm)
FFMPEGCONF += --arch=arm
ifdef HAVE_NEON
FFMPEGCONF += --enable-neon
endif
ifdef HAVE_ARMV7A
FFMPEGCONF += --cpu=cortex-a8
endif
ifdef HAVE_ARMV6
FFMPEGCONF += --cpu=armv6 --disable-neon
endif
endif
# ARM64 stuff
ifeq ($(ARCH),aarch64)
FFMPEGCONF += --arch=aarch64
endif
# Windows
ifdef HAVE_WIN32
FFMPEGCONF += --target-os=mingw32 --enable-memalign-hack
......@@ -128,6 +161,6 @@ ffmpeg: ffmpeg-$(FFMPEG_HASH).tar.xz .sum-ffmpeg
.ffmpeg: ffmpeg
cd $< && $(HOSTVARS) ./configure \
--extra-ldflags="$(LDFLAGS)" $(FFMPEGCONF) \
--prefix="$(PREFIX)" --enable-static --disable-shared
--prefix="$(PREFIX)" --enable-static --disable-shared
cd $< && $(MAKE) install-libs install-headers
touch $@
......@@ -97,16 +97,20 @@ endif
ifdef HAVE_IOS
VPX_CONF += --sdk-path=$(SDKROOT)
endif
LOCAL_HOSTVARS=
ifdef HAVE_ANDROID
# vpx configure.sh overrides our sysroot and it looks for it itself, and
# uses that path to look for the compiler (which we already know)
VPX_CONF += --sdk-path=$(shell dirname $(shell which $(CROSS_COMPILE)gcc))
# needed for cpu-features.h
VPX_CONF += --extra-cflags="-I $(ANDROID_NDK)/sources/cpufeatures/"
# set an explicit alternative libc since the sysroot override can make it blank
VPX_CONF += --libc=$(SYSROOT)
LOCAL_HOSTVARS=$(HOSTVARS)
endif
.vpx: libvpx
cd $< && CROSS=$(VPX_CROSS) ./configure --target=$(VPX_TARGET) \
cd $< && CROSS=$(VPX_CROSS) $(LOCAL_HOSTVARS) ./configure --target=$(VPX_TARGET) \
$(VPX_CONF) --prefix=$(PREFIX)
cd $< && $(MAKE)
cd $< && ../../../contrib/src/pkg-static.sh vpx.pc
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment