Skip to content

Commit 1624564

Browse files
committed
Remove hardcoded python2 flags for zbar recipe
The python headers are set in the method get_recipe_env of PythonRecipe's base class, so there is no need to set the python headers. Also make sure that we can build with python2legacy. Also move libraries from LDFLAGS TO LIBS.
1 parent 21bc8b8 commit 1624564

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

pythonforandroid/recipes/zbar/__init__.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import os
1+
from os.path import join
22
from pythonforandroid.recipe import PythonRecipe
33

44

@@ -15,7 +15,9 @@ class ZBarRecipe(PythonRecipe):
1515

1616
call_hostpython_via_targetpython = False
1717

18-
depends = ['hostpython2', 'python2', 'setuptools', 'libzbar']
18+
depends = [('hostpython2legacy', 'hostpython2'),
19+
('python2legacy', 'python2'),
20+
'setuptools', 'libzbar']
1921

2022
patches = ["zbar-0.10-python-crash.patch"]
2123

@@ -24,13 +26,9 @@ def get_recipe_env(self, arch=None, with_flags_in_cc=True):
2426
libzbar = self.get_recipe('libzbar', self.ctx)
2527
libzbar_dir = libzbar.get_build_dir(arch.arch)
2628
env['PYTHON_ROOT'] = self.ctx.get_python_install_dir()
27-
env['CFLAGS'] += ' -I' + os.path.join(libzbar_dir, 'include')
28-
env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python2.7'
29-
# TODO
30-
env['LDSHARED'] = env['CC'] + \
31-
' -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions'
32-
# TODO: hardcoded Python version
33-
env['LDFLAGS'] += " -landroid -lpython2.7 -lzbar"
29+
env['CFLAGS'] += ' -I' + join(libzbar_dir, 'include')
30+
env['LDFLAGS'] += ' -L' + join(libzbar_dir, 'zbar', '.libs')
31+
env['LIBS'] = env.get('LIBS', '') + ' -landroid -lzbar'
3432
return env
3533

3634

0 commit comments

Comments
 (0)