Skip to content

Commit

Permalink
Fix libshine and re-enable it for ffmpeg & ffpyplayer_codecs (#2027)
Browse files Browse the repository at this point in the history
* [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
  • Loading branch information
opacam authored Nov 24, 2019
1 parent 11a9eb0 commit 0c6acfc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
5 changes: 0 additions & 5 deletions pythonforandroid/recipes/ffmpeg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 += [
Expand Down
3 changes: 1 addition & 2 deletions pythonforandroid/recipes/ffpyplayer_codecs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 13 additions & 5 deletions pythonforandroid/recipes/libshine/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,27 @@ 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)):
env = self.get_recipe_env(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)
Expand Down

0 comments on commit 0c6acfc

Please sign in to comment.