Commit fd61e128 authored by Zeeshan Ali's avatar Zeeshan Ali

WIP: Generate Rust code for our D-Bus interfaces

parent e832e7b0
Pipeline #28932 passed with stage
in 4 minutes and 14 seconds
#!/usr/bin/env python3
import sys
import os
if len(sys.argv) < 4:
print('Usage: CODEGEN_BINARY OUTPUT_FILE INPUT_FILE')
sys.exit(-1)
os.system(sys.argv[1] + ">" + sys.argv[2] + "<" + sys.argv[3])
dbus_interface_dir = join_paths(datadir, 'dbus-1', 'interfaces')
geoclue_iface_sources = []
geoclue_iface_rust_sources = []
# Fetch dbus-codegen-rust command
cargo = find_program('cargo')
dbus_codegen_rs_fetch_cmd = [
cargo,
'install', 'dbus-codegen',
'--bin', 'dbus-codegen-rust',
'--root', meson.current_build_dir() ]
dbus_codegen_rs_dep = custom_target(
'dbus-codegen-rs-dep',
output: 'dbus-codegen-rs-dep.out',
capture: true,
command: dbus_codegen_rs_fetch_cmd)
dbus_codegen_rs = join_paths(
meson.current_build_dir(),
'bin',
'dbus-codegen-rust')
python = find_program('python3')
dbus_codegen_rs_wrapper = find_program('dbus-codegen-rust.py')
dbus_codegen_rs_cmd = [
python,
dbus_codegen_rs_wrapper,
dbus_codegen_rs,
'@OUTPUT@',
'@INPUT@']
# Client interface
client_interface_xml = 'org.freedesktop.GeoClue2.Client.xml'
......@@ -10,6 +37,15 @@ geoclue_iface_sources += gnome.gdbus_codegen(
interface_prefix: 'org.freedesktop.GeoClue2.',
namespace: 'GClueDBus',
docbook: 'docs')
geoclue_iface_rust_sources += custom_target(
'gclue-client-interface',
input: client_interface_xml,
output: 'client-dbus.rs',
install: true,
install_dir: dbus_interface_dir,
depends: dbus_codegen_rs_dep,
command: dbus_codegen_rs_cmd)
# Location interface
location_interface_xml = 'org.freedesktop.GeoClue2.Location.xml'
geoclue_iface_sources += gnome.gdbus_codegen(
......@@ -18,6 +54,7 @@ geoclue_iface_sources += gnome.gdbus_codegen(
interface_prefix: 'org.freedesktop.GeoClue2.',
namespace: 'GClueDBus',
docbook: 'docs')
# Manager interface
manager_interface_xml = 'org.freedesktop.GeoClue2.Manager.xml'
geoclue_iface_sources += gnome.gdbus_codegen(
......@@ -81,7 +118,6 @@ interface_files = [ location_interface_xml,
# Provide a single interface file too for backwards compatiblity.
# At least gnome-settings-daemon currently relies on that.
unified_interface_xml = 'org.freedesktop.GeoClue2.xml'
python = find_program('python3')
create_interface = find_program('create-unified-xml.py')
cmd = [python, create_interface, '@OUTPUT@', '@INPUT@' ]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment