mirror of https://github.com/mpv-player/mpv
build: automagically extract client library version
This reads MPV_CLIENT_API_VERSION from the source header, and turns it into a 3 part version number. E.g. if MPV_CLIENT_API_VERSION were 0x12abcdef, this would result in "18.171.773615" (8 bits, 8 bits, 16 bits). We'll see if this is actually useful, or if it's too clever.
This commit is contained in:
parent
40855d6c12
commit
14c1816c71
|
@ -1,3 +1,5 @@
|
||||||
|
import re
|
||||||
|
|
||||||
def _add_rst_manual_dependencies(ctx):
|
def _add_rst_manual_dependencies(ctx):
|
||||||
manpage_sources_basenames = """
|
manpage_sources_basenames = """
|
||||||
options.rst ao.rst vo.rst af.rst vf.rst encode.rst
|
options.rst ao.rst vo.rst af.rst vf.rst encode.rst
|
||||||
|
@ -440,6 +442,13 @@ def build(ctx):
|
||||||
|
|
||||||
if ctx.dependency_satisfied('libmpv-shared'):
|
if ctx.dependency_satisfied('libmpv-shared'):
|
||||||
ctx.load("syms")
|
ctx.load("syms")
|
||||||
|
vnum = int(re.search('^#define MPV_CLIENT_API_VERSION 0x(.*)UL$',
|
||||||
|
ctx.path.find_node("libmpv/client.h").read(),
|
||||||
|
re.M)
|
||||||
|
.group(1), 16)
|
||||||
|
libversion = (str(vnum >> 24) + '.' +
|
||||||
|
str((vnum >> 16) & 0xff) + '.' +
|
||||||
|
str(vnum & 0xffff))
|
||||||
ctx(
|
ctx(
|
||||||
target = "mpv",
|
target = "mpv",
|
||||||
source = ctx.filtered_sources(sources),
|
source = ctx.filtered_sources(sources),
|
||||||
|
@ -449,7 +458,7 @@ def build(ctx):
|
||||||
features = "c cshlib syms",
|
features = "c cshlib syms",
|
||||||
export_symbols_regex = 'mpv_.*',
|
export_symbols_regex = 'mpv_.*',
|
||||||
install_path = ctx.env.LIBDIR,
|
install_path = ctx.env.LIBDIR,
|
||||||
vnum = "0.0.0",
|
vnum = libversion,
|
||||||
)
|
)
|
||||||
|
|
||||||
ctx(
|
ctx(
|
||||||
|
@ -459,7 +468,7 @@ def build(ctx):
|
||||||
PREFIX = ctx.env.PREFIX,
|
PREFIX = ctx.env.PREFIX,
|
||||||
LIBDIR = ctx.env.LIBDIR,
|
LIBDIR = ctx.env.LIBDIR,
|
||||||
INCDIR = ctx.env.INCDIR,
|
INCDIR = ctx.env.INCDIR,
|
||||||
VERSION = ctx.env.VERSION,
|
VERSION = libversion,
|
||||||
)
|
)
|
||||||
|
|
||||||
headers = ["client.h"]
|
headers = ["client.h"]
|
||||||
|
|
Loading…
Reference in New Issue