@@ -13,7 +13,20 @@ class LibffiRecipe(Recipe):
1313
1414 patches = ['remove-version-info.patch' ]
1515
16- host = 'arm-unknown-linux-androideabi'
16+ def get_host (self , arch ):
17+ with current_directory (self .get_build_dir (arch .arch )):
18+ host = None
19+ with open ('Makefile' ) as f :
20+ for line in f :
21+ if line .startswith ('host = ' ):
22+ host = line .strip ()[7 :]
23+ break
24+
25+ if not host or not exists (host ):
26+ raise RuntimeError ('failed to find build output! ({})'
27+ .format (host ))
28+
29+ return host
1730
1831 def should_build (self , arch ):
1932 # return not bool(glob.glob(join(self.ctx.get_libs_dir(arch.arch),
@@ -27,23 +40,11 @@ def build_arch(self, arch):
2740 with current_directory (self .get_build_dir (arch .arch )):
2841 if not exists ('configure' ):
2942 shprint (sh .Command ('./autogen.sh' ), _env = env )
30- shprint (sh .Command ('./configure' ), '--host=arm-linux-androideabi' ,
43+ shprint (sh .Command ('./configure' ), '--host=' + arch . toolchain_prefix ,
3144 '--prefix=' + self .ctx .get_python_install_dir (),
3245 '--enable-shared' , _env = env )
3346 shprint (sh .make , '-j5' , 'libffi.la' , _env = env )
3447
35- host = None
36- with open ('Makefile' ) as f :
37- for line in f :
38- if line .startswith ('host = ' ):
39- host = line .strip ()[7 :]
40- break
41-
42- if not host or not exists (host ):
43- raise RuntimeError ('failed to find build output! ({})'
44- .format (host ))
45-
46- self .host = host
4748
4849 # dlname = None
4950 # with open(join(host, 'libffi.la')) as f:
@@ -59,11 +60,11 @@ def build_arch(self, arch):
5960 # shprint(sh.sed, '-i', 's/^dlname=.*$/dlname=\'libffi.so\'/', join(host, 'libffi.la'))
6061
6162 shprint (sh .cp , '-t' , self .ctx .get_libs_dir (arch .arch ),
62- join (host , '.libs' , 'libffi.so' )) #,
63+ join (self . get_host ( arch ) , '.libs' , 'libffi.so' )) #,
6364 # join(host, 'libffi.la'))
6465
6566 def get_include_dirs (self , arch ):
66- return [join (self .get_build_dir (arch .arch ), self .host , 'include' )]
67+ return [join (self .get_build_dir (arch .arch ), self .get_host ( arch ) , 'include' )]
6768
6869
6970recipe = LibffiRecipe ()
0 commit comments