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,10 +21,21 @@ 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
2534 env ['LDFLAGS' ] = env ['LDFLAGS' ] + ' -L{} ' .format (
2635 self .ctx .get_libs_dir (arch .arch ) +
2736 ' -L{} ' .format (self .ctx .libs_dir ) +
37+ ' -L{} ' .format (join (self .ctx .bootstrap .build_dir , 'libs' ,
38+ arch .arch )) +
2839 ' -L{}' .format (join (self .ctx .bootstrap .build_dir , 'obj' , 'local' ,
2940 arch .arch )))
3041 env ['LDSHARED' ] = env ['CC' ] + ' -shared'
0 commit comments