2013-07-16 13:28:28 +02:00
|
|
|
# vi: ft=python
|
|
|
|
|
|
|
|
import sys, os, re
|
|
|
|
sys.path.insert(0, os.path.join(os.getcwd(), 'waftools'))
|
2013-11-23 10:58:19 +01:00
|
|
|
sys.path.insert(0, os.getcwd())
|
2013-07-16 13:28:28 +02:00
|
|
|
from waflib.Configure import conf
|
|
|
|
from waflib import Utils
|
|
|
|
from waftools.checks.generic import *
|
|
|
|
from waftools.checks.custom import *
|
|
|
|
|
|
|
|
build_options = [
|
|
|
|
{
|
2014-11-28 15:55:54 +01:00
|
|
|
'name': '--cplayer',
|
|
|
|
'desc': 'mpv CLI player',
|
|
|
|
'default': 'enable',
|
|
|
|
'func': check_true
|
|
|
|
}, {
|
2014-03-11 23:56:19 +01:00
|
|
|
'name': '--libmpv-shared',
|
2014-02-24 11:50:21 +01:00
|
|
|
'desc': 'shared library',
|
2014-02-10 21:25:22 +01:00
|
|
|
'default': 'disable',
|
|
|
|
'func': check_true
|
2014-06-16 11:22:46 +02:00
|
|
|
}, {
|
|
|
|
'name': '--libmpv-static',
|
|
|
|
'desc': 'static library',
|
|
|
|
'default': 'disable',
|
|
|
|
'deps_neg': [ 'libmpv-shared' ],
|
|
|
|
'func': check_true
|
2014-02-10 21:25:22 +01:00
|
|
|
}, {
|
2013-07-16 13:28:28 +02: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 18:45:43 +02:00
|
|
|
}, {
|
|
|
|
'name': '--optimize',
|
|
|
|
'desc': 'whether to optimize',
|
|
|
|
'default': 'enable',
|
|
|
|
'func': check_true
|
2013-07-16 13:28:28 +02: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')
|
|
|
|
}, {
|
|
|
|
'name': '--pdf-build',
|
|
|
|
'desc': 'pdf manual generation',
|
2014-01-08 16:00:40 +01:00
|
|
|
'func': check_ctx_vars('RST2PDF'),
|
2015-02-02 12:06:06 +01:00
|
|
|
'default': 'disable',
|
2013-07-16 13:28:28 +02:00
|
|
|
}, {
|
|
|
|
'name': 'libdl',
|
|
|
|
'desc': 'dynamic loader',
|
|
|
|
'func': check_libs(['dl'], check_statement('dlfcn.h', 'dlopen("", 0)'))
|
|
|
|
}, {
|
|
|
|
'name': 'dlopen',
|
|
|
|
'desc': 'dlopen',
|
|
|
|
'deps_any': [ 'libdl', 'os-win32', 'os-cygwin' ],
|
|
|
|
'func': check_true
|
|
|
|
}, {
|
|
|
|
'name': '--vf-dlopen-filters',
|
|
|
|
'desc': 'compilation of default filters for vf_dlopen',
|
|
|
|
'deps': [ 'dlopen' ],
|
|
|
|
'default': 'disable',
|
|
|
|
'func': check_true
|
2014-06-08 16:00:43 +02:00
|
|
|
}, {
|
|
|
|
'name': '--zsh-comp',
|
|
|
|
'desc': 'zsh completion',
|
|
|
|
'func': check_true,
|
2014-06-09 15:17:03 +02:00
|
|
|
'default': 'disable',
|
2013-12-29 17:34:31 +01:00
|
|
|
}, {
|
2014-04-19 17:09:24 +02:00
|
|
|
# does nothing - left for backward and forward compatibility
|
2013-12-29 17:34:31 +01:00
|
|
|
'name': '--asm',
|
2014-04-19 17:09:24 +02:00
|
|
|
'desc': 'inline assembly (currently without effect)',
|
2013-12-29 17:34:31 +01:00
|
|
|
'default': 'enable',
|
|
|
|
'func': check_true,
|
2014-12-28 09:38:22 +01:00
|
|
|
}, {
|
|
|
|
'name': '--test',
|
|
|
|
'desc': 'test suite (using cmocka)',
|
2015-02-23 15:56:55 +01:00
|
|
|
'func': check_pkg_config('cmocka', '>= 0.4.1'),
|
2015-03-10 18:19:32 +01:00
|
|
|
'default': 'disable',
|
2015-02-05 21:00:23 +01:00
|
|
|
}, {
|
|
|
|
'name': '--clang-database',
|
|
|
|
'desc': 'generate a clang compilation database',
|
|
|
|
'func': check_true,
|
|
|
|
'default': 'disable',
|
2013-07-16 13:28:28 +02: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 16:21:04 +02:00
|
|
|
}, {
|
|
|
|
'name': 'mingw',
|
|
|
|
'desc': 'MinGW',
|
|
|
|
'deps': [ 'os-win32' ],
|
2014-11-17 23:47:30 +01:00
|
|
|
'func': check_statement('stddef.h', 'int x = __MINGW32__;'
|
|
|
|
'int y = __MINGW64_VERSION_MAJOR'),
|
|
|
|
}, {
|
|
|
|
'name': 'posix',
|
|
|
|
'desc': 'POSIX environment',
|
|
|
|
# This should be good enough.
|
2014-12-26 17:14:48 +01: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)'),
|
2014-11-17 23:47:30 +01:00
|
|
|
}, {
|
|
|
|
'name': 'posix-or-mingw',
|
2015-03-11 23:40:54 +01:00
|
|
|
'desc': 'development environment',
|
2014-11-17 23:47:30 +01:00
|
|
|
'deps_any': [ 'posix', 'mingw' ],
|
|
|
|
'func': check_true,
|
|
|
|
'req': True,
|
|
|
|
'fmsg': 'Unable to find either POSIX or MinGW-w64 environment, ' \
|
|
|
|
'or compiler does not work.',
|
2015-03-11 23:40:54 +01:00
|
|
|
}, {
|
|
|
|
'name': 'win32',
|
|
|
|
'desc': 'win32',
|
|
|
|
'deps': [ 'os-win32' ],
|
|
|
|
'func': check_libs(['gdi32', 'winmm', 'ole32', 'uuid'], check_true),
|
2015-01-01 15:10:42 +01:00
|
|
|
}, {
|
|
|
|
'name': '--win32-internal-pthreads',
|
|
|
|
'desc': 'internal pthread wrapper for win32 (Vista+)',
|
|
|
|
'deps_neg': [ 'posix' ],
|
2015-03-11 23:40:54 +01:00
|
|
|
'deps': [ 'win32' ],
|
2015-01-01 15:10:42 +01:00
|
|
|
'func': check_true,
|
|
|
|
'default': 'disable',
|
2013-07-16 13:28:28 +02:00
|
|
|
}, {
|
2013-11-28 19:28:38 +01:00
|
|
|
'name': 'pthreads',
|
2013-07-16 13:28:28 +02:00
|
|
|
'desc': 'POSIX threads',
|
|
|
|
'func': check_pthreads,
|
2013-11-28 19:28:38 +01:00
|
|
|
'req': True,
|
|
|
|
'fmsg': 'Unable to find pthreads support.'
|
2014-05-21 01:04:47 +02:00
|
|
|
}, {
|
|
|
|
'name': 'stdatomic',
|
|
|
|
'desc': 'stdatomic.h',
|
2014-06-17 20:03:19 +02:00
|
|
|
'func': check_libs(['atomic'],
|
2014-05-21 01:04:47 +02:00
|
|
|
check_statement('stdatomic.h',
|
2014-06-17 20:03:19 +02:00
|
|
|
'atomic_int_least64_t test = ATOMIC_VAR_INIT(123);'
|
|
|
|
'int test2 = atomic_load(&test)'))
|
2013-12-30 16:30:30 +01:00
|
|
|
}, {
|
2014-01-01 20:42:13 +01:00
|
|
|
'name': 'atomic-builtins',
|
2013-12-30 16:30:30 +01:00
|
|
|
'desc': 'compiler support for __atomic built-ins',
|
|
|
|
'func': check_libs(['atomic'],
|
|
|
|
check_statement('stdint.h',
|
|
|
|
'int64_t test = 0;'
|
2014-05-21 01:04:47 +02:00
|
|
|
'test = __atomic_add_fetch(&test, 1, __ATOMIC_SEQ_CST)')),
|
|
|
|
'deps_neg': [ 'stdatomic' ],
|
2014-01-01 20:42:13 +01:00
|
|
|
}, {
|
|
|
|
'name': 'sync-builtins',
|
|
|
|
'desc': 'compiler support for __sync built-ins',
|
|
|
|
'func': check_statement('stdint.h',
|
|
|
|
'int64_t test = 0;'
|
2014-11-09 15:12:54 +01:00
|
|
|
'__typeof__(test) x = ({int a = 1; a;});'
|
2014-01-01 20:42:13 +01:00
|
|
|
'test = __sync_add_and_fetch(&test, 1)'),
|
2014-05-21 01:04:47 +02:00
|
|
|
'deps_neg': [ 'stdatomic', 'atomic-builtins' ],
|
2014-01-01 20:42:13 +01:00
|
|
|
}, {
|
2014-07-05 17:02:06 +02:00
|
|
|
'name': 'atomics',
|
2014-01-01 20:42:13 +01:00
|
|
|
'desc': 'compiler support for usable thread synchronization built-ins',
|
|
|
|
'func': check_true,
|
2014-05-21 01:04:47 +02:00
|
|
|
'deps_any': ['stdatomic', 'atomic-builtins', 'sync-builtins'],
|
2013-07-16 13:28:28 +02:00
|
|
|
}, {
|
|
|
|
'name': 'librt',
|
|
|
|
'desc': 'linking with -lrt',
|
|
|
|
'deps': [ 'pthreads' ],
|
|
|
|
'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',
|
|
|
|
'deps_any': [ 'os-win32', 'os-cygwin' ],
|
|
|
|
'func': check_true
|
2014-09-14 16:21:04 +02:00
|
|
|
}, {
|
|
|
|
'name': '--waio',
|
|
|
|
'desc': 'libwaio for win32',
|
|
|
|
'deps': [ 'os-win32', 'mingw' ],
|
|
|
|
'func': check_libs(['waio'],
|
|
|
|
check_statement('waio/waio.h', 'waio_alloc(0, 0, 0, 0)')),
|
2013-07-16 13:28:28 +02:00
|
|
|
}, {
|
|
|
|
'name': '--termios',
|
|
|
|
'desc': 'termios',
|
|
|
|
'func': check_headers('termios.h', 'sys/termios.h'),
|
|
|
|
}, {
|
|
|
|
'name': '--shm',
|
|
|
|
'desc': 'shm',
|
2013-12-26 16:57:21 +01:00
|
|
|
'func': check_statement(['sys/types.h', 'sys/ipc.h', 'sys/shm.h'],
|
2013-07-16 13:28:28 +02:00
|
|
|
'shmget(0, 0, 0); shmat(0, 0, 0); shmctl(0, 0, 0)')
|
2014-11-17 23:50:32 +01: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-19 01:42:28 +02:00
|
|
|
}, {
|
|
|
|
'name': 'posix-spawn',
|
2014-10-19 12:55:29 +02:00
|
|
|
'desc': 'POSIX spawnp()/kill()',
|
|
|
|
'func': check_statement(['spawn.h', 'signal.h'],
|
|
|
|
'posix_spawnp(0,0,0,0,0,0); kill(0,0)')
|
2013-07-16 13:28:28 +02:00
|
|
|
}, {
|
|
|
|
'name': 'glob',
|
|
|
|
'desc': 'glob()',
|
|
|
|
'func': check_statement('glob.h', 'glob("filename", 0, 0, 0)')
|
|
|
|
}, {
|
|
|
|
'name': 'glob-win32-replacement',
|
|
|
|
'desc': 'glob() win32 replacement',
|
|
|
|
'deps_neg': [ 'glob' ],
|
|
|
|
'deps_any': [ 'os-win32', 'os-cygwin' ],
|
|
|
|
'func': check_true
|
2015-02-26 21:44:35 +01:00
|
|
|
}, {
|
|
|
|
'name': 'fchmod',
|
|
|
|
'desc': 'fchmod()',
|
|
|
|
'func': check_statement('sys/stat.h', 'fchmod(0, 0)'),
|
2014-10-19 23:32:34 +02: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',
|
|
|
|
'deps_neg': [ 'glibc-thread-name' ],
|
|
|
|
'func': check_statement('pthread.h',
|
|
|
|
'pthread_setname_np("ducks")', use=['pthreads']),
|
|
|
|
}, {
|
|
|
|
'name': 'bsd-thread-name',
|
|
|
|
'desc': 'BSD API for setting thread name',
|
|
|
|
'deps_neg': [ 'glibc-thread-name', 'osx-thread-name' ],
|
2014-10-22 01:02:55 +02:00
|
|
|
'func': check_statement(['pthread.h', 'pthread_np.h'],
|
2014-10-19 23:32:34 +02:00
|
|
|
'pthread_set_name_np(pthread_self(), "ducks")',
|
|
|
|
use=['pthreads']),
|
2014-10-22 01:02:55 +02:00
|
|
|
}, {
|
|
|
|
'name': 'netbsd-thread-name',
|
|
|
|
'desc': 'NetBSD API for setting thread name',
|
|
|
|
'deps_neg': [ 'glibc-thread-name', 'osx-thread-name', 'bsd-thread-name' ],
|
|
|
|
'func': check_statement('pthread.h',
|
|
|
|
'pthread_setname_np(pthread_self(), "%s", (void *)"ducks")',
|
|
|
|
use=['pthreads']),
|
2014-02-17 12:51:38 +01:00
|
|
|
}, {
|
|
|
|
'name': 'bsd-fstatfs',
|
|
|
|
'desc': "BSD's fstatfs()",
|
|
|
|
'func': check_statement(['sys/param.h', 'sys/mount.h'],
|
2014-03-12 00:49:16 +01:00
|
|
|
'struct statfs fs; fstatfs(0, &fs); fs.f_fstypename')
|
2014-03-11 20:27:50 +01:00
|
|
|
}, {
|
|
|
|
'name': 'linux-fstatfs',
|
|
|
|
'desc': "Linux's fstatfs()",
|
2014-03-17 03:12:31 +01:00
|
|
|
'deps': [ 'os-linux' ],
|
2014-03-11 20:27:50 +01:00
|
|
|
'func': check_statement('sys/vfs.h',
|
|
|
|
'struct statfs fs; fstatfs(0, &fs); fs.f_namelen')
|
2013-07-16 13:28:28 +02:00
|
|
|
}, {
|
|
|
|
'name': '--libguess',
|
|
|
|
'desc': 'libguess support',
|
|
|
|
'func': check_pkg_config('libguess', '>= 1.0'),
|
|
|
|
}, {
|
|
|
|
'name': '--libsmbclient',
|
|
|
|
'desc': 'Samba support',
|
|
|
|
'deps': [ 'libdl' ],
|
2013-11-30 19:47:09 +01:00
|
|
|
'func': check_pkg_config('smbclient'),
|
2013-07-16 13:28:28 +02:00
|
|
|
'module': 'input',
|
2014-10-12 01:31:20 +02:00
|
|
|
}, {
|
|
|
|
'name' : '--lua',
|
|
|
|
'desc' : 'Lua',
|
|
|
|
'func': check_lua,
|
2013-07-16 13:28:28 +02:00
|
|
|
}, {
|
|
|
|
'name': '--libass',
|
|
|
|
'desc': 'SSA/ASS support',
|
2015-02-18 21:11:53 +01:00
|
|
|
'func': check_pkg_config('libass', '>= 0.12.1'),
|
2013-07-16 13:28:28 +02:00
|
|
|
'req': True,
|
2015-02-21 17:13:38 +01: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 13:28:28 +02:00
|
|
|
}, {
|
|
|
|
'name': '--libass-osd',
|
|
|
|
'desc': 'libass OSD support',
|
|
|
|
'deps': [ 'libass' ],
|
|
|
|
'func': check_true,
|
|
|
|
}, {
|
|
|
|
'name': 'dummy-osd',
|
|
|
|
'desc': 'dummy OSD support',
|
|
|
|
'deps_neg': [ 'libass-osd' ],
|
|
|
|
'func': check_true,
|
|
|
|
} , {
|
|
|
|
'name': 'zlib',
|
|
|
|
'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,
|
|
|
|
}, {
|
|
|
|
'name' : '--joystick',
|
|
|
|
'desc' : 'joystick',
|
|
|
|
'func': check_cc(header_name='linux/joystick.h'),
|
|
|
|
'default': 'disable'
|
|
|
|
}, {
|
|
|
|
'name' : '--lirc',
|
|
|
|
'desc' : 'lirc',
|
|
|
|
'func': check_cc(header_name='lirc/lirc_client.h', lib='lirc_client'),
|
2014-07-15 01:49:02 +02:00
|
|
|
}, {
|
|
|
|
'name': '--libbluray',
|
|
|
|
'desc': 'Bluray support',
|
|
|
|
'func': check_pkg_config('libbluray', '>= 0.3.0'),
|
|
|
|
}, {
|
|
|
|
'name': '--dvdread',
|
|
|
|
'desc': 'dvdread support',
|
|
|
|
'func': check_pkg_config('dvdread', '>= 4.1.0'),
|
|
|
|
}, {
|
|
|
|
'name': '--dvdnav',
|
|
|
|
'desc': 'dvdnav support',
|
|
|
|
'deps': [ 'dvdread' ],
|
|
|
|
'func': check_pkg_config('dvdnav', '>= 4.2.0'),
|
2013-07-16 13:28:28 +02:00
|
|
|
}, {
|
|
|
|
'name': '--cdda',
|
|
|
|
'desc': 'cdda support (libcdio)',
|
|
|
|
'func': check_pkg_config('libcdio_paranoia'),
|
|
|
|
}, {
|
|
|
|
'name': '--enca',
|
|
|
|
'desc': 'ENCA support',
|
|
|
|
'func': check_statement('enca.h', 'enca_get_languages(NULL)', lib='enca'),
|
|
|
|
}, {
|
|
|
|
'name': '--mpg123',
|
|
|
|
'desc': 'mpg123 support',
|
2014-02-13 13:26:46 +01:00
|
|
|
'func': check_pkg_config('libmpg123', '>= 1.14.0'),
|
2013-07-16 13:28:28 +02:00
|
|
|
}, {
|
|
|
|
'name': '--ladspa',
|
|
|
|
'desc': 'LADSPA plugin support',
|
|
|
|
'func': check_statement('ladspa.h', 'LADSPA_Descriptor ld = {0}'),
|
2015-02-10 23:50:17 +01:00
|
|
|
}, {
|
|
|
|
'name': '--rubberband',
|
|
|
|
'desc': 'librubberband support',
|
|
|
|
'func': check_pkg_config('rubberband', '>= 1.8.0'),
|
2013-07-16 13:28:28 +02:00
|
|
|
}, {
|
|
|
|
'name': '--libbs2b',
|
|
|
|
'desc': 'libbs2b audio filter support',
|
|
|
|
'func': check_pkg_config('libbs2b'),
|
|
|
|
}, {
|
|
|
|
'name': '--lcms2',
|
|
|
|
'desc': 'LCMS2 support',
|
2014-06-16 16:57:19 +02:00
|
|
|
'func': check_pkg_config('lcms2', '>= 2.6'),
|
2014-10-12 01:31:20 +02:00
|
|
|
}, {
|
|
|
|
'name': 'vapoursynth-core',
|
|
|
|
'desc': 'VapourSynth filter bridge (core)',
|
2015-02-16 20:56:00 +01:00
|
|
|
'func': check_pkg_config('vapoursynth >= 24'),
|
2014-04-12 17:51:19 +02:00
|
|
|
}, {
|
|
|
|
'name': '--vapoursynth',
|
2014-10-12 01:31:20 +02:00
|
|
|
'desc': 'VapourSynth filter bridge (Python)',
|
|
|
|
'deps': ['vapoursynth-core'],
|
|
|
|
'func': check_pkg_config('vapoursynth-script >= 23'),
|
|
|
|
}, {
|
|
|
|
'name': '--vapoursynth-lazy',
|
|
|
|
'desc': 'VapourSynth filter bridge (Lazy Lua)',
|
|
|
|
'deps': ['vapoursynth-core', 'lua'],
|
|
|
|
'func': check_true,
|
2013-07-16 13:28:28 +02:00
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
libav_pkg_config_checks = [
|
2015-03-03 11:51:22 +01:00
|
|
|
'libavutil', '>= 54.02.0',
|
|
|
|
'libavcodec', '>= 56.1.0',
|
|
|
|
'libavformat', '>= 56.01.0',
|
|
|
|
'libswscale', '>= 2.1.3'
|
2013-07-16 13:28:28 +02:00
|
|
|
]
|
2015-03-03 11:51:22 +01:00
|
|
|
libav_versions_string = "FFmpeg 2.4 or Libav 11"
|
2013-07-16 13:28:28 +02:00
|
|
|
|
|
|
|
libav_dependencies = [
|
|
|
|
{
|
|
|
|
'name': 'libav',
|
|
|
|
'desc': 'libav/ffmpeg',
|
|
|
|
'func': check_pkg_config(*libav_pkg_config_checks),
|
|
|
|
'req': True,
|
|
|
|
'fmsg': "Unable to find development files for some of the required \
|
2015-03-03 11:51:22 +01:00
|
|
|
FFmpeg/Libav libraries. You need at least {0}. Aborting.".format(libav_versions_string)
|
2013-07-16 13:28:28 +02:00
|
|
|
}, {
|
|
|
|
'name': '--libswresample',
|
|
|
|
'desc': 'libswresample',
|
2015-03-03 11:51:22 +01:00
|
|
|
'func': check_pkg_config('libswresample', '>= 1.1.100'),
|
2015-01-02 01:43:59 +01:00
|
|
|
}, {
|
|
|
|
'name': '--libavresample',
|
|
|
|
'desc': 'libavresample',
|
2015-03-03 11:51:22 +01:00
|
|
|
'func': check_pkg_config('libavresample', '>= 2.1.0'),
|
2015-01-02 01:43:59 +01:00
|
|
|
'deps_neg': ['libswresample'],
|
2013-07-16 13:28:28 +02:00
|
|
|
}, {
|
|
|
|
'name': 'resampler',
|
|
|
|
'desc': 'usable resampler found',
|
|
|
|
'deps_any': [ 'libavresample', 'libswresample' ],
|
|
|
|
'func': check_true,
|
|
|
|
'req': True,
|
|
|
|
'fmsg': 'No resampler found. Install libavresample or libswresample (FFmpeg).'
|
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 15:53:40 +01:00
|
|
|
}, {
|
|
|
|
'name': '--libavfilter',
|
|
|
|
'desc': 'libavfilter',
|
2015-03-03 11:51:22 +01:00
|
|
|
'func': check_pkg_config('libavfilter', '>= 5.0.0'),
|
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 15:53:40 +01:00
|
|
|
}, {
|
|
|
|
'name': '--libavdevice',
|
|
|
|
'desc': 'libavdevice',
|
2015-03-03 11:51:22 +01:00
|
|
|
'func': check_pkg_config('libavdevice', '>= 55.0.0'),
|
2013-07-16 13:28:28 +02:00
|
|
|
}, {
|
|
|
|
'name': 'avcodec-chroma-pos-api',
|
|
|
|
'desc': 'libavcodec avcodec_enum_to_chroma_pos API',
|
|
|
|
'func': check_statement('libavcodec/avcodec.h', """int x, y;
|
|
|
|
avcodec_enum_to_chroma_pos(&x, &y, AVCHROMA_LOC_UNSPECIFIED)""",
|
|
|
|
use='libav')
|
2014-03-25 18:45:08 +01:00
|
|
|
}, {
|
2014-04-13 16:04:23 +02:00
|
|
|
'name': 'avframe-metadata',
|
|
|
|
'desc': 'libavutil AVFrame metadata',
|
|
|
|
'func': check_statement('libavutil/frame.h',
|
|
|
|
'av_frame_get_metadata(NULL)',
|
|
|
|
use='libav')
|
2014-10-03 17:29:53 +02:00
|
|
|
}, {
|
|
|
|
'name': 'avframe-skip-samples',
|
|
|
|
'desc': 'libavutil AVFrame skip samples metadata',
|
|
|
|
'func': check_statement('libavutil/frame.h',
|
|
|
|
'enum AVFrameSideDataType type = AV_FRAME_DATA_SKIP_SAMPLES',
|
|
|
|
use='libav')
|
2013-07-16 13:28:28 +02:00
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
audio_output_features = [
|
|
|
|
{
|
|
|
|
'name': '--sdl2',
|
|
|
|
'desc': 'SDL2',
|
2014-07-05 17:02:06 +02:00
|
|
|
'deps': ['atomics'],
|
2013-12-29 14:14:09 +01:00
|
|
|
'func': check_pkg_config('sdl2'),
|
|
|
|
'default': 'disable'
|
2013-07-16 13:28:28 +02:00
|
|
|
}, {
|
2014-01-25 00:30:28 +01:00
|
|
|
'name': '--sdl1',
|
2013-07-16 13:28:28 +02:00
|
|
|
'desc': 'SDL (1.x)',
|
2014-07-05 17:02:06 +02:00
|
|
|
'deps': ['atomics'],
|
2013-07-16 13:28:28 +02:00
|
|
|
'deps_neg': [ 'sdl2' ],
|
2013-12-29 14:14:09 +01:00
|
|
|
'func': check_pkg_config('sdl'),
|
|
|
|
'default': 'disable'
|
2013-12-07 16:58:22 +01:00
|
|
|
}, {
|
|
|
|
'name': 'oss-audio-4front',
|
|
|
|
'desc': 'OSS (implementation from opensound.com)',
|
|
|
|
'func': check_oss_4front,
|
|
|
|
'groups' : [ 'oss-audio' ]
|
2013-11-29 09:01:14 +01:00
|
|
|
}, {
|
|
|
|
'name': 'oss-audio-native',
|
|
|
|
'desc': 'OSS (platform-specific OSS implementation)',
|
|
|
|
'func': check_cc(header_name='sys/soundcard.h',
|
|
|
|
defines=['PATH_DEV_DSP="/dev/dsp"',
|
|
|
|
'PATH_DEV_MIXER="/dev/mixer"'],
|
|
|
|
fragment=load_fragment('oss_audio.c')),
|
2013-12-07 16:58:22 +01:00
|
|
|
'deps_neg': [ 'oss-audio-4front' ],
|
2013-11-29 09:01:14 +01:00
|
|
|
'groups' : [ 'oss-audio' ]
|
|
|
|
}, {
|
|
|
|
'name': 'oss-audio-sunaudio',
|
|
|
|
'desc': 'OSS (emulation on top of SunAudio)',
|
|
|
|
'func': check_cc(header_name='soundcard.h',
|
|
|
|
lib='ossaudio',
|
|
|
|
defines=['PATH_DEV_DSP="/dev/sound"',
|
|
|
|
'PATH_DEV_MIXER="/dev/mixer"'],
|
|
|
|
fragment=load_fragment('oss_audio_sunaudio.c')),
|
2013-12-07 16:58:22 +01:00
|
|
|
'deps_neg': [ 'oss-audio-4front', 'oss-audio-native' ],
|
2013-11-29 09:01:14 +01:00
|
|
|
'groups' : [ 'oss-audio' ]
|
2013-07-16 13:28:28 +02:00
|
|
|
}, {
|
|
|
|
'name': '--oss-audio',
|
|
|
|
'desc': 'OSS audio output',
|
2013-11-29 09:01:14 +01:00
|
|
|
'func': check_true,
|
|
|
|
'deps_any': [ 'oss-audio-native', 'oss-audio-sunaudio',
|
|
|
|
'oss-audio-4front' ]
|
2013-07-16 13:28:28 +02: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 15:52:29 +02:00
|
|
|
'struct sio_par par; sio_initpar(&par); const char *s = SIO_DEVANY', lib='sndio'),
|
|
|
|
'default': 'disable'
|
2013-07-16 13:28:28 +02:00
|
|
|
}, {
|
|
|
|
'name': '--pulse',
|
|
|
|
'desc': 'PulseAudio audio output',
|
2014-07-26 22:40:27 +02:00
|
|
|
'func': check_pkg_config('libpulse', '>= 1.0')
|
2013-07-16 13:28:28 +02:00
|
|
|
}, {
|
|
|
|
'name': '--jack',
|
|
|
|
'desc': 'JACK audio output',
|
2014-07-05 17:02:06 +02:00
|
|
|
'deps': ['atomics'],
|
2013-07-16 13:28:28 +02:00
|
|
|
'func': check_pkg_config('jack'),
|
|
|
|
}, {
|
|
|
|
'name': '--openal',
|
|
|
|
'desc': 'OpenAL audio output',
|
|
|
|
'func': check_pkg_config('openal', '>= 1.13'),
|
|
|
|
'default': 'disable'
|
|
|
|
}, {
|
|
|
|
'name': '--alsa',
|
|
|
|
'desc': 'ALSA audio output',
|
2015-02-23 15:56:55 +01:00
|
|
|
'func': check_pkg_config('alsa', '>= 1.0.18'),
|
2013-07-16 13:28:28 +02:00
|
|
|
}, {
|
|
|
|
'name': '--coreaudio',
|
|
|
|
'desc': 'CoreAudio audio output',
|
2014-07-05 17:02:06 +02:00
|
|
|
'deps': ['atomics'],
|
2013-07-16 13:28:28 +02:00
|
|
|
'func': check_cc(
|
|
|
|
fragment=load_fragment('coreaudio.c'),
|
2013-12-06 10:17:20 +01:00
|
|
|
framework_name=['CoreFoundation', 'CoreAudio', 'AudioUnit', 'AudioToolbox'])
|
2013-07-16 13:28:28 +02:00
|
|
|
}, {
|
|
|
|
'name': '--dsound',
|
|
|
|
'desc': 'DirectSound audio output',
|
|
|
|
'func': check_cc(header_name='dsound.h'),
|
|
|
|
}, {
|
|
|
|
'name': '--wasapi',
|
|
|
|
'desc': 'WASAPI audio output',
|
2015-03-11 23:40:54 +01:00
|
|
|
'deps': ['win32', 'atomics'],
|
|
|
|
'func': check_cc(fragment=load_fragment('wasapi.c')),
|
2013-07-16 13:28:28 +02:00
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
video_output_features = [
|
|
|
|
{
|
|
|
|
'name': '--cocoa',
|
|
|
|
'desc': 'Cocoa',
|
2014-01-02 20:34:14 +01:00
|
|
|
'func': check_cocoa
|
2013-07-16 13:28:28 +02:00
|
|
|
} , {
|
|
|
|
'name': '--wayland',
|
|
|
|
'desc': 'Wayland',
|
2014-09-19 17:40:26 +02:00
|
|
|
'func': check_pkg_config('wayland-client', '>= 1.6.0',
|
|
|
|
'wayland-cursor', '>= 1.6.0',
|
2013-07-16 13:28:28 +02:00
|
|
|
'xkbcommon', '>= 0.3.0'),
|
|
|
|
} , {
|
|
|
|
'name': '--x11',
|
|
|
|
'desc': 'X11',
|
|
|
|
'func': check_pkg_config('x11'),
|
|
|
|
} , {
|
|
|
|
'name': '--xss',
|
|
|
|
'desc': 'Xss screensaver extensions',
|
|
|
|
'deps': [ 'x11' ],
|
2014-08-16 22:00:00 +02:00
|
|
|
'func': check_pkg_config('xscrnsaver'),
|
2013-07-16 13:28:28 +02:00
|
|
|
} , {
|
|
|
|
'name': '--xext',
|
|
|
|
'desc': 'X extensions',
|
|
|
|
'deps': [ 'x11' ],
|
|
|
|
'func': check_pkg_config('xext'),
|
|
|
|
} , {
|
|
|
|
'name': '--xv',
|
|
|
|
'desc': 'Xv video output',
|
|
|
|
'deps': [ 'x11' ],
|
|
|
|
'func': check_pkg_config('xv'),
|
|
|
|
} , {
|
|
|
|
'name': '--xinerama',
|
|
|
|
'desc': 'Xinerama',
|
|
|
|
'deps': [ 'x11' ],
|
|
|
|
'func': check_pkg_config('xinerama'),
|
|
|
|
}, {
|
2014-08-16 21:43:13 +02:00
|
|
|
'name': '--xrandr',
|
|
|
|
'desc': 'Xrandr',
|
2013-07-16 13:28:28 +02:00
|
|
|
'deps': [ 'x11' ],
|
2014-08-17 15:38:47 +02:00
|
|
|
'func': check_pkg_config('xrandr', '>= 1.2.0'),
|
2013-07-16 13:28:28 +02:00
|
|
|
} , {
|
|
|
|
'name': '--gl-cocoa',
|
|
|
|
'desc': 'OpenGL Cocoa Backend',
|
|
|
|
'deps': [ 'cocoa' ],
|
2013-11-28 08:36:41 +01:00
|
|
|
'groups': [ 'gl' ],
|
2013-07-16 13:28:28 +02:00
|
|
|
'func': check_true
|
|
|
|
} , {
|
|
|
|
'name': '--gl-x11',
|
|
|
|
'desc': 'OpenGL X11 Backend',
|
|
|
|
'deps': [ 'x11' ],
|
2013-11-28 08:36:41 +01:00
|
|
|
'groups': [ 'gl' ],
|
2013-07-16 13:28:28 +02:00
|
|
|
'func': check_libs(['GL', 'GL Xdamage'],
|
|
|
|
check_cc(fragment=load_fragment('gl_x11.c'),
|
|
|
|
use=['x11', 'libdl', 'pthreads']))
|
2014-11-04 00:12:04 +01:00
|
|
|
} , {
|
|
|
|
'name': '--egl-x11',
|
|
|
|
'desc': 'OpenGL X11 EGL Backend',
|
|
|
|
'deps': [ 'x11' ],
|
|
|
|
'groups': [ 'gl' ],
|
|
|
|
'func': check_pkg_config('egl', 'gl'),
|
|
|
|
'default': 'disable',
|
2013-07-16 13:28:28 +02:00
|
|
|
} , {
|
|
|
|
'name': '--gl-wayland',
|
|
|
|
'desc': 'OpenGL Wayland Backend',
|
|
|
|
'deps': [ 'wayland' ],
|
2013-11-28 08:36:41 +01:00
|
|
|
'groups': [ 'gl' ],
|
2013-07-16 13:28:28 +02:00
|
|
|
'func': check_pkg_config('wayland-egl', '>= 9.0.0',
|
|
|
|
'egl', '>= 9.0.0')
|
|
|
|
} , {
|
|
|
|
'name': '--gl-win32',
|
|
|
|
'desc': 'OpenGL Win32 Backend',
|
2015-03-11 23:40:54 +01:00
|
|
|
'deps': [ 'win32' ],
|
2013-11-28 08:36:41 +01:00
|
|
|
'groups': [ 'gl' ],
|
2013-07-16 13:28:28 +02:00
|
|
|
'func': check_statement('windows.h', 'wglCreateContext(0)',
|
|
|
|
lib='opengl32')
|
|
|
|
} , {
|
|
|
|
'name': '--gl',
|
|
|
|
'desc': 'OpenGL video outputs',
|
|
|
|
'deps_any': [ 'gl-cocoa', 'gl-x11', 'gl-win32', 'gl-wayland' ],
|
|
|
|
'func': check_true
|
|
|
|
} , {
|
|
|
|
'name': '--vdpau',
|
|
|
|
'desc': 'VDPAU acceleration',
|
|
|
|
'deps': [ 'x11' ],
|
|
|
|
'func': check_pkg_config('vdpau', '>= 0.2'),
|
|
|
|
} , {
|
|
|
|
'name': '--vdpau-gl-x11',
|
|
|
|
'desc': 'VDPAU with OpenGL/X11',
|
|
|
|
'deps': [ 'vdpau', 'gl-x11' ],
|
|
|
|
'func': check_true,
|
|
|
|
}, {
|
|
|
|
'name': '--vaapi',
|
|
|
|
'desc': 'VAAPI acceleration',
|
|
|
|
'deps': [ 'x11', 'libdl' ],
|
|
|
|
'func': check_pkg_config(
|
|
|
|
'libva', '>= 0.32.0', 'libva-x11', '>= 0.32.0'),
|
|
|
|
}, {
|
|
|
|
'name': '--vaapi-vpp',
|
|
|
|
'desc': 'VAAPI VPP',
|
|
|
|
'deps': [ 'vaapi' ],
|
|
|
|
'func': check_pkg_config('libva', '>= 0.34.0'),
|
|
|
|
}, {
|
|
|
|
'name': '--vaapi-glx',
|
|
|
|
'desc': 'VAAPI GLX',
|
|
|
|
'deps': [ 'vaapi', 'gl-x11' ],
|
|
|
|
'func': check_pkg_config('libva-glx', '>= 0.32.0'),
|
|
|
|
}, {
|
|
|
|
'name': '--caca',
|
|
|
|
'desc': 'CACA',
|
|
|
|
'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',
|
2015-03-11 23:40:54 +01:00
|
|
|
'deps': [ 'win32' ],
|
2013-07-16 13:28:28 +02:00
|
|
|
'func': check_cc(header_name='d3d9.h'),
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
hwaccel_features = [
|
|
|
|
{
|
|
|
|
'name': '--vaapi-hwaccel',
|
|
|
|
'desc': 'libavcodec VAAPI hwaccel',
|
|
|
|
'deps': [ 'vaapi' ],
|
2015-03-06 11:01:53 +01:00
|
|
|
'func': check_headers('libavcodec/vaapi.h', use='libav'),
|
2013-07-16 13:28:28 +02:00
|
|
|
} , {
|
|
|
|
'name': '--vda-hwaccel',
|
|
|
|
'desc': 'libavcodec VDA hwaccel',
|
|
|
|
'func': compose_checks(
|
|
|
|
check_headers('VideoDecodeAcceleration/VDADecoder.h'),
|
|
|
|
check_statement('libavcodec/vda.h',
|
2014-08-01 09:16:42 +02:00
|
|
|
'av_vda_alloc_context()',
|
2013-07-16 13:28:28 +02:00
|
|
|
framework='IOSurface',
|
|
|
|
use='libav')),
|
2013-11-13 21:59:11 +01:00
|
|
|
}, {
|
|
|
|
'name': '--vda-gl',
|
|
|
|
'desc': 'VDA with OpenGL',
|
|
|
|
'deps': [ 'gl-cocoa', 'vda-hwaccel' ],
|
2015-02-25 22:13:07 +01:00
|
|
|
'func': check_true
|
2013-07-16 13:28:28 +02:00
|
|
|
}, {
|
|
|
|
'name': '--vdpau-hwaccel',
|
2014-03-16 09:21:21 +01:00
|
|
|
'desc': 'libavcodec VDPAU hwaccel',
|
|
|
|
'deps': [ 'vdpau' ],
|
2015-03-05 17:10:00 +01:00
|
|
|
'func': check_statement('libavcodec/vdpau.h',
|
|
|
|
'av_vdpau_alloc_context()',
|
|
|
|
use='libav'),
|
2014-10-25 19:23:46 +02:00
|
|
|
}, {
|
|
|
|
'name': '--dxva2-hwaccel',
|
|
|
|
'desc': 'libavcodec DXVA2 hwaccel',
|
2015-03-11 23:40:54 +01:00
|
|
|
'deps': [ 'win32' ],
|
2015-03-06 11:01:53 +01:00
|
|
|
'func': check_headers('libavcodec/dxva2.h', use='libav'),
|
2013-07-16 13:28:28 +02:00
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
radio_and_tv_features = [
|
|
|
|
{
|
|
|
|
'name': '--tv',
|
|
|
|
'desc': 'TV interface',
|
|
|
|
'func': check_true,
|
2015-01-31 16:14:14 +01:00
|
|
|
}, {
|
|
|
|
'name': 'sys_videoio_h',
|
|
|
|
'desc': 'videoio.h',
|
|
|
|
'func': check_cc(header_name=['sys/time.h', 'sys/videoio.h'])
|
|
|
|
}, {
|
|
|
|
'name': 'videodev',
|
|
|
|
'desc': 'videodev2.h',
|
|
|
|
'func': check_cc(header_name=['sys/time.h', 'linux/videodev2.h']),
|
|
|
|
'deps_neg': [ 'sys_videoio_h' ],
|
2013-07-16 13:28:28 +02:00
|
|
|
}, {
|
|
|
|
'name': '--tv-v4l2',
|
|
|
|
'desc': 'Video4Linux2 TV interface',
|
2014-05-22 09:29:41 +02:00
|
|
|
'deps': [ 'tv' ],
|
2015-01-31 16:14:14 +01:00
|
|
|
'deps_any': [ 'sys_videoio_h', 'videodev' ],
|
|
|
|
'func': check_true,
|
2013-07-16 13:28:28 +02:00
|
|
|
}, {
|
|
|
|
'name': '--libv4l2',
|
|
|
|
'desc': 'libv4l2 support',
|
|
|
|
'func': check_pkg_config('libv4l2'),
|
2015-01-31 16:14:14 +01:00
|
|
|
'deps': [ 'tv-v4l2' ],
|
2013-07-16 13:28:28 +02:00
|
|
|
}, {
|
|
|
|
'name': '--pvr',
|
|
|
|
'desc': 'Video4Linux2 MPEG PVR interface',
|
2013-11-22 14:55:19 +01:00
|
|
|
'func': check_cc(fragment=load_fragment('pvr.c')),
|
2013-07-16 13:28:28 +02:00
|
|
|
}, {
|
|
|
|
'name': '--audio-input',
|
|
|
|
'desc': 'audio input support',
|
2014-04-13 18:51:43 +02:00
|
|
|
'deps_any': [ 'tv-v4l2' ],
|
2013-07-16 13:28:28 +02:00
|
|
|
'func': check_true
|
2014-11-28 15:54:52 +01:00
|
|
|
} , {
|
|
|
|
'name': '--dvbin',
|
|
|
|
'desc': 'DVB input module',
|
|
|
|
'func': check_cc(fragment=load_fragment('dvb.c')),
|
2013-07-16 13:28:28 +02:00
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2014-04-16 03:08:50 +02:00
|
|
|
standalone_features = [
|
|
|
|
{
|
|
|
|
'name': 'win32-executable',
|
|
|
|
'desc': 'w32 executable',
|
|
|
|
'deps_any': [ 'os-win32', 'os-cygwin'],
|
|
|
|
'func': check_ctx_vars('WINDRES')
|
|
|
|
}, {
|
|
|
|
'name': 'cocoa-application',
|
|
|
|
'desc': 'standalone Cocoa application',
|
|
|
|
'deps': [ 'cocoa' ],
|
|
|
|
'deps_neg': [ 'libmpv-shared', 'libmpv-static' ],
|
|
|
|
'func': check_true
|
2014-10-17 17:07:01 +02:00
|
|
|
}, {
|
|
|
|
'name': '--apple-remote',
|
|
|
|
'desc': 'Apple Remote support',
|
|
|
|
'deps': [ 'cocoa' ],
|
|
|
|
'func': check_true
|
2014-04-16 03:08:50 +02:00
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2013-07-16 13:28:28 +02:00
|
|
|
_INSTALL_DIRS_LIST = [
|
|
|
|
('bindir', '${PREFIX}/bin', 'binary files'),
|
|
|
|
('libdir', '${PREFIX}/lib', 'library files'),
|
|
|
|
('confdir', '${PREFIX}/etc/mpv', 'configuration files'),
|
|
|
|
|
2014-02-10 21:25:22 +01:00
|
|
|
('incdir', '${PREFIX}/include', 'include files'),
|
|
|
|
|
2013-07-16 13:28:28 +02:00
|
|
|
('datadir', '${PREFIX}/share', 'data files'),
|
|
|
|
('mandir', '${DATADIR}/man', 'man pages '),
|
|
|
|
('docdir', '${DATADIR}/doc/mpv', 'documentation files'),
|
2014-10-10 19:58:41 +02:00
|
|
|
('zshdir', '${DATADIR}/zsh/site-functions', 'zsh completion functions'),
|
2013-07-16 13:28:28 +02: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 10:44:21 +02:00
|
|
|
group.add_option('--variant',
|
|
|
|
default = '',
|
|
|
|
help = 'variant name for saving configuration and build results')
|
|
|
|
|
2013-07-16 13:28:28 +02:00
|
|
|
opt.parse_features('build and install options', build_options)
|
|
|
|
optional_features = main_dependencies + libav_dependencies
|
2014-11-28 15:40:55 +01:00
|
|
|
opt.parse_features('optional features', optional_features)
|
2013-07-16 13:28:28 +02: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 18:51:43 +02:00
|
|
|
opt.parse_features('tv features', radio_and_tv_features)
|
2014-04-16 03:08:50 +02:00
|
|
|
opt.parse_features('standalone app', standalone_features)
|
2013-07-16 13:28:28 +02:00
|
|
|
|
2014-11-28 15:40:55 +01:00
|
|
|
group = opt.get_option_group("optional features")
|
2013-07-16 13:28:28 +02:00
|
|
|
group.add_option('--lua',
|
|
|
|
type = 'string',
|
|
|
|
dest = 'LUA_VER',
|
2014-01-14 23:49:26 +01:00
|
|
|
help = "select Lua package which should be autodetected. Choices: 51 51deb 51fbsd 52 52deb 52fbsd luajit")
|
2013-07-16 13:28:28 +02:00
|
|
|
|
2014-07-19 18:45:43 +02:00
|
|
|
@conf
|
|
|
|
def is_optimization(ctx):
|
|
|
|
return getattr(ctx.options, 'enable_optimize')
|
|
|
|
|
2013-07-16 13:28:28 +02:00
|
|
|
@conf
|
|
|
|
def is_debug_build(ctx):
|
|
|
|
return getattr(ctx.options, 'enable_debug-build')
|
|
|
|
|
|
|
|
def configure(ctx):
|
2014-08-04 10:44:21 +02:00
|
|
|
ctx.resetenv(ctx.options.variant)
|
2014-12-04 21:55:00 +01:00
|
|
|
ctx.check_waf_version(mini='1.8.4')
|
2013-07-16 13:28:28 +02:00
|
|
|
target = os.environ.get('TARGET')
|
2014-11-01 00:20:10 +01:00
|
|
|
(cc, pkg_config, ar, windres) = ('cc', 'pkg-config', 'ar', 'windres')
|
2013-07-16 13:28:28 +02:00
|
|
|
|
|
|
|
if target:
|
|
|
|
cc = '-'.join([target, 'gcc'])
|
|
|
|
pkg_config = '-'.join([target, pkg_config])
|
2014-11-01 00:20:10 +01:00
|
|
|
ar = '-'.join([target, ar])
|
2013-07-16 13:28:28 +02:00
|
|
|
windres = '-'.join([target, windres])
|
|
|
|
|
|
|
|
ctx.find_program(cc, var='CC')
|
|
|
|
ctx.find_program(pkg_config, var='PKG_CONFIG')
|
2014-11-01 00:20:10 +01:00
|
|
|
ctx.find_program(ar, var='AR')
|
2013-07-16 13:28:28 +02:00
|
|
|
ctx.find_program('perl', var='BIN_PERL')
|
|
|
|
ctx.find_program('rst2man', var='RST2MAN', mandatory=False)
|
2014-01-08 16:00:40 +01:00
|
|
|
ctx.find_program('rst2pdf', var='RST2PDF', mandatory=False)
|
2013-07-16 13:28:28 +02:00
|
|
|
ctx.find_program(windres, var='WINDRES', mandatory=False)
|
|
|
|
|
|
|
|
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.load('compiler_c')
|
|
|
|
ctx.load('waf_customizations')
|
|
|
|
ctx.load('dependencies')
|
|
|
|
ctx.load('detections.compiler')
|
|
|
|
ctx.load('detections.devices')
|
|
|
|
|
|
|
|
ctx.parse_dependencies(build_options)
|
|
|
|
ctx.parse_dependencies(main_dependencies)
|
|
|
|
ctx.parse_dependencies(audio_output_features)
|
|
|
|
ctx.parse_dependencies(video_output_features)
|
|
|
|
ctx.parse_dependencies(libav_dependencies)
|
|
|
|
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 03:08:50 +02:00
|
|
|
ctx.parse_dependencies(standalone_features)
|
2013-07-16 13:28:28 +02:00
|
|
|
|
2013-11-29 09:01:14 +01:00
|
|
|
ctx.define('HAVE_SYS_SOUNDCARD_H',
|
|
|
|
'(HAVE_OSS_AUDIO_NATIVE || HAVE_OSS_AUDIO_4FRONT)',
|
|
|
|
quote=False)
|
|
|
|
|
|
|
|
ctx.define('HAVE_SOUNDCARD_H',
|
|
|
|
'HAVE_OSS_AUDIO_SUNAUDIO',
|
|
|
|
quote=False)
|
|
|
|
|
2013-07-16 13:28:28 +02:00
|
|
|
ctx.load('generators.headers')
|
|
|
|
|
|
|
|
if not ctx.dependency_satisfied('build-date'):
|
|
|
|
ctx.env.CFLAGS += ['-DNO_BUILD_TIMESTAMPS']
|
|
|
|
|
2015-02-05 21:00:23 +01:00
|
|
|
if ctx.dependency_satisfied('clang-database'):
|
|
|
|
ctx.load('clang_compilation_database')
|
|
|
|
|
2013-11-24 14:22:45 +01:00
|
|
|
ctx.store_dependencies_lists()
|
|
|
|
|
2013-07-16 13:28:28 +02:00
|
|
|
def build(ctx):
|
2014-08-04 10:44:21 +02: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 14:22:45 +01:00
|
|
|
ctx.unpack_dependencies_lists()
|
2013-07-16 13:28:28 +02:00
|
|
|
ctx.load('wscript_build')
|
2014-08-04 10:44:21 +02: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)
|