Skip to content

Commit

Permalink
Fixes ffmpeg build on ndk 19 (#1997)
Browse files Browse the repository at this point in the history
* ffmpeg builds w/ libx264 and openssl via ndk 19 fixes #1996
* target a specific hash
* update travis_wait to 30
  • Loading branch information
misl6 authored and AndreMiras committed Nov 23, 2019
1 parent 3938445 commit e2851d9
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ jobs:
script: make docker/run/make/testapps/python2/armeabi-v7a
- <<: *testapps
name: Rebuild updated recipes
script: make docker/run/make/rebuild_updated_recipes
script: travis_wait 30 make docker/run/make/rebuild_updated_recipes
33 changes: 22 additions & 11 deletions pythonforandroid/recipes/ffmpeg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


class FFMpegRecipe(Recipe):
version = 'n3.4.5'
version = '007e03348dbd8d3de3eb09022d72c734a8608144'
# Moved to github.com instead of ffmpeg.org to improve download speed
url = 'https://github.com/FFmpeg/FFmpeg/archive/{version}.zip'
depends = ['sdl2'] # Need this to build correct recipe order
Expand Down Expand Up @@ -37,22 +37,31 @@ def build_arch(self, arch):
'--enable-nonfree',
'--enable-protocol=https,tls_openssl',
]
build_dir = Recipe.get_recipe('openssl', self.ctx).get_build_dir(arch.arch)
cflags += ['-I' + build_dir + '/include/']
build_dir = Recipe.get_recipe(
'openssl', self.ctx).get_build_dir(arch.arch)
cflags += ['-I' + build_dir + '/include/',
'-DOPENSSL_API_COMPAT=0x10002000L']
ldflags += ['-L' + build_dir]

if 'ffpyplayer_codecs' in self.ctx.recipe_build_order:
# libx264
flags += ['--enable-libx264']
build_dir = Recipe.get_recipe('libx264', self.ctx).get_build_dir(arch.arch)
build_dir = Recipe.get_recipe(
'libx264', self.ctx).get_build_dir(arch.arch)
cflags += ['-I' + build_dir + '/include/']
ldflags += ['-lx264', '-L' + build_dir + '/lib/']

"""
WARNING: DISABLED during migration to ndk19, cause We're
getting a runtime error for a missing symbol.
# libshine
flags += ['--enable-libshine']
build_dir = Recipe.get_recipe('libshine', self.ctx).get_build_dir(arch.arch)
cflags += ['-I' + build_dir + '/include/']
ldflags += ['-lshine', '-L' + build_dir + '/lib/']
ldflags += ['-lm']
"""

# Enable all codecs:
flags += [
Expand All @@ -79,22 +88,20 @@ def build_arch(self, arch):

# disable binaries / doc
flags += [
'--disable-ffmpeg',
'--disable-ffplay',
'--disable-ffprobe',
'--disable-ffserver',
'--disable-programs',
'--disable-doc',
]

# other flags:
flags += [
'--enable-filter=aresample,resample,crop,adelay,volume,scale',
'--enable-protocol=file,http',
'--enable-protocol=file,http,hls',
'--enable-small',
'--enable-hwaccels',
'--enable-gpl',
'--enable-pic',
'--disable-static',
'--disable-debug',
'--enable-shared',
]

Expand All @@ -108,9 +115,13 @@ def build_arch(self, arch):
# android:
flags += [
'--target-os=android',
'--cross-prefix={}'.format(cross_prefix),
'--enable-cross-compile',
'--cross-prefix={}-'.format(arch.target),
'--arch={}'.format(arch_flag),
'--sysroot=' + self.ctx.ndk_platform,
'--strip={}strip'.format(cross_prefix),
'--sysroot={}'.format(join(self.ctx.ndk_dir, 'toolchains',
'llvm', 'prebuilt', 'linux-x86_64',
'sysroot')),
'--enable-neon',
'--prefix={}'.format(realpath('.')),
]
Expand Down
52 changes: 16 additions & 36 deletions pythonforandroid/recipes/ffmpeg/patches/configure.patch
Original file line number Diff line number Diff line change
@@ -1,40 +1,20 @@
--- ./configure.orig 2017-12-11 00:35:18.000000000 +0300
+++ ./configure 2017-12-19 09:47:54.104914600 +0300
@@ -4841,9 +4841,6 @@
add_cflags -std=c11 ||
check_cflags -std=c99

-check_cppflags -D_FILE_OFFSET_BITS=64
-check_cppflags -D_LARGEFILE_SOURCE
-
add_host_cppflags -D_ISOC99_SOURCE
check_host_cflags -std=c99
check_host_cflags -Wall
@@ -5979,7 +5976,7 @@
--- ./configure 2019-07-21 18:36:31.000000000 +0200
+++ ./configure_new 2019-10-04 12:43:41.798448200 +0200
@@ -6222,7 +6222,7 @@
enabled librsvg && require_pkg_config librsvg librsvg-2.0 librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo
enabled librtmp && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket
enabled librubberband && require_pkg_config librubberband "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new
enabled librubberband && require_pkg_config librubberband "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append librubberband_extralibs "-lstdc++"
-enabled libshine && require_pkg_config libshine shine shine/layer3.h shine_encode_buffer
+enabled libshine && require "shine" shine/layer3.h shine_encode_buffer -lshine
enabled libsmbclient && { use_pkg_config libsmbclient smbclient libsmbclient.h smbc_init ||
require smbclient libsmbclient.h smbc_init -lsmbclient; }
enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy

diff -Naur ffmpeg/configure ffmpeg-1/configure
--- ffmpeg/configure 2019-01-11 09:30:02.824961600 +0100
+++ ffmpeg-1/configure 2019-01-11 09:29:54.976149600 +0100
@@ -6068,11 +6068,11 @@
{ ! enabled cross_compile && add_cflags -isystem/opt/vc/include/IL && check_header OMX_Core.h ; } ||
die "ERROR: OpenMAX IL headers not found"; }
enabled omx && require_header OMX_Core.h
-enabled openssl && { use_pkg_config openssl openssl openssl/ssl.h OPENSSL_init_ssl ||
+enabled openssl && { use_pkg_config openssl openssl openssl/ssl.h OPENSSL_init_ssl ||
use_pkg_config openssl openssl openssl/ssl.h SSL_library_init ||
- check_lib openssl openssl/ssl.h OPENSSL_init_ssl -lssl -lcrypto ||
- check_lib openssl openssl/ssl.h OPENSSL_init_ssl -lssl32 -leay32 ||
- check_lib openssl openssl/ssl.h OPENSSL_init_ssl -lssl -lcrypto -lws2_32 -lgdi32 ||
+ check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto ||
+ check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
+ check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
+enabled libshine && require "shine" shine/layer3.h shine_encode_buffer -lshine -lm
enabled libsmbclient && { check_pkg_config libsmbclient smbclient libsmbclient.h smbc_init ||
require libsmbclient libsmbclient.h smbc_init -lsmbclient; }
enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy -lstdc++
@@ -6322,7 +6322,7 @@
die "ERROR: OpenMAX IL headers not found"; } && enable omx
enabled openssl && { check_pkg_config openssl openssl openssl/ssl.h OPENSSL_init_ssl ||
check_pkg_config openssl openssl openssl/ssl.h SSL_library_init ||
- check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto ||
+ check_lib openssl openssl/ssl.h OPENSSL_init_ssl -lssl -lcrypto ||
check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
die "ERROR: openssl not found"; }
enabled rkmpp && { { require_pkg_config rockchip_mpp rockchip_mpp rockchip/rk_mpi.h mpp_create ||
3 changes: 2 additions & 1 deletion pythonforandroid/recipes/ffpyplayer_codecs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@


class FFPyPlayerCodecsRecipe(Recipe):
depends = ['libshine', 'libx264']
depends = ['libx264']
# disabled libshine due a missing symbol error (see ffmpeg recipe)

def build_arch(self, arch):
pass
Expand Down

0 comments on commit e2851d9

Please sign in to comment.