Skip to content

Commit 1a8a05d

Browse files
committed
add apsw recipe;
1 parent 95f2849 commit 1a8a05d

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
from pythonforandroid.toolchain import PythonRecipe, shprint, shutil, current_directory
2+
from os.path import join, exists
3+
import sh
4+
5+
class ApswRecipe(PythonRecipe):
6+
version = '3.11.0-r1'
7+
url = 'https://github.com/rogerbinns/apsw/archive/{version}.tar.gz'
8+
depends = ['sqlite3', 'hostpython2', 'python2', 'setuptools']
9+
call_hostpython_via_targetpython = False
10+
site_packages_name = 'apsw'
11+
12+
def build_arch(self, arch):
13+
env = self.get_recipe_env(arch)
14+
with current_directory(self.get_build_dir(arch.arch)):
15+
# Build python bindings
16+
hostpython = sh.Command(self.hostpython_location)
17+
shprint(hostpython,
18+
'setup.py',
19+
'build_ext',
20+
'--enable=fts4'
21+
, _env=env)
22+
# Install python bindings
23+
super(ApswRecipe, self).build_arch(arch)
24+
25+
def get_recipe_env(self, arch):
26+
env = super(ApswRecipe, self).get_recipe_env(arch)
27+
env['PYTHON_ROOT'] = self.ctx.get_python_install_dir()
28+
env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python2.7' + \
29+
' -I' + self.get_recipe('sqlite3', self.ctx).get_build_dir(arch.arch)
30+
# Set linker to use the correct gcc
31+
env['LDSHARED'] = env['CC'] + ' -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions'
32+
env['LDFLAGS'] += ' -L' + env['PYTHON_ROOT'] + '/lib' + \
33+
' -lpython2.7' + \
34+
' -lsqlite3'
35+
return env
36+
37+
recipe = ApswRecipe()

0 commit comments

Comments
 (0)