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
4
5
import sh
5
6
6
7
7
8
class LibZMQRecipe (Recipe ):
8
- version = '4.3.1 '
9
+ version = '4.3.2 '
9
10
url = 'https://github.com/zeromq/libzmq/releases/download/v{version}/zeromq-{version}.zip'
10
11
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
16
14
17
15
def build_arch (self , arch ):
18
- super (LibZMQRecipe , self ).build_arch (arch )
19
16
env = self .get_recipe_env (arch )
20
17
#
21
18
# libsodium_recipe = Recipe.get_recipe('libsodium', self.ctx)
@@ -27,6 +24,7 @@ def build_arch(self, arch):
27
24
28
25
curdir = self .get_build_dir (arch .arch )
29
26
prefix = join (curdir , "install" )
27
+
30
28
with current_directory (curdir ):
31
29
bash = sh .Command ('sh' )
32
30
shprint (
@@ -39,43 +37,6 @@ def build_arch(self, arch):
39
37
_env = env )
40
38
shprint (sh .make , _env = env )
41
39
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
79
40
80
41
81
42
recipe = LibZMQRecipe ()
0 commit comments