|
1 | 1 | from pythonforandroid.toolchain import Recipe, current_directory, shprint |
2 | 2 | from os.path import exists, join, realpath |
3 | 3 | import sh |
| 4 | +from multiprocessing import cpu_count |
4 | 5 |
|
5 | 6 |
|
6 | 7 | class FFMpegRecipe(Recipe): |
7 | 8 | version = 'n6.1.2' |
8 | 9 | # Moved to github.com instead of ffmpeg.org to improve download speed |
9 | 10 | url = 'https://github.com/FFmpeg/FFmpeg/archive/{version}.zip' |
10 | | - depends = ['sdl2'] # Need this to build correct recipe order |
| 11 | + depends = [('sdl2', 'sdl3')] # Need this to build correct recipe order |
11 | 12 | opts_depends = ['openssl', 'ffpyplayer_codecs', 'av_codecs'] |
12 | 13 | patches = ['patches/configure.patch'] |
| 14 | + _libs = [ |
| 15 | + "libavcodec.so", |
| 16 | + "libavfilter.so", |
| 17 | + "libavutil.so", |
| 18 | + "libswscale.so", |
| 19 | + "libavdevice.so", |
| 20 | + "libavformat.so", |
| 21 | + "libswresample.so", |
| 22 | + "libffmpegbin.so", |
| 23 | + ] |
| 24 | + built_libraries = dict.fromkeys(_libs, "./lib") |
13 | 25 |
|
14 | 26 | def should_build(self, arch): |
15 | 27 | build_dir = self.get_build_dir(arch.arch) |
@@ -98,9 +110,8 @@ def build_arch(self, arch): |
98 | 110 | '--disable-symver', |
99 | 111 | ] |
100 | 112 |
|
101 | | - # disable binaries / doc |
| 113 | + # disable doc |
102 | 114 | flags += [ |
103 | | - '--disable-programs', |
104 | 115 | '--disable-doc', |
105 | 116 | ] |
106 | 117 |
|
@@ -148,11 +159,9 @@ def build_arch(self, arch): |
148 | 159 |
|
149 | 160 | configure = sh.Command('./configure') |
150 | 161 | shprint(configure, *flags, _env=env) |
151 | | - shprint(sh.make, '-j4', _env=env) |
| 162 | + shprint(sh.make, '-j', f"{cpu_count()}", _env=env) |
152 | 163 | shprint(sh.make, 'install', _env=env) |
153 | | - # copy libs: |
154 | | - sh.cp('-a', sh.glob('./lib/lib*.so'), |
155 | | - self.ctx.get_libs_dir(arch.arch)) |
| 164 | + shprint(sh.cp, "ffmpeg", "./lib/libffmpegbin.so") |
156 | 165 |
|
157 | 166 |
|
158 | 167 | recipe = FFMpegRecipe() |
0 commit comments