summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Ekström <jeebjp@gmail.com>2018-04-15 03:16:36 +0300
committerJan Ekström <jeebjp@gmail.com>2018-04-15 14:09:50 +0300
commit46d2f1f08d8919155ae6455ae2c3a17b262a63f7 (patch)
tree618d21ae3b1cada7977beeeab26edb3b2c36598c
parent9de51b6032b5a1ee14fc85017ea9f77f612c7704 (diff)
downloadmpv-46d2f1f08d8919155ae6455ae2c3a17b262a63f7.tar.bz2
mpv-46d2f1f08d8919155ae6455ae2c3a17b262a63f7.tar.xz
build: fixup vendored wayland protocols with variants
Utilize the SRC variable for this to get a built-in relative path. Can be tested by adding `--variant="random_string"` to configure and build.
-rw-r--r--waftools/generators/sources.py27
-rw-r--r--wscript_build.py14
2 files changed, 31 insertions, 10 deletions
diff --git a/waftools/generators/sources.py b/waftools/generators/sources.py
index 0b83432bc1..5bde478a34 100644
--- a/waftools/generators/sources.py
+++ b/waftools/generators/sources.py
@@ -9,8 +9,11 @@ def __zshcomp_cmd__(ctx, argument):
return '"${{BIN_PERL}}" "{0}/TOOLS/zsh.pl" "{1}" > "${{TGT}}"' \
.format(ctx.srcnode.abspath(), argument)
-def __wayland_scanner_cmd__(ctx, mode, dir, src):
- return "${{WAYSCAN}} {0} < {1}/{2} > ${{TGT}}".format(mode, dir, src)
+def __wayland_scanner_cmd__(ctx, mode, dir, src, vendored_file):
+ return "${{WAYSCAN}} {0} < {1} > ${{TGT}}".format(
+ mode,
+ "${SRC}" if vendored_file else "{}/{}".format(dir, src)
+ )
def __file2string__(ctx, **kwargs):
ctx(
@@ -55,17 +58,33 @@ def __zshcomp__(ctx, **kwargs):
)
def __wayland_protocol_code__(ctx, **kwargs):
+ protocol_is_vendored = kwargs.get("vendored_protocol", False)
+ file_name = kwargs['protocol'] + '.xml'
+
+ if protocol_is_vendored:
+ del kwargs['vendored_protocol']
+ kwargs['source'] = '{}/{}'.format(kwargs['proto_dir'], file_name)
+
ctx(
rule = __wayland_scanner_cmd__(ctx, 'code', kwargs['proto_dir'],
- kwargs['protocol'] + '.xml'),
+ file_name,
+ protocol_is_vendored),
name = os.path.basename(kwargs['target']),
**kwargs
)
def __wayland_protocol_header__(ctx, **kwargs):
+ protocol_is_vendored = kwargs.get("vendored_protocol", False)
+ file_name = kwargs['protocol'] + '.xml'
+
+ if protocol_is_vendored:
+ del kwargs['vendored_protocol']
+ kwargs['source'] = '{}/{}'.format(kwargs['proto_dir'], file_name)
+
ctx(
rule = __wayland_scanner_cmd__(ctx, 'client-header', kwargs['proto_dir'],
- kwargs['protocol'] + '.xml'),
+ file_name,
+ protocol_is_vendored),
before = ('c',),
name = os.path.basename(kwargs['target']),
**kwargs
diff --git a/wscript_build.py b/wscript_build.py
index efccc97af6..cd2c9d099f 100644
--- a/wscript_build.py
+++ b/wscript_build.py
@@ -129,12 +129,14 @@ def build(ctx):
ctx.wayland_protocol_header(proto_dir = ctx.env.WL_PROTO_DIR,
protocol = "unstable/idle-inhibit/idle-inhibit-unstable-v1",
target = "video/out/wayland/idle-inhibit-v1.h")
- ctx.wayland_protocol_code(proto_dir = "../video/out/wayland",
- protocol = "server-decoration",
- target = "video/out/wayland/srv-decor.c")
- ctx.wayland_protocol_header(proto_dir = "../video/out/wayland",
- protocol = "server-decoration",
- target = "video/out/wayland/srv-decor.h")
+ ctx.wayland_protocol_code(proto_dir = "video/out/wayland",
+ protocol = "server-decoration",
+ vendored_protocol = True,
+ target = "video/out/wayland/srv-decor.c")
+ ctx.wayland_protocol_header(proto_dir = "video/out/wayland",
+ protocol = "server-decoration",
+ vendored_protocol = True,
+ target = "video/out/wayland/srv-decor.h")
ctx(features = "ebml_header", target = "ebml_types.h")
ctx(features = "ebml_definitions", target = "ebml_defs.c")