22from pythonforandroid .toolchain import shprint , current_directory , info
33from pythonforandroid .patching import will_build
44import sh
5- from os .path import join
5+ from os .path import exists , join
66
77
88class PyjniusRecipe (PyProjectRecipe ):
@@ -21,12 +21,24 @@ class PyjniusRecipe(PyProjectRecipe):
2121 def get_recipe_env (self , arch , ** kwargs ):
2222 env = super ().get_recipe_env (arch , ** kwargs )
2323
24+ generic_main_libs = (
25+ join (self .ctx .bootstrap .build_dir , 'libs' , arch .arch ,
26+ 'libmain_{}.so' .format (arch .arch )),
27+ join (self .ctx .bootstrap .build_dir , 'obj' , 'local' , arch .arch ,
28+ 'libmain_{}.so' .format (arch .arch )),
29+ )
30+ if any (exists (lib ) for lib in generic_main_libs ):
31+ env ['PYJNIUS_ANDROID_LIBMAIN' ] = 'main_{}' .format (arch .arch )
32+
2433 # Taken from CythonRecipe
25- env ['LDFLAGS' ] = env ['LDFLAGS' ] + ' -L{} ' .format (
26- self .ctx .get_libs_dir (arch .arch ) +
27- ' -L{} ' .format (self .ctx .libs_dir ) +
28- ' -L{}' .format (join (self .ctx .bootstrap .build_dir , 'obj' , 'local' ,
29- arch .arch )))
34+ env ['LDFLAGS' ] = env ['LDFLAGS' ] + ' ' + ' ' .join ([
35+ '-L{}' .format (self .ctx .get_libs_dir (arch .arch )),
36+ '-L{}' .format (self .ctx .libs_dir ),
37+ '-L{}' .format (join (self .ctx .bootstrap .build_dir , 'libs' ,
38+ arch .arch )),
39+ '-L{}' .format (join (self .ctx .bootstrap .build_dir , 'obj' , 'local' ,
40+ arch .arch )),
41+ ])
3042 env ['LDSHARED' ] = env ['CC' ] + ' -shared'
3143 env ['LIBLINK' ] = 'NOTNONE'
3244
0 commit comments