@@ -15,6 +15,36 @@ class NumpyRecipe(CompiledComponentsPythonRecipe):
15
15
'patches/ar.patch' ,
16
16
'patches/lib.patch' ]
17
17
18
+ def get_recipe_env (self , arch ):
19
+ """ looks like numpy has no proper -L flags. Code copied and adapted from
20
+ https://github.com/frmdstryr/p4a-numpy/
21
+ """
22
+
23
+ env = super (NumpyRecipe , self ).get_recipe_env (arch )
24
+ #: Hack add path L to crystax as a CFLAG
25
+
26
+ py_ver = '3.5'
27
+ if {'python2crystax' , 'python2' } & set (self .ctx .recipe_build_order ):
28
+ py_ver = '2.7'
29
+
30
+ py_so = '2.7' if py_ver == '2.7' else '3.5m'
31
+
32
+ api_ver = self .ctx .android_api
33
+
34
+ platform = 'arm' if 'arm' in arch .arch else arch .arch
35
+ #: Not sure why but we have to inject these into the CC and LD env's for it to
36
+ #: use the correct arguments.
37
+ flags = " -L{ctx.ndk_dir}/platforms/android-{api_ver}/arch-{platform}/usr/lib/" \
38
+ " --sysroot={ctx.ndk_dir}/platforms/android-{api_ver}/arch-{platform}" \
39
+ .format (ctx = self .ctx , arch = arch , platform = platform , api_ver = api_ver ,
40
+ py_so = py_so , py_ver = py_ver )
41
+ if flags not in env ['CC' ]:
42
+ env ['CC' ] += flags
43
+ if flags not in env ['LD' ]:
44
+ env ['LD' ] += flags + ' -shared'
45
+
46
+ return env
47
+
18
48
def prebuild_arch (self , arch ):
19
49
super (NumpyRecipe , self ).prebuild_arch (arch )
20
50
0 commit comments