From 0c6acfc4254ecf9d770009b4c365867bdbb6a6ec Mon Sep 17 00:00:00 2001 From: Pol Canelles Date: Sun, 24 Nov 2019 18:43:53 +0100 Subject: [PATCH] Fix libshine and re-enable it for ffmpeg & ffpyplayer_codecs (#2027) * [libs] Rework of libshine to be an shared library - make it build as shared - move to python3's f-strings - fix linking when building the shared library * [libs] Re-enable libshine for ffmpeg & ffpyplayer_codecs --- pythonforandroid/recipes/ffmpeg/__init__.py | 5 ----- .../recipes/ffpyplayer_codecs/__init__.py | 3 +-- pythonforandroid/recipes/libshine/__init__.py | 18 +++++++++++++----- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/pythonforandroid/recipes/ffmpeg/__init__.py b/pythonforandroid/recipes/ffmpeg/__init__.py index 519fbe991d..3418ed1a90 100644 --- a/pythonforandroid/recipes/ffmpeg/__init__.py +++ b/pythonforandroid/recipes/ffmpeg/__init__.py @@ -51,17 +51,12 @@ def build_arch(self, 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 += [ diff --git a/pythonforandroid/recipes/ffpyplayer_codecs/__init__.py b/pythonforandroid/recipes/ffpyplayer_codecs/__init__.py index da67d928f6..558c0c223d 100644 --- a/pythonforandroid/recipes/ffpyplayer_codecs/__init__.py +++ b/pythonforandroid/recipes/ffpyplayer_codecs/__init__.py @@ -2,8 +2,7 @@ class FFPyPlayerCodecsRecipe(Recipe): - depends = ['libx264'] - # disabled libshine due a missing symbol error (see ffmpeg recipe) + depends = ['libx264', 'libshine'] def build_arch(self, arch): pass diff --git a/pythonforandroid/recipes/libshine/__init__.py b/pythonforandroid/recipes/libshine/__init__.py index 7d114d25a1..32fa9e175d 100644 --- a/pythonforandroid/recipes/libshine/__init__.py +++ b/pythonforandroid/recipes/libshine/__init__.py @@ -10,7 +10,15 @@ class LibShineRecipe(Recipe): version = 'c72aba9031bde18a0995e7c01c9b53f2e08a0e46' url = 'https://github.com/toots/shine/archive/{version}.zip' - built_libraries = {'libshine.a': 'lib'} + built_libraries = {'libshine.so': 'lib'} + + def get_recipe_env(self, arch=None, with_flags_in_cc=True): + env = super().get_recipe_env(arch, with_flags_in_cc) + # technically, libraries should go to `LDLIBS`, but it seems + # that libshine doesn't like so, and it will fail on linking stage + env['LDLIBS'] = env['LDLIBS'].replace(' -lm', '') + env['LDFLAGS'] += ' -lm' + return env def build_arch(self, arch): with current_directory(self.get_build_dir(arch.arch)): @@ -18,11 +26,11 @@ def build_arch(self, arch): shprint(sh.Command('./bootstrap')) configure = sh.Command('./configure') shprint(configure, - '--host=arm-linux', + f'--host={arch.command_prefix}', '--enable-pic', - '--disable-shared', - '--enable-static', - '--prefix={}'.format(realpath('.')), + '--disable-static', + '--enable-shared', + f'--prefix={realpath(".")}', _env=env) shprint(sh.make, '-j', str(cpu_count()), _env=env) shprint(sh.make, 'install', _env=env)