commit: 71e6699d92b216d83f39c6b99ad97f6ee74cc69f
parent a9a4415ee61ed549c46742238fb930e3760edae3
Author: Michael Forney <mforney@mforney.org>
Date: Thu, 19 Sep 2019 20:40:57 -0700
Use table to control waylandproto outputs
Diffstat:
5 files changed, 31 insertions(+), 23 deletions(-)
diff --git a/ninja.lua b/ninja.lua
@@ -359,16 +359,16 @@ function yacc(name, gram)
})
end
-function waylandproto(proto, client, server, code, args)
+function waylandproto(proto, outs, args)
proto = '$srcdir/'..proto
- code = '$outdir/'..code
- if client then
- build('waylandproto', '$outdir/'..client, proto, {type='client-header'})
+ if outs.client then
+ build('waylandproto', '$outdir/'..outs.client, proto, {type='client-header'})
end
- if server then
- build('waylandproto', '$outdir/'..server, proto, {type='server-header'})
+ if outs.server then
+ build('waylandproto', '$outdir/'..outs.server, proto, {type='server-header'})
end
- if code then
+ if outs.code then
+ local code = '$outdir/'..outs.code
build('waylandproto', code, proto, {type='code'})
cc(code, {'pkg/wayland/headers'}, args)
end
diff --git a/pkg/mpv/gen.lua b/pkg/mpv/gen.lua
@@ -36,7 +36,10 @@ pkg.deps = {
build('copy', '$outdir/video/out/wayland/xdg-shell.h', '$builddir/pkg/wayland-protocols/include/xdg-shell-client-protocol.h')
build('copy', '$outdir/video/out/wayland/idle-inhibit-v1.h', '$builddir/pkg/wayland-protocols/include/idle-inhibit-unstable-v1-client-protocol.h')
-waylandproto('video/out/wayland/server-decoration.xml', 'video/out/wayland/srv-decor.h', nil, 'video/out/wayland/srv-decor.c')
+waylandproto('video/out/wayland/server-decoration.xml', {
+ client='video/out/wayland/srv-decor.h',
+ code='video/out/wayland/srv-decor.c',
+})
rule('file2string', '$outdir/file2string $in >$out.tmp && mv $out.tmp $out')
local function file2string(out, inp)
diff --git a/pkg/swc/gen.lua b/pkg/swc/gen.lua
@@ -18,7 +18,11 @@ cflags{
cc('launch/protocol.c')
-waylandproto('protocol/swc.xml', 'include/swc-client-protocol.h', 'include/swc-server-protocol.h', 'swc-protocol.c')
+waylandproto('protocol/swc.xml', {
+ client='include/swc-client-protocol.h',
+ server='include/swc-server-protocol.h',
+ code='swc-protocol.c',
+})
pkg.hdrs = {
copy('$outdir/include', '$srcdir/libswc', {'swc.h'}),
diff --git a/pkg/velox/gen.lua b/pkg/velox/gen.lua
@@ -9,10 +9,11 @@ cflags{
'-I $builddir/pkg/wld/include',
}
-waylandproto('protocol/velox.xml',
- 'protocol/velox-client-protocol.h',
- 'protocol/velox-server-protocol.h',
- 'velox-protocol.c')
+waylandproto('protocol/velox.xml', {
+ client='protocol/velox-client-protocol.h',
+ server='protocol/velox-server-protocol.h',
+ code='velox-protocol.c',
+})
build('copy', '$outdir/protocol/swc-client-protocol.h', '$builddir/pkg/swc/include/swc-client-protocol.h')
pkg.deps = {
diff --git a/pkg/wayland-protocols/gen.lua b/pkg/wayland-protocols/gen.lua
@@ -1,16 +1,16 @@
cflags{'-I $builddir/pkg/wayland/include'}
-waylandproto('stable/xdg-shell/xdg-shell.xml',
- 'include/xdg-shell-client-protocol.h',
- 'include/xdg-shell-server-protocol.h',
- 'xdg-shell-protocol.c'
-)
+waylandproto('stable/xdg-shell/xdg-shell.xml', {
+ client='include/xdg-shell-client-protocol.h',
+ server='include/xdg-shell-server-protocol.h',
+ code='xdg-shell-protocol.c',
+})
-waylandproto('unstable/idle-inhibit/idle-inhibit-unstable-v1.xml',
- 'include/idle-inhibit-unstable-v1-client-protocol.h',
- 'include/idle-inhibit-unstable-v1-server-protocol.h',
- 'idle-inhibit-v1-protocol.c'
-)
+waylandproto('unstable/idle-inhibit/idle-inhibit-unstable-v1.xml', {
+ client='include/idle-inhibit-unstable-v1-client-protocol.h',
+ server='include/idle-inhibit-unstable-v1-server-protocol.h',
+ code='idle-inhibit-v1-protocol.c'
+})
pkg.hdrs = {
'$outdir/include/xdg-shell-client-protocol.h',