2022-12-02 21:15:34 +01:00
|
|
|
from pythonforandroid.recipe import Recipe
|
|
|
|
from pythonforandroid.util import current_directory
|
|
|
|
from pythonforandroid.logger import shprint
|
|
|
|
from multiprocessing import cpu_count
|
|
|
|
from os.path import realpath
|
2017-08-13 03:24:00 +02:00
|
|
|
import sh
|
|
|
|
|
|
|
|
|
|
|
|
class LibX264Recipe(Recipe):
|
2022-12-02 21:15:34 +01:00
|
|
|
version = '5db6aa6cab1b146e07b60cc1736a01f21da01154' # commit of latest known stable version
|
|
|
|
url = 'https://code.videolan.org/videolan/x264/-/archive/{version}/x264-{version}.zip'
|
|
|
|
built_libraries = {'libx264.a': 'lib'}
|
2017-08-13 03:24:00 +02:00
|
|
|
|
|
|
|
def build_arch(self, arch):
|
|
|
|
with current_directory(self.get_build_dir(arch.arch)):
|
|
|
|
env = self.get_recipe_env(arch)
|
|
|
|
configure = sh.Command('./configure')
|
|
|
|
shprint(configure,
|
2022-12-02 21:15:34 +01:00
|
|
|
f'--host={arch.command_prefix}',
|
2017-08-13 03:24:00 +02:00
|
|
|
'--disable-asm',
|
|
|
|
'--disable-cli',
|
|
|
|
'--enable-pic',
|
|
|
|
'--enable-static',
|
|
|
|
'--prefix={}'.format(realpath('.')),
|
|
|
|
_env=env)
|
2022-12-02 21:15:34 +01:00
|
|
|
shprint(sh.make, '-j', str(cpu_count()), _env=env)
|
2017-08-13 03:24:00 +02:00
|
|
|
shprint(sh.make, 'install', _env=env)
|
|
|
|
|
2019-03-30 21:58:45 +01:00
|
|
|
|
2017-08-13 03:24:00 +02:00
|
|
|
recipe = LibX264Recipe()
|