2019-03-30 21:58:45 +01:00
|
|
|
import os
|
|
|
|
from pythonforandroid.recipe import Recipe
|
2022-12-02 21:15:34 +01:00
|
|
|
from pythonforandroid.util import current_directory
|
|
|
|
from pythonforandroid.logger import shprint
|
2019-03-30 21:58:45 +01:00
|
|
|
from multiprocessing import cpu_count
|
|
|
|
import sh
|
|
|
|
|
|
|
|
|
|
|
|
class LibZBarRecipe(Recipe):
|
|
|
|
|
|
|
|
version = '0.10'
|
|
|
|
|
|
|
|
url = 'https://github.com/ZBar/ZBar/archive/{version}.zip'
|
|
|
|
|
|
|
|
depends = ['libiconv']
|
|
|
|
|
|
|
|
patches = ["werror.patch"]
|
|
|
|
|
2022-12-02 21:15:34 +01:00
|
|
|
built_libraries = {'libzbar.so': 'zbar/.libs'}
|
2019-03-30 21:58:45 +01:00
|
|
|
|
|
|
|
def get_recipe_env(self, arch=None, with_flags_in_cc=True):
|
2022-12-02 21:15:34 +01:00
|
|
|
env = super().get_recipe_env(arch, with_flags_in_cc)
|
2019-03-30 21:58:45 +01:00
|
|
|
libiconv = self.get_recipe('libiconv', self.ctx)
|
|
|
|
libiconv_dir = libiconv.get_build_dir(arch.arch)
|
|
|
|
env['CFLAGS'] += ' -I' + os.path.join(libiconv_dir, 'include')
|
|
|
|
env['LIBS'] = env.get('LIBS', '') + ' -landroid -liconv'
|
|
|
|
return env
|
|
|
|
|
|
|
|
def build_arch(self, arch):
|
|
|
|
env = self.get_recipe_env(arch)
|
|
|
|
with current_directory(self.get_build_dir(arch.arch)):
|
|
|
|
shprint(sh.Command('autoreconf'), '-vif', _env=env)
|
|
|
|
shprint(
|
|
|
|
sh.Command('./configure'),
|
2022-12-02 21:15:34 +01:00
|
|
|
'--host=' + arch.command_prefix,
|
|
|
|
'--target=' + arch.command_prefix,
|
|
|
|
'--prefix=' + self.ctx.get_python_install_dir(arch.arch),
|
2019-03-30 21:58:45 +01:00
|
|
|
# Python bindings are compiled in a separated recipe
|
|
|
|
'--with-python=no',
|
|
|
|
'--with-gtk=no',
|
|
|
|
'--with-qt=no',
|
|
|
|
'--with-x=no',
|
|
|
|
'--with-jpeg=no',
|
|
|
|
'--with-imagemagick=no',
|
|
|
|
'--enable-pthread=no',
|
|
|
|
'--enable-video=no',
|
|
|
|
'--enable-shared=yes',
|
|
|
|
'--enable-static=no',
|
|
|
|
_env=env)
|
|
|
|
shprint(sh.make, '-j' + str(cpu_count()), _env=env)
|
|
|
|
|
|
|
|
|
|
|
|
recipe = LibZBarRecipe()
|