diff options
author | Jan-Michael Brummer <jan.brummer@tabos.org> | 2023-02-07 10:56:37 +0100 |
---|---|---|
committer | Jan-Michael Brummer <jan.brummer@tabos.org> | 2023-03-27 16:31:58 +0200 |
commit | 6b59dd19f667135482de2a70f8a219c35af0eaa7 (patch) | |
tree | 9eea9893ecbe74c7175b35dd75e5f3ac7c40afe4 | |
parent | 0bd5a16259bb5274d0642aa98ae4c10d68b2479e (diff) | |
download | libproxy-git-6b59dd19f667135482de2a70f8a219c35af0eaa7.tar.gz |
Add D-Bus service files (#38)
-rw-r--r-- | .github/workflows/build.yml | 4 | ||||
-rw-r--r-- | meson.build | 2 | ||||
-rw-r--r-- | meson_options.txt | 4 | ||||
-rw-r--r-- | src/backend/dbus/meson.build | 20 | ||||
-rw-r--r-- | src/backend/dbus/org.libproxy.proxy.conf | 21 | ||||
-rw-r--r-- | src/backend/dbus/org.libproxy.proxy.service.in | 3 | ||||
-rw-r--r-- | src/backend/dbus/proxyd.service.in | 6 | ||||
-rw-r--r-- | src/backend/meson.build | 4 | ||||
-rw-r--r-- | src/libproxy/meson.build | 2 |
9 files changed, 55 insertions, 11 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5dd6034..13eaddd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,7 +22,7 @@ jobs: gsettings-desktop-schemas-dev \ libcurl4-openssl-dev - name: Build setup - run: meson setup build -Db_coverage=true + run: meson setup build -Db_coverage=true -Ddbus=disabled - name: Build run: ninja -C build - name: Tests and Coverage @@ -76,7 +76,7 @@ jobs: gsettings-desktop-schemas-dev \ libcurl4-openssl-dev - name: Build setup - run: meson setup build -Db_coverage=true -Ddbus=true + run: meson setup build -Db_coverage=true -Ddbus=enabled - name: Build run: ninja -C build - name: Tests diff --git a/meson.build b/meson.build index 12cf963..a7be8a7 100644 --- a/meson.build +++ b/meson.build @@ -114,6 +114,8 @@ curl_dep = dependency('libcurl', required: get_option('download-curl')) ws2_32_dep = cc.find_library('ws2_32', required : with_platform_windows) gsettings_desktop_schema = dependency('gsettings-desktop-schemas', required: get_option('config-gnome')) +build_dbus = get_option('dbus').disable_auto_if(['window', 'darwin'].contains(host_system)).allowed() + subdir('src') subdir('docs') diff --git a/meson_options.txt b/meson_options.txt index a82890c..89d05e1 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -14,8 +14,8 @@ option( option( 'dbus', - type: 'boolean', - value: false, + type: 'feature', + value: 'auto', description: 'Whether to build dbus service' ) diff --git a/src/backend/dbus/meson.build b/src/backend/dbus/meson.build index 866d0b8..eb64fcd 100644 --- a/src/backend/dbus/meson.build +++ b/src/backend/dbus/meson.build @@ -1,7 +1,12 @@ -if get_option('dbus') +if build_dbus gdbus_codegen = find_program('gdbus-codegen') unitdir = '' + dbus_data_dir = join_paths(get_option('prefix'), get_option('datadir'), 'dbus-1') + dbus_interfaces_dir = join_paths(dbus_data_dir, 'interfaces') + dbus_services_dir = join_paths(dbus_data_dir, 'services') + dbus_sysconf_dir = join_paths(dbus_data_dir, 'session.d') + systemd = dependency('systemd', required: false) if systemd.found() unitdir = systemd.get_variable(pkgconfig: 'systemduserunitdir') @@ -57,6 +62,19 @@ if get_option('dbus') service_data = configuration_data() service_data.set('LIBEXECDIR', join_paths(px_prefix, get_option('libexecdir'))) + dbus_service = configure_file( + input: 'org.libproxy.proxy.service.in', + output: 'org.libproxy.proxy.service', + configuration: service_data + ) + + install_data('org.libproxy.proxy.conf', install_dir : dbus_sysconf_dir) + install_data(dbus_service, install_dir : dbus_services_dir) + install_data('org.libproxy.proxy.xml', install_dir : dbus_interfaces_dir) + + service_data = configuration_data() + service_data.set('LIBEXECDIR', join_paths(px_prefix, get_option('libexecdir'))) + service = configure_file( input: 'proxyd.service.in', output: 'proxyd.service', diff --git a/src/backend/dbus/org.libproxy.proxy.conf b/src/backend/dbus/org.libproxy.proxy.conf new file mode 100644 index 0000000..f9232a1 --- /dev/null +++ b/src/backend/dbus/org.libproxy.proxy.conf @@ -0,0 +1,21 @@ +<!DOCTYPE busconfig PUBLIC + "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" + "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> +<busconfig> + <policy user="root"> + <allow own="org.libproxy.proxy"/> + </policy> + <policy context="default"> + <allow send_destination="org.libproxy.proxy" + send_interface="org.freedesktop.DBus.Introspectable"/> + + <allow send_destination="org.libproxy.proxy" + send_interface="org.freedesktop.DBus.Peer"/> + + <allow send_destination="org.libproxy.proxy" + send_interface="org.freedesktop.DBus.Properties"/> + + <allow send_destination="org.libproxy.proxy" + send_interface="org.libproxy.proxy"/> + </policy> +</busconfig>
\ No newline at end of file diff --git a/src/backend/dbus/org.libproxy.proxy.service.in b/src/backend/dbus/org.libproxy.proxy.service.in new file mode 100644 index 0000000..e958cd2 --- /dev/null +++ b/src/backend/dbus/org.libproxy.proxy.service.in @@ -0,0 +1,3 @@ +[D-BUS Service] +Name=org.libproxy.proxy +Exec=@LIBEXECDIR@/proxyd
\ No newline at end of file diff --git a/src/backend/dbus/proxyd.service.in b/src/backend/dbus/proxyd.service.in index 2e2a7cc..038e86d 100644 --- a/src/backend/dbus/proxyd.service.in +++ b/src/backend/dbus/proxyd.service.in @@ -6,13 +6,9 @@ Type=dbus BusName=org.libproxy.proxy ExecStart=@LIBEXECDIR@/proxyd #Environment="G_MESSAGES_DEBUG=all" -Restart=on-failure MemoryDenyWriteExecute=yes PrivateTmp=yes ProtectHome=yes ProtectSystem=full -RestrictRealtime=yes - -[Install] -WantedBy=default.target
\ No newline at end of file +RestrictRealtime=yes
\ No newline at end of file diff --git a/src/backend/meson.build b/src/backend/meson.build index 24f3d88..bdca0f1 100644 --- a/src/backend/meson.build +++ b/src/backend/meson.build @@ -51,3 +51,7 @@ px_backend_dep = declare_dependency( subdir('dbus') subdir('plugins') + +summary({ + 'D-Bus Service' : build_dbus, +}, section: 'Architecture')
\ No newline at end of file diff --git a/src/libproxy/meson.build b/src/libproxy/meson.build index 3ee67b6..0368e77 100644 --- a/src/libproxy/meson.build +++ b/src/libproxy/meson.build @@ -4,7 +4,7 @@ libproxy_inc = include_directories('.') libproxy_sources = [] -if get_option('dbus') +if build_dbus libproxy_sources += [ 'proxy-dbus.c', ] |