@@ -556,15 +556,13 @@ def prepare_build_dir(self, arch):
556556 self .get_build_dir (arch ))
557557
558558
559- class NDKRecipe (Recipe ):
559+ class BootstrapNDKRecipe (Recipe ):
560560 '''A recipe class for recipes built in an Android project jni dir with
561561 an Android.mk. These are not cached separatly, but built in the
562562 bootstrap's own building directory.
563563
564- In the future they should probably also copy their contents from a
565- standalone set of ndk recipes, but for now the bootstraps include
566- all their recipe code.
567-
564+ To build an NDK project which is not part of the bootstrap, see
565+ :class:`~pythonforandroid.recipe.NDKRecipe`.
568566 '''
569567
570568 dir_name = None # The name of the recipe build folder in the jni dir
@@ -582,6 +580,34 @@ def get_jni_dir(self):
582580 return join (self .ctx .bootstrap .build_dir , 'jni' )
583581
584582
583+ class NDKRecipe (Recipe ):
584+ '''A recipe class for any NDK project not included in the bootstrap.'''
585+
586+ generated_libraries = []
587+
588+ def should_build (self , arch ):
589+ lib_dir = self .get_lib_dir (arch )
590+
591+ for lib in self .generated_libraries :
592+ if not exists (join (lib_dir , lib )):
593+ return True
594+
595+ return False
596+
597+ def get_lib_dir (self , arch ):
598+ return join (self .get_build_dir (arch .arch ), 'obj' , 'local' , arch .arch )
599+
600+ def get_jni_dir (self , arch ):
601+ return join (self .get_build_dir (arch .arch ), 'jni' )
602+
603+ def build_arch (self , arch , * extra_args ):
604+ super (NDKRecipe , self ).build_arch (arch )
605+
606+ env = self .get_recipe_env (arch )
607+ with current_directory (self .get_build_dir (arch .arch )):
608+ shprint (sh .ndk_build , 'V=1' , 'APP_ABI=' + arch .arch , * extra_args , _env = env )
609+
610+
585611class PythonRecipe (Recipe ):
586612 site_packages_name = None
587613 '''The name of the module's folder when installed in the Python
0 commit comments