mirror of
https://github.com/mpv-player/mpv
synced 2025-04-18 21:27:00 +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',
|
'desc': 'shared library',
|
||||||
'default': 'disable',
|
'default': 'disable',
|
||||||
'func': check_true
|
'func': check_true
|
||||||
|
}, {
|
||||||
|
'name': '--libmpv-static',
|
||||||
|
'desc': 'static library',
|
||||||
|
'default': 'disable',
|
||||||
|
'deps_neg': [ 'libmpv-shared' ],
|
||||||
|
'func': check_true
|
||||||
}, {
|
}, {
|
||||||
'name': '--client-api-examples',
|
'name': '--client-api-examples',
|
||||||
'desc': 'build client API examples',
|
'desc': 'build client API examples',
|
||||||
'deps': ['libmpv-shared'],
|
'deps_any': [ 'libmpv-shared', 'libmpv-static' ],
|
||||||
'func': check_true
|
'func': check_true
|
||||||
}, {
|
}, {
|
||||||
'name': '--static-build',
|
'name': '--static-build',
|
||||||
|
@ -439,8 +439,11 @@ def build(ctx):
|
|||||||
**cprog_kwargs
|
**cprog_kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
if ctx.dependency_satisfied('libmpv-shared'):
|
build_shared = ctx.dependency_satisfied('libmpv-shared')
|
||||||
ctx.load("syms")
|
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$',
|
vnum = int(re.search('^#define MPV_CLIENT_API_VERSION 0x(.*)UL$',
|
||||||
ctx.path.find_node("libmpv/client.h").read(),
|
ctx.path.find_node("libmpv/client.h").read(),
|
||||||
re.M)
|
re.M)
|
||||||
@ -448,17 +451,28 @@ def build(ctx):
|
|||||||
libversion = (str(vnum >> 24) + '.' +
|
libversion = (str(vnum >> 24) + '.' +
|
||||||
str((vnum >> 16) & 0xff) + '.' +
|
str((vnum >> 16) & 0xff) + '.' +
|
||||||
str(vnum & 0xffff))
|
str(vnum & 0xffff))
|
||||||
ctx(
|
|
||||||
target = "mpv",
|
def _build_libmpv(shared):
|
||||||
source = ctx.filtered_sources(sources),
|
features = "c "
|
||||||
use = ctx.dependencies_use(),
|
if shared:
|
||||||
includes = [ctx.bldnode.abspath(), ctx.srcnode.abspath()] + \
|
features += "cshlib syms"
|
||||||
ctx.dependencies_includes(),
|
else:
|
||||||
features = "c cshlib syms",
|
features += "cstlib"
|
||||||
export_symbols_regex = 'mpv_.*',
|
ctx(
|
||||||
install_path = ctx.env.LIBDIR,
|
target = "mpv",
|
||||||
vnum = libversion,
|
source = ctx.filtered_sources(sources),
|
||||||
)
|
use = ctx.dependencies_use(),
|
||||||
|
includes = [ctx.bldnode.abspath(), ctx.srcnode.abspath()] + \
|
||||||
|
ctx.dependencies_includes(),
|
||||||
|
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(
|
ctx(
|
||||||
target = 'libmpv/mpv.pc',
|
target = 'libmpv/mpv.pc',
|
||||||
|
Loading…
Reference in New Issue
Block a user