From 3facadc79402727c215f51ec52ebf3a0f79b4ba3 Mon Sep 17 00:00:00 2001 From: Romain Bertozzi <romain.bertozzi@savoirfairelinux.com> Date: Tue, 12 Apr 2016 08:40:34 -0400 Subject: [PATCH] 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 --- contrib/src/ffmpeg/rules.mak | 35 ++++++++++++++++++++++++++++++++++- contrib/src/vpx/rules.mak | 6 +++++- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/contrib/src/ffmpeg/rules.mak b/contrib/src/ffmpeg/rules.mak index ff0d24c4ac..34d0263ce1 100644 --- a/contrib/src/ffmpeg/rules.mak +++ b/contrib/src/ffmpeg/rules.mak @@ -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 $@ diff --git a/contrib/src/vpx/rules.mak b/contrib/src/vpx/rules.mak index 7602ccb3df..10b6cf4000 100644 --- a/contrib/src/vpx/rules.mak +++ b/contrib/src/vpx/rules.mak @@ -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 -- GitLab