22from pythonforandroid .toolchain import CompiledComponentsPythonRecipe
33from pythonforandroid .util import current_directory , ensure_dir
44from pythonforandroid .logger import debug , shprint , info
5- from os .path import exists , join
5+ from os .path import exists , join , dirname
66import sh
77import glob
88
@@ -19,77 +19,21 @@ def should_build(self, arch):
1919 return True
2020 return not exists (join (self .ctx .get_libs_dir (arch .arch ), 'liblxml.so' ))
2121
22- """
23- def build_arch(self, arch):
24- env = self.get_recipe_env(arch)
25- env['CFLAGS'] = env['CFLAGS'] + ' -I{jni_path}/png -I{jni_path}/jpeg'.format(
26- jni_path=join(self.ctx.bootstrap.build_dir, 'jni'))
27- env['CFLAGS'] = env['CFLAGS'] + ' -I{jni_path}/sdl/include -I{jni_path}/sdl_mixer'.format(
28- jni_path=join(self.ctx.bootstrap.build_dir, 'jni'))
29- env['CFLAGS'] = env['CFLAGS'] + ' -I{jni_path}/sdl_ttf -I{jni_path}/sdl_image'.format(
30- jni_path=join(self.ctx.bootstrap.build_dir, 'jni'))
31- debug('pygame cflags', env['CFLAGS'])
32-
33-
34- env['LDFLAGS'] = env['LDFLAGS'] + ' -L{libs_path} -L{src_path}/obj/local/{arch} -lm -lz'.format(
35- libs_path=self.ctx.libs_dir, src_path=self.ctx.bootstrap.build_dir, arch=env['ARCH'])
36-
37- env['LDSHARED'] = join(self.ctx.root_dir, 'tools', 'liblink')
38-
39- with current_directory(self.get_build_dir(arch.arch)):
40- info('hostpython is ' + self.ctx.hostpython)
41- hostpython = sh.Command(self.ctx.hostpython)
42- shprint(hostpython, 'setup.py',
43- 'build_ext',
44- "-I/home/zgoldberg/.local/share/python-for-android/dists/peggo-python/python-install/include/python2.7/pyconfig.h",
45- "-I/home/zgoldberg/.local/share/python-for-android/build/other_builds/libxml2/armeabi/libxml2/include",
46- "-I/home/zgoldberg/.local/share/python-for-android/build/other_builds/libxslt/armeabi/libxslt",
47- _tail=10000, _critical=True, _env=env)
48-
49- build_lib = glob.glob('./build/lib*')
50- assert len(build_lib) == 1
51-
52- shprint(sh.find, ".", '-iname', '*.pyx', '-exec',
53- env['CYTHON'], '{}', ';')
54-
55- shprint(hostpython, 'setup.py',
56- 'build_ext', "-v",
57- _tail=10000, _critical=True, _env=env)
58-
59- shprint(sh.find, build_lib[0], '-name', '*.o', '-exec',
60- env['STRIP'], '{}', ';')
61-
62- shprint(hostpython, 'setup.py',
63- 'install', "-O2",
64- _tail=10000, _critical=True, _env=env)
65-
66- #env['PYTHONPATH'] += $BUILD_hostpython/Lib/site-packages
67- #try $BUILD_hostpython/hostpython setup.py install -O2 --root=$BUILD_PATH/python-install --install-lib=lib/python2.7/site-packages
68-
69-
70-
71- super(LXMLRecipe, self).build_arch(arch)
72- """
7322 def get_recipe_env (self , arch ):
7423 env = super (LXMLRecipe , self ).get_recipe_env (arch )
7524 bxml = "/home/zgoldberg/.local/share/python-for-android/build/other_builds/libxml2/armeabi/libxml2/"
7625 bxsl = "/home/zgoldberg/.local/share/python-for-android/build/other_builds/libxslt/armeabi/libxslt"
77- env ['CC' ] += " -I%s/include -I%s" % (bxml , bxsl )
78- env ['LDFLAGS' ] = (" -L%s/libxslt/.libs -L%s/.libs -L%s/libxslt -L%s/ " % (bxsl , bxsl , bxml , bxsl )) + env ['LDFLAGS' ]
79- env ['CYTHON' ] = "cython"
80- env ['LDSHARED' ] = "$LIBLINK"
81- env ['PATH' ] += ":%s" % bxsl
82- env ['CFLAGS' ] += ' -Os'
83- env ['LDFLAGS' ] = env ['LDFLAGS' ] + ' -L{}' .format (
84- self .ctx .get_libs_dir (arch .arch ))
26+ targetpython = "%s/include/python2.7/" % dirname (dirname (self .ctx .hostpython ))
27+ env ['CC' ] += " -I%s/include -I%s -I%s" % (bxml , bxsl , targetpython )
28+ #env['LDSHARED'] = ENV['CC']
8529 env ['LDSHARED' ] = join (self .ctx .root_dir , 'tools' , 'liblink' )
86- env ['LIBLINK' ] = 'NOTNONE'
87- env ['NDKPLATFORM' ] = self .ctx .ndk_platform
30+ # WTH is liblink?
31+ env ['LDSHARED' ] = env ['LIBLINK' ]
32+ # This linking almost works. Going to have to muck with LDSHARED to
33+ # include the libs_collection folder
34+ #zgoldberg@badass:~/.local/share/python-for-android/build/other_builds/lxml/armeabi/lxml (master)$ /usr/bin/ccache arm-linux-androideabi-ld -L/home/zgoldberg/.local/share/python-for-android/build/other_builds/libxml2/armeabi/libxml2//include -L/home/zgoldberg/.local/share/python-for-android/build/other_builds/libxslt/armeabi/libxslt -L/home/zgoldberg/android-sdks/ndk-bundle/platforms/android-16/arch-arm/usr/lib/ -L/home/zgoldberg/android-sdks/ndk-bundle/platforms/android-16/arch-arm/usr/lib/ -L/home/zgoldberg/.local/share/python-for-android/build/libs_collections/peggo-python/armeabi build/temp.linux-x86_64-2.7/src/lxml/lxml.objectify.o -lxslt -lxml2 -lpython2.7 -lz -lm -o build/lib.linux-x86_64-2.7/lxml/objectify.soi
8835
89- # Every recipe uses its own liblink path, object files are collected and biglinked later
90- liblink_path = join (self .get_build_container_dir (arch .arch ), 'objects_{}' .format (self .name ))
91- env ['LIBLINK_PATH' ] = liblink_path
92- ensure_dir (liblink_path )
36+ import pdb ; pdb .set_trace ()
9337 return env
9438
9539recipe = LXMLRecipe ()
0 commit comments