Skip to content

Commit

Permalink
Fixes ffmpeg and libx264 recipes for arm64-v8 (#1916)
Browse files Browse the repository at this point in the history
libx264 and ffmpeg recipes fixes for arm64-v8
  • Loading branch information
misl6 authored and AndreMiras committed Jul 11, 2019
1 parent b5d9b61 commit 7338ae4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
26 changes: 18 additions & 8 deletions pythonforandroid/recipes/ffmpeg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,29 @@ def build_arch(self, arch):
'--enable-shared',
]

if 'arm64' in arch.arch:
cross_prefix = 'aarch64-linux-android-'
arch_flag = 'aarch64'
else:
cross_prefix = 'arm-linux-androideabi-'
arch_flag = 'arm'

# android:
flags += [
'--target-os=android',
'--cross-prefix=arm-linux-androideabi-',
'--arch=arm',
'--cross-prefix={}'.format(cross_prefix),
'--arch={}'.format(arch_flag),
'--sysroot=' + self.ctx.ndk_platform,
'--enable-neon',
'--prefix={}'.format(realpath('.')),
]
cflags += [
'-mfpu=vfpv3-d16',
'-mfloat-abi=softfp',
'-fPIC',
]

if arch_flag == 'arm':
cflags += [
'-mfpu=vfpv3-d16',
'-mfloat-abi=softfp',
'-fPIC',
]

env['CFLAGS'] += ' ' + ' '.join(cflags)
env['LDFLAGS'] += ' ' + ' '.join(ldflags)
Expand All @@ -121,7 +130,8 @@ def build_arch(self, arch):
shprint(sh.make, '-j4', _env=env)
shprint(sh.make, 'install', _env=env)
# copy libs:
sh.cp('-a', sh.glob('./lib/lib*.so'), self.ctx.get_libs_dir(arch.arch))
sh.cp('-a', sh.glob('./lib/lib*.so'),
self.ctx.get_libs_dir(arch.arch))


recipe = FFMpegRecipe()
6 changes: 5 additions & 1 deletion pythonforandroid/recipes/libx264/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ def should_build(self, arch):
def build_arch(self, arch):
with current_directory(self.get_build_dir(arch.arch)):
env = self.get_recipe_env(arch)
if 'arm64' in arch.arch:
cross_prefix = 'aarch64-linux-android-'
else:
cross_prefix = 'arm-linux-androideabi-'
configure = sh.Command('./configure')
shprint(configure,
'--cross-prefix=arm-linux-androideabi-',
'--cross-prefix={}'.format(cross_prefix),
'--host=arm-linux',
'--disable-asm',
'--disable-cli',
Expand Down

0 comments on commit 7338ae4

Please sign in to comment.