mirror of
https://github.com/mpv-player/mpv
synced 2025-01-03 13:32:16 +00:00
build: add '--enable-libmpv-static' option
Signed-off-by: wm4 <wm4@nowhere>
This commit is contained in:
parent
ae1b1a68cb
commit
858d6d93cb
8
wscript
8
wscript
@ -14,10 +14,16 @@ build_options = [
|
||||
'desc': 'shared library',
|
||||
'default': 'disable',
|
||||
'func': check_true
|
||||
}, {
|
||||
'name': '--libmpv-static',
|
||||
'desc': 'static library',
|
||||
'default': 'disable',
|
||||
'deps_neg': [ 'libmpv-shared' ],
|
||||
'func': check_true
|
||||
}, {
|
||||
'name': '--client-api-examples',
|
||||
'desc': 'build client API examples',
|
||||
'deps': ['libmpv-shared'],
|
||||
'deps_any': [ 'libmpv-shared', 'libmpv-static' ],
|
||||
'func': check_true
|
||||
}, {
|
||||
'name': '--static-build',
|
||||
|
@ -439,7 +439,10 @@ def build(ctx):
|
||||
**cprog_kwargs
|
||||
)
|
||||
|
||||
if ctx.dependency_satisfied('libmpv-shared'):
|
||||
build_shared = ctx.dependency_satisfied('libmpv-shared')
|
||||
build_static = ctx.dependency_satisfied('libmpv-static')
|
||||
if build_shared or build_static:
|
||||
if build_shared:
|
||||
ctx.load("syms")
|
||||
vnum = int(re.search('^#define MPV_CLIENT_API_VERSION 0x(.*)UL$',
|
||||
ctx.path.find_node("libmpv/client.h").read(),
|
||||
@ -448,17 +451,28 @@ def build(ctx):
|
||||
libversion = (str(vnum >> 24) + '.' +
|
||||
str((vnum >> 16) & 0xff) + '.' +
|
||||
str(vnum & 0xffff))
|
||||
|
||||
def _build_libmpv(shared):
|
||||
features = "c "
|
||||
if shared:
|
||||
features += "cshlib syms"
|
||||
else:
|
||||
features += "cstlib"
|
||||
ctx(
|
||||
target = "mpv",
|
||||
source = ctx.filtered_sources(sources),
|
||||
use = ctx.dependencies_use(),
|
||||
includes = [ctx.bldnode.abspath(), ctx.srcnode.abspath()] + \
|
||||
ctx.dependencies_includes(),
|
||||
features = "c cshlib syms",
|
||||
features = features,
|
||||
export_symbols_regex = 'mpv_.*',
|
||||
install_path = ctx.env.LIBDIR,
|
||||
vnum = libversion,
|
||||
)
|
||||
if build_shared:
|
||||
_build_libmpv(True)
|
||||
if build_static:
|
||||
_build_libmpv(False)
|
||||
|
||||
ctx(
|
||||
target = 'libmpv/mpv.pc',
|
||||
|
Loading…
Reference in New Issue
Block a user