Skip to content

Commit e848e2d

Browse files
committed
[recipe-lib] Make libx264 a library recipe and ...
also:   - make the imports from the right module   - remove the hardcoded cpu count when compiling
1 parent 9410245 commit e848e2d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

pythonforandroid/recipes/libx264/__init__.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
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
36
import sh
47

58

69
class LibX264Recipe(Recipe):
710
version = 'x264-snapshot-20171218-2245-stable' # using mirror url since can't use ftp
811
url = 'http://mirror.yandex.ru/mirrors/ftp.videolan.org/x264/snapshots/{version}.tar.bz2'
12+
built_libraries = {'libx264.a': 'lib'}
913

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):
1515
with current_directory(self.get_build_dir(arch.arch)):
1616
env = self.get_recipe_env(arch)
1717
if 'arm64' in arch.arch:
@@ -29,7 +29,7 @@ def build_arch(self, arch):
2929
'--enable-static',
3030
'--prefix={}'.format(realpath('.')),
3131
_env=env)
32-
shprint(sh.make, '-j4', _env=env)
32+
shprint(sh.make, '-j', str(cpu_count()), _env=env)
3333
shprint(sh.make, 'install', _env=env)
3434

3535

0 commit comments

Comments
 (0)