1
1
from pythonforandroid .toolchain import Recipe , shprint , shutil , current_directory
2
+ from pythonforandroid .util import current_directory , ensure_dir
3
+ from pythonforandroid .logger import debug , shprint , info
2
4
from os .path import exists , join
3
5
import sh
4
6
5
7
class LXMLRecipe (Recipe ):
6
8
version = '3.6.0'
7
9
url = 'https://pypi.python.org/packages/source/l/lxml/lxml-{version}.tar.gz'
8
10
depends = ['python2' , 'libxml2' , 'libxslt' ]
11
+ name = 'lxml'
9
12
10
13
def should_build (self , arch ):
11
14
super (LXMLRecipe , self ).should_build (arch )
@@ -14,17 +17,29 @@ def should_build(self, arch):
14
17
15
18
def build_arch (self , arch ):
16
19
env = self .get_recipe_env (arch )
20
+ env ['CFLAGS' ] = env ['CFLAGS' ] + ' -I{jni_path}/png -I{jni_path}/jpeg' .format (
21
+ jni_path = join (self .ctx .bootstrap .build_dir , 'jni' ))
22
+ env ['CFLAGS' ] = env ['CFLAGS' ] + ' -I{jni_path}/sdl/include -I{jni_path}/sdl_mixer' .format (
23
+ jni_path = join (self .ctx .bootstrap .build_dir , 'jni' ))
24
+ env ['CFLAGS' ] = env ['CFLAGS' ] + ' -I{jni_path}/sdl_ttf -I{jni_path}/sdl_image' .format (
25
+ jni_path = join (self .ctx .bootstrap .build_dir , 'jni' ))
26
+ debug ('pygame cflags' , env ['CFLAGS' ])
27
+
28
+
29
+ env ['LDFLAGS' ] = env ['LDFLAGS' ] + ' -L{libs_path} -L{src_path}/obj/local/{arch} -lm -lz' .format (
30
+ libs_path = self .ctx .libs_dir , src_path = self .ctx .bootstrap .build_dir , arch = env ['ARCH' ])
31
+
32
+ env ['LDSHARED' ] = join (self .ctx .root_dir , 'tools' , 'liblink' )
33
+
17
34
with current_directory (self .get_build_dir (arch .arch )):
35
+ info ('hostpython is ' + self .ctx .hostpython )
18
36
hostpython = sh .Command (self .ctx .hostpython )
19
- shprint (hostpython ,
20
- 'setup.py' ,
37
+ shprint (hostpython , 'setup.py' ,
21
38
'build_ext' ,
22
- "-p%s" % arch .arch ,
23
39
"-I/home/zgoldberg/.local/share/python-for-android/dists/peggo-python/python-install/include/python2.7/pyconfig.h" ,
24
40
"-I/home/zgoldberg/.local/share/python-for-android/build/other_builds/libxml2/armeabi/libxml2/include" ,
25
- "-I/home/zgoldberg/.local/share/python-for-android/build/other_builds/libxslt/armeabi/libxslt"
26
-
27
- , _env = env )
41
+ "-I/home/zgoldberg/.local/share/python-for-android/build/other_builds/libxslt/armeabi/libxslt" ,
42
+ _tail = 10000 , _critical = True , _env = env )
28
43
29
44
super (LXMLRecipe , self ).build_arch (arch )
30
45
@@ -37,6 +52,16 @@ def get_recipe_env(self, arch):
37
52
env ['LDSHARED' ] = "$LIBLINK"
38
53
env ['PATH' ] += ":%s" % bxsl
39
54
env ['CFLAGS' ] += ' -Os'
55
+ env ['LDFLAGS' ] = env ['LDFLAGS' ] + ' -L{}' .format (
56
+ self .ctx .get_libs_dir (arch .arch ))
57
+ env ['LDSHARED' ] = join (self .ctx .root_dir , 'tools' , 'liblink' )
58
+ env ['LIBLINK' ] = 'NOTNONE'
59
+ env ['NDKPLATFORM' ] = self .ctx .ndk_platform
60
+
61
+ # Every recipe uses its own liblink path, object files are collected and biglinked later
62
+ liblink_path = join (self .get_build_container_dir (arch .arch ), 'objects_{}' .format (self .name ))
63
+ env ['LIBLINK_PATH' ] = liblink_path
64
+ ensure_dir (liblink_path )
40
65
return env
41
66
42
67
recipe = LXMLRecipe ()
0 commit comments