lbry-android-sdk/p4a/pythonforandroid/recipes/sqlite3/__init__.py

36 lines
1.2 KiB
Python
Raw Permalink Normal View History

from pythonforandroid.recipe import NDKRecipe
from pythonforandroid.toolchain import shutil
from os.path import join
2017-08-13 03:24:00 +02:00
import sh
2017-08-13 03:24:00 +02:00
class Sqlite3Recipe(NDKRecipe):
2022-12-02 21:15:34 +01:00
version = '3.35.5'
2017-08-13 03:24:00 +02:00
# Don't forget to change the URL when changing the version
2022-12-02 21:15:34 +01:00
url = 'https://www.sqlite.org/2021/sqlite-amalgamation-3350500.zip'
2017-08-13 03:24:00 +02:00
generated_libraries = ['sqlite3']
def should_build(self, arch):
return not self.has_libs(arch, 'libsqlite3.so')
def prebuild_arch(self, arch):
2022-12-02 21:15:34 +01:00
super().prebuild_arch(arch)
2017-08-13 03:24:00 +02:00
# Copy the Android make file
sh.mkdir('-p', join(self.get_build_dir(arch.arch), 'jni'))
shutil.copyfile(join(self.get_recipe_dir(), 'Android.mk'),
join(self.get_build_dir(arch.arch), 'jni/Android.mk'))
def build_arch(self, arch, *extra_args):
2022-12-02 21:15:34 +01:00
super().build_arch(arch)
2017-08-13 03:24:00 +02:00
# Copy the shared library
shutil.copyfile(join(self.get_build_dir(arch.arch), 'libs', arch.arch, 'libsqlite3.so'),
join(self.ctx.get_libs_dir(arch.arch), 'libsqlite3.so'))
def get_recipe_env(self, arch):
2022-12-02 21:15:34 +01:00
env = super().get_recipe_env(arch)
2017-08-13 03:24:00 +02:00
env['NDK_PROJECT_PATH'] = self.get_build_dir(arch.arch)
return env
2017-08-13 03:24:00 +02:00
recipe = Sqlite3Recipe()