1
- from pythonforandroid .toolchain import Recipe , shprint , shutil , current_directory
2
- from os .path import exists , join
1
+ from pythonforandroid .recipe import Recipe
2
+ from pythonforandroid .util import current_directory
3
+ from pythonforandroid .logger import shprint
4
+ from multiprocessing import cpu_count
3
5
import sh
4
6
5
7
@@ -8,19 +10,21 @@ class LibsodiumRecipe(Recipe):
8
10
url = 'https://github.com/jedisct1/libsodium/releases/download/{version}/libsodium-{version}.tar.gz'
9
11
depends = []
10
12
patches = ['size_max_fix.patch' ]
11
-
12
- def should_build (self , arch ):
13
- super (LibsodiumRecipe , self ).should_build (arch )
14
- return not exists (join (self .ctx .get_libs_dir (arch .arch ), 'libsodium.so' ))
13
+ built_libraries = {'libsodium.so' : 'src/libsodium/.libs' }
15
14
16
15
def build_arch (self , arch ):
17
- super (LibsodiumRecipe , self ).build_arch (arch )
18
16
env = self .get_recipe_env (arch )
19
17
with current_directory (self .get_build_dir (arch .arch )):
20
18
bash = sh .Command ('bash' )
21
- shprint (bash , 'configure' , '--disable-soname-versions' , '--host=arm-linux-androideabi' , '--enable-shared' , _env = env )
22
- shprint (sh .make , _env = env )
23
- shutil .copyfile ('src/libsodium/.libs/libsodium.so' , join (self .ctx .get_libs_dir (arch .arch ), 'libsodium.so' ))
19
+ shprint (
20
+ bash ,
21
+ 'configure' ,
22
+ '--disable-soname-versions' ,
23
+ '--host={}' .format (arch .command_prefix ),
24
+ '--enable-shared' ,
25
+ _env = env ,
26
+ )
27
+ shprint (sh .make , '-j' , str (cpu_count ()), _env = env )
24
28
25
29
def get_recipe_env (self , arch ):
26
30
env = super (LibsodiumRecipe , self ).get_recipe_env (arch )
0 commit comments