Skip to content

Commit 024cb16

Browse files
author
Pol Canelles
committed
Adds new recipe: libexpat
1 parent 8829312 commit 024cb16

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
2+
import sh
3+
from pythonforandroid.toolchain import Recipe, shprint, shutil, current_directory
4+
from os.path import exists, join
5+
from multiprocessing import cpu_count
6+
7+
8+
class LibexpatRecipe(Recipe):
9+
version = 'master'
10+
url = 'https://github.com/libexpat/libexpat/archive/{version}.zip'
11+
depends = []
12+
13+
def should_build(self, arch):
14+
super(LibexpatRecipe, self).should_build(arch)
15+
return not exists(
16+
join(self.ctx.get_libs_dir(arch.arch), 'libexpat.so'))
17+
18+
def build_arch(self, arch):
19+
super(LibexpatRecipe, self).build_arch(arch)
20+
env = self.get_recipe_env(arch)
21+
with current_directory(join(self.get_build_dir(arch.arch), 'expat')):
22+
dst_dir = join(self.get_build_dir(arch.arch), 'dist')
23+
shprint(sh.Command('./buildconf.sh'), _env=env)
24+
shprint(
25+
sh.Command('./configure'),
26+
'--host=arm-linux-androideabi',
27+
'--enable-shared',
28+
'--without-xmlwf',
29+
'--prefix={}'.format(dst_dir),
30+
_env=env)
31+
shprint(sh.make, '-j', str(cpu_count()), _env=env)
32+
shprint(sh.make, 'install', _env=env)
33+
shutil.copyfile(
34+
'{}/lib/libexpat.so'.format(dst_dir),
35+
join(self.ctx.get_libs_dir(arch.arch), 'libexpat.so'))
36+
37+
38+
recipe = LibexpatRecipe()

0 commit comments

Comments
 (0)