Skip to content

Commit 7338ae4

Browse files
misl6AndreMiras
authored andcommitted
Fixes ffmpeg and libx264 recipes for arm64-v8 (#1916)
libx264 and ffmpeg recipes fixes for arm64-v8
1 parent b5d9b61 commit 7338ae4

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

pythonforandroid/recipes/ffmpeg/__init__.py

+18-8
Original file line numberDiff line numberDiff line change
@@ -98,20 +98,29 @@ def build_arch(self, arch):
9898
'--enable-shared',
9999
]
100100

101+
if 'arm64' in arch.arch:
102+
cross_prefix = 'aarch64-linux-android-'
103+
arch_flag = 'aarch64'
104+
else:
105+
cross_prefix = 'arm-linux-androideabi-'
106+
arch_flag = 'arm'
107+
101108
# android:
102109
flags += [
103110
'--target-os=android',
104-
'--cross-prefix=arm-linux-androideabi-',
105-
'--arch=arm',
111+
'--cross-prefix={}'.format(cross_prefix),
112+
'--arch={}'.format(arch_flag),
106113
'--sysroot=' + self.ctx.ndk_platform,
107114
'--enable-neon',
108115
'--prefix={}'.format(realpath('.')),
109116
]
110-
cflags += [
111-
'-mfpu=vfpv3-d16',
112-
'-mfloat-abi=softfp',
113-
'-fPIC',
114-
]
117+
118+
if arch_flag == 'arm':
119+
cflags += [
120+
'-mfpu=vfpv3-d16',
121+
'-mfloat-abi=softfp',
122+
'-fPIC',
123+
]
115124

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

126136

127137
recipe = FFMpegRecipe()

pythonforandroid/recipes/libx264/__init__.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,13 @@ def should_build(self, arch):
1414
def build_arch(self, arch):
1515
with current_directory(self.get_build_dir(arch.arch)):
1616
env = self.get_recipe_env(arch)
17+
if 'arm64' in arch.arch:
18+
cross_prefix = 'aarch64-linux-android-'
19+
else:
20+
cross_prefix = 'arm-linux-androideabi-'
1721
configure = sh.Command('./configure')
1822
shprint(configure,
19-
'--cross-prefix=arm-linux-androideabi-',
23+
'--cross-prefix={}'.format(cross_prefix),
2024
'--host=arm-linux',
2125
'--disable-asm',
2226
'--disable-cli',

0 commit comments

Comments
 (0)