Skip to content

Commit 49250e7

Browse files
committed
Add new class variable to Recipe: stl_depends
This will allow us to know if some recipe depends on stl library, so we can load the corresponding stl library when our application initializes
1 parent 9ec87cb commit 49250e7

File tree

6 files changed

+19
-0
lines changed

6 files changed

+19
-0
lines changed

pythonforandroid/recipe.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,19 @@ class Recipe(with_metaclass(RecipeMeta)):
9999
list of pure-Python packages to install via pip. If you need these packages
100100
at build time, you must create a recipe.'''
101101

102+
stl_depends = None
103+
'''This should be a string which could be two values: ``c++_shared`` or
104+
``gnustl_shared``. It will meant that we depend on one of those shared
105+
libs, so it must be loaded at runtime when the apk initialises.
106+
107+
.. note:: if you write a new recipe you should use c++_shared because it
108+
will be the only one stl lib available starting from android ndk r18.
109+
110+
.. warning:: keep in mind that you should do the copy of the shared lib
111+
inside the recipe, except if you inherit from the class
112+
:class:`pythonforandroid.recipe.CppCompiledComponentsPythonRecipe`.
113+
'''
114+
102115
archs = ['armeabi'] # Not currently implemented properly
103116

104117
@property
@@ -875,6 +888,7 @@ def rebuild_compiled_components(self, arch, env):
875888
class CppCompiledComponentsPythonRecipe(CompiledComponentsPythonRecipe):
876889
""" Extensions that require the cxx-stl """
877890
call_hostpython_via_targetpython = False
891+
stl_depends = 'gnustl_shared'
878892

879893
def get_recipe_env(self, arch):
880894
env = super(CppCompiledComponentsPythonRecipe, self).get_recipe_env(arch)

pythonforandroid/recipes/boost/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class BoostRecipe(Recipe):
1313
# Don't forget to change the URL when changing the version
1414
url = 'http://downloads.sourceforge.net/project/boost/boost/{version}/boost_1_60_0.tar.bz2'
1515
depends = ['python2']
16+
stl_depends = 'gnustl_shared'
1617
patches = ['disable-so-version.patch', 'use-android-libs.patch']
1718

1819
def should_build(self, arch):

pythonforandroid/recipes/icu/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class ICURecipe(NDKRecipe):
1212
url = 'http://download.icu-project.org/files/icu4c/57.1/icu4c-57_1-src.tgz'
1313

1414
depends = [('python2', 'python3crystax'), 'hostpython2'] # installs in python
15+
stl_depends = 'gnustl_shared'
1516
generated_libraries = [
1617
'libicui18n.so', 'libicuuc.so', 'libicudata.so', 'libicule.so']
1718

pythonforandroid/recipes/leveldb/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class LevelDBRecipe(Recipe):
77
version = '1.18'
88
url = 'https://github.com/google/leveldb/archive/v{version}.tar.gz'
99
opt_depends = ['snappy']
10+
stl_depends = 'gnustl_shared'
1011
patches = ['disable-so-version.patch', 'find-snappy.patch']
1112

1213
def should_build(self, arch):

pythonforandroid/recipes/libzmq/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class LibZMQRecipe(Recipe):
88
version = '4.1.4'
99
url = 'http://download.zeromq.org/zeromq-{version}.tar.gz'
1010
depends = ['python2']
11+
stl_depends = 'gnustl_shared'
1112

1213
def should_build(self, arch):
1314
super(LibZMQRecipe, self).should_build(arch)

pythonforandroid/recipes/protobuf_cpp/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class ProtobufCppRecipe(PythonRecipe):
1515
url = 'https://github.com/google/protobuf/releases/download/v{version}/protobuf-python-{version}.tar.gz'
1616
call_hostpython_via_targetpython = False
1717
depends = ['cffi', 'setuptools']
18+
stl_depends = 'gnustl_shared'
1819
site_packages_name = 'google/protobuf/pyext'
1920
protoc_dir = None
2021

0 commit comments

Comments
 (0)