| 1 | #!/usr/bin/env -S v |
| 2 | |
| 3 | import log |
| 4 | |
| 5 | fn sh(cmd string) { |
| 6 | log.info('Executing: ❯ ${cmd}') |
| 7 | print(execute_or_exit(cmd).output) |
| 8 | } |
| 9 | |
| 10 | fn gen_protocol(protocols_dir string, output_dir string, name string, path string) { |
| 11 | log.info('Generating protocol: ${name}') |
| 12 | sh('wayland-scanner client-header ${protocols_dir}/${path} ${output_dir}/${name}-client-protocol.h') |
| 13 | sh('wayland-scanner private-code ${protocols_dir}/${path} ${output_dir}/${name}-protocol.c') |
| 14 | } |
| 15 | |
| 16 | protocols_dir := '/usr/share/wayland-protocols' |
| 17 | output_dir := '.' |
| 18 | protocols := { |
| 19 | 'xdg-shell': '/stable/xdg-shell/xdg-shell.xml' |
| 20 | 'viewporter': '/stable/viewporter/viewporter.xml' |
| 21 | 'fractional-scale-v1': '/staging/fractional-scale/fractional-scale-v1.xml' |
| 22 | 'cursor-shape-v1': '/staging/cursor-shape/cursor-shape-v1.xml' |
| 23 | 'xdg-toplevel-icon-v1': '/staging/xdg-toplevel-icon/xdg-toplevel-icon-v1.xml' |
| 24 | 'tablet-unstable-v2': '/unstable/tablet/tablet-unstable-v2.xml' |
| 25 | 'pointer-constraints-unstable-v1': '/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml' |
| 26 | 'relative-pointer-unstable-v1': '/unstable/relative-pointer/relative-pointer-unstable-v1.xml' |
| 27 | 'xdg-decoration-unstable-v1': '/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml' |
| 28 | } |
| 29 | |
| 30 | for protocol, path in protocols { |
| 31 | gen_protocol(protocols_dir, output_dir, protocol, path) |
| 32 | } |
| 33 | |