lbry-fdroid/p4a/pythonforandroid/recipes/libxslt/__init__.py
Akinwale Ariwodola 8b2694efb7
New build (#508)
* fix build for openssl 1.1.1b required for sdk
(cherry picked from commit aa49e3b2755b97b6331cdbbb89efc954de8d5977)

* use js code from master

* fix openssl recipe and tweak build
(cherry picked from commit 6e94c27021c7bd7b1e880c2fc314850e36a5a38e)

* remove unused build recipes
(cherry picked from commit f5c0577bdb175bfc0990602936bbc9e2052e1f25)
2019-03-30 21:58:45 +01:00

74 lines
2.7 KiB
Python

from pythonforandroid.recipe import Recipe
from pythonforandroid.toolchain import shprint, shutil, current_directory
from os.path import exists, join
import sh
class LibxsltRecipe(Recipe):
version = '1.1.32'
url = 'http://xmlsoft.org/sources/libxslt-{version}.tar.gz'
depends = ['libxml2']
patches = ['fix-dlopen.patch']
call_hostpython_via_targetpython = False
def should_build(self, arch):
return not exists(
join(self.get_build_dir(arch.arch),
'libxslt', '.libs', 'libxslt.a'))
def build_arch(self, arch):
super(LibxsltRecipe, self).build_arch(arch)
env = self.get_recipe_env(arch)
build_dir = self.get_build_dir(arch.arch)
with current_directory(build_dir):
# If the build is done with /bin/sh things blow up,
# try really hard to use bash
libxml2_recipe = Recipe.get_recipe('libxml2', self.ctx)
libxml2_build_dir = libxml2_recipe.get_build_dir(arch.arch)
build_arch = shprint(sh.gcc, '-dumpmachine').stdout.decode(
'utf-8').split('\n')[0]
if not exists('configure'):
shprint(sh.Command('./autogen.sh'), _env=env)
shprint(sh.Command('autoreconf'), '-vif', _env=env)
shprint(sh.Command('./configure'),
'--build=' + build_arch,
'--host=' + arch.command_prefix,
'--target=' + arch.command_prefix,
'--without-plugins',
'--without-debug',
'--without-python',
'--without-crypto',
'--with-libxml-src=' + libxml2_build_dir,
'--disable-shared',
_env=env)
shprint(sh.make, "V=1", _env=env)
shutil.copyfile('libxslt/.libs/libxslt.a',
join(self.ctx.libs_dir, 'libxslt.a'))
shutil.copyfile('libexslt/.libs/libexslt.a',
join(self.ctx.libs_dir, 'libexslt.a'))
def get_recipe_env(self, arch):
env = super(LibxsltRecipe, self).get_recipe_env(arch)
env['CONFIG_SHELL'] = '/bin/bash'
env['SHELL'] = '/bin/bash'
libxml2_recipe = Recipe.get_recipe('libxml2', self.ctx)
libxml2_build_dir = libxml2_recipe.get_build_dir(arch.arch)
libxml2_libs_dir = join(libxml2_build_dir, '.libs')
env['CFLAGS'] = ' '.join([
env['CFLAGS'],
'-I' + libxml2_build_dir,
'-I' + join(libxml2_build_dir, 'include', 'libxml'),
'-I' + self.get_build_dir(arch.arch),
])
env['LDFLAGS'] += ' -L' + libxml2_libs_dir
env['LIBS'] = '-lxml2 -lz -lm'
return env
recipe = LibxsltRecipe()