1
- from pythonforandroid .toolchain import Recipe , current_directory , shprint
2
- from os .path import exists , join , realpath
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
5
+ from os .path import realpath
3
6
import sh
4
7
5
8
6
9
class LibX264Recipe (Recipe ):
7
10
version = 'x264-snapshot-20171218-2245-stable' # using mirror url since can't use ftp
8
11
url = 'http://mirror.yandex.ru/mirrors/ftp.videolan.org/x264/snapshots/{version}.tar.bz2'
12
+ built_libraries = {'libx264.a' : 'lib' }
9
13
10
- def should_build (self , arch ):
11
- build_dir = self .get_build_dir (arch .arch )
12
- return not exists (join (build_dir , 'lib' , 'libx264.a' ))
13
-
14
- def build_arch (self , arch ):
14
+ def do_build_libs (self , arch ):
15
15
with current_directory (self .get_build_dir (arch .arch )):
16
16
env = self .get_recipe_env (arch )
17
17
if 'arm64' in arch .arch :
@@ -29,7 +29,7 @@ def build_arch(self, arch):
29
29
'--enable-static' ,
30
30
'--prefix={}' .format (realpath ('.' )),
31
31
_env = env )
32
- shprint (sh .make , '-j4' , _env = env )
32
+ shprint (sh .make , '-j' , str ( cpu_count ()) , _env = env )
33
33
shprint (sh .make , 'install' , _env = env )
34
34
35
35
0 commit comments