|
1 | | -from os.path import join |
2 | | -import shutil |
3 | | - |
4 | | -from pythonforandroid.recipe import NDKRecipe |
5 | | -from pythonforandroid.util import ensure_dir |
6 | | - |
7 | | - |
8 | | -class Sqlite3Recipe(NDKRecipe): |
9 | | - version = '3.35.5' |
10 | | - # Don't forget to change the URL when changing the version |
11 | | - url = 'https://www.sqlite.org/2021/sqlite-amalgamation-3350500.zip' |
12 | | - generated_libraries = ['sqlite3'] |
13 | | - |
14 | | - def should_build(self, arch): |
15 | | - return not self.has_libs(arch, 'libsqlite3.so') |
16 | | - |
17 | | - def prebuild_arch(self, arch): |
18 | | - super().prebuild_arch(arch) |
19 | | - # Copy the Android make file |
20 | | - ensure_dir(join(self.get_build_dir(arch.arch), 'jni')) |
21 | | - shutil.copyfile(join(self.get_recipe_dir(), 'Android.mk'), |
22 | | - join(self.get_build_dir(arch.arch), 'jni/Android.mk')) |
23 | | - |
24 | | - def build_arch(self, arch, *extra_args): |
25 | | - super().build_arch(arch) |
26 | | - # Copy the shared library |
27 | | - shutil.copyfile(join(self.get_build_dir(arch.arch), 'libs', arch.arch, 'libsqlite3.so'), |
28 | | - join(self.ctx.get_libs_dir(arch.arch), 'libsqlite3.so')) |
29 | | - |
30 | | - def get_recipe_env(self, arch): |
31 | | - env = super().get_recipe_env(arch) |
32 | | - env['NDK_PROJECT_PATH'] = self.get_build_dir(arch.arch) |
33 | | - return env |
| 1 | +import sh |
| 2 | +from pythonforandroid.logger import shprint |
| 3 | +from pythonforandroid.util import current_directory |
| 4 | +from pythonforandroid.recipe import Recipe |
| 5 | +from multiprocessing import cpu_count |
| 6 | + |
| 7 | + |
| 8 | +class Sqlite3Recipe(Recipe): |
| 9 | + version = '3.50.4' |
| 10 | + url = 'https://github.com/sqlite/sqlite/archive/refs/tags/version-{version}.tar.gz' |
| 11 | + built_libraries = {'libsqlite3.so': '.'} |
| 12 | + |
| 13 | + def build_arch(self, arch): |
| 14 | + env = self.get_recipe_env(arch) |
| 15 | + build_dir = self.get_build_dir(arch.arch) |
| 16 | + config_args = { |
| 17 | + '--host={}'.format(arch.command_prefix), |
| 18 | + '--prefix={}'.format(build_dir), |
| 19 | + '--disable-tcl', |
| 20 | + } |
| 21 | + with current_directory(build_dir): |
| 22 | + configure = sh.Command('./configure') |
| 23 | + shprint(configure, *config_args, _env=env) |
| 24 | + shprint(sh.make, '-j', str(cpu_count()), _env=env) |
34 | 25 |
|
35 | 26 |
|
36 | 27 | recipe = Sqlite3Recipe() |
0 commit comments