Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix libshine and re-enable it for ffmpeg & ffpyplayer_codecs #2027

Merged
merged 2 commits into from
Nov 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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