|
1 | 1 | from pythonforandroid.toolchain import Recipe, shprint, shutil, current_directory |
2 | | -from os.path import exists, join, dirname, basename |
| 2 | +from os.path import exists, join, dirname |
3 | 3 | import sh |
4 | 4 |
|
| 5 | + |
5 | 6 | class LibxsltRecipe(Recipe): |
6 | | - version = '1.1.28' |
7 | | - url = 'http://xmlsoft.org/sources/libxslt-{version}.tar.gz' |
8 | | - depends = ['libxml2'] |
9 | | - patches = ['fix-dlopen.patch'] |
| 7 | + version = "1.1.28" |
| 8 | + url = "http://xmlsoft.org/sources/libxslt-{version}.tar.gz" |
| 9 | + depends = ["libxml2"] |
| 10 | + patches = ["fix-dlopen.patch"] |
10 | 11 |
|
11 | 12 | call_hostpython_via_targetpython = False |
12 | 13 |
|
13 | 14 | def should_build(self, arch): |
14 | 15 | super(LibxsltRecipe, self).should_build(arch) |
15 | | - return not exists(join(self.ctx.get_libs_dir(arch.arch), 'libxslt.a')) |
| 16 | + return not exists(join(self.ctx.get_libs_dir(arch.arch), "libxslt.a")) |
16 | 17 |
|
17 | 18 | def build_arch(self, arch): |
18 | 19 | super(LibxsltRecipe, self).build_arch(arch) |
19 | 20 | env = self.get_recipe_env(arch) |
20 | 21 | with current_directory(self.get_build_dir(arch.arch)): |
21 | 22 | # If the build is done with /bin/sh things blow up, |
22 | 23 | # try really hard to use bash |
23 | | - env['CC'] += " -I%s" % self.get_build_dir(arch.arch) |
24 | | - libxml = dirname(dirname(self.get_build_container_dir(arch.arch))) + "/libxml2/%s/libxml2" % arch.arch |
25 | | - shprint(sh.Command('./configure'), |
26 | | - '--build=i686-pc-linux-gnu', '--host=arm-linux-eabi', |
27 | | - '--without-plugins', '--without-debug', '--without-python', '--without-crypto', |
28 | | - '--with-libxml-src=%s' % libxml, |
29 | | - _env=env) |
| 24 | + env["CC"] += " -I%s" % self.get_build_dir(arch.arch) |
| 25 | + libxml = ( |
| 26 | + dirname(dirname(self.get_build_container_dir(arch.arch))) |
| 27 | + + "/libxml2/%s/libxml2" % arch.arch |
| 28 | + ) |
| 29 | + shprint( |
| 30 | + sh.Command("./configure"), |
| 31 | + "--build=i686-pc-linux-gnu", |
| 32 | + "--host=arm-linux-eabi", |
| 33 | + "--without-plugins", |
| 34 | + "--without-debug", |
| 35 | + "--without-python", |
| 36 | + "--without-crypto", |
| 37 | + "--with-libxml-src=%s" % libxml, |
| 38 | + _env=env, |
| 39 | + ) |
30 | 40 | shprint(sh.make, "V=1", _env=env) |
31 | | - shutil.copyfile('libxslt/.libs/libxslt.a', join(self.ctx.get_libs_dir(arch.arch), 'libxslt.a')) |
32 | | - shutil.copyfile('libexslt/.libs/libexslt.a', join(self.ctx.get_libs_dir(arch.arch), 'libexslt.a')) |
33 | | - |
| 41 | + shutil.copyfile( |
| 42 | + "libxslt/.libs/libxslt.a", |
| 43 | + join(self.ctx.get_libs_dir(arch.arch), "libxslt.a"), |
| 44 | + ) |
| 45 | + shutil.copyfile( |
| 46 | + "libexslt/.libs/libexslt.a", |
| 47 | + join(self.ctx.get_libs_dir(arch.arch), "libexslt.a"), |
| 48 | + ) |
34 | 49 |
|
35 | 50 | def get_recipe_env(self, arch): |
36 | 51 | env = super(LibxsltRecipe, self).get_recipe_env(arch) |
37 | | - env['CONFIG_SHELL'] = '/bin/bash' |
38 | | - env['SHELL'] = '/bin/bash' |
39 | | - env['CC'] = '/usr/bin/ccache arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer' |
40 | | - env['LDSHARED'] = "%s -nostartfiles -shared -fPIC" % env['CC'] |
| 52 | + env["CONFIG_SHELL"] = "/bin/bash" |
| 53 | + env["SHELL"] = "/bin/bash" |
| 54 | + env[ |
| 55 | + "CC" |
| 56 | + ] = "arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer --sysroot={}".format( |
| 57 | + self.ctx.ndk_platform |
| 58 | + ) |
| 59 | + |
| 60 | + env["LDSHARED"] = "%s -nostartfiles -shared -fPIC" % env["CC"] |
41 | 61 | return env |
42 | 62 |
|
| 63 | + |
43 | 64 | recipe = LibxsltRecipe() |
0 commit comments