summaryrefslogtreecommitdiffstats
path: root/wscript
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-01-27 09:57:01 +0100
committerwm4 <wm4@nowhere>2017-01-27 09:57:01 +0100
commitcfda696580a994055e4532a273ce86c867ffdac4 (patch)
treeec58b108f5444ca888732576c79e076088e931b0 /wscript
parenta9e0f4b2793091991dfca4fba715f7a6635e797d (diff)
downloadmpv-cfda696580a994055e4532a273ce86c867ffdac4.tar.bz2
mpv-cfda696580a994055e4532a273ce86c867ffdac4.tar.xz
build: explicitly check for FFmpeg vs. Libav, and their exact versions
In a first pass, we check whether libavcodec is present. Then we try to compile a snippet and check for FFmpeg vs. Libav. (This could probably also be done by somehow checking the pkgconfig version. But pkg-config can't deal with that idiotic FFmpeg idea that a micro version number >= 100 identifies FFmpeg vs. Libav.) After that we check the project-specific version numbers. This means it can no longer happen that we accidentally allow older, unsupported versions of FFmpeg, just because the Libav version numbers are somehow this way. Also drop the resampler checks. We hardcode which resampler to each with each project. A user can no longer force use of libavresample with FFmpeg.
Diffstat (limited to 'wscript')
-rw-r--r--wscript91
1 files changed, 52 insertions, 39 deletions
diff --git a/wscript b/wscript
index 0986f8dc40..81a048df5d 100644
--- a/wscript
+++ b/wscript
@@ -386,55 +386,68 @@ iconv support use --disable-iconv.",
}
]
-# Libav 12:
-# libavutil 55.20.0
-# libavcodec 57.25.0
-# libavformat 57.7.2
-# libswscale 4.0.0
-# libavfilter 6.7.0
-# libavresample 3.0.0
-# FFmpeg 3.2.2:
-# libavutil 55.34.100
-# libavcodec 57.64.101
-# libavformat 57.56.100
-# libswscale 4.2.100
-# libavfilter 6.65.100
-# libswresample 2.3.100
-
+ffmpeg_version = "3.2.2"
+ffmpeg_pkg_config_checks = [
+ 'libavutil', '>= 55.34.100',
+ 'libavcodec', '>= 57.64.100',
+ 'libavformat', '>= 57.56.100',
+ 'libswscale', '>= 4.2.100',
+ 'libavfilter', '>= 6.65.100',
+ 'libswresample', '>= 2.3.100',
+]
+libav_version = "12"
libav_pkg_config_checks = [
- 'libavutil', '>= 55.20.0',
- 'libavcodec', '>= 57.25.0',
- 'libavformat', '>= 57.07.0',
- 'libswscale', '>= 4.0.0',
- 'libavfilter', '>= 6.7.0',
+ 'libavutil', '>= 55.20.0',
+ 'libavcodec', '>= 57.25.0',
+ 'libavformat', '>= 57.7.0',
+ 'libswscale', '>= 4.0.0',
+ 'libavfilter', '>= 6.7.0',
+ 'libavresample', '>= 3.0.0',
]
-libav_versions_string = "FFmpeg 3.2.2 or Libav 12"
+
+libav_versions_string = "FFmpeg %s or Libav %s" % (ffmpeg_version, libav_version)
+
+def check_ffmpeg_or_libav_versions():
+ def fn(ctx, dependency_identifier, **kw):
+ versions = ffmpeg_pkg_config_checks
+ if ctx.dependency_satisfied('is_libav'):
+ versions = libav_pkg_config_checks
+ return check_pkg_config(*versions)(ctx, dependency_identifier, **kw)
+ return fn
libav_dependencies = [
{
+ 'name': 'libavcodec',
+ 'desc': 'FFmpeg/Libav present',
+ 'func': check_pkg_config('libavcodec'),
+ 'req': True,
+ 'fmsg': "FFmpeg/Libav development files not found.",
+ }, {
+ 'name': 'is_ffmpeg',
+ 'desc': 'libav* is FFmpeg',
+ # FFmpeg <=> LIBAVUTIL_VERSION_MICRO>=100
+ 'func': check_statement('libavcodec/version.h',
+ 'int x[LIBAVCODEC_VERSION_MICRO >= 100 ? 1 : -1]',
+ use='libavcodec')
+ }, {
+ # This check should always result in the opposite of is_ffmpeg.
+ # Run it to make sure is_ffmpeg didn't fail for some other reason than
+ # the actual version check.
+ 'name': 'is_libav',
+ 'desc': 'libav* is Libav',
+ # FFmpeg <=> LIBAVUTIL_VERSION_MICRO>=100
+ 'func': check_statement('libavcodec/version.h',
+ 'int x[LIBAVCODEC_VERSION_MICRO >= 100 ? -1 : 1]',
+ use='libavcodec')
+ }, {
'name': 'libav',
- 'desc': 'libav/ffmpeg',
- 'func': check_pkg_config(*libav_pkg_config_checks),
+ 'desc': 'Libav/FFmpeg library versions',
+ 'deps_any': [ 'is_ffmpeg', 'is_libav' ],
+ 'func': check_ffmpeg_or_libav_versions(),
'req': True,
'fmsg': "Unable to find development files for some of the required \
FFmpeg/Libav libraries. You need at least {0}. Aborting.".format(libav_versions_string)
}, {
- 'name': '--libswresample',
- 'desc': 'libswresample',
- 'func': check_pkg_config('libswresample', '>= 2.3.100'),
- }, {
- 'name': '--libavresample',
- 'desc': 'libavresample',
- 'func': check_pkg_config('libavresample', '>= 3.0.0'),
- 'deps_neg': ['libswresample'],
- }, {
- 'name': 'resampler',
- 'desc': 'usable resampler found',
- 'deps_any': [ 'libavresample', 'libswresample' ],
- 'func': check_true,
- 'req': True,
- 'fmsg': 'No resampler found. Install libavresample or libswresample (FFmpeg).'
- }, {
'name': '--libavdevice',
'desc': 'libavdevice',
'func': check_pkg_config('libavdevice', '>= 57.0.0'),