Skip to content

Commit dfad9c0

Browse files
opacaminclement
authored andcommitted
[recipe-stl] Make libzmq a library recipe (#1968)
1 parent 9e39fbe commit dfad9c0

File tree

1 file changed

+8
-47
lines changed

1 file changed

+8
-47
lines changed
Lines changed: 8 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
1-
from pythonforandroid.toolchain import Recipe, shprint, shutil, current_directory
2-
from pythonforandroid.util import ensure_dir
3-
from os.path import exists, join
1+
from pythonforandroid.recipe import Recipe
2+
from pythonforandroid.logger import shprint
3+
from pythonforandroid.util import current_directory
4+
from os.path import join
45
import sh
56

67

78
class LibZMQRecipe(Recipe):
8-
version = '4.3.1'
9+
version = '4.3.2'
910
url = 'https://github.com/zeromq/libzmq/releases/download/v{version}/zeromq-{version}.zip'
1011
depends = []
11-
12-
def should_build(self, arch):
13-
super(LibZMQRecipe, self).should_build(arch)
14-
return True
15-
return not exists(join(self.ctx.get_libs_dir(arch.arch), 'libzmq.so'))
12+
built_libraries = {'libzmq.so': 'src/.libs'}
13+
need_stl_shared = True
1614

1715
def build_arch(self, arch):
18-
super(LibZMQRecipe, self).build_arch(arch)
1916
env = self.get_recipe_env(arch)
2017
#
2118
# libsodium_recipe = Recipe.get_recipe('libsodium', self.ctx)
@@ -27,6 +24,7 @@ def build_arch(self, arch):
2724

2825
curdir = self.get_build_dir(arch.arch)
2926
prefix = join(curdir, "install")
27+
3028
with current_directory(curdir):
3129
bash = sh.Command('sh')
3230
shprint(
@@ -39,43 +37,6 @@ def build_arch(self, arch):
3937
_env=env)
4038
shprint(sh.make, _env=env)
4139
shprint(sh.make, 'install', _env=env)
42-
shutil.copyfile('src/.libs/libzmq.so', join(
43-
self.ctx.get_libs_dir(arch.arch), 'libzmq.so'))
44-
45-
bootstrap_obj_dir = join(self.ctx.bootstrap.build_dir, 'obj', 'local', arch.arch)
46-
ensure_dir(bootstrap_obj_dir)
47-
shutil.copyfile(
48-
'{}/sources/cxx-stl/gnu-libstdc++/{}/libs/{}/libgnustl_shared.so'.format(
49-
self.ctx.ndk_dir, self.ctx.toolchain_version, arch),
50-
join(bootstrap_obj_dir, 'libgnustl_shared.so'))
51-
52-
# Copy libgnustl_shared.so
53-
with current_directory(self.get_build_dir(arch.arch)):
54-
sh.cp(
55-
"{ctx.ndk_dir}/sources/cxx-stl/gnu-libstdc++/{ctx.toolchain_version}/libs/{arch.arch}/libgnustl_shared.so".format(ctx=self.ctx, arch=arch),
56-
self.ctx.get_libs_dir(arch.arch)
57-
)
58-
59-
def get_include_dirs(self, arch):
60-
return [join(self.get_build_dir(arch.arch), 'include')]
61-
62-
def get_recipe_env(self, arch):
63-
# XXX should stl be configuration for the toolchain itself?
64-
env = super(LibZMQRecipe, self).get_recipe_env(arch)
65-
env['CFLAGS'] += ' -Os'
66-
env['CXXFLAGS'] += ' -Os -fPIC -fvisibility=default'
67-
env['CXXFLAGS'] += ' -I{}/sources/cxx-stl/gnu-libstdc++/{}/include'.format(
68-
self.ctx.ndk_dir, self.ctx.toolchain_version)
69-
env['CXXFLAGS'] += ' -I{}/sources/cxx-stl/gnu-libstdc++/{}/libs/{}/include'.format(
70-
self.ctx.ndk_dir, self.ctx.toolchain_version, arch)
71-
env['CXXFLAGS'] += ' -L{}/sources/cxx-stl/gnu-libstdc++/{}/libs/{}'.format(
72-
self.ctx.ndk_dir, self.ctx.toolchain_version, arch)
73-
env['CXXFLAGS'] += ' -lgnustl_shared'
74-
env['LDFLAGS'] += ' -L{}/sources/cxx-stl/gnu-libstdc++/{}/libs/{}'.format(
75-
self.ctx.ndk_dir, self.ctx.toolchain_version, arch)
76-
env['CXXFLAGS'] += ' --sysroot={}/platforms/android-{}/{}'.format(
77-
self.ctx.ndk_dir, self.ctx.ndk_api, arch.platform_dir)
78-
return env
7940

8041

8142
recipe = LibZMQRecipe()

0 commit comments

Comments
 (0)