Skip to content

Commit 32b38f2

Browse files
author
lanmao
committed
Fix pyjnius linking with Qt bootstrap libmain
1 parent 869c74b commit 32b38f2

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

pythonforandroid/recipes/pyjnius/__init__.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from pythonforandroid.toolchain import shprint, current_directory, info
33
from pythonforandroid.patching import will_build
44
import sh
5-
from os.path import join
5+
from os.path import exists, join
66

77

88
class PyjniusRecipe(PyProjectRecipe):
@@ -18,13 +18,26 @@ class PyjniusRecipe(PyProjectRecipe):
1818
('sdl3_jnienv_getter.patch', will_build('sdl3')),
1919
]
2020

21+
def ensure_main_library_alias(self, arch):
22+
for lib_dir in (
23+
join(self.ctx.bootstrap.build_dir, 'libs', arch.arch),
24+
join(self.ctx.bootstrap.build_dir, 'obj', 'local', arch.arch),
25+
):
26+
source = join(lib_dir, 'libmain_{}.so'.format(arch.arch))
27+
alias = join(lib_dir, 'libmain.so')
28+
if exists(source) and not exists(alias):
29+
shprint(sh.cp, source, alias)
30+
2131
def get_recipe_env(self, arch, **kwargs):
32+
self.ensure_main_library_alias(arch)
2233
env = super().get_recipe_env(arch, **kwargs)
2334

2435
# Taken from CythonRecipe
2536
env['LDFLAGS'] = env['LDFLAGS'] + ' -L{} '.format(
2637
self.ctx.get_libs_dir(arch.arch) +
2738
' -L{} '.format(self.ctx.libs_dir) +
39+
' -L{} '.format(join(self.ctx.bootstrap.build_dir, 'libs',
40+
arch.arch)) +
2841
' -L{}'.format(join(self.ctx.bootstrap.build_dir, 'obj', 'local',
2942
arch.arch)))
3043
env['LDSHARED'] = env['CC'] + ' -shared'

0 commit comments

Comments
 (0)