about summary refs log tree commit diff
path: root/dispatcher
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2018-04-23 18:00:21 +0200
committerMichael Biebl <biebl@debian.org>2018-04-23 18:00:21 +0200
commitf60117b41d5433be1b4a96d82cd11d0c3dce9b63 (patch)
tree2dd55c4ab0fdcbe9cddb26adb4a554b1a45c73c8 /dispatcher
parent7e9ff09fcb2366b383b7ebbec80d2f6fff117290 (diff)
New upstream version 1.11.3 upstream/1.11.3
Diffstat (limited to 'dispatcher')
-rw-r--r--dispatcher/meson.build71
-rw-r--r--dispatcher/nm-dispatcher.c4
-rw-r--r--dispatcher/tests/meson.build27
-rw-r--r--dispatcher/tests/test-dispatcher-envp.c1
4 files changed, 99 insertions, 4 deletions
diff --git a/dispatcher/meson.build b/dispatcher/meson.build
new file mode 100644
index 00000000..5859a6ed
--- /dev/null
+++ b/dispatcher/meson.build
@@ -0,0 +1,71 @@
+dispatcher_inc = include_directories('.')
+
+name = 'nm-dispatcher'
+
+service_conf = configuration_data()
+service_conf.set('sbindir', nm_sbindir)
+service_conf.set('sysconfdir', nm_sysconfdir)
+service_conf.set('localstatedir', nm_localstatedir)
+service_conf.set('libexecdir', nm_libexecdir)
+
+service = 'org.freedesktop.nm_dispatcher.service'
+
+configure_file(
+  input: service + '.in',
+  output: service,
+  install: true,
+  install_dir: dbus_sys_dir,
+  configuration: service_conf
+)
+
+install_data(
+  'nm-dispatcher.conf',
+  install_dir: dbus_conf_dir
+)
+
+sources = files('nm-dispatcher-utils.c')
+
+deps = [
+  libnm_dep,
+  nm_core_dep
+]
+
+cflags = [
+  '-DLIBEXECDIR="@0@"'.format(nm_libexecdir),
+  '-DSYSCONFDIR="@0@"'.format(nm_sysconfdir),
+  '-DNMCONFDIR="@0@"'.format(nm_pkgconfdir),
+  '-DG_LOG_DOMAIN="@0@"'.format(name),
+  '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT',
+]
+
+libnm_dispatcher_core = static_library(
+  name + '-core',
+  sources: sources,
+  dependencies: deps,
+  c_args: cflags
+)
+
+sources = files('nm-dispatcher.c')
+
+sources += gnome.gdbus_codegen(
+  'nmdbus-dispatcher',
+  name + '.xml',
+  interface_prefix: 'org.freedesktop',
+  namespace: 'NMDBus'
+)
+
+executable(
+  name,
+  sources,
+  dependencies: deps,
+  c_args: cflags,
+  link_with: libnm_dispatcher_core,
+  link_args: ldflags_linker_script_binary,
+  link_depends: linker_script_binary,
+  install: true,
+  install_dir: nm_libexecdir
+)
+
+if enable_tests
+  subdir('tests')
+endif
diff --git a/dispatcher/nm-dispatcher.c b/dispatcher/nm-dispatcher.c
index 6bb52218..efab0a53 100644
--- a/dispatcher/nm-dispatcher.c
+++ b/dispatcher/nm-dispatcher.c
@@ -604,7 +604,7 @@ find_scripts (const char *str_action)
 
 	while ((filename = g_dir_read_name (dir))) {
 		char *path;
-		struct stat	st;
+		struct stat st;
 		int err;
 		const char *err_msg = NULL;
 
@@ -916,8 +916,6 @@ main (int argc, char **argv)
 
 	g_option_context_free (opt_ctx);
 
-	nm_g_type_init ();
-
 	g_unix_signal_add (SIGTERM, signal_handler, GINT_TO_POINTER (SIGTERM));
 	g_unix_signal_add (SIGINT, signal_handler, GINT_TO_POINTER (SIGINT));
 
diff --git a/dispatcher/tests/meson.build b/dispatcher/tests/meson.build
new file mode 100644
index 00000000..1368a1f3
--- /dev/null
+++ b/dispatcher/tests/meson.build
@@ -0,0 +1,27 @@
+test_unit = 'test-dispatcher-envp'
+
+incs = [
+  dispatcher_inc,
+  libnm_inc
+]
+
+cflags = [
+  '-DNETWORKMANAGER_COMPILATION_TEST',
+  '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT',
+  '-DSRCDIR="@0@"'.format(meson.current_source_dir()),
+]
+
+exe = executable(
+  test_unit,
+  test_unit + '.c',
+  include_directories: incs,
+  dependencies: nm_core_dep,
+  c_args: cflags,
+  link_with: libnm_dispatcher_core
+)
+
+test(
+  'dispatcher/' + test_unit,
+  test_script,
+  args: test_args + [exe.full_path()]
+)
diff --git a/dispatcher/tests/test-dispatcher-envp.c b/dispatcher/tests/test-dispatcher-envp.c
index 6dd4db07..25cd5e60 100644
--- a/dispatcher/tests/test-dispatcher-envp.c
+++ b/dispatcher/tests/test-dispatcher-envp.c
@@ -24,7 +24,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "nm-core-internal.h"
 #include "nm-dispatcher-utils.h"
 #include "nm-dispatcher-api.h"