2015-02-20 16:12:42 +01:00
|
|
|
from toolchain import Recipe, shprint
|
2015-08-14 02:31:44 +02:00
|
|
|
from os.path import join, exists
|
2015-02-20 16:12:42 +01:00
|
|
|
import sh
|
|
|
|
|
|
|
|
|
|
|
|
class FFMpegRecipe(Recipe):
|
2019-11-24 22:34:18 +01:00
|
|
|
version = "n3.4.5"
|
|
|
|
url = "https://github.com/FFmpeg/FFmpeg/archive/{version}.zip"
|
2015-02-20 16:12:42 +01:00
|
|
|
include_per_arch = True
|
|
|
|
include_dir = "dist/include"
|
2015-08-14 12:18:15 +02:00
|
|
|
optional_depends = ["openssl"]
|
2015-02-20 16:12:42 +01:00
|
|
|
libraries = [
|
|
|
|
"libavcodec/libavcodec.a",
|
|
|
|
"libavdevice/libavdevice.a",
|
|
|
|
"libavfilter/libavfilter.a",
|
2015-02-22 18:57:04 +01:00
|
|
|
"libavformat/libavformat.a",
|
2015-02-20 16:12:42 +01:00
|
|
|
"libavresample/libavresample.a",
|
|
|
|
"libavutil/libavutil.a",
|
|
|
|
"libswresample/libswresample.a",
|
2019-11-24 22:34:18 +01:00
|
|
|
"libswscale/libswscale.a",
|
|
|
|
]
|
|
|
|
pbx_frameworks = ["VideoToolbox"]
|
2015-02-20 16:12:42 +01:00
|
|
|
|
|
|
|
def build_arch(self, arch):
|
2015-08-14 16:11:59 +02:00
|
|
|
options = [
|
2015-08-14 02:31:44 +02:00
|
|
|
"--disable-everything",
|
2019-11-24 22:34:18 +01:00
|
|
|
"--enable-parsers",
|
|
|
|
"--enable-decoders",
|
|
|
|
"--enable-demuxers",
|
|
|
|
"--enable-filter=aresample,resample,crop,scale",
|
|
|
|
"--enable-protocol=file,http,rtmp",
|
2015-08-14 02:31:44 +02:00
|
|
|
"--enable-pic",
|
|
|
|
"--enable-small",
|
|
|
|
"--enable-hwaccels",
|
|
|
|
"--enable-static",
|
|
|
|
"--disable-shared",
|
|
|
|
# libpostproc is GPL: https://ffmpeg.org/pipermail/ffmpeg-user/2012-February/005162.html
|
|
|
|
"--enable-gpl",
|
|
|
|
# disable some unused algo
|
|
|
|
# note: "golomb" are the one used in our video test, so don't use --disable-golomb
|
|
|
|
# note: and for aac decoding: "rdft", "mdct", and "fft" are needed
|
|
|
|
"--disable-dxva2",
|
|
|
|
"--disable-vdpau",
|
|
|
|
"--disable-vaapi",
|
|
|
|
"--disable-dct",
|
|
|
|
# disable binaries / doc
|
|
|
|
"--enable-cross-compile",
|
|
|
|
"--disable-debug",
|
|
|
|
"--disable-programs",
|
|
|
|
"--disable-doc",
|
|
|
|
"--enable-pic",
|
2015-08-14 16:11:59 +02:00
|
|
|
"--enable-avresample"]
|
|
|
|
|
|
|
|
if "openssl.build_all" in self.ctx.state:
|
|
|
|
options += [
|
|
|
|
"--enable-openssl",
|
|
|
|
"--enable-nonfree",
|
|
|
|
"--enable-protocol=https,tls_openssl"]
|
2015-08-14 02:31:44 +02:00
|
|
|
|
2015-02-20 16:12:42 +01:00
|
|
|
build_env = arch.get_env()
|
|
|
|
build_env["VERBOSE"] = "1"
|
|
|
|
configure = sh.Command(join(self.build_dir, "configure"))
|
|
|
|
shprint(configure,
|
|
|
|
"--target-os=darwin",
|
|
|
|
"--arch={}".format(arch.arch),
|
|
|
|
"--cc={}".format(build_env["CC"]),
|
|
|
|
"--prefix={}/dist".format(self.build_dir),
|
|
|
|
"--extra-cflags={}".format(build_env["CFLAGS"]),
|
|
|
|
"--extra-cxxflags={}".format(build_env["CFLAGS"]),
|
|
|
|
"--extra-ldflags={}".format(build_env["LDFLAGS"]),
|
2019-11-24 22:34:18 +01:00
|
|
|
"--disable-x86asm",
|
2015-02-20 16:12:42 +01:00
|
|
|
*options,
|
|
|
|
_env=build_env)
|
2015-08-14 02:31:44 +02:00
|
|
|
"""
|
|
|
|
shprint(sh.sed,
|
|
|
|
"-i.bak",
|
|
|
|
"s/HAVE_CLOSESOCKET=yes//g",
|
|
|
|
"config.mak")
|
|
|
|
shprint(sh.sed,
|
|
|
|
"-i.bak",
|
|
|
|
"s/#define HAVE_CLOSESOCKET 1//g",
|
|
|
|
"config.h")
|
|
|
|
if exists("config.asm"):
|
|
|
|
shprint(sh.sed,
|
|
|
|
"-i.bak",
|
|
|
|
"s/%define HAVE_CLOSESOCKET 1//g",
|
|
|
|
"config.asm")
|
|
|
|
"""
|
2015-02-20 16:12:42 +01:00
|
|
|
shprint(sh.make, "clean", _env=build_env)
|
2017-05-02 08:10:11 +02:00
|
|
|
shprint(sh.make, self.ctx.concurrent_make, _env=build_env)
|
2015-02-20 16:12:42 +01:00
|
|
|
shprint(sh.make, "install")
|
|
|
|
|
|
|
|
|
|
|
|
recipe = FFMpegRecipe()
|