Skip to content
Snippets Groups Projects
Commit 3facadc7 authored by Romain Bertozzi's avatar Romain Bertozzi
Browse files

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
No related branches found
No related tags found
No related merge requests found
...@@ -33,9 +33,11 @@ FFMPEGCONF += \ ...@@ -33,9 +33,11 @@ FFMPEGCONF += \
--enable-parser=vp8 --enable-parser=vp8
#librairies #librairies
ifndef HAVE_ANDROID
FFMPEGCONF += \ FFMPEGCONF += \
--enable-libx264 \ --enable-libx264 \
--enable-libvpx --enable-libvpx
endif
#encoders/decoders #encoders/decoders
FFMPEGCONF += \ FFMPEGCONF += \
...@@ -88,6 +90,18 @@ FFMPEGCONF += \ ...@@ -88,6 +90,18 @@ FFMPEGCONF += \
DEPS_ffmpeg = iconv zlib x264 vpx opus speex $(DEPS_vpx) 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 ifdef HAVE_CROSS_COMPILE
FFMPEGCONF += --cross-prefix=$(HOST)- FFMPEGCONF += --cross-prefix=$(HOST)-
endif endif
...@@ -101,6 +115,25 @@ ifeq ($(ARCH),x86_64) ...@@ -101,6 +115,25 @@ ifeq ($(ARCH),x86_64)
FFMPEGCONF += --arch=x86_64 FFMPEGCONF += --arch=x86_64
endif 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 # Windows
ifdef HAVE_WIN32 ifdef HAVE_WIN32
FFMPEGCONF += --target-os=mingw32 --enable-memalign-hack FFMPEGCONF += --target-os=mingw32 --enable-memalign-hack
...@@ -128,6 +161,6 @@ ffmpeg: ffmpeg-$(FFMPEG_HASH).tar.xz .sum-ffmpeg ...@@ -128,6 +161,6 @@ ffmpeg: ffmpeg-$(FFMPEG_HASH).tar.xz .sum-ffmpeg
.ffmpeg: ffmpeg .ffmpeg: ffmpeg
cd $< && $(HOSTVARS) ./configure \ cd $< && $(HOSTVARS) ./configure \
--extra-ldflags="$(LDFLAGS)" $(FFMPEGCONF) \ --extra-ldflags="$(LDFLAGS)" $(FFMPEGCONF) \
--prefix="$(PREFIX)" --enable-static --disable-shared --prefix="$(PREFIX)" --enable-static --disable-shared
cd $< && $(MAKE) install-libs install-headers cd $< && $(MAKE) install-libs install-headers
touch $@ touch $@
...@@ -97,16 +97,20 @@ endif ...@@ -97,16 +97,20 @@ endif
ifdef HAVE_IOS ifdef HAVE_IOS
VPX_CONF += --sdk-path=$(SDKROOT) VPX_CONF += --sdk-path=$(SDKROOT)
endif endif
LOCAL_HOSTVARS=
ifdef HAVE_ANDROID ifdef HAVE_ANDROID
# vpx configure.sh overrides our sysroot and it looks for it itself, and # 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) # uses that path to look for the compiler (which we already know)
VPX_CONF += --sdk-path=$(shell dirname $(shell which $(CROSS_COMPILE)gcc)) VPX_CONF += --sdk-path=$(shell dirname $(shell which $(CROSS_COMPILE)gcc))
# needed for cpu-features.h # needed for cpu-features.h
VPX_CONF += --extra-cflags="-I $(ANDROID_NDK)/sources/cpufeatures/" 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 endif
.vpx: libvpx .vpx: libvpx
cd $< && CROSS=$(VPX_CROSS) ./configure --target=$(VPX_TARGET) \ cd $< && CROSS=$(VPX_CROSS) $(LOCAL_HOSTVARS) ./configure --target=$(VPX_TARGET) \
$(VPX_CONF) --prefix=$(PREFIX) $(VPX_CONF) --prefix=$(PREFIX)
cd $< && $(MAKE) cd $< && $(MAKE)
cd $< && ../../../contrib/src/pkg-static.sh vpx.pc cd $< && ../../../contrib/src/pkg-static.sh vpx.pc
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment