Skip to content

Commit 0c6acfc

Browse files
authored
Fix libshine and re-enable it for ffmpeg & ffpyplayer_codecs (kivy#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
1 parent 11a9eb0 commit 0c6acfc

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

pythonforandroid/recipes/ffmpeg/__init__.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,12 @@ def build_arch(self, arch):
5151
cflags += ['-I' + build_dir + '/include/']
5252
ldflags += ['-lx264', '-L' + build_dir + '/lib/']
5353

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

6661
# Enable all codecs:
6762
flags += [

pythonforandroid/recipes/ffpyplayer_codecs/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33

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

87
def build_arch(self, arch):
98
pass

pythonforandroid/recipes/libshine/__init__.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,27 @@ class LibShineRecipe(Recipe):
1010
version = 'c72aba9031bde18a0995e7c01c9b53f2e08a0e46'
1111
url = 'https://github.com/toots/shine/archive/{version}.zip'
1212

13-
built_libraries = {'libshine.a': 'lib'}
13+
built_libraries = {'libshine.so': 'lib'}
14+
15+
def get_recipe_env(self, arch=None, with_flags_in_cc=True):
16+
env = super().get_recipe_env(arch, with_flags_in_cc)
17+
# technically, libraries should go to `LDLIBS`, but it seems
18+
# that libshine doesn't like so, and it will fail on linking stage
19+
env['LDLIBS'] = env['LDLIBS'].replace(' -lm', '')
20+
env['LDFLAGS'] += ' -lm'
21+
return env
1422

1523
def build_arch(self, arch):
1624
with current_directory(self.get_build_dir(arch.arch)):
1725
env = self.get_recipe_env(arch)
1826
shprint(sh.Command('./bootstrap'))
1927
configure = sh.Command('./configure')
2028
shprint(configure,
21-
'--host=arm-linux',
29+
f'--host={arch.command_prefix}',
2230
'--enable-pic',
23-
'--disable-shared',
24-
'--enable-static',
25-
'--prefix={}'.format(realpath('.')),
31+
'--disable-static',
32+
'--enable-shared',
33+
f'--prefix={realpath(".")}',
2634
_env=env)
2735
shprint(sh.make, '-j', str(cpu_count()), _env=env)
2836
shprint(sh.make, 'install', _env=env)

0 commit comments

Comments
 (0)