2015-07-26 13:00:47 +00:00
|
|
|
from waftools import inflector
|
2013-07-16 11:28:28 +00:00
|
|
|
from waftools.checks.generic import *
|
2013-11-29 08:01:14 +00:00
|
|
|
from waflib import Utils
|
2018-11-24 11:49:55 +00:00
|
|
|
from distutils.version import StrictVersion
|
2013-11-29 08:01:14 +00:00
|
|
|
import os
|
2013-07-16 11:28:28 +00:00
|
|
|
|
2017-06-22 08:30:11 +00:00
|
|
|
__all__ = ["check_pthreads", "check_iconv", "check_lua",
|
2020-04-18 18:38:52 +00:00
|
|
|
"check_cocoa", "check_wl_protocols", "check_swift",
|
2022-01-23 05:06:26 +00:00
|
|
|
"check_egl_provider", "check_platform"]
|
2013-07-16 11:28:28 +00:00
|
|
|
|
|
|
|
pthreads_program = load_fragment('pthreads.c')
|
|
|
|
|
2014-04-27 07:05:07 +00:00
|
|
|
def check_pthread_flag(ctx, dependency_identifier):
|
|
|
|
checks = [
|
|
|
|
check_cc(fragment = pthreads_program, cflags = '-pthread'),
|
|
|
|
check_cc(fragment = pthreads_program, cflags = '-pthread',
|
|
|
|
linkflags = '-pthread') ]
|
|
|
|
|
|
|
|
for fn in checks:
|
|
|
|
if fn(ctx, dependency_identifier):
|
|
|
|
return True
|
|
|
|
return False
|
|
|
|
|
2013-07-16 11:28:28 +00:00
|
|
|
def check_pthreads(ctx, dependency_identifier):
|
2015-01-01 14:10:42 +00:00
|
|
|
if ctx.dependency_satisfied('win32-internal-pthreads'):
|
|
|
|
h = ctx.path.find_node('osdep/win32/include').abspath()
|
|
|
|
# define IN_WINPTHREAD to workaround mingw stupidity (we never want it
|
|
|
|
# to define features specific to its own pthread stuff)
|
2015-01-07 20:33:14 +00:00
|
|
|
ctx.env.CFLAGS += ['-isystem', h, '-I', h, '-DIN_WINPTHREAD']
|
2015-01-01 14:10:42 +00:00
|
|
|
return True
|
2014-04-27 07:05:07 +00:00
|
|
|
if check_pthread_flag(ctx, dependency_identifier):
|
|
|
|
return True
|
2013-07-16 11:28:28 +00:00
|
|
|
platform_cflags = {
|
|
|
|
'linux': '-D_REENTRANT',
|
|
|
|
'freebsd': '-D_THREAD_SAFE',
|
|
|
|
'netbsd': '-D_THREAD_SAFE',
|
|
|
|
'openbsd': '-D_THREAD_SAFE',
|
|
|
|
}.get(ctx.env.DEST_OS, '')
|
|
|
|
libs = ['pthreadGC2', 'pthread']
|
|
|
|
checkfn = check_cc(fragment=pthreads_program, cflags=platform_cflags)
|
2013-11-26 13:16:29 +00:00
|
|
|
checkfn_nocflags = check_cc(fragment=pthreads_program)
|
|
|
|
for fn in [checkfn, checkfn_nocflags]:
|
|
|
|
if check_libs(libs, fn)(ctx, dependency_identifier):
|
|
|
|
return True
|
|
|
|
return False
|
2013-07-16 11:28:28 +00:00
|
|
|
|
|
|
|
def check_iconv(ctx, dependency_identifier):
|
|
|
|
iconv_program = load_fragment('iconv.c')
|
|
|
|
libdliconv = " ".join(ctx.env.LIB_LIBDL + ['iconv'])
|
|
|
|
libs = ['iconv', libdliconv]
|
2016-02-01 17:30:22 +00:00
|
|
|
args = {'fragment': iconv_program}
|
2016-05-10 21:00:01 +00:00
|
|
|
if ctx.env.DEST_OS == 'openbsd' or ctx.env.DEST_OS == 'freebsd':
|
2016-02-01 17:30:22 +00:00
|
|
|
args['cflags'] = '-I/usr/local/include'
|
|
|
|
args['linkflags'] = '-L/usr/local/lib'
|
2017-01-28 10:31:28 +00:00
|
|
|
elif ctx.env.DEST_OS == 'win32':
|
|
|
|
args['linkflags'] = " ".join(['-L' + x for x in ctx.env.LIBRARY_PATH])
|
2016-02-01 17:30:22 +00:00
|
|
|
checkfn = check_cc(**args)
|
2013-07-16 11:28:28 +00:00
|
|
|
return check_libs(libs, checkfn)(ctx, dependency_identifier)
|
|
|
|
|
|
|
|
def check_lua(ctx, dependency_identifier):
|
build: lua 5.1/5.2: use generic version names
TL;DR: use --lua=XXX for pkg-config name XXX, e.g. --lua=lua-5.1 .
For unversioned 'lua.pc', use the name luadef51/luadef52 .
Autodetection remains the same (5.2 names, luajit, 5.1 names).
The old names are still supported, but not auto-detected.
Before this patch, if one wanted to choose a specific lua version when
more than one is installed, then the names were a mess, e.g. 51obsd is
also the name detected on Arch linux, and other (distro) names are
also not unique to a specific distro/platform.
So to ask mpv to choose the package name (specifically, the pkg-config
file name), one needs to look at the mpv sources and find the
(arbitrary) distro name which has the same lua version naming as they
do on their own system, e.g. --lua=51obsd on Arch. This is a pain.
Now we add generic names:
- luadef51/luadef52 - generic pkg-config lua.pc (version is inside).
- lua* - exactly the pkg-config name, e.g. --lua=lua-51 for lua-51.pc
(the names are curated, e.g. --lua=foo won't detect foo.pc).
- The legacy names (e.g. 51deb) are still supported, but undocumented,
and the new generic names take precedence during auto-detection.
The fact that the generic names all start with "lua" has an additional
benefit that it shows right after "lua" at the output of mpv -v,
while the old names start with numbers, so they're first at the list,
making it hard to understand that e.g. "51obsd" is the lua version.
None of these names are actually used at the mpv code. The C code
checks the version using the lua headers (LUA_VERSION_NUM).
2021-09-25 14:51:19 +00:00
|
|
|
# mainline lua 5.1/5.2 doesn't have a .pc file, so each distro chooses
|
|
|
|
# a different name, either non-versioned (lua.pc) or lua5x/lua5.x/lua-5.x
|
|
|
|
# and we need to check them all. luadef* are the non-versioned .pc files,
|
|
|
|
# and the rest represent the .pc file exactly e.g. --lua=lua-5.1
|
|
|
|
# The non lua* names are legacy in mpv configure, and kept for compat.
|
2013-07-16 11:28:28 +00:00
|
|
|
lua_versions = [
|
build: lua 5.1/5.2: use generic version names
TL;DR: use --lua=XXX for pkg-config name XXX, e.g. --lua=lua-5.1 .
For unversioned 'lua.pc', use the name luadef51/luadef52 .
Autodetection remains the same (5.2 names, luajit, 5.1 names).
The old names are still supported, but not auto-detected.
Before this patch, if one wanted to choose a specific lua version when
more than one is installed, then the names were a mess, e.g. 51obsd is
also the name detected on Arch linux, and other (distro) names are
also not unique to a specific distro/platform.
So to ask mpv to choose the package name (specifically, the pkg-config
file name), one needs to look at the mpv sources and find the
(arbitrary) distro name which has the same lua version naming as they
do on their own system, e.g. --lua=51obsd on Arch. This is a pain.
Now we add generic names:
- luadef51/luadef52 - generic pkg-config lua.pc (version is inside).
- lua* - exactly the pkg-config name, e.g. --lua=lua-51 for lua-51.pc
(the names are curated, e.g. --lua=foo won't detect foo.pc).
- The legacy names (e.g. 51deb) are still supported, but undocumented,
and the new generic names take precedence during auto-detection.
The fact that the generic names all start with "lua" has an additional
benefit that it shows right after "lua" at the output of mpv -v,
while the old names start with numbers, so they're first at the list,
making it hard to understand that e.g. "51obsd" is the lua version.
None of these names are actually used at the mpv code. The C code
checks the version using the lua headers (LUA_VERSION_NUM).
2021-09-25 14:51:19 +00:00
|
|
|
( 'luadef52','lua >= 5.2.0 lua < 5.3.0' ), # package "lua"
|
2015-04-01 21:59:09 +00:00
|
|
|
( '52', 'lua >= 5.2.0 lua < 5.3.0' ),
|
build: lua 5.1/5.2: use generic version names
TL;DR: use --lua=XXX for pkg-config name XXX, e.g. --lua=lua-5.1 .
For unversioned 'lua.pc', use the name luadef51/luadef52 .
Autodetection remains the same (5.2 names, luajit, 5.1 names).
The old names are still supported, but not auto-detected.
Before this patch, if one wanted to choose a specific lua version when
more than one is installed, then the names were a mess, e.g. 51obsd is
also the name detected on Arch linux, and other (distro) names are
also not unique to a specific distro/platform.
So to ask mpv to choose the package name (specifically, the pkg-config
file name), one needs to look at the mpv sources and find the
(arbitrary) distro name which has the same lua version naming as they
do on their own system, e.g. --lua=51obsd on Arch. This is a pain.
Now we add generic names:
- luadef51/luadef52 - generic pkg-config lua.pc (version is inside).
- lua* - exactly the pkg-config name, e.g. --lua=lua-51 for lua-51.pc
(the names are curated, e.g. --lua=foo won't detect foo.pc).
- The legacy names (e.g. 51deb) are still supported, but undocumented,
and the new generic names take precedence during auto-detection.
The fact that the generic names all start with "lua" has an additional
benefit that it shows right after "lua" at the output of mpv -v,
while the old names start with numbers, so they're first at the list,
making it hard to understand that e.g. "51obsd" is the lua version.
None of these names are actually used at the mpv code. The C code
checks the version using the lua headers (LUA_VERSION_NUM).
2021-09-25 14:51:19 +00:00
|
|
|
( 'lua52', 'lua52 >= 5.2.0'),
|
2015-05-13 12:54:58 +00:00
|
|
|
( '52arch', 'lua52 >= 5.2.0'), # Arch
|
build: lua 5.1/5.2: use generic version names
TL;DR: use --lua=XXX for pkg-config name XXX, e.g. --lua=lua-5.1 .
For unversioned 'lua.pc', use the name luadef51/luadef52 .
Autodetection remains the same (5.2 names, luajit, 5.1 names).
The old names are still supported, but not auto-detected.
Before this patch, if one wanted to choose a specific lua version when
more than one is installed, then the names were a mess, e.g. 51obsd is
also the name detected on Arch linux, and other (distro) names are
also not unique to a specific distro/platform.
So to ask mpv to choose the package name (specifically, the pkg-config
file name), one needs to look at the mpv sources and find the
(arbitrary) distro name which has the same lua version naming as they
do on their own system, e.g. --lua=51obsd on Arch. This is a pain.
Now we add generic names:
- luadef51/luadef52 - generic pkg-config lua.pc (version is inside).
- lua* - exactly the pkg-config name, e.g. --lua=lua-51 for lua-51.pc
(the names are curated, e.g. --lua=foo won't detect foo.pc).
- The legacy names (e.g. 51deb) are still supported, but undocumented,
and the new generic names take precedence during auto-detection.
The fact that the generic names all start with "lua" has an additional
benefit that it shows right after "lua" at the output of mpv -v,
while the old names start with numbers, so they're first at the list,
making it hard to understand that e.g. "51obsd" is the lua version.
None of these names are actually used at the mpv code. The C code
checks the version using the lua headers (LUA_VERSION_NUM).
2021-09-25 14:51:19 +00:00
|
|
|
( 'lua5.2', 'lua5.2 >= 5.2.0'),
|
2013-07-16 11:28:28 +00:00
|
|
|
( '52deb', 'lua5.2 >= 5.2.0'), # debian
|
build: lua 5.1/5.2: use generic version names
TL;DR: use --lua=XXX for pkg-config name XXX, e.g. --lua=lua-5.1 .
For unversioned 'lua.pc', use the name luadef51/luadef52 .
Autodetection remains the same (5.2 names, luajit, 5.1 names).
The old names are still supported, but not auto-detected.
Before this patch, if one wanted to choose a specific lua version when
more than one is installed, then the names were a mess, e.g. 51obsd is
also the name detected on Arch linux, and other (distro) names are
also not unique to a specific distro/platform.
So to ask mpv to choose the package name (specifically, the pkg-config
file name), one needs to look at the mpv sources and find the
(arbitrary) distro name which has the same lua version naming as they
do on their own system, e.g. --lua=51obsd on Arch. This is a pain.
Now we add generic names:
- luadef51/luadef52 - generic pkg-config lua.pc (version is inside).
- lua* - exactly the pkg-config name, e.g. --lua=lua-51 for lua-51.pc
(the names are curated, e.g. --lua=foo won't detect foo.pc).
- The legacy names (e.g. 51deb) are still supported, but undocumented,
and the new generic names take precedence during auto-detection.
The fact that the generic names all start with "lua" has an additional
benefit that it shows right after "lua" at the output of mpv -v,
while the old names start with numbers, so they're first at the list,
making it hard to understand that e.g. "51obsd" is the lua version.
None of these names are actually used at the mpv code. The C code
checks the version using the lua headers (LUA_VERSION_NUM).
2021-09-25 14:51:19 +00:00
|
|
|
( 'lua-5.2','lua-5.2 >= 5.2.0'),
|
2014-01-14 22:49:26 +00:00
|
|
|
( '52fbsd', 'lua-5.2 >= 5.2.0'), # FreeBSD
|
2014-12-02 21:09:29 +00:00
|
|
|
( 'luajit', 'luajit >= 2.0.0' ),
|
build: lua 5.1/5.2: use generic version names
TL;DR: use --lua=XXX for pkg-config name XXX, e.g. --lua=lua-5.1 .
For unversioned 'lua.pc', use the name luadef51/luadef52 .
Autodetection remains the same (5.2 names, luajit, 5.1 names).
The old names are still supported, but not auto-detected.
Before this patch, if one wanted to choose a specific lua version when
more than one is installed, then the names were a mess, e.g. 51obsd is
also the name detected on Arch linux, and other (distro) names are
also not unique to a specific distro/platform.
So to ask mpv to choose the package name (specifically, the pkg-config
file name), one needs to look at the mpv sources and find the
(arbitrary) distro name which has the same lua version naming as they
do on their own system, e.g. --lua=51obsd on Arch. This is a pain.
Now we add generic names:
- luadef51/luadef52 - generic pkg-config lua.pc (version is inside).
- lua* - exactly the pkg-config name, e.g. --lua=lua-51 for lua-51.pc
(the names are curated, e.g. --lua=foo won't detect foo.pc).
- The legacy names (e.g. 51deb) are still supported, but undocumented,
and the new generic names take precedence during auto-detection.
The fact that the generic names all start with "lua" has an additional
benefit that it shows right after "lua" at the output of mpv -v,
while the old names start with numbers, so they're first at the list,
making it hard to understand that e.g. "51obsd" is the lua version.
None of these names are actually used at the mpv code. The C code
checks the version using the lua headers (LUA_VERSION_NUM).
2021-09-25 14:51:19 +00:00
|
|
|
( 'luadef51','lua >= 5.1.0 lua < 5.2.0'), # package "lua"
|
2020-02-29 19:11:13 +00:00
|
|
|
( '51', 'lua >= 5.1.0 lua < 5.2.0'),
|
build: lua 5.1/5.2: use generic version names
TL;DR: use --lua=XXX for pkg-config name XXX, e.g. --lua=lua-5.1 .
For unversioned 'lua.pc', use the name luadef51/luadef52 .
Autodetection remains the same (5.2 names, luajit, 5.1 names).
The old names are still supported, but not auto-detected.
Before this patch, if one wanted to choose a specific lua version when
more than one is installed, then the names were a mess, e.g. 51obsd is
also the name detected on Arch linux, and other (distro) names are
also not unique to a specific distro/platform.
So to ask mpv to choose the package name (specifically, the pkg-config
file name), one needs to look at the mpv sources and find the
(arbitrary) distro name which has the same lua version naming as they
do on their own system, e.g. --lua=51obsd on Arch. This is a pain.
Now we add generic names:
- luadef51/luadef52 - generic pkg-config lua.pc (version is inside).
- lua* - exactly the pkg-config name, e.g. --lua=lua-51 for lua-51.pc
(the names are curated, e.g. --lua=foo won't detect foo.pc).
- The legacy names (e.g. 51deb) are still supported, but undocumented,
and the new generic names take precedence during auto-detection.
The fact that the generic names all start with "lua" has an additional
benefit that it shows right after "lua" at the output of mpv -v,
while the old names start with numbers, so they're first at the list,
making it hard to understand that e.g. "51obsd" is the lua version.
None of these names are actually used at the mpv code. The C code
checks the version using the lua headers (LUA_VERSION_NUM).
2021-09-25 14:51:19 +00:00
|
|
|
( 'lua51', 'lua51 >= 5.1.0'),
|
2020-02-29 19:11:13 +00:00
|
|
|
( '51obsd', 'lua51 >= 5.1.0'), # OpenBSD
|
build: lua 5.1/5.2: use generic version names
TL;DR: use --lua=XXX for pkg-config name XXX, e.g. --lua=lua-5.1 .
For unversioned 'lua.pc', use the name luadef51/luadef52 .
Autodetection remains the same (5.2 names, luajit, 5.1 names).
The old names are still supported, but not auto-detected.
Before this patch, if one wanted to choose a specific lua version when
more than one is installed, then the names were a mess, e.g. 51obsd is
also the name detected on Arch linux, and other (distro) names are
also not unique to a specific distro/platform.
So to ask mpv to choose the package name (specifically, the pkg-config
file name), one needs to look at the mpv sources and find the
(arbitrary) distro name which has the same lua version naming as they
do on their own system, e.g. --lua=51obsd on Arch. This is a pain.
Now we add generic names:
- luadef51/luadef52 - generic pkg-config lua.pc (version is inside).
- lua* - exactly the pkg-config name, e.g. --lua=lua-51 for lua-51.pc
(the names are curated, e.g. --lua=foo won't detect foo.pc).
- The legacy names (e.g. 51deb) are still supported, but undocumented,
and the new generic names take precedence during auto-detection.
The fact that the generic names all start with "lua" has an additional
benefit that it shows right after "lua" at the output of mpv -v,
while the old names start with numbers, so they're first at the list,
making it hard to understand that e.g. "51obsd" is the lua version.
None of these names are actually used at the mpv code. The C code
checks the version using the lua headers (LUA_VERSION_NUM).
2021-09-25 14:51:19 +00:00
|
|
|
( 'lua5.1', 'lua5.1 >= 5.1.0'),
|
2020-02-29 19:11:13 +00:00
|
|
|
( '51deb', 'lua5.1 >= 5.1.0'), # debian
|
build: lua 5.1/5.2: use generic version names
TL;DR: use --lua=XXX for pkg-config name XXX, e.g. --lua=lua-5.1 .
For unversioned 'lua.pc', use the name luadef51/luadef52 .
Autodetection remains the same (5.2 names, luajit, 5.1 names).
The old names are still supported, but not auto-detected.
Before this patch, if one wanted to choose a specific lua version when
more than one is installed, then the names were a mess, e.g. 51obsd is
also the name detected on Arch linux, and other (distro) names are
also not unique to a specific distro/platform.
So to ask mpv to choose the package name (specifically, the pkg-config
file name), one needs to look at the mpv sources and find the
(arbitrary) distro name which has the same lua version naming as they
do on their own system, e.g. --lua=51obsd on Arch. This is a pain.
Now we add generic names:
- luadef51/luadef52 - generic pkg-config lua.pc (version is inside).
- lua* - exactly the pkg-config name, e.g. --lua=lua-51 for lua-51.pc
(the names are curated, e.g. --lua=foo won't detect foo.pc).
- The legacy names (e.g. 51deb) are still supported, but undocumented,
and the new generic names take precedence during auto-detection.
The fact that the generic names all start with "lua" has an additional
benefit that it shows right after "lua" at the output of mpv -v,
while the old names start with numbers, so they're first at the list,
making it hard to understand that e.g. "51obsd" is the lua version.
None of these names are actually used at the mpv code. The C code
checks the version using the lua headers (LUA_VERSION_NUM).
2021-09-25 14:51:19 +00:00
|
|
|
( 'lua-5.1','lua-5.1 >= 5.1.0'),
|
2020-02-29 19:11:13 +00:00
|
|
|
( '51fbsd', 'lua-5.1 >= 5.1.0'), # FreeBSD
|
2013-07-16 11:28:28 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
if ctx.options.LUA_VER:
|
|
|
|
lua_versions = \
|
|
|
|
[lv for lv in lua_versions if lv[0] == ctx.options.LUA_VER]
|
|
|
|
|
|
|
|
for lua_version, pkgconfig_query in lua_versions:
|
2021-09-25 18:21:13 +00:00
|
|
|
display_version = lua_version
|
|
|
|
lua_version = inflector.sanitize_id(lua_version)
|
2014-10-25 18:07:44 +00:00
|
|
|
if check_pkg_config(pkgconfig_query, uselib_store=lua_version) \
|
|
|
|
(ctx, dependency_identifier):
|
2013-07-16 11:28:28 +00:00
|
|
|
# XXX: this is a bit of a hack, ask waf developers if I can copy
|
|
|
|
# the uselib_store to 'lua'
|
|
|
|
ctx.mark_satisfied(lua_version)
|
|
|
|
ctx.add_optional_message(dependency_identifier,
|
2021-09-25 18:21:13 +00:00
|
|
|
'version found: ' + display_version)
|
2013-07-16 11:28:28 +00:00
|
|
|
return True
|
|
|
|
return False
|
|
|
|
|
2017-10-01 20:16:49 +00:00
|
|
|
def check_wl_protocols(ctx, dependency_identifier):
|
|
|
|
def fn(ctx, dependency_identifier):
|
2023-06-12 19:34:50 +00:00
|
|
|
ret = check_pkg_config_datadir("wayland-protocols", ">= 1.25")
|
2017-10-01 20:16:49 +00:00
|
|
|
ret = ret(ctx, dependency_identifier)
|
|
|
|
if ret != None:
|
|
|
|
ctx.env.WL_PROTO_DIR = ret.split()[0]
|
|
|
|
return ret
|
|
|
|
return fn(ctx, dependency_identifier)
|
|
|
|
|
2014-01-02 19:34:14 +00:00
|
|
|
def check_cocoa(ctx, dependency_identifier):
|
|
|
|
fn = check_cc(
|
|
|
|
fragment = load_fragment('cocoa.m'),
|
|
|
|
compile_filename = 'test.m',
|
2015-02-25 21:13:07 +00:00
|
|
|
framework_name = ['Cocoa', 'IOKit', 'OpenGL', 'QuartzCore'],
|
2018-10-27 19:15:31 +00:00
|
|
|
includes = [ctx.srcnode.abspath()],
|
2014-01-02 19:34:14 +00:00
|
|
|
linkflags = '-fobjc-arc')
|
|
|
|
|
2018-06-08 21:03:28 +00:00
|
|
|
res = fn(ctx, dependency_identifier)
|
|
|
|
if res and ctx.env.MACOS_SDK:
|
|
|
|
# on macOS we explicitly need to set the SDK path, otherwise it can lead
|
|
|
|
# to linking warnings or errors
|
|
|
|
ctx.env.append_value('LAST_LINKFLAGS', [
|
|
|
|
'-isysroot', ctx.env.MACOS_SDK,
|
|
|
|
'-L/usr/lib',
|
|
|
|
'-L/usr/local/lib'
|
|
|
|
])
|
|
|
|
|
|
|
|
return res
|
2018-07-08 14:49:33 +00:00
|
|
|
|
2020-12-25 13:47:35 +00:00
|
|
|
def check_swift(version):
|
|
|
|
def fn(ctx, dependency_identifier):
|
|
|
|
minVer = StrictVersion(version)
|
|
|
|
if ctx.env.SWIFT_VERSION:
|
|
|
|
if StrictVersion(ctx.env.SWIFT_VERSION) >= minVer:
|
|
|
|
ctx.add_optional_message(dependency_identifier,
|
|
|
|
'version found: ' + str(ctx.env.SWIFT_VERSION))
|
|
|
|
return True
|
|
|
|
ctx.add_optional_message(dependency_identifier,
|
|
|
|
"'swift >= " + str(minVer) + "' not found, found " +
|
|
|
|
str(ctx.env.SWIFT_VERSION or None))
|
|
|
|
return False
|
|
|
|
return fn
|
2020-04-18 18:38:52 +00:00
|
|
|
|
|
|
|
def check_egl_provider(minVersion=None, name='egl', check=None):
|
|
|
|
def fn(ctx, dependency_identifier, **kw):
|
|
|
|
if not hasattr(ctx, 'egl_provider'):
|
|
|
|
egl_provider_check = check or check_pkg_config(name)
|
|
|
|
if egl_provider_check(ctx, dependency_identifier):
|
|
|
|
ctx.egl_provider = name
|
|
|
|
for ver in ['1.5', '1.4', '1.3', '1.2', '1.1', '1.0']:
|
|
|
|
stmt = 'int x[EGL_VERSION_{0}]'.format(ver.replace('.','_'))
|
|
|
|
check_stmt = check_statement(['EGL/egl.h'], stmt)
|
|
|
|
if check_stmt(ctx, dependency_identifier):
|
|
|
|
ctx.egl_provider_version = StrictVersion(ver)
|
|
|
|
break
|
|
|
|
return True
|
|
|
|
else:
|
|
|
|
return False
|
|
|
|
else:
|
|
|
|
minVersionSV = minVersion and StrictVersion(minVersion)
|
|
|
|
if not minVersionSV or ctx.egl_provider_version and \
|
|
|
|
ctx.egl_provider_version >= minVersionSV:
|
|
|
|
defkey = inflector.define_key(dependency_identifier)
|
|
|
|
ctx.define(defkey, 1)
|
|
|
|
return True
|
|
|
|
else:
|
|
|
|
return False
|
|
|
|
return fn
|
2022-01-23 05:06:26 +00:00
|
|
|
|
|
|
|
# Strictly for matching the platform names to what
|
|
|
|
# the meson build calls them.
|
|
|
|
def check_platform(ctx):
|
|
|
|
if ctx.env.DEST_OS == "win32":
|
|
|
|
return "windows"
|
|
|
|
elif ctx.dependency_satisfied("android"):
|
|
|
|
return "android"
|
|
|
|
else:
|
|
|
|
return ctx.env.DEST_OS
|