From: Simon McVittie Date: Mon, 28 Apr 2025 12:26:56 +0000 (+0100) Subject: build: Only define DBUS_TEST_SOCKET_DIR on Unix platforms X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a9fddb26dc8ddc7e8a3619af65ebee20cdcd41a;p=thirdparty%2Fdbus.git build: Only define DBUS_TEST_SOCKET_DIR on Unix platforms This makes it more obvious that it is currently only used on Unix, and therefore it's OK for it to have a default that wouldn't work on Windows. The non-default CMake build system already didn't set the variable when building for Windows. Signed-off-by: Simon McVittie --- diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake index 54625bdc6..852021590 100644 --- a/cmake/config.h.cmake +++ b/cmake/config.h.cmake @@ -227,8 +227,6 @@ #cmakedefine DBUS_USER "@DBUS_USER@" #cmakedefine DBUS_TEST_USER "@DBUS_TEST_USER@" #cmakedefine DBUS_TEST_EXEC "@DBUS_TEST_EXEC@" -/* Where to put test sockets */ -#define DBUS_TEST_SOCKET_DIR "@TEST_SOCKET_DIR@" // system type defines #if defined(_WIN32) || defined(_WIN64) || defined (_WIN32_WCE) @@ -244,6 +242,11 @@ # define DBUS_UNIX #endif +#ifdef DBUS_UNIX +/* Where to put test sockets */ +#define DBUS_TEST_SOCKET_DIR "@TEST_SOCKET_DIR@" +#endif + #if defined(_WIN32) || defined(_WIN64) // mingw mode_t # ifdef HAVE_STDIO_H diff --git a/meson.build b/meson.build index 7a4067a05..c11f1c5a8 100644 --- a/meson.build +++ b/meson.build @@ -1078,13 +1078,19 @@ values = run_command(python, '-c', values += '/tmp' default_socket_dir = values.strip().split('\n')[0] -test_socket_dir = get_option('test_socket_dir') -if test_socket_dir == '' - test_socket_dir = default_socket_dir +if platform_unix + test_socket_dir = get_option('test_socket_dir') + + if test_socket_dir == '' + test_socket_dir = default_socket_dir + endif + + config.set_quoted('DBUS_TEST_SOCKET_DIR', test_socket_dir) + test_listen = 'unix:tmpdir=' + test_socket_dir +else + test_listen = 'tcp:host=localhost' endif -test_listen = platform_unix ? 'unix:tmpdir=' + test_socket_dir : 'tcp:host=localhost' config.set_quoted('TEST_LISTEN', test_listen) -config.set_quoted('DBUS_TEST_SOCKET_DIR', test_socket_dir) data_config.set('TEST_LISTEN', test_listen) session_socket_dir = get_option('session_socket_dir') @@ -1395,9 +1401,14 @@ summary_dict += { 'System bus user': dbus_user, 'Session bus services dir': get_option('prefix') / get_option('datadir') / 'dbus-1' / 'services', - 'Tests socket dir': test_socket_dir, } +if platform_unix + summary_dict += { + 'Tests socket dir': test_socket_dir, + } +endif + if host_os.contains('solaris') summary_dict += { 'Console owner file': console_owner_file,