2013-07-16 11:28:28 +00:00
|
|
|
# vi: ft=python
|
|
|
|
|
|
|
|
import sys, os, re
|
|
|
|
sys.path.insert(0, os.path.join(os.getcwd(), 'waftools'))
|
2013-11-23 09:58:19 +00:00
|
|
|
sys.path.insert(0, os.getcwd())
|
2013-07-16 11:28:28 +00:00
|
|
|
from waflib.Configure import conf
|
2016-10-21 06:51:17 +00:00
|
|
|
from waflib.Tools import c_preproc
|
2013-07-16 11:28:28 +00:00
|
|
|
from waflib import Utils
|
|
|
|
from waftools.checks.generic import *
|
|
|
|
from waftools.checks.custom import *
|
|
|
|
|
2016-10-21 06:51:17 +00:00
|
|
|
c_preproc.go_absolute=True # enable system folders
|
|
|
|
c_preproc.standard_includes.append('/usr/local/include')
|
|
|
|
|
2017-06-27 11:47:46 +00:00
|
|
|
"""
|
|
|
|
Dependency identifiers (for win32 vs. Unix):
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
wscript / C source meaning
|
2017-06-27 11:47:46 +00:00
|
|
|
--------------------------------------------------------------------------
|
|
|
|
posix / HAVE_POSIX: defined on Linux, OSX, Cygwin
|
|
|
|
(Cygwin emulates POSIX APIs on Windows)
|
|
|
|
mingw / __MINGW32__: defined if posix is not defined
|
|
|
|
(Windows without Cygwin)
|
|
|
|
os-win32 / _WIN32: defined if basic windows.h API is available
|
|
|
|
win32-desktop / HAVE_WIN32_DESKTOP: defined if desktop windows.h API is available
|
2017-06-27 11:50:58 +00:00
|
|
|
uwp / HAVE_UWP: defined if building for UWP (basic Windows only)
|
2017-06-27 11:47:46 +00:00
|
|
|
"""
|
|
|
|
|
2013-07-16 11:28:28 +00:00
|
|
|
build_options = [
|
|
|
|
{
|
2017-09-21 11:50:18 +00:00
|
|
|
'name': '--preliminary-lgpl3',
|
|
|
|
'desc': 'Preliminary LGPLv3+ license',
|
|
|
|
'default': 'disable',
|
|
|
|
'func': check_true,
|
|
|
|
}, {
|
|
|
|
'name': 'gpl',
|
|
|
|
'desc': 'GPL build',
|
|
|
|
'deps': '!preliminary-lgpl3',
|
|
|
|
'func': check_true,
|
|
|
|
}, {
|
|
|
|
'name': 'libaf',
|
|
|
|
'desc': 'internal audio filter chain',
|
|
|
|
'deps': 'gpl',
|
|
|
|
'func': check_true,
|
|
|
|
}, {
|
2014-11-28 14:55:54 +00:00
|
|
|
'name': '--cplayer',
|
|
|
|
'desc': 'mpv CLI player',
|
|
|
|
'default': 'enable',
|
|
|
|
'func': check_true
|
|
|
|
}, {
|
2014-03-11 22:56:19 +00:00
|
|
|
'name': '--libmpv-shared',
|
2014-02-24 10:50:21 +00:00
|
|
|
'desc': 'shared library',
|
2014-02-10 20:25:22 +00:00
|
|
|
'default': 'disable',
|
|
|
|
'func': check_true
|
2014-06-16 09:22:46 +00:00
|
|
|
}, {
|
|
|
|
'name': '--libmpv-static',
|
|
|
|
'desc': 'static library',
|
|
|
|
'default': 'disable',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': '!libmpv-shared',
|
2014-06-16 09:22:46 +00:00
|
|
|
'func': check_true
|
2014-02-10 20:25:22 +00:00
|
|
|
}, {
|
2013-07-16 11:28:28 +00:00
|
|
|
'name': '--static-build',
|
|
|
|
'desc': 'static build',
|
|
|
|
'default': 'disable',
|
|
|
|
'func': check_true
|
|
|
|
}, {
|
|
|
|
'name': '--build-date',
|
|
|
|
'desc': 'whether to include binary compile time',
|
|
|
|
'default': 'enable',
|
|
|
|
'func': check_true
|
2014-07-19 16:45:43 +00:00
|
|
|
}, {
|
|
|
|
'name': '--optimize',
|
|
|
|
'desc': 'whether to optimize',
|
|
|
|
'default': 'enable',
|
|
|
|
'func': check_true
|
2013-07-16 11:28:28 +00:00
|
|
|
}, {
|
|
|
|
'name': '--debug-build',
|
|
|
|
'desc': 'whether to compile-in debugging information',
|
|
|
|
'default': 'enable',
|
|
|
|
'func': check_true
|
|
|
|
}, {
|
|
|
|
'name': '--manpage-build',
|
|
|
|
'desc': 'manpage generation',
|
|
|
|
'func': check_ctx_vars('RST2MAN')
|
2015-12-29 19:57:09 +00:00
|
|
|
}, {
|
|
|
|
'name': '--html-build',
|
|
|
|
'desc': 'html manual generation',
|
|
|
|
'func': check_ctx_vars('RST2HTML'),
|
|
|
|
'default': 'disable',
|
2013-07-16 11:28:28 +00:00
|
|
|
}, {
|
|
|
|
'name': '--pdf-build',
|
|
|
|
'desc': 'pdf manual generation',
|
2014-01-08 15:00:40 +00:00
|
|
|
'func': check_ctx_vars('RST2PDF'),
|
2015-02-02 11:06:06 +00:00
|
|
|
'default': 'disable',
|
2013-07-16 11:28:28 +00:00
|
|
|
}, {
|
|
|
|
'name': 'libdl',
|
|
|
|
'desc': 'dynamic loader',
|
|
|
|
'func': check_libs(['dl'], check_statement('dlfcn.h', 'dlopen("", 0)'))
|
2017-01-12 16:37:11 +00:00
|
|
|
}, {
|
|
|
|
'name': '--cplugins',
|
|
|
|
'desc': 'C plugins',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'libdl && !os-win32',
|
2017-03-02 13:40:14 +00:00
|
|
|
'func': check_cc(linkflags=['-rdynamic']),
|
2014-06-08 14:00:43 +00:00
|
|
|
}, {
|
|
|
|
'name': '--zsh-comp',
|
|
|
|
'desc': 'zsh completion',
|
2016-12-17 12:24:05 +00:00
|
|
|
'func': check_ctx_vars('BIN_PERL'),
|
2014-06-08 14:00:43 +00:00
|
|
|
'func': check_true,
|
2014-06-09 13:17:03 +00:00
|
|
|
'default': 'disable',
|
2013-12-29 16:34:31 +00:00
|
|
|
}, {
|
2014-04-19 15:09:24 +00:00
|
|
|
# does nothing - left for backward and forward compatibility
|
2013-12-29 16:34:31 +00:00
|
|
|
'name': '--asm',
|
2014-04-19 15:09:24 +00:00
|
|
|
'desc': 'inline assembly (currently without effect)',
|
2013-12-29 16:34:31 +00:00
|
|
|
'default': 'enable',
|
|
|
|
'func': check_true,
|
2014-12-28 08:38:22 +00:00
|
|
|
}, {
|
|
|
|
'name': '--test',
|
|
|
|
'desc': 'test suite (using cmocka)',
|
2015-06-12 17:31:55 +00:00
|
|
|
'func': check_pkg_config('cmocka', '>= 1.0.0'),
|
2015-03-10 17:19:32 +00:00
|
|
|
'default': 'disable',
|
2015-02-05 20:00:23 +00:00
|
|
|
}, {
|
|
|
|
'name': '--clang-database',
|
|
|
|
'desc': 'generate a clang compilation database',
|
|
|
|
'func': check_true,
|
|
|
|
'default': 'disable',
|
2013-07-16 11:28:28 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
main_dependencies = [
|
|
|
|
{
|
|
|
|
'name': 'noexecstack',
|
|
|
|
'desc': 'compiler support for noexecstack',
|
|
|
|
'func': check_cc(linkflags='-Wl,-z,noexecstack')
|
|
|
|
}, {
|
|
|
|
'name': 'noexecstack',
|
|
|
|
'desc': 'linker support for --nxcompat --no-seh --dynamicbase',
|
|
|
|
'func': check_cc(linkflags=['-Wl,--nxcompat', '-Wl,--no-seh', '-Wl,--dynamicbase'])
|
|
|
|
} , {
|
|
|
|
'name': 'libm',
|
|
|
|
'desc': '-lm',
|
|
|
|
'func': check_cc(lib='m')
|
2014-09-14 14:21:04 +00:00
|
|
|
}, {
|
|
|
|
'name': 'mingw',
|
|
|
|
'desc': 'MinGW',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'os-win32',
|
2016-11-17 11:46:18 +00:00
|
|
|
'func': check_statement('stdlib.h', 'int x = __MINGW32__;'
|
2014-11-17 22:47:30 +00:00
|
|
|
'int y = __MINGW64_VERSION_MAJOR'),
|
|
|
|
}, {
|
|
|
|
'name': 'posix',
|
|
|
|
'desc': 'POSIX environment',
|
|
|
|
# This should be good enough.
|
2014-12-26 16:14:48 +00:00
|
|
|
'func': check_statement(['poll.h', 'unistd.h', 'sys/mman.h'],
|
|
|
|
'struct pollfd pfd; poll(&pfd, 1, 0); fork(); int f[2]; pipe(f); munmap(f,0)'),
|
2017-08-04 21:42:35 +00:00
|
|
|
}, {
|
|
|
|
'name': '--android',
|
|
|
|
'desc': 'Android environment',
|
|
|
|
'func': check_statement('android/api-level.h', '(void)__ANDROID__'), # arbitrary android-specific header
|
2014-11-17 22:47:30 +00:00
|
|
|
}, {
|
|
|
|
'name': 'posix-or-mingw',
|
2015-03-11 22:40:54 +00:00
|
|
|
'desc': 'development environment',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'posix || mingw',
|
2014-11-17 22:47:30 +00:00
|
|
|
'func': check_true,
|
|
|
|
'req': True,
|
|
|
|
'fmsg': 'Unable to find either POSIX or MinGW-w64 environment, ' \
|
|
|
|
'or compiler does not work.',
|
2017-06-27 11:50:58 +00:00
|
|
|
}, {
|
|
|
|
'name': '--uwp',
|
|
|
|
'desc': 'Universal Windows Platform',
|
|
|
|
'default': 'disable',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'os-win32 && mingw && !cplayer',
|
2017-06-27 11:50:58 +00:00
|
|
|
'func': check_cc(lib=['windowsapp']),
|
2015-03-11 22:40:54 +00:00
|
|
|
}, {
|
2017-06-27 11:47:46 +00:00
|
|
|
'name': 'win32-desktop',
|
|
|
|
'desc': 'win32 desktop APIs',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': '(os-win32 || os-cygwin) && !uwp',
|
2016-09-27 12:44:18 +00:00
|
|
|
'func': check_cc(lib=['winmm', 'gdi32', 'ole32', 'uuid', 'avrt', 'dwmapi']),
|
2015-01-01 14:10:42 +00:00
|
|
|
}, {
|
|
|
|
'name': '--win32-internal-pthreads',
|
|
|
|
'desc': 'internal pthread wrapper for win32 (Vista+)',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'os-win32 && !posix',
|
2015-01-01 14:10:42 +00:00
|
|
|
'func': check_true,
|
2013-07-16 11:28:28 +00:00
|
|
|
}, {
|
2013-11-28 18:28:38 +00:00
|
|
|
'name': 'pthreads',
|
2013-07-16 11:28:28 +00:00
|
|
|
'desc': 'POSIX threads',
|
|
|
|
'func': check_pthreads,
|
2013-11-28 18:28:38 +00:00
|
|
|
'req': True,
|
|
|
|
'fmsg': 'Unable to find pthreads support.'
|
2016-09-06 18:13:30 +00:00
|
|
|
}, {
|
|
|
|
'name': 'gnuc',
|
|
|
|
'desc': 'GNU C extensions',
|
|
|
|
'func': check_statement([], "__GNUC__"),
|
2014-05-20 23:04:47 +00:00
|
|
|
}, {
|
|
|
|
'name': 'stdatomic',
|
|
|
|
'desc': 'stdatomic.h',
|
2014-06-17 18:03:19 +00:00
|
|
|
'func': check_libs(['atomic'],
|
2014-05-20 23:04:47 +00:00
|
|
|
check_statement('stdatomic.h',
|
2014-06-17 18:03:19 +00:00
|
|
|
'atomic_int_least64_t test = ATOMIC_VAR_INIT(123);'
|
wscript: improve stdatomic check
The current stdatomic check verifies the availability of the function by
calling atomic_load(). It also uses this test to check if linking
against libatomic is needed or not.
Unfortunately, on specific architectures (namely SPARC), using
atomic_load() does *not* require linking against libatomic, while other
atomic operations do. Due to this, mpv's wscript concludes that
stdatomic is available, and that linking against libatomic is not
needed, causing the following link failure:
[190/190] Linking build/mpv
audio/out/ao.c.13.o: In function `ao_query_and_reset_events':
/home/peko/autobuild/instance-0/output/build/mpv-0.18.1/build/../audio/out/ao.c:399: undefined reference to `__atomic_fetch_and_4'
In order to fix this, the stdatomic check is adjusted to call
atomic_fetch_add() instead, which does require libatomic. Thanks to
this, the wscript realizes that linking against libatomic is needed, and
the build works fine.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2016-08-08 21:34:32 +00:00
|
|
|
'atomic_fetch_add(&test, 1)'))
|
2014-01-01 19:42:13 +00:00
|
|
|
}, {
|
2014-07-05 15:02:06 +00:00
|
|
|
'name': 'atomics',
|
2017-02-13 05:45:40 +00:00
|
|
|
'desc': 'stdatomic.h support or slow emulation',
|
2014-01-01 19:42:13 +00:00
|
|
|
'func': check_true,
|
2016-08-05 15:10:22 +00:00
|
|
|
'req': True,
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'stdatomic || gnuc',
|
2013-07-16 11:28:28 +00:00
|
|
|
}, {
|
|
|
|
'name': 'librt',
|
|
|
|
'desc': 'linking with -lrt',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'pthreads',
|
2013-07-16 11:28:28 +00:00
|
|
|
'func': check_cc(lib='rt')
|
|
|
|
}, {
|
|
|
|
'name': '--iconv',
|
|
|
|
'desc': 'iconv',
|
|
|
|
'func': check_iconv,
|
|
|
|
'req': True,
|
|
|
|
'fmsg': "Unable to find iconv which should be part of a standard \
|
|
|
|
compilation environment. Aborting. If you really mean to compile without \
|
|
|
|
iconv support use --disable-iconv.",
|
|
|
|
}, {
|
|
|
|
'name': 'dos-paths',
|
|
|
|
'desc': 'w32/dos paths',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'os-win32 || os-cygwin',
|
2013-07-16 11:28:28 +00:00
|
|
|
'func': check_true
|
|
|
|
}, {
|
|
|
|
'name': '--termios',
|
|
|
|
'desc': 'termios',
|
|
|
|
'func': check_headers('termios.h', 'sys/termios.h'),
|
|
|
|
}, {
|
|
|
|
'name': '--shm',
|
|
|
|
'desc': 'shm',
|
2013-12-26 15:57:21 +00:00
|
|
|
'func': check_statement(['sys/types.h', 'sys/ipc.h', 'sys/shm.h'],
|
2013-07-16 11:28:28 +00:00
|
|
|
'shmget(0, 0, 0); shmat(0, 0, 0); shmctl(0, 0, 0)')
|
2014-11-17 22:50:32 +00:00
|
|
|
}, {
|
|
|
|
'name': 'nanosleep',
|
|
|
|
'desc': 'nanosleep',
|
|
|
|
'func': check_statement('time.h', 'nanosleep(0,0)')
|
lua: add an utility function for starting processes
Because 1) Lua is terrible, and 2) popen() is terrible. Unfortunately,
since Unix is also terrible, this turned out more complicated than I
hoped. As a consequence and to avoid that this code has to be maintained
forever, add a disclaimer that any function in Lua's utils module can
disappear any time. The complexity seems a bit ridiculous, especially
for a feature so far removed from actual video playback, so if it turns
out that we don't really need this function, it will be dropped again.
The motivation for this commit is the same as with 8e4fa5fc.
Note that there is an "#ifndef __GLIBC__". The GNU people are very
special people and thought it'd be convenient to actually declare
"environ", even though the POSIX people, which are also very special
people, state that no header declares this and that the user has to
declare this manually. Since the GNU people overtook the Unix world with
their very clever "embrace, extend, extinguish" strategy, but not 100%,
and trying to build without _GNU_SOURCE is hopeless; but since there
might be Unix environments which support _GNU_SOURCE features partially,
this means that in practice "environ" will be randomly declared or not
declared by system headers. Also, gcc was written by very clever people
too, and prints a warning if an external variable is declared twice (I
didn't check, but I suppose redeclaring is legal C, and not even the gcc
people are clever enough to only warn against a definitely not legal C
construct, although sometimes they do this), ...and since we at mpv hate
compiler warnings, we seek to silence them all. Adding a configure test
just for a warning seems too radical, so we special-case this against
__GLIBC__, which is hopefully not defined on other libcs, especially not
libcs which don't implement all aspects of _GNU_SOURCE, and redefine
"environ" on systems even if the headers define it already (because they
support _GNU_SOURCE - as I mentioned before, the clever GNU people wrote
software THAT portable that other libcs just gave up and implemented
parts of _GNU_SOURCE, although probably not all), which means that
compiling mpv will print a warning about "environ" being redefined, but
at least this won't happen on my system, so all is fine. However, should
someone complain about this warning, I will force whoever complained
about this warning to read this ENTIRE commit message, and if possible,
will also force them to eat a printed-out copy of the GNU Manifesto, and
if that is not enough, maybe this person could even be forced to
convince the very clever POSIX people of not doing crap like this:
having the user to manually declare somewhat central symbols - but I
doubt it's possible, because the POSIX people are too far gone and only
care about maintaining compatibility with old versions of AIX and HP-UX.
Oh, also, this code contains some subtle and obvious issues, but writing
about this is not fun.
2014-10-18 23:42:28 +00:00
|
|
|
}, {
|
2017-08-03 20:50:10 +00:00
|
|
|
'name': 'posix-spawn-native',
|
|
|
|
'desc': 'spawnp()/kill() POSIX support',
|
2014-10-19 10:55:29 +00:00
|
|
|
'func': check_statement(['spawn.h', 'signal.h'],
|
2015-03-30 17:46:02 +00:00
|
|
|
'posix_spawnp(0,0,0,0,0,0); kill(0,0)'),
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': '!mingw',
|
2017-08-03 20:50:10 +00:00
|
|
|
}, {
|
|
|
|
'name': 'posix-spawn-android',
|
|
|
|
'desc': 'spawnp()/kill() Android replacement',
|
|
|
|
'func': check_true,
|
|
|
|
'deps': 'android && !posix-spawn-native',
|
|
|
|
},{
|
|
|
|
'name': 'posix-spawn',
|
|
|
|
'desc': 'any spawnp()/kill() support',
|
|
|
|
'deps': 'posix-spawn-native || posix-spawn-android',
|
|
|
|
'func': check_true,
|
2015-03-30 17:46:02 +00:00
|
|
|
}, {
|
2017-06-27 11:47:46 +00:00
|
|
|
'name': 'win32-pipes',
|
|
|
|
'desc': 'Windows pipe support',
|
2015-03-30 17:46:02 +00:00
|
|
|
'func': check_true,
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'win32-desktop && !posix',
|
2017-08-04 21:47:16 +00:00
|
|
|
}, {
|
|
|
|
'name': 'glob-posix',
|
|
|
|
'desc': 'glob() POSIX support',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': '!(os-win32 || os-cygwin)',
|
2017-08-04 21:47:16 +00:00
|
|
|
'func': check_statement('glob.h', 'glob("filename", 0, 0, 0)'),
|
2013-07-16 11:28:28 +00:00
|
|
|
}, {
|
2017-06-27 10:37:47 +00:00
|
|
|
'name': 'glob-win32',
|
2013-07-16 11:28:28 +00:00
|
|
|
'desc': 'glob() win32 replacement',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': '!posix && (os-win32 || os-cygwin)',
|
2013-07-16 11:28:28 +00:00
|
|
|
'func': check_true
|
2017-08-04 21:47:16 +00:00
|
|
|
}, {
|
|
|
|
'name': 'glob',
|
|
|
|
'desc': 'any glob() support',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'glob-posix || glob-win32',
|
2017-08-04 21:47:16 +00:00
|
|
|
'func': check_true,
|
2015-02-26 20:44:35 +00:00
|
|
|
}, {
|
|
|
|
'name': 'fchmod',
|
|
|
|
'desc': 'fchmod()',
|
|
|
|
'func': check_statement('sys/stat.h', 'fchmod(0, 0)'),
|
2015-04-19 07:09:37 +00:00
|
|
|
}, {
|
|
|
|
'name': 'vt.h',
|
|
|
|
'desc': 'vt.h',
|
|
|
|
'func': check_statement(['sys/vt.h', 'sys/ioctl.h'],
|
|
|
|
'int m; ioctl(0, VT_GETMODE, &m)'),
|
vo_opengl: add DRM EGL backend
Notes:
- Unfortunately the only way to talk to EGL from within DRM I could find
involves linking with GBM (generic buffer management for Mesa.)
Because of this, I'm pretty sure it won't work with proprietary NVidia
drivers, but then again, last time I checked NVidia didn't offer
proper screen resolution for VT.
- VT switching doesn't seem to work at all. It's worth mentioning that
using vo_drm before introduction of VT switcher had an anomaly where
user could switch to another VT and input text to it, while video
played on top of that VT. However, that isn't the case with drm_egl:
I can't switch to other VT during playback like this. This makes me
think that it's either a limitation coming from my firmware or from
EGL/KMS itself rather than a bug with my code. Nonetheless, I still
left (untestable) VT switching code in place, in case it's useful to
someone else.
- The mode_id, connector_id and device_path should be configurable for
power users and people who wish to watch videos on nonprimary screen.
Unfortunately I didn't see anything that would allow OpenGL backends
to register their own set of options. At the same time, adding them to
global namespace is pointless.
- A few dozens of lines could be shared with vo_drm (setting up VT
switching, most of code behind page flipping). I don't have any strong
opinion on this.
- Sometimes I get minor visual glitches. I'm not sure if there's a race
condition of some sort, unitialized variable (doubtful), or if it's
buggy driver. (I'm using integrated Intel HD Graphics 4400 with Mesa)
- .config and .control are very minimal.
Signed-off-by: wm4 <wm4@nowhere>
2015-11-07 18:06:57 +00:00
|
|
|
}, {
|
|
|
|
'name': 'gbm.h',
|
|
|
|
'desc': 'gbm.h',
|
|
|
|
'func': check_cc(header_name=['stdio.h', 'gbm.h']),
|
2014-10-19 21:32:34 +00:00
|
|
|
}, {
|
|
|
|
'name': 'glibc-thread-name',
|
|
|
|
'desc': 'GLIBC API for setting thread name',
|
|
|
|
'func': check_statement('pthread.h',
|
|
|
|
'pthread_setname_np(pthread_self(), "ducks")',
|
|
|
|
use=['pthreads']),
|
|
|
|
}, {
|
|
|
|
'name': 'osx-thread-name',
|
|
|
|
'desc': 'OSX API for setting thread name',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': '!glibc-thread-name',
|
2014-10-19 21:32:34 +00:00
|
|
|
'func': check_statement('pthread.h',
|
|
|
|
'pthread_setname_np("ducks")', use=['pthreads']),
|
|
|
|
}, {
|
|
|
|
'name': 'bsd-thread-name',
|
|
|
|
'desc': 'BSD API for setting thread name',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': '!(glibc-thread-name || osx-thread-name)',
|
2014-10-21 23:02:55 +00:00
|
|
|
'func': check_statement('pthread.h',
|
2017-06-22 08:32:48 +00:00
|
|
|
'pthread_set_name_np(pthread_self(), "ducks")',
|
2014-10-21 23:02:55 +00:00
|
|
|
use=['pthreads']),
|
2014-02-17 11:51:38 +00:00
|
|
|
}, {
|
|
|
|
'name': 'bsd-fstatfs',
|
|
|
|
'desc': "BSD's fstatfs()",
|
|
|
|
'func': check_statement(['sys/param.h', 'sys/mount.h'],
|
2014-03-11 23:49:16 +00:00
|
|
|
'struct statfs fs; fstatfs(0, &fs); fs.f_fstypename')
|
2014-03-11 19:27:50 +00:00
|
|
|
}, {
|
|
|
|
'name': 'linux-fstatfs',
|
|
|
|
'desc': "Linux's fstatfs()",
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'os-linux',
|
2014-03-11 19:27:50 +00:00
|
|
|
'func': check_statement('sys/vfs.h',
|
|
|
|
'struct statfs fs; fstatfs(0, &fs); fs.f_namelen')
|
2013-07-16 11:28:28 +00:00
|
|
|
}, {
|
|
|
|
'name': '--libsmbclient',
|
2017-05-11 06:12:14 +00:00
|
|
|
'desc': 'Samba support (makes mpv GPLv3)',
|
2017-09-21 11:50:18 +00:00
|
|
|
'deps': 'libdl && gpl',
|
2013-11-30 18:47:09 +00:00
|
|
|
'func': check_pkg_config('smbclient'),
|
2017-05-11 06:12:14 +00:00
|
|
|
'default': 'disable',
|
2013-07-16 11:28:28 +00:00
|
|
|
'module': 'input',
|
2014-10-11 23:31:20 +00:00
|
|
|
}, {
|
|
|
|
'name' : '--lua',
|
|
|
|
'desc' : 'Lua',
|
|
|
|
'func': check_lua,
|
2014-12-13 16:27:47 +00:00
|
|
|
}, {
|
|
|
|
'name' : '--javascript',
|
|
|
|
'desc' : 'Javascript (MuJS backend)',
|
2017-06-16 12:24:24 +00:00
|
|
|
'func': check_pkg_config('mujs', '>= 1.0.0'),
|
2013-07-16 11:28:28 +00:00
|
|
|
}, {
|
|
|
|
'name': '--libass',
|
|
|
|
'desc': 'SSA/ASS support',
|
2015-02-18 20:11:53 +00:00
|
|
|
'func': check_pkg_config('libass', '>= 0.12.1'),
|
2013-07-16 11:28:28 +00:00
|
|
|
'req': True,
|
2015-02-21 16:13:38 +00:00
|
|
|
'fmsg': "Unable to find development files for libass, or the version " +
|
|
|
|
"found is too old. Aborting. If you really mean to compile " +
|
|
|
|
"without libass support use --disable-libass."
|
2013-07-16 11:28:28 +00:00
|
|
|
}, {
|
|
|
|
'name': '--libass-osd',
|
|
|
|
'desc': 'libass OSD support',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'libass',
|
2013-07-16 11:28:28 +00:00
|
|
|
'func': check_true,
|
|
|
|
}, {
|
|
|
|
'name': 'dummy-osd',
|
|
|
|
'desc': 'dummy OSD support',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': '!libass-osd',
|
2013-07-16 11:28:28 +00:00
|
|
|
'func': check_true,
|
|
|
|
} , {
|
2017-06-28 13:33:21 +00:00
|
|
|
'name': '--zlib',
|
2013-07-16 11:28:28 +00:00
|
|
|
'desc': 'zlib',
|
|
|
|
'func': check_libs(['z'],
|
|
|
|
check_statement('zlib.h', 'inflate(0, Z_NO_FLUSH)')),
|
|
|
|
'req': True,
|
|
|
|
'fmsg': 'Unable to find development files for zlib.'
|
|
|
|
} , {
|
|
|
|
'name' : '--encoding',
|
|
|
|
'desc' : 'Encoding',
|
|
|
|
'func': check_true,
|
2014-07-14 23:49:02 +00:00
|
|
|
}, {
|
|
|
|
'name': '--libbluray',
|
|
|
|
'desc': 'Bluray support',
|
|
|
|
'func': check_pkg_config('libbluray', '>= 0.3.0'),
|
2017-03-15 00:20:47 +00:00
|
|
|
#'default': 'disable',
|
2014-07-14 23:49:02 +00:00
|
|
|
}, {
|
|
|
|
'name': '--dvdread',
|
|
|
|
'desc': 'dvdread support',
|
2017-09-21 11:50:18 +00:00
|
|
|
'deps': 'gpl',
|
2014-07-14 23:49:02 +00:00
|
|
|
'func': check_pkg_config('dvdread', '>= 4.1.0'),
|
2017-03-15 00:20:47 +00:00
|
|
|
'default': 'disable',
|
2014-07-14 23:49:02 +00:00
|
|
|
}, {
|
|
|
|
'name': '--dvdnav',
|
|
|
|
'desc': 'dvdnav support',
|
2017-09-21 11:50:18 +00:00
|
|
|
'deps': 'gpl',
|
2017-03-31 15:43:20 +00:00
|
|
|
'func': check_pkg_config('dvdnav', '>= 4.2.0',
|
|
|
|
'dvdread', '>= 4.1.0'),
|
2017-03-15 00:20:47 +00:00
|
|
|
'default': 'disable',
|
2017-03-31 19:17:01 +00:00
|
|
|
}, {
|
2017-04-07 15:26:02 +00:00
|
|
|
'name': 'dvdread-common',
|
|
|
|
'desc': 'DVD/IFO support',
|
2017-09-21 11:50:18 +00:00
|
|
|
'deps': 'gpl && (dvdread || dvdnav)',
|
2017-03-31 19:17:01 +00:00
|
|
|
'func': check_true,
|
2013-07-16 11:28:28 +00:00
|
|
|
}, {
|
|
|
|
'name': '--cdda',
|
|
|
|
'desc': 'cdda support (libcdio)',
|
2017-09-21 11:50:18 +00:00
|
|
|
'deps': 'gpl',
|
2013-07-16 11:28:28 +00:00
|
|
|
'func': check_pkg_config('libcdio_paranoia'),
|
2017-03-15 00:20:47 +00:00
|
|
|
'default': 'disable',
|
2015-08-01 22:12:36 +00:00
|
|
|
}, {
|
|
|
|
'name': '--uchardet',
|
|
|
|
'desc': 'uchardet support',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'iconv',
|
2015-08-01 22:12:36 +00:00
|
|
|
'func': check_pkg_config('uchardet'),
|
2015-02-10 22:50:17 +00:00
|
|
|
}, {
|
|
|
|
'name': '--rubberband',
|
|
|
|
'desc': 'librubberband support',
|
2017-09-21 11:50:18 +00:00
|
|
|
'deps': 'libaf',
|
2015-02-10 22:50:17 +00:00
|
|
|
'func': check_pkg_config('rubberband', '>= 1.8.0'),
|
2013-07-16 11:28:28 +00:00
|
|
|
}, {
|
|
|
|
'name': '--lcms2',
|
|
|
|
'desc': 'LCMS2 support',
|
2014-06-16 14:57:19 +00:00
|
|
|
'func': check_pkg_config('lcms2', '>= 2.6'),
|
2014-04-12 15:51:19 +00:00
|
|
|
}, {
|
|
|
|
'name': '--vapoursynth',
|
2014-10-11 23:31:20 +00:00
|
|
|
'desc': 'VapourSynth filter bridge (Python)',
|
2015-09-22 09:46:57 +00:00
|
|
|
'func': check_pkg_config('vapoursynth', '>= 24',
|
|
|
|
'vapoursynth-script', '>= 23'),
|
2014-10-11 23:31:20 +00:00
|
|
|
}, {
|
|
|
|
'name': '--vapoursynth-lazy',
|
|
|
|
'desc': 'VapourSynth filter bridge (Lazy Lua)',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'lua',
|
2015-09-22 09:46:57 +00:00
|
|
|
'func': check_pkg_config('vapoursynth', '>= 24'),
|
|
|
|
}, {
|
|
|
|
'name': 'vapoursynth-core',
|
|
|
|
'desc': 'VapourSynth filter bridge (core)',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'vapoursynth || vapoursynth-lazy',
|
2014-10-11 23:31:20 +00:00
|
|
|
'func': check_true,
|
stream: libarchive wrapper for reading compressed archives
This works similar to the existing .rar support, but uses libarchive.
libarchive supports a number of formats, including zip and (most of)
rar.
Unfortunately, seeking does not work too well. Most libarchive readers
do not support seeking, so it's emulated by skipping data until the
target position. On backwards seek, the file is reopened. This works
fine on a local machine (and if the file is not too large), but will
perform not so well over network connection.
This is disabled by default for now. One reason is that we try
libarchive on every file we open, before trying libavformat, and I'm not
sure if I trust libarchive that much yet. Another reason is that this
breaks multivolume rar support. While libarchive supports seeking in
rar, and (probably) supports multivolume archive, our support of
libarchive (probably) does not. I don't care about multivolume rar, but
vocal users do.
2015-08-16 22:55:26 +00:00
|
|
|
}, {
|
|
|
|
'name': '--libarchive',
|
|
|
|
'desc': 'libarchive wrapper for reading zip files and more',
|
|
|
|
'func': check_pkg_config('libarchive >= 3.0.0'),
|
|
|
|
'default': 'disable',
|
2013-07-16 11:28:28 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2017-01-27 08:57:01 +00:00
|
|
|
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"
|
2013-07-16 11:28:28 +00:00
|
|
|
libav_pkg_config_checks = [
|
2017-01-27 08:57:01 +00:00
|
|
|
'libavutil', '>= 55.20.0',
|
|
|
|
'libavcodec', '>= 57.25.0',
|
|
|
|
'libavformat', '>= 57.7.0',
|
|
|
|
'libswscale', '>= 4.0.0',
|
|
|
|
'libavfilter', '>= 6.7.0',
|
|
|
|
'libavresample', '>= 3.0.0',
|
2013-07-16 11:28:28 +00:00
|
|
|
]
|
2017-01-27 08:57:01 +00:00
|
|
|
|
|
|
|
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
|
2013-07-16 11:28:28 +00:00
|
|
|
|
2016-06-09 19:05:33 +00:00
|
|
|
libav_dependencies = [
|
2013-07-16 11:28:28 +00:00
|
|
|
{
|
2017-01-27 08:57:01 +00:00
|
|
|
'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')
|
|
|
|
}, {
|
2016-06-09 19:05:33 +00:00
|
|
|
'name': 'libav',
|
2017-01-27 08:57:01 +00:00
|
|
|
'desc': 'Libav/FFmpeg library versions',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'is_ffmpeg || is_libav',
|
2017-01-27 08:57:01 +00:00
|
|
|
'func': check_ffmpeg_or_libav_versions(),
|
2013-07-16 11:28:28 +00:00
|
|
|
'req': True,
|
|
|
|
'fmsg': "Unable to find development files for some of the required \
|
2016-06-09 19:05:33 +00:00
|
|
|
FFmpeg/Libav libraries. You need at least {0}. Aborting.".format(libav_versions_string)
|
build: reduce worst case with mismatching FFmpeg pkg-config files
Handles mismatching libavfilter/libavdevice and libavcodec slightly
better.
libavfilter and libavdevice are optional, and thus are checked
separately and at a later point of the build. But if a user system has
at least 2 FFmpeg installations, and one of them lacks libavfilter or
libavdevice, the build script will pick up the libavfilter/libavdevice
package of the "other" FFmpeg installation. The moment waf picks these
up, all include paths will start pointing at the "wrong" FFmpeg, and the
FFmpeg API checks done earlier might be wrong too, leading to obscure
and hard to explain compilation failures.
Just moving the libavfilter/libavdevice checks before the FFmpeg API
checks somewhat deals with this issue. Certainly not a proper solution,
but since the change is harmless, and there is no proper solution, and
the change doesn't actually add anything new, why not.
2015-01-20 14:53:40 +00:00
|
|
|
}, {
|
|
|
|
'name': '--libavdevice',
|
|
|
|
'desc': 'libavdevice',
|
2016-12-07 17:17:41 +00:00
|
|
|
'func': check_pkg_config('libavdevice', '>= 57.0.0'),
|
2017-06-10 12:02:55 +00:00
|
|
|
}, {
|
|
|
|
'name': 'avutil-content-light-level',
|
|
|
|
'desc': 'libavutil content light level struct',
|
|
|
|
'func': check_statement('libavutil/frame.h',
|
|
|
|
'AV_FRAME_DATA_CONTENT_LIGHT_LEVEL',
|
|
|
|
use='libav'),
|
2017-07-25 21:06:27 +00:00
|
|
|
}, {
|
|
|
|
'name': 'avutil-icc-profile',
|
|
|
|
'desc': 'libavutil ICC profile side data',
|
|
|
|
'func': check_statement('libavutil/frame.h',
|
|
|
|
'AV_FRAME_DATA_ICC_PROFILE',
|
|
|
|
use='libav'),
|
2017-08-21 12:56:07 +00:00
|
|
|
}, {
|
|
|
|
'name': 'avutil-spherical',
|
|
|
|
'desc': 'libavutil spherical side data',
|
|
|
|
'func': check_statement('libavutil/spherical.h',
|
|
|
|
'AV_SPHERICAL_EQUIRECTANGULAR',
|
|
|
|
use='libav'),
|
2016-12-07 18:44:29 +00:00
|
|
|
},
|
2013-07-16 11:28:28 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
audio_output_features = [
|
|
|
|
{
|
|
|
|
'name': '--sdl2',
|
|
|
|
'desc': 'SDL2',
|
2013-12-29 13:14:09 +00:00
|
|
|
'func': check_pkg_config('sdl2'),
|
|
|
|
'default': 'disable'
|
2013-07-16 11:28:28 +00:00
|
|
|
}, {
|
2014-01-24 23:30:28 +00:00
|
|
|
'name': '--sdl1',
|
2013-07-16 11:28:28 +00:00
|
|
|
'desc': 'SDL (1.x)',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': '!sdl2',
|
2013-12-29 13:14:09 +00:00
|
|
|
'func': check_pkg_config('sdl'),
|
|
|
|
'default': 'disable'
|
2013-07-16 11:28:28 +00:00
|
|
|
}, {
|
|
|
|
'name': '--oss-audio',
|
2017-06-22 08:30:11 +00:00
|
|
|
'desc': 'OSS',
|
|
|
|
'func': check_cc(header_name='sys/soundcard.h'),
|
2017-09-21 11:50:18 +00:00
|
|
|
'deps': 'posix && gpl',
|
2013-07-16 11:28:28 +00:00
|
|
|
}, {
|
|
|
|
'name': '--rsound',
|
|
|
|
'desc': 'RSound audio output',
|
|
|
|
'func': check_statement('rsound.h', 'rsd_init(NULL)', lib='rsound')
|
|
|
|
}, {
|
|
|
|
'name': '--sndio',
|
|
|
|
'desc': 'sndio audio input/output',
|
|
|
|
'func': check_statement('sndio.h',
|
2014-09-26 13:52:29 +00:00
|
|
|
'struct sio_par par; sio_initpar(&par); const char *s = SIO_DEVANY', lib='sndio'),
|
|
|
|
'default': 'disable'
|
2013-07-16 11:28:28 +00:00
|
|
|
}, {
|
|
|
|
'name': '--pulse',
|
|
|
|
'desc': 'PulseAudio audio output',
|
2014-07-26 20:40:27 +00:00
|
|
|
'func': check_pkg_config('libpulse', '>= 1.0')
|
2013-07-16 11:28:28 +00:00
|
|
|
}, {
|
|
|
|
'name': '--jack',
|
|
|
|
'desc': 'JACK audio output',
|
2017-09-21 11:50:18 +00:00
|
|
|
'deps': 'gpl',
|
2013-07-16 11:28:28 +00:00
|
|
|
'func': check_pkg_config('jack'),
|
|
|
|
}, {
|
|
|
|
'name': '--openal',
|
|
|
|
'desc': 'OpenAL audio output',
|
2016-08-21 21:59:08 +00:00
|
|
|
'func': check_openal,
|
2013-07-16 11:28:28 +00:00
|
|
|
'default': 'disable'
|
2016-02-14 17:03:47 +00:00
|
|
|
}, {
|
|
|
|
'name': '--opensles',
|
|
|
|
'desc': 'OpenSL ES audio output',
|
|
|
|
'func': check_statement('SLES/OpenSLES.h', 'slCreateEngine', lib="OpenSLES"),
|
2013-07-16 11:28:28 +00:00
|
|
|
}, {
|
|
|
|
'name': '--alsa',
|
|
|
|
'desc': 'ALSA audio output',
|
2017-09-21 11:50:18 +00:00
|
|
|
'deps': 'gpl',
|
2015-02-23 14:56:55 +00:00
|
|
|
'func': check_pkg_config('alsa', '>= 1.0.18'),
|
2013-07-16 11:28:28 +00:00
|
|
|
}, {
|
|
|
|
'name': '--coreaudio',
|
|
|
|
'desc': 'CoreAudio audio output',
|
|
|
|
'func': check_cc(
|
|
|
|
fragment=load_fragment('coreaudio.c'),
|
2013-12-06 09:17:20 +00:00
|
|
|
framework_name=['CoreFoundation', 'CoreAudio', 'AudioUnit', 'AudioToolbox'])
|
2016-10-19 22:08:48 +00:00
|
|
|
}, {
|
|
|
|
'name': '--audiounit',
|
|
|
|
'desc': 'AudioUnit output for iOS',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'atomics',
|
2016-10-19 22:08:48 +00:00
|
|
|
'func': check_cc(
|
|
|
|
fragment=load_fragment('audiounit.c'),
|
|
|
|
framework_name=['Foundation', 'AudioToolbox'])
|
2013-07-16 11:28:28 +00:00
|
|
|
}, {
|
|
|
|
'name': '--wasapi',
|
|
|
|
'desc': 'WASAPI audio output',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'os-win32 || os-cygwin',
|
2015-03-11 22:40:54 +00:00
|
|
|
'func': check_cc(fragment=load_fragment('wasapi.c')),
|
2013-07-16 11:28:28 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
video_output_features = [
|
|
|
|
{
|
|
|
|
'name': '--cocoa',
|
|
|
|
'desc': 'Cocoa',
|
2014-01-02 19:34:14 +00:00
|
|
|
'func': check_cocoa
|
vo_opengl: add DRM EGL backend
Notes:
- Unfortunately the only way to talk to EGL from within DRM I could find
involves linking with GBM (generic buffer management for Mesa.)
Because of this, I'm pretty sure it won't work with proprietary NVidia
drivers, but then again, last time I checked NVidia didn't offer
proper screen resolution for VT.
- VT switching doesn't seem to work at all. It's worth mentioning that
using vo_drm before introduction of VT switcher had an anomaly where
user could switch to another VT and input text to it, while video
played on top of that VT. However, that isn't the case with drm_egl:
I can't switch to other VT during playback like this. This makes me
think that it's either a limitation coming from my firmware or from
EGL/KMS itself rather than a bug with my code. Nonetheless, I still
left (untestable) VT switching code in place, in case it's useful to
someone else.
- The mode_id, connector_id and device_path should be configurable for
power users and people who wish to watch videos on nonprimary screen.
Unfortunately I didn't see anything that would allow OpenGL backends
to register their own set of options. At the same time, adding them to
global namespace is pointless.
- A few dozens of lines could be shared with vo_drm (setting up VT
switching, most of code behind page flipping). I don't have any strong
opinion on this.
- Sometimes I get minor visual glitches. I'm not sure if there's a race
condition of some sort, unitialized variable (doubtful), or if it's
buggy driver. (I'm using integrated Intel HD Graphics 4400 with Mesa)
- .config and .control are very minimal.
Signed-off-by: wm4 <wm4@nowhere>
2015-11-07 18:06:57 +00:00
|
|
|
}, {
|
|
|
|
'name': '--drm',
|
|
|
|
'desc': 'DRM',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'vt.h',
|
vo_opengl: add DRM EGL backend
Notes:
- Unfortunately the only way to talk to EGL from within DRM I could find
involves linking with GBM (generic buffer management for Mesa.)
Because of this, I'm pretty sure it won't work with proprietary NVidia
drivers, but then again, last time I checked NVidia didn't offer
proper screen resolution for VT.
- VT switching doesn't seem to work at all. It's worth mentioning that
using vo_drm before introduction of VT switcher had an anomaly where
user could switch to another VT and input text to it, while video
played on top of that VT. However, that isn't the case with drm_egl:
I can't switch to other VT during playback like this. This makes me
think that it's either a limitation coming from my firmware or from
EGL/KMS itself rather than a bug with my code. Nonetheless, I still
left (untestable) VT switching code in place, in case it's useful to
someone else.
- The mode_id, connector_id and device_path should be configurable for
power users and people who wish to watch videos on nonprimary screen.
Unfortunately I didn't see anything that would allow OpenGL backends
to register their own set of options. At the same time, adding them to
global namespace is pointless.
- A few dozens of lines could be shared with vo_drm (setting up VT
switching, most of code behind page flipping). I don't have any strong
opinion on this.
- Sometimes I get minor visual glitches. I'm not sure if there's a race
condition of some sort, unitialized variable (doubtful), or if it's
buggy driver. (I'm using integrated Intel HD Graphics 4400 with Mesa)
- .config and .control are very minimal.
Signed-off-by: wm4 <wm4@nowhere>
2015-11-07 18:06:57 +00:00
|
|
|
'func': check_pkg_config('libdrm'),
|
|
|
|
}, {
|
|
|
|
'name': '--gbm',
|
|
|
|
'desc': 'GBM',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'gbm.h',
|
vo_opengl: add DRM EGL backend
Notes:
- Unfortunately the only way to talk to EGL from within DRM I could find
involves linking with GBM (generic buffer management for Mesa.)
Because of this, I'm pretty sure it won't work with proprietary NVidia
drivers, but then again, last time I checked NVidia didn't offer
proper screen resolution for VT.
- VT switching doesn't seem to work at all. It's worth mentioning that
using vo_drm before introduction of VT switcher had an anomaly where
user could switch to another VT and input text to it, while video
played on top of that VT. However, that isn't the case with drm_egl:
I can't switch to other VT during playback like this. This makes me
think that it's either a limitation coming from my firmware or from
EGL/KMS itself rather than a bug with my code. Nonetheless, I still
left (untestable) VT switching code in place, in case it's useful to
someone else.
- The mode_id, connector_id and device_path should be configurable for
power users and people who wish to watch videos on nonprimary screen.
Unfortunately I didn't see anything that would allow OpenGL backends
to register their own set of options. At the same time, adding them to
global namespace is pointless.
- A few dozens of lines could be shared with vo_drm (setting up VT
switching, most of code behind page flipping). I don't have any strong
opinion on this.
- Sometimes I get minor visual glitches. I'm not sure if there's a race
condition of some sort, unitialized variable (doubtful), or if it's
buggy driver. (I'm using integrated Intel HD Graphics 4400 with Mesa)
- .config and .control are very minimal.
Signed-off-by: wm4 <wm4@nowhere>
2015-11-07 18:06:57 +00:00
|
|
|
'func': check_pkg_config('gbm'),
|
2013-07-16 11:28:28 +00:00
|
|
|
} , {
|
|
|
|
'name': '--wayland',
|
|
|
|
'desc': 'Wayland',
|
2014-09-19 15:40:26 +00:00
|
|
|
'func': check_pkg_config('wayland-client', '>= 1.6.0',
|
|
|
|
'wayland-cursor', '>= 1.6.0',
|
2013-07-16 11:28:28 +00:00
|
|
|
'xkbcommon', '>= 0.3.0'),
|
|
|
|
} , {
|
|
|
|
'name': '--x11',
|
|
|
|
'desc': 'X11',
|
2017-09-21 11:50:18 +00:00
|
|
|
'deps': 'gpl',
|
2017-04-21 05:30:03 +00:00
|
|
|
'func': check_pkg_config('x11', '>= 1.0.0',
|
2017-08-20 07:11:26 +00:00
|
|
|
'xscrnsaver', '>= 1.0.0',
|
2017-04-21 05:30:03 +00:00
|
|
|
'xext', '>= 1.0.0',
|
|
|
|
'xinerama', '>= 1.0.0',
|
|
|
|
'xrandr', '>= 1.2.0'),
|
2013-07-16 11:28:28 +00:00
|
|
|
} , {
|
|
|
|
'name': '--xv',
|
|
|
|
'desc': 'Xv video output',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'x11',
|
2013-07-16 11:28:28 +00:00
|
|
|
'func': check_pkg_config('xv'),
|
|
|
|
} , {
|
|
|
|
'name': '--gl-cocoa',
|
|
|
|
'desc': 'OpenGL Cocoa Backend',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'cocoa',
|
2013-11-28 07:36:41 +00:00
|
|
|
'groups': [ 'gl' ],
|
2016-10-19 20:40:10 +00:00
|
|
|
'func': check_statement('IOSurface/IOSurface.h',
|
|
|
|
'IOSurfaceRef surface;',
|
|
|
|
framework='IOSurface')
|
2013-07-16 11:28:28 +00:00
|
|
|
} , {
|
|
|
|
'name': '--gl-x11',
|
|
|
|
'desc': 'OpenGL X11 Backend',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'x11',
|
2013-11-28 07:36:41 +00:00
|
|
|
'groups': [ 'gl' ],
|
2013-07-16 11:28:28 +00:00
|
|
|
'func': check_libs(['GL', 'GL Xdamage'],
|
|
|
|
check_cc(fragment=load_fragment('gl_x11.c'),
|
|
|
|
use=['x11', 'libdl', 'pthreads']))
|
2014-11-03 23:12:04 +00:00
|
|
|
} , {
|
|
|
|
'name': '--egl-x11',
|
|
|
|
'desc': 'OpenGL X11 EGL Backend',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'x11',
|
2014-11-03 23:12:04 +00:00
|
|
|
'groups': [ 'gl' ],
|
2017-04-26 15:09:16 +00:00
|
|
|
'func': check_pkg_config('egl'),
|
vo_opengl: add DRM EGL backend
Notes:
- Unfortunately the only way to talk to EGL from within DRM I could find
involves linking with GBM (generic buffer management for Mesa.)
Because of this, I'm pretty sure it won't work with proprietary NVidia
drivers, but then again, last time I checked NVidia didn't offer
proper screen resolution for VT.
- VT switching doesn't seem to work at all. It's worth mentioning that
using vo_drm before introduction of VT switcher had an anomaly where
user could switch to another VT and input text to it, while video
played on top of that VT. However, that isn't the case with drm_egl:
I can't switch to other VT during playback like this. This makes me
think that it's either a limitation coming from my firmware or from
EGL/KMS itself rather than a bug with my code. Nonetheless, I still
left (untestable) VT switching code in place, in case it's useful to
someone else.
- The mode_id, connector_id and device_path should be configurable for
power users and people who wish to watch videos on nonprimary screen.
Unfortunately I didn't see anything that would allow OpenGL backends
to register their own set of options. At the same time, adding them to
global namespace is pointless.
- A few dozens of lines could be shared with vo_drm (setting up VT
switching, most of code behind page flipping). I don't have any strong
opinion on this.
- Sometimes I get minor visual glitches. I'm not sure if there's a race
condition of some sort, unitialized variable (doubtful), or if it's
buggy driver. (I'm using integrated Intel HD Graphics 4400 with Mesa)
- .config and .control are very minimal.
Signed-off-by: wm4 <wm4@nowhere>
2015-11-07 18:06:57 +00:00
|
|
|
} , {
|
|
|
|
'name': '--egl-drm',
|
|
|
|
'desc': 'OpenGL DRM EGL Backend',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'drm && gbm',
|
vo_opengl: add DRM EGL backend
Notes:
- Unfortunately the only way to talk to EGL from within DRM I could find
involves linking with GBM (generic buffer management for Mesa.)
Because of this, I'm pretty sure it won't work with proprietary NVidia
drivers, but then again, last time I checked NVidia didn't offer
proper screen resolution for VT.
- VT switching doesn't seem to work at all. It's worth mentioning that
using vo_drm before introduction of VT switcher had an anomaly where
user could switch to another VT and input text to it, while video
played on top of that VT. However, that isn't the case with drm_egl:
I can't switch to other VT during playback like this. This makes me
think that it's either a limitation coming from my firmware or from
EGL/KMS itself rather than a bug with my code. Nonetheless, I still
left (untestable) VT switching code in place, in case it's useful to
someone else.
- The mode_id, connector_id and device_path should be configurable for
power users and people who wish to watch videos on nonprimary screen.
Unfortunately I didn't see anything that would allow OpenGL backends
to register their own set of options. At the same time, adding them to
global namespace is pointless.
- A few dozens of lines could be shared with vo_drm (setting up VT
switching, most of code behind page flipping). I don't have any strong
opinion on this.
- Sometimes I get minor visual glitches. I'm not sure if there's a race
condition of some sort, unitialized variable (doubtful), or if it's
buggy driver. (I'm using integrated Intel HD Graphics 4400 with Mesa)
- .config and .control are very minimal.
Signed-off-by: wm4 <wm4@nowhere>
2015-11-07 18:06:57 +00:00
|
|
|
'groups': [ 'gl' ],
|
2017-04-26 15:09:16 +00:00
|
|
|
'func': check_pkg_config('egl'),
|
2013-07-16 11:28:28 +00:00
|
|
|
} , {
|
|
|
|
'name': '--gl-wayland',
|
|
|
|
'desc': 'OpenGL Wayland Backend',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'wayland',
|
2013-11-28 07:36:41 +00:00
|
|
|
'groups': [ 'gl' ],
|
2013-07-16 11:28:28 +00:00
|
|
|
'func': check_pkg_config('wayland-egl', '>= 9.0.0',
|
|
|
|
'egl', '>= 9.0.0')
|
|
|
|
} , {
|
|
|
|
'name': '--gl-win32',
|
|
|
|
'desc': 'OpenGL Win32 Backend',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'win32-desktop',
|
2013-11-28 07:36:41 +00:00
|
|
|
'groups': [ 'gl' ],
|
2013-07-16 11:28:28 +00:00
|
|
|
'func': check_statement('windows.h', 'wglCreateContext(0)',
|
|
|
|
lib='opengl32')
|
2015-11-30 13:56:02 +00:00
|
|
|
} , {
|
|
|
|
'name': '--gl-dxinterop',
|
|
|
|
'desc': 'OpenGL/DirectX Interop Backend',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'gl-win32',
|
2015-11-30 13:56:02 +00:00
|
|
|
'groups': [ 'gl' ],
|
|
|
|
'func': compose_checks(
|
|
|
|
check_statement(['GL/gl.h', 'GL/wglext.h'], 'int i = WGL_ACCESS_WRITE_DISCARD_NV'),
|
|
|
|
check_statement('d3d9.h', 'IDirect3D9Ex *d'))
|
2015-11-13 13:04:30 +00:00
|
|
|
} , {
|
|
|
|
'name': '--egl-angle',
|
2017-06-30 10:27:15 +00:00
|
|
|
'desc': 'OpenGL ANGLE headers',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'os-win32 || os-cygwin',
|
2015-11-13 13:04:30 +00:00
|
|
|
'groups': [ 'gl' ],
|
2016-05-11 10:33:49 +00:00
|
|
|
'func': check_statement(['EGL/egl.h', 'EGL/eglext.h'],
|
|
|
|
'int x = EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE')
|
2016-11-22 22:26:43 +00:00
|
|
|
} , {
|
|
|
|
'name': '--egl-angle-lib',
|
|
|
|
'desc': 'OpenGL Win32 ANGLE Library',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'egl-angle',
|
2016-11-22 22:26:43 +00:00
|
|
|
'groups': [ 'gl' ],
|
|
|
|
'func': check_statement(['EGL/egl.h'],
|
|
|
|
'eglCreateWindowSurface(0, 0, 0, 0)',
|
2017-02-19 12:25:23 +00:00
|
|
|
cflags=['-DGL_APICALL=', '-DEGLAPI=',
|
|
|
|
'-DANGLE_NO_ALIASES', '-DANGLE_EXPORT='],
|
|
|
|
lib=['EGL', 'GLESv2', 'dxguid', 'd3d9',
|
|
|
|
'gdi32', 'stdc++'])
|
2017-06-30 10:27:15 +00:00
|
|
|
}, {
|
|
|
|
'name': '--egl-angle-win32',
|
|
|
|
'desc': 'OpenGL Win32 ANGLE Backend',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'egl-angle && win32-desktop',
|
2017-06-30 10:27:15 +00:00
|
|
|
'groups': [ 'gl' ],
|
|
|
|
'func': check_true,
|
2013-07-16 11:28:28 +00:00
|
|
|
} , {
|
|
|
|
'name': '--vdpau',
|
|
|
|
'desc': 'VDPAU acceleration',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'x11',
|
2013-07-16 11:28:28 +00:00
|
|
|
'func': check_pkg_config('vdpau', '>= 0.2'),
|
|
|
|
} , {
|
|
|
|
'name': '--vdpau-gl-x11',
|
|
|
|
'desc': 'VDPAU with OpenGL/X11',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'vdpau && gl-x11',
|
2013-07-16 11:28:28 +00:00
|
|
|
'func': check_true,
|
|
|
|
}, {
|
|
|
|
'name': '--vaapi',
|
|
|
|
'desc': 'VAAPI acceleration',
|
2017-09-21 11:50:18 +00:00
|
|
|
'deps': 'gpl && libdl && (x11 || wayland || egl-drm)',
|
2015-10-17 12:17:49 +00:00
|
|
|
'func': check_pkg_config('libva', '>= 0.36.0'),
|
2015-09-27 18:09:10 +00:00
|
|
|
}, {
|
|
|
|
'name': '--vaapi-x11',
|
|
|
|
'desc': 'VAAPI (X11 support)',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'vaapi && x11',
|
2015-10-17 12:17:49 +00:00
|
|
|
'func': check_pkg_config('libva-x11', '>= 0.36.0'),
|
2015-09-27 19:24:35 +00:00
|
|
|
}, {
|
|
|
|
'name': '--vaapi-wayland',
|
|
|
|
'desc': 'VAAPI (Wayland support)',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'vaapi && gl-wayland',
|
2015-10-17 12:17:49 +00:00
|
|
|
'func': check_pkg_config('libva-wayland', '>= 0.36.0'),
|
2016-01-20 18:41:29 +00:00
|
|
|
}, {
|
|
|
|
'name': '--vaapi-drm',
|
|
|
|
'desc': 'VAAPI (DRM/EGL support)',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'vaapi && egl-drm',
|
2016-01-20 18:41:29 +00:00
|
|
|
'func': check_pkg_config('libva-drm', '>= 0.36.0'),
|
2013-07-16 11:28:28 +00:00
|
|
|
}, {
|
|
|
|
'name': '--vaapi-glx',
|
|
|
|
'desc': 'VAAPI GLX',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'vaapi-x11 && gl-x11',
|
2015-04-05 20:44:22 +00:00
|
|
|
'func': check_true,
|
2015-09-24 22:20:57 +00:00
|
|
|
}, {
|
|
|
|
'name': '--vaapi-x-egl',
|
|
|
|
'desc': 'VAAPI EGL on X11',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'vaapi-x11 && egl-x11',
|
2015-09-27 18:09:10 +00:00
|
|
|
'func': check_true,
|
|
|
|
}, {
|
|
|
|
'name': 'vaapi-egl',
|
|
|
|
'desc': 'VAAPI EGL',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'vaapi-x-egl || vaapi-wayland',
|
2015-09-24 22:20:57 +00:00
|
|
|
'func': check_true,
|
2013-07-16 11:28:28 +00:00
|
|
|
}, {
|
|
|
|
'name': '--caca',
|
|
|
|
'desc': 'CACA',
|
2017-09-21 11:50:18 +00:00
|
|
|
'deps': 'gpl',
|
2013-07-16 11:28:28 +00:00
|
|
|
'func': check_pkg_config('caca', '>= 0.99.beta18'),
|
|
|
|
}, {
|
|
|
|
'name': '--jpeg',
|
|
|
|
'desc': 'JPEG support',
|
|
|
|
'func': check_cc(header_name=['stdio.h', 'jpeglib.h'],
|
|
|
|
lib='jpeg', use='libm'),
|
|
|
|
}, {
|
|
|
|
'name': '--direct3d',
|
|
|
|
'desc': 'Direct3D support',
|
2017-09-21 11:50:18 +00:00
|
|
|
'deps': 'win32-desktop && gpl',
|
2013-07-16 11:28:28 +00:00
|
|
|
'func': check_cc(header_name='d3d9.h'),
|
2017-08-15 16:41:16 +00:00
|
|
|
}, {
|
|
|
|
# We need MMAL/bcm_host/dispmanx APIs. Also, most RPI distros require
|
|
|
|
# every project to hardcode the paths to the include directories. Also,
|
|
|
|
# these headers are so broken that they spam tons of warnings by merely
|
|
|
|
# including them (compensate with -isystem and -fgnu89-inline).
|
2015-08-18 22:12:13 +00:00
|
|
|
'name': '--rpi',
|
2015-03-29 13:12:11 +00:00
|
|
|
'desc': 'Raspberry Pi support',
|
2017-08-15 16:41:16 +00:00
|
|
|
'func': compose_checks(
|
|
|
|
check_cc(cflags="-isystem/opt/vc/include/ "+
|
|
|
|
"-isystem/opt/vc/include/interface/vcos/pthreads " +
|
|
|
|
"-isystem/opt/vc/include/interface/vmcs_host/linux " +
|
|
|
|
"-fgnu89-inline",
|
|
|
|
linkflags="-L/opt/vc/lib",
|
|
|
|
header_name="bcm_host.h",
|
|
|
|
lib=['mmal_core', 'mmal_util', 'mmal_vc_client', 'bcm_host']),
|
|
|
|
# We still need all OpenGL symbols, because the vo_opengl code is
|
|
|
|
# generic and supports anything from GLES2/OpenGL 2.1 to OpenGL 4 core.
|
|
|
|
check_cc(lib="EGL"),
|
|
|
|
check_cc(lib="GLESv2"),
|
|
|
|
),
|
2016-10-19 19:07:05 +00:00
|
|
|
} , {
|
|
|
|
'name': '--ios-gl',
|
2017-04-07 12:30:51 +00:00
|
|
|
'desc': 'iOS OpenGL ES hardware decoding interop support',
|
2016-10-19 19:07:05 +00:00
|
|
|
'func': check_statement('OpenGLES/ES3/glext.h', '(void)GL_RGB32F'), # arbitrary OpenGL ES 3.0 symbol
|
2016-02-08 21:06:51 +00:00
|
|
|
} , {
|
|
|
|
'name': '--plain-gl',
|
|
|
|
'desc': 'OpenGL without platform-specific code (e.g. for libmpv)',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'libmpv-shared || libmpv-static',
|
2016-02-08 21:06:51 +00:00
|
|
|
'func': check_true,
|
2016-09-13 15:03:24 +00:00
|
|
|
}, {
|
|
|
|
'name': '--mali-fbdev',
|
|
|
|
'desc': 'MALI via Linux fbdev',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'libdl',
|
2016-09-13 15:03:24 +00:00
|
|
|
'func': compose_checks(
|
|
|
|
check_cc(lib="EGL"),
|
|
|
|
check_statement('EGL/fbdev_window.h', 'struct fbdev_window test'),
|
|
|
|
check_statement('linux/fb.h', 'struct fb_var_screeninfo test'),
|
|
|
|
),
|
|
|
|
}, {
|
2015-03-29 13:12:11 +00:00
|
|
|
'name': '--gl',
|
vo_opengl: refactor into vo_gpu
This is done in several steps:
1. refactor MPGLContext -> struct ra_ctx
2. move GL-specific stuff in vo_opengl into opengl/context.c
3. generalize context creation to support other APIs, and add --gpu-api
4. rename all of the --opengl- options that are no longer opengl-specific
5. move all of the stuff from opengl/* that isn't GL-specific into gpu/
(note: opengl/gl_utils.h became opengl/utils.h)
6. rename vo_opengl to vo_gpu
7. to handle window screenshots, the short-term approach was to just add
it to ra_swchain_fns. Long term (and for vulkan) this has to be moved to
ra itself (and vo_gpu altered to compensate), but this was a stop-gap
measure to prevent this commit from getting too big
8. move ra->fns->flush to ra_gl_ctx instead
9. some other minor changes that I've probably already forgotten
Note: This is one half of a major refactor, the other half of which is
provided by rossy's following commit. This commit enables support for
all linux platforms, while his version enables support for all non-linux
platforms.
Note 2: vo_opengl_cb.c also re-uses ra_gl_ctx so it benefits from the
--opengl- options like --opengl-early-flush, --opengl-finish etc. Should
be a strict superset of the old functionality.
Disclaimer: Since I have no way of compiling mpv on all platforms, some
of these ports were done blindly. Specifically, the blind ports included
context_mali_fbdev.c and context_rpi.c. Since they're both based on
egl_helpers, the port should have gone smoothly without any major
changes required. But if somebody complains about a compile error on
those platforms (assuming anybody actually uses them), you know where to
complain.
2017-09-14 06:04:55 +00:00
|
|
|
'desc': 'OpenGL context support',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'gl-cocoa || gl-x11 || egl-x11 || egl-drm || '
|
|
|
|
+ 'gl-win32 || gl-wayland || rpi || mali-fbdev || '
|
|
|
|
+ 'plain-gl',
|
2016-05-01 18:15:53 +00:00
|
|
|
'func': check_true,
|
|
|
|
'req': True,
|
2017-09-22 03:35:26 +00:00
|
|
|
'fmsg': "No OpenGL video output found or enabled. " +
|
|
|
|
"Aborting. If you really mean to compile without OpenGL " +
|
|
|
|
"video outputs use --disable-gl.",
|
vo_gpu: vulkan: initial implementation
This time based on ra/vo_gpu. 2017 is the year of the vulkan desktop!
Current problems / limitations / improvement opportunities:
1. The swapchain/flipping code violates the vulkan spec, by assuming
that the presentation queue will be bounded (in cases where rendering
is significantly faster than vsync). But apparently, there's simply
no better way to do this right now, to the point where even the
stupid cube.c examples from LunarG etc. do it wrong.
(cf. https://github.com/KhronosGroup/Vulkan-Docs/issues/370)
2. The memory allocator could be improved. (This is a universal
constant)
3. Could explore using push descriptors instead of descriptor sets,
especially since we expect to switch descriptors semi-often for some
passes (like interpolation). Probably won't make a difference, but
the synchronization overhead might be a factor. Who knows.
4. Parallelism across frames / async transfer is not well-defined, we
either need to use a better semaphore / command buffer strategy or a
resource pooling layer to safely handle cross-frame parallelism.
(That said, I gave resource pooling a try and was not happy with the
result at all - so I'm still exploring the semaphore strategy)
5. We aggressively use pipeline barriers where events would offer a much
more fine-grained synchronization mechanism. As a result of this, we
might be suffering from GPU bubbles due to too-short dependencies on
objects. (That said, I'm also exploring the use of semaphores as a an
ordering tactic which would allow cross-frame time slicing in theory)
Some minor changes to the vo_gpu and infrastructure, but nothing
consequential.
NOTE: For safety, all use of asynchronous commands / multiple command
pools is currently disabled completely. There are some left-over relics
of this in the code (e.g. the distinction between dev_poll and
pool_poll), but that is kept in place mostly because this will be
re-extended in the future (vulkan rev 2).
The queue count is also currently capped to 1, because of the lack of
cross-frame semaphores means we need the implicit synchronization from
the same-queue semantics to guarantee a correct result.
2016-09-14 18:54:18 +00:00
|
|
|
}, {
|
|
|
|
'name': '--vulkan',
|
|
|
|
'desc': 'Vulkan context support',
|
|
|
|
'func': check_cc(header_name='vulkan/vulkan.h', lib='vulkan'),
|
2017-09-13 01:09:48 +00:00
|
|
|
}, {
|
|
|
|
'name': '--shaderc',
|
|
|
|
'desc': 'libshaderc SPIR-V compiler',
|
|
|
|
'func': check_cc(header_name='shaderc/shaderc.h', lib='shaderc_shared'),
|
2015-12-19 11:45:07 +00:00
|
|
|
}, {
|
|
|
|
'name': 'egl-helpers',
|
|
|
|
'desc': 'EGL helper functions',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'egl-x11 || mali-fbdev || rpi || gl-wayland || egl-drm || ' +
|
|
|
|
'egl-angle-win32',
|
2015-03-29 13:12:11 +00:00
|
|
|
'func': check_true
|
2013-07-16 11:28:28 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
hwaccel_features = [
|
|
|
|
{
|
|
|
|
'name': '--vaapi-hwaccel',
|
2017-04-23 13:56:45 +00:00
|
|
|
'desc': 'libavcodec VAAPI hwaccel (FFmpeg 3.3 API)',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'vaapi',
|
2017-01-11 15:27:58 +00:00
|
|
|
'func': check_statement('libavcodec/version.h',
|
2017-01-12 08:19:02 +00:00
|
|
|
'int x[(LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 26, 0) && '
|
2017-01-18 07:17:29 +00:00
|
|
|
' LIBAVCODEC_VERSION_MICRO < 100) ||'
|
|
|
|
' (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 74, 100) && '
|
|
|
|
' LIBAVCODEC_VERSION_MICRO >= 100)'
|
|
|
|
' ? 1 : -1]',
|
2017-01-12 08:19:02 +00:00
|
|
|
use='libav'),
|
2015-07-11 15:21:39 +00:00
|
|
|
}, {
|
2017-09-26 17:13:26 +00:00
|
|
|
'name': 'videotoolbox-hwaccel',
|
2017-05-24 13:07:45 +00:00
|
|
|
'desc': 'libavcodec videotoolbox hwaccel (new API)',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'gl-cocoa || ios-gl',
|
2017-05-24 13:07:45 +00:00
|
|
|
'func': check_statement('libavcodec/version.h',
|
|
|
|
'int x[(LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 96, 100) && '
|
|
|
|
' LIBAVCODEC_VERSION_MICRO >= 100)'
|
|
|
|
' ? 1 : -1]',
|
|
|
|
use='libav'),
|
|
|
|
}, {
|
2015-07-11 15:21:39 +00:00
|
|
|
'name': '--videotoolbox-gl',
|
|
|
|
'desc': 'Videotoolbox with OpenGL',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'gl-cocoa && videotoolbox-hwaccel',
|
2015-07-11 15:21:39 +00:00
|
|
|
'func': check_true
|
2017-03-23 10:06:28 +00:00
|
|
|
}, {
|
2013-07-16 11:28:28 +00:00
|
|
|
'name': '--vdpau-hwaccel',
|
2017-04-23 13:56:45 +00:00
|
|
|
'desc': 'libavcodec VDPAU hwaccel (FFmpeg 3.3 API)',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'vdpau',
|
2017-03-23 10:06:28 +00:00
|
|
|
'func': check_statement('libavcodec/version.h',
|
|
|
|
'int x[(LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 37, 1) && '
|
|
|
|
' LIBAVCODEC_VERSION_MICRO < 100) ||'
|
|
|
|
' (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 85, 101) && '
|
|
|
|
' LIBAVCODEC_VERSION_MICRO >= 100)'
|
|
|
|
' ? 1 : -1]',
|
|
|
|
use='libav'),
|
2014-10-25 17:23:46 +00:00
|
|
|
}, {
|
2017-06-30 10:27:15 +00:00
|
|
|
# (conflated with ANGLE for easier deps)
|
2016-05-11 12:37:03 +00:00
|
|
|
'name': '--d3d-hwaccel',
|
2017-09-26 16:12:19 +00:00
|
|
|
'desc': 'D3D11VA hwaccel (new API, plus ANGLE)',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'os-win32 && egl-angle',
|
2017-06-08 19:16:11 +00:00
|
|
|
'func': check_statement('libavcodec/version.h',
|
2017-06-27 14:44:05 +00:00
|
|
|
'int x[(LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(58, 4, 0) && '
|
|
|
|
' LIBAVCODEC_VERSION_MICRO < 100) ||'
|
|
|
|
' (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 100, 100) && '
|
|
|
|
' LIBAVCODEC_VERSION_MICRO >= 100)'
|
|
|
|
' ? 1 : -1]',
|
|
|
|
use='libav'),
|
2017-06-30 10:27:15 +00:00
|
|
|
}, {
|
|
|
|
'name': '--d3d9-hwaccel',
|
|
|
|
'desc': 'DXVA2 hwaccel (plus ANGLE)',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'd3d-hwaccel && egl-angle-win32',
|
2017-06-30 10:27:15 +00:00
|
|
|
'func': check_true,
|
|
|
|
}, {
|
|
|
|
'name': '--gl-dxinterop-d3d9',
|
|
|
|
'desc': 'OpenGL/DirectX Interop Backend DXVA2 interop',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'gl-dxinterop && d3d9-hwaccel',
|
2017-06-30 10:27:15 +00:00
|
|
|
'groups': [ 'gl' ],
|
|
|
|
'func': check_true,
|
hwdec/opengl: Add support for CUDA and cuvid/NvDecode
Nvidia's "NvDecode" API (up until recently called "cuvid" is a cross
platform, but nvidia proprietary API that exposes their hardware
video decoding capabilities. It is analogous to their DXVA or VDPAU
support on Windows or Linux but without using platform specific API
calls.
As a rule, you'd rather use DXVA or VDPAU as these are more mature
and well supported APIs, but on Linux, VDPAU is falling behind the
hardware capabilities, and there's no sign that nvidia are making
the investments to update it.
Most concretely, this means that there is no VP8/9 or HEVC Main10
support in VDPAU. On the other hand, NvDecode does export vp8/9 and
partial support for HEVC Main10 (more on that below).
ffmpeg already has support in the form of the "cuvid" family of
decoders. Due to the design of the API, it is best exposed as a full
decoder rather than an hwaccel. As such, there are decoders like
h264_cuvid, hevc_cuvid, etc.
These decoders support two output paths today - in both cases, NV12
frames are returned, either in CUDA device memory or regular system
memory.
In the case of the system memory path, the decoders can be used
as-is in mpv today with a command line like:
mpv --vd=lavc:h264_cuvid foobar.mp4
Doing this will take advantage of hardware decoding, but the cost
of the memcpy to system memory adds up, especially for high
resolution video (4K etc).
To avoid that, we need an hwdec that takes advantage of CUDA's
OpenGL interop to copy from device memory into OpenGL textures.
That is what this change implements.
The process is relatively simple as only basic device context
aquisition needs to be done by us - the CUDA buffer pool is managed
by the decoder - thankfully.
The hwdec looks a bit like the vdpau interop one - the hwdec
maintains a single set of plane textures and each output frame
is repeatedly mapped into these textures to pass on.
The frames are always in NV12 format, at least until 10bit output
supports emerges.
The only slightly interesting part of the copying process is that
CUDA works by associating PBOs, so we need to define these for
each of the textures.
TODO Items:
* I need to add a download_image function for screenshots. This
would do the same copy to system memory that the decoder's
system memory output does.
* There are items to investigate on the ffmpeg side. There appears
to be a problem with timestamps for some content.
Final note: I mentioned HEVC Main10. While there is no 10bit output
support, NvDecode can return dithered 8bit NV12 so you can take
advantage of the hardware acceleration.
This particular mode requires compiling ffmpeg with a modified
header (or possibly the CUDA 8 RC) and is not upstream in ffmpeg
yet.
Usage:
You will need to specify vo=opengl and hwdec=cuda.
Note that hwdec=auto will probably not work as it will try to use
vdpau first.
mpv --hwdec=cuda --vo=opengl foobar.mp4
If you want to use filters that require frames in system memory,
just use the decoder directly without the hwdec, as documented
above.
2016-09-04 22:23:55 +00:00
|
|
|
}, {
|
2016-09-16 03:15:36 +00:00
|
|
|
'name': '--cuda-hwaccel',
|
|
|
|
'desc': 'CUDA hwaccel',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'gl',
|
2016-11-23 18:14:32 +00:00
|
|
|
'func': check_cc(fragment=load_fragment('cuda.c'),
|
|
|
|
use='libav'),
|
2013-07-16 11:28:28 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
radio_and_tv_features = [
|
|
|
|
{
|
|
|
|
'name': '--tv',
|
|
|
|
'desc': 'TV interface',
|
2017-09-21 11:50:18 +00:00
|
|
|
'deps': 'gpl',
|
2013-07-16 11:28:28 +00:00
|
|
|
'func': check_true,
|
2017-06-25 09:59:03 +00:00
|
|
|
'default': 'disable',
|
2015-01-31 15:14:14 +00:00
|
|
|
}, {
|
|
|
|
'name': 'sys_videoio_h',
|
|
|
|
'desc': 'videoio.h',
|
2017-06-25 09:59:03 +00:00
|
|
|
'func': check_cc(header_name=['sys/time.h', 'sys/videoio.h']),
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'tv',
|
2015-01-31 15:14:14 +00:00
|
|
|
}, {
|
|
|
|
'name': 'videodev',
|
|
|
|
'desc': 'videodev2.h',
|
|
|
|
'func': check_cc(header_name=['sys/time.h', 'linux/videodev2.h']),
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'tv && !sys_videoio_h',
|
2013-07-16 11:28:28 +00:00
|
|
|
}, {
|
|
|
|
'name': '--tv-v4l2',
|
|
|
|
'desc': 'Video4Linux2 TV interface',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'tv && (sys_videoio_h || videodev)',
|
2015-01-31 15:14:14 +00:00
|
|
|
'func': check_true,
|
2013-07-16 11:28:28 +00:00
|
|
|
}, {
|
|
|
|
'name': '--libv4l2',
|
|
|
|
'desc': 'libv4l2 support',
|
|
|
|
'func': check_pkg_config('libv4l2'),
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'tv-v4l2',
|
2013-07-16 11:28:28 +00:00
|
|
|
}, {
|
|
|
|
'name': '--audio-input',
|
|
|
|
'desc': 'audio input support',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'tv-v4l2',
|
2013-07-16 11:28:28 +00:00
|
|
|
'func': check_true
|
2014-11-28 14:54:52 +00:00
|
|
|
} , {
|
|
|
|
'name': '--dvbin',
|
|
|
|
'desc': 'DVB input module',
|
2017-09-21 11:50:18 +00:00
|
|
|
'deps': 'gpl',
|
2017-06-22 10:39:18 +00:00
|
|
|
'func': check_true,
|
2017-05-11 06:13:57 +00:00
|
|
|
'default': 'disable',
|
2013-07-16 11:28:28 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2014-04-16 01:08:50 +00:00
|
|
|
standalone_features = [
|
|
|
|
{
|
|
|
|
'name': 'win32-executable',
|
|
|
|
'desc': 'w32 executable',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'os-win32 || !(!(os-cygwin))',
|
2014-04-16 01:08:50 +00:00
|
|
|
'func': check_ctx_vars('WINDRES')
|
2014-10-17 15:07:01 +00:00
|
|
|
}, {
|
|
|
|
'name': '--apple-remote',
|
|
|
|
'desc': 'Apple Remote support',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'cocoa',
|
2014-10-17 15:07:01 +00:00
|
|
|
'func': check_true
|
2017-02-25 20:56:59 +00:00
|
|
|
}, {
|
|
|
|
'name': '--macos-touchbar',
|
|
|
|
'desc': 'macOS Touch Bar support',
|
build: use unified dependency expressions instead of weird fields
Instead of "deps", "deps_neg", and "deps_any" fields, just have a single
"deps" field, which changes from an array to a string. The string is now
an expression, which can contain the operators &&, ||, !, and allows
grouping with ( ).
It's probably overkill. If it gets a maintenance burden, we can switch
to specifiying the dep expressions as ASTs (or maybe eval()-able Python
expressions), and we could simplify the code that determines the reason
why a dependency is not fulfilled. The latter involves a complicated
conversion of the expression AST to DNF.
The parser is actually pretty simple, and pretty much follows:
https://en.wikipedia.org/wiki/Shunting_yard_algorithm
2017-09-18 20:35:37 +00:00
|
|
|
'deps': 'cocoa',
|
2017-02-25 20:56:59 +00:00
|
|
|
'func': check_cc(
|
|
|
|
fragment=load_fragment('touchbar.m'),
|
|
|
|
framework_name=['AppKit'],
|
|
|
|
compile_filename='test-touchbar.m',
|
|
|
|
linkflags='-fobjc-arc')
|
|
|
|
}
|
2014-04-16 01:08:50 +00:00
|
|
|
]
|
|
|
|
|
2013-07-16 11:28:28 +00:00
|
|
|
_INSTALL_DIRS_LIST = [
|
|
|
|
('bindir', '${PREFIX}/bin', 'binary files'),
|
|
|
|
('libdir', '${PREFIX}/lib', 'library files'),
|
|
|
|
('confdir', '${PREFIX}/etc/mpv', 'configuration files'),
|
|
|
|
|
2014-02-10 20:25:22 +00:00
|
|
|
('incdir', '${PREFIX}/include', 'include files'),
|
|
|
|
|
2013-07-16 11:28:28 +00:00
|
|
|
('datadir', '${PREFIX}/share', 'data files'),
|
|
|
|
('mandir', '${DATADIR}/man', 'man pages '),
|
|
|
|
('docdir', '${DATADIR}/doc/mpv', 'documentation files'),
|
2016-07-26 06:55:54 +00:00
|
|
|
('htmldir', '${DOCDIR}', 'html documentation files'),
|
2014-10-10 17:58:41 +00:00
|
|
|
('zshdir', '${DATADIR}/zsh/site-functions', 'zsh completion functions'),
|
2016-01-11 15:35:30 +00:00
|
|
|
|
|
|
|
('confloaddir', '${CONFDIR}', 'configuration files load directory'),
|
2013-07-16 11:28:28 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
def options(opt):
|
|
|
|
opt.load('compiler_c')
|
|
|
|
opt.load('waf_customizations')
|
|
|
|
opt.load('features')
|
|
|
|
|
|
|
|
group = opt.get_option_group("build and install options")
|
|
|
|
for ident, default, desc in _INSTALL_DIRS_LIST:
|
|
|
|
group.add_option('--{0}'.format(ident),
|
|
|
|
type = 'string',
|
|
|
|
dest = ident,
|
|
|
|
default = default,
|
|
|
|
help = 'directory for installing {0} [{1}]' \
|
|
|
|
.format(desc, default))
|
|
|
|
|
2014-08-04 08:44:21 +00:00
|
|
|
group.add_option('--variant',
|
|
|
|
default = '',
|
|
|
|
help = 'variant name for saving configuration and build results')
|
|
|
|
|
2013-07-16 11:28:28 +00:00
|
|
|
opt.parse_features('build and install options', build_options)
|
2016-06-09 19:05:33 +00:00
|
|
|
optional_features = main_dependencies + libav_dependencies
|
2014-11-28 14:40:55 +00:00
|
|
|
opt.parse_features('optional features', optional_features)
|
2013-07-16 11:28:28 +00:00
|
|
|
opt.parse_features('audio outputs', audio_output_features)
|
|
|
|
opt.parse_features('video outputs', video_output_features)
|
|
|
|
opt.parse_features('hwaccels', hwaccel_features)
|
2014-04-13 16:51:43 +00:00
|
|
|
opt.parse_features('tv features', radio_and_tv_features)
|
2014-04-16 01:08:50 +00:00
|
|
|
opt.parse_features('standalone app', standalone_features)
|
2013-07-16 11:28:28 +00:00
|
|
|
|
2014-11-28 14:40:55 +00:00
|
|
|
group = opt.get_option_group("optional features")
|
2013-07-16 11:28:28 +00:00
|
|
|
group.add_option('--lua',
|
|
|
|
type = 'string',
|
|
|
|
dest = 'LUA_VER',
|
2016-01-21 17:18:55 +00:00
|
|
|
help = "select Lua package which should be autodetected. Choices: 51 51deb 51obsd 51fbsd 52 52deb 52arch 52fbsd luajit")
|
2013-07-16 11:28:28 +00:00
|
|
|
|
2014-07-19 16:45:43 +00:00
|
|
|
@conf
|
|
|
|
def is_optimization(ctx):
|
|
|
|
return getattr(ctx.options, 'enable_optimize')
|
|
|
|
|
2013-07-16 11:28:28 +00:00
|
|
|
@conf
|
|
|
|
def is_debug_build(ctx):
|
|
|
|
return getattr(ctx.options, 'enable_debug-build')
|
|
|
|
|
|
|
|
def configure(ctx):
|
2014-08-04 08:44:21 +00:00
|
|
|
ctx.resetenv(ctx.options.variant)
|
2014-12-04 20:55:00 +00:00
|
|
|
ctx.check_waf_version(mini='1.8.4')
|
2013-07-16 11:28:28 +00:00
|
|
|
target = os.environ.get('TARGET')
|
2014-10-31 23:20:10 +00:00
|
|
|
(cc, pkg_config, ar, windres) = ('cc', 'pkg-config', 'ar', 'windres')
|
2013-07-16 11:28:28 +00:00
|
|
|
|
|
|
|
if target:
|
|
|
|
cc = '-'.join([target, 'gcc'])
|
|
|
|
pkg_config = '-'.join([target, pkg_config])
|
2014-10-31 23:20:10 +00:00
|
|
|
ar = '-'.join([target, ar])
|
2013-07-16 11:28:28 +00:00
|
|
|
windres = '-'.join([target, windres])
|
|
|
|
|
|
|
|
ctx.find_program(cc, var='CC')
|
|
|
|
ctx.find_program(pkg_config, var='PKG_CONFIG')
|
2014-10-31 23:20:10 +00:00
|
|
|
ctx.find_program(ar, var='AR')
|
2015-12-29 19:57:09 +00:00
|
|
|
ctx.find_program('rst2html', var='RST2HTML', mandatory=False)
|
2013-07-16 11:28:28 +00:00
|
|
|
ctx.find_program('rst2man', var='RST2MAN', mandatory=False)
|
2014-01-08 15:00:40 +00:00
|
|
|
ctx.find_program('rst2pdf', var='RST2PDF', mandatory=False)
|
2013-07-16 11:28:28 +00:00
|
|
|
ctx.find_program(windres, var='WINDRES', mandatory=False)
|
2016-12-17 12:24:05 +00:00
|
|
|
ctx.find_program('perl', var='BIN_PERL', mandatory=False)
|
2013-07-16 11:28:28 +00:00
|
|
|
|
2017-01-28 10:31:28 +00:00
|
|
|
ctx.add_os_flags('LIBRARY_PATH')
|
|
|
|
|
2016-11-16 15:18:11 +00:00
|
|
|
ctx.load('compiler_c')
|
|
|
|
ctx.load('waf_customizations')
|
|
|
|
ctx.load('dependencies')
|
|
|
|
ctx.load('detections.compiler')
|
|
|
|
ctx.load('detections.devices')
|
|
|
|
|
2013-07-16 11:28:28 +00:00
|
|
|
for ident, _, _ in _INSTALL_DIRS_LIST:
|
|
|
|
varname = ident.upper()
|
|
|
|
ctx.env[varname] = getattr(ctx.options, ident)
|
|
|
|
|
|
|
|
# keep substituting vars, until the paths are fully expanded
|
|
|
|
while re.match('\$\{([^}]+)\}', ctx.env[varname]):
|
|
|
|
ctx.env[varname] = Utils.subst_vars(ctx.env[varname], ctx.env)
|
|
|
|
|
|
|
|
ctx.parse_dependencies(build_options)
|
|
|
|
ctx.parse_dependencies(main_dependencies)
|
|
|
|
ctx.parse_dependencies(audio_output_features)
|
|
|
|
ctx.parse_dependencies(video_output_features)
|
2016-06-09 19:05:33 +00:00
|
|
|
ctx.parse_dependencies(libav_dependencies)
|
2013-07-16 11:28:28 +00:00
|
|
|
ctx.parse_dependencies(hwaccel_features)
|
|
|
|
ctx.parse_dependencies(radio_and_tv_features)
|
|
|
|
|
|
|
|
if ctx.options.LUA_VER:
|
|
|
|
ctx.options.enable_lua = True
|
|
|
|
|
2014-04-16 01:08:50 +00:00
|
|
|
ctx.parse_dependencies(standalone_features)
|
2013-07-16 11:28:28 +00:00
|
|
|
|
|
|
|
ctx.load('generators.headers')
|
|
|
|
|
|
|
|
if not ctx.dependency_satisfied('build-date'):
|
|
|
|
ctx.env.CFLAGS += ['-DNO_BUILD_TIMESTAMPS']
|
|
|
|
|
2015-02-05 20:00:23 +00:00
|
|
|
if ctx.dependency_satisfied('clang-database'):
|
|
|
|
ctx.load('clang_compilation_database')
|
|
|
|
|
2017-01-12 16:37:11 +00:00
|
|
|
if ctx.dependency_satisfied('cplugins'):
|
|
|
|
# We need to export the libmpv symbols, since the mpv binary itself is
|
|
|
|
# not linked against libmpv. The C plugin needs to be able to pick
|
|
|
|
# up the libmpv symbols from the binary. We still restrict the set
|
|
|
|
# of exported symbols via mpv.def.
|
2017-03-02 13:40:14 +00:00
|
|
|
ctx.env.LINKFLAGS += ['-rdynamic']
|
2017-01-12 16:37:11 +00:00
|
|
|
|
2013-11-24 13:22:45 +00:00
|
|
|
ctx.store_dependencies_lists()
|
|
|
|
|
2015-06-30 13:56:26 +00:00
|
|
|
def __write_version__(ctx):
|
2015-07-11 17:03:44 +00:00
|
|
|
ctx.env.VERSIONH_ST = '--versionh="%s"'
|
|
|
|
ctx.env.CWD_ST = '--cwd="%s"'
|
|
|
|
ctx.env.VERSIONSH_CWD = [ctx.srcnode.abspath()]
|
|
|
|
|
|
|
|
ctx(
|
|
|
|
source = 'version.sh',
|
|
|
|
target = 'version.h',
|
|
|
|
rule = 'sh ${SRC} ${CWD_ST:VERSIONSH_CWD} ${VERSIONH_ST:TGT}',
|
|
|
|
always = True,
|
|
|
|
update_outputs = True)
|
2015-06-30 13:56:26 +00:00
|
|
|
|
2013-07-16 11:28:28 +00:00
|
|
|
def build(ctx):
|
2014-08-04 08:44:21 +00:00
|
|
|
if ctx.options.variant not in ctx.all_envs:
|
|
|
|
from waflib import Errors
|
|
|
|
raise Errors.WafError(
|
|
|
|
'The project was not configured: run "waf --variant={0} configure" first!'
|
|
|
|
.format(ctx.options.variant))
|
2013-11-24 13:22:45 +00:00
|
|
|
ctx.unpack_dependencies_lists()
|
2015-06-30 13:56:26 +00:00
|
|
|
__write_version__(ctx)
|
2013-07-16 11:28:28 +00:00
|
|
|
ctx.load('wscript_build')
|
2014-08-04 08:44:21 +00:00
|
|
|
|
|
|
|
def init(ctx):
|
|
|
|
from waflib.Build import BuildContext, CleanContext, InstallContext, UninstallContext
|
|
|
|
for y in (BuildContext, CleanContext, InstallContext, UninstallContext):
|
|
|
|
class tmp(y):
|
|
|
|
variant = ctx.options.variant
|
|
|
|
|
|
|
|
# This is needed because waf initializes the ConfigurationContext with
|
|
|
|
# an arbitrary setenv('') which would rewrite the previous configuration
|
|
|
|
# cache for the default variant if the configure step finishes.
|
|
|
|
# Ideally ConfigurationContext should just let us override this at class
|
|
|
|
# level like the other Context subclasses do with variant
|
|
|
|
from waflib.Configure import ConfigurationContext
|
|
|
|
class cctx(ConfigurationContext):
|
|
|
|
def resetenv(self, name):
|
|
|
|
self.all_envs = {}
|
|
|
|
self.setenv(name)
|