8000 Rework libxslt recipe and update version · pygame/python-for-android@f7d987a · GitHub
[go: up one dir, main page]

Skip to content

Commit f7d987a

Browse files
committed
Rework libxslt recipe and update version
Actions taken:   - replace double quotes to single quotes because I think that it' 8000 s more readable   - fixed imports   - fix hardcoded entries
1 parent 6ed40d5 commit f7d987a

File tree

1 file changed

+51
-39
lines changed

1 file changed

+51
-39
lines changed

pythonforandroid/recipes/libxslt/__init__.py

Lines changed: 51 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,73 @@
1-
from pythonforandroid.toolchain import Recipe, shprint, shutil, current_directory
1+
from pythonforandroid.recipe import Recipe
2+
from pythonforandroid.toolchain import shprint, shutil, current_directory
23
from os.path import exists, join
34
import sh
45

56

67
class LibxsltRecipe(Recipe):
7-
version = "1.1.28"
8-
url = "http://xmlsoft.org/sources/libxslt-{version}.tar.gz"
9-
depends = ["libxml2"]
10-
patches = ["fix-dlopen.patch"]
8+
version = '1.1.32'
9+
url = 'http://xmlsoft.org/sources/libxslt-{version}.tar.gz'
10+
depends = ['libxml2']
11+
patches = ['fix-dlopen.patch']
1112

1213
call_hostpython_via_targetpython = False
1314

1415
def should_build(self, arch):
15-
super(LibxsltRecipe, self).should_build(arch)
16-
return not exists(join(self.ctx.get_libs_dir(arch.arch), "libxslt.a"))
16+
return not exists(
17+
join(self.get_build_dir(arch.arch),
18+
'libxslt', '.libs', 'libxslt.a'))
1719

1820
def build_arch(self, arch):
1921
super(LibxsltRecipe, self).build_arch(arch)
2022
env = self.get_recipe_env(arch)
21-
with current_directory(self.get_build_dir(arch.arch)):
23+
build_dir = self.get_build_dir(arch.arch)
24+
with current_directory(build_dir):
2225
# If the build is done with /bin/sh things blow up,
2326
# try really hard to use bash
24-
env["CC"] += " -I%s" % self.get_build_dir(arch.arch)
25-
libxml = Recipe.get_recipe(
26-
'libxml2', self.ctx).get_build_dir(arch.arch)
27-
shprint(
28-
sh.Command("./configure"),
29-
"--build=i686-pc-linux-gnu",
30-
"--host=arm-linux-eabi",
31-
"--without-plugins",
32-
"--without-debug",
33-
"--without-python",
34-
"--without-crypto",
35-
"--with-libxml-src=%s" % libxml,
36-
_env=env,
37-
)
27+
libxml2_recipe = Recipe.get_recipe('libxml2', self.ctx)
28+
libxml2_build_dir = libxml2_recipe.get_build_dir(arch.arch)
29+
build_arch = shprint(sh.gcc, '-dumpmachine').stdout.decode(
30+
'utf-8').split('\n')[0]
31+
32+
if not exists('configure'):
33+
shprint(sh.Command('./autogen.sh'), _env=env)
34+
shprint(sh.Command('autoreconf'), '-vif', _env=env)
35+
shprint(sh.Command('./configure'),
36+
'--build=' + build_arch,
37+
'--host=' + arch.command_prefix,
38+
'--target=' + arch.command_prefix,
39+
'--without-plugins',
40+
'--without-debug',
41+
'--without-python',
42+
'--without-crypto',
43+
'--with-libxml-src=' + libxml2_build_dir,
44+
'--disable-shared',
45+
_env=env)
3846
shprint(sh.make, "V=1", _env=env)
39-
shutil.copyfile(
40-
"libxslt/.libs/libxslt.a",
41-
join(self.ctx.get_libs_dir(arch.arch), "libxslt.a"),
42-
)
43-
shutil.copyfile(
44-
"libexslt/.libs/libexslt.a",
45-
join(self.ctx.get_libs_dir(arch.arch), "libexslt.a"),
46-
)
47+
48+
shutil.copyfile('libxslt/.libs/libxslt.a',
49+
join(self.ctx.libs_dir, 'libxslt.a'))
50+
shutil.copyfile('libexslt/.libs/libexslt.a',
51+
join(self.ctx.libs_dir, 'libexslt.a'))
4752

4853
def get_recipe_env(self, arch):
4954
env = super(LibxsltRecipe, self).get_recipe_env(arch)
50-
env["CONFIG_SHELL"] = "/bin/bash"
51-
env["SHELL"] = "/bin/bash"
52-
env[
53-
"CC"
54-
] = "arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer --sysroot={}".format(
55-
self.ctx.ndk_platform
56-
)
57-
58-
env["LDSHARED"] = "%s -nostartfiles -shared -fPIC" % env["CC"]
55+
env['CONFIG_SHELL'] = '/bin/bash'
56+
env['SHELL'] = '/bin/bash'
57+
58+
libxml2_recipe = Recipe.get_recipe('libxml2', self.ctx)
59+
libxml2_build_dir = libxml2_recipe.get_build_dir(arch.arch)
60+
libxml2_libs_dir = join(libxml2_build_dir, '.libs')
61+
62+
env['CFLAGS'] = ' '.join([
63+
env['CFLAGS'],
64+
'-I' + libxml2_build_dir,
65+
'-I' + join(libxml2_build_dir, 'include', 'libxml'),
66+
'-I' + self.get_build_dir(arch.arch),
67+
])
68+
env['LDFLAGS'] += ' -L' + libxml2_libs_dir
69+
env['LIBS'] = '-lxml2 -lz -lm'
70+
5971
return env
6072

6173

0 commit comments

Comments
 (0)
0