2020-01-23 13:12:15 +01:00
# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
2023-08-14 16:53:55 +01:00
# SPDX-License-Identifier: MIT
2020-01-23 13:12:15 +01:00
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
project ( 'dbus' ,
2022-07-25 14:30:02 +01:00
'c' ,
2024-12-06 17:49:02 +00:00
version : '1.16.99-alpha' ,
2020-01-23 13:12:15 +01:00
meson_version : '>=0.56' ,
)
project_url = 'https://gitlab.freedesktop.org/dbus/dbus'
cc = meson . get_compiler ( 'c' )
windows = import ( 'windows' )
pkgconfig = import ( 'pkgconfig' )
config = configuration_data ( )
# Used for dbus-arch-deps.h, separated from config.h
arch_config = configuration_data ( )
# Non-quoted variables
data_config = configuration_data ( )
2022-06-27 15:37:17 +01:00
install_emptydirs = [ ]
2022-06-27 15:12:54 +01:00
install_symlinks = [ ]
2020-01-23 13:12:15 +01:00
###############################################################################
# Project configuration
not_found = dependency ( '' , required : false )
version = meson . project_version ( )
build: Allow version number to be followed by "-" and a suffix
Some distributions are known to have shipped dbus 1.15.x as though it
was a stable release, and it isn't clear whether they knew that we use
the odd/even versioning convention like GLib does.
If we add a -alpha, -beta, -rc suffix to development versions starting
from 1.17.0, then distros that know we use odd/even versioning will
know that our development versions are not a stable-branch, and so will
distros that mistakenly think we use the "semantic versioning"
versioning convention popularized by <https://semver.org/>.
(We intentionally do not use semver, because semver would require us to
ship a new minor version every time we add new API, and we do not have
the resources to provide security support for an unlimited number of
minor versions in parallel: we need to be able to nominate a subset of
our releases as having longer-term security support, in a way that signals
to distros that these are the releases they should prefer to ship.)
CMake's `project()` doesn't allow this version number format[1], but
we intend to use version numbers where the (major, minor, micro) tuple
is enough to uniquely identify a release, so we can just tell CMake our
version number without the suffix and there will be no ambiguity.
Similarly, the dash is not allowed in GNU ld version scripts, so use
the form of the version number without the suffix there.
[1] https://gitlab.kitware.com/cmake/cmake/-/issues/16716
Helps: dbus#530
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-12-06 17:48:04 +00:00
version_no_suffix = version . split ( '-' ) [ 0 ]
2020-01-23 13:12:15 +01:00
config . set_quoted ( 'VERSION' , version )
data_config . set ( 'VERSION' , version )
data_config . set ( 'DBUS_VERSION' , version )
build: Allow version number to be followed by "-" and a suffix
Some distributions are known to have shipped dbus 1.15.x as though it
was a stable release, and it isn't clear whether they knew that we use
the odd/even versioning convention like GLib does.
If we add a -alpha, -beta, -rc suffix to development versions starting
from 1.17.0, then distros that know we use odd/even versioning will
know that our development versions are not a stable-branch, and so will
distros that mistakenly think we use the "semantic versioning"
versioning convention popularized by <https://semver.org/>.
(We intentionally do not use semver, because semver would require us to
ship a new minor version every time we add new API, and we do not have
the resources to provide security support for an unlimited number of
minor versions in parallel: we need to be able to nominate a subset of
our releases as having longer-term security support, in a way that signals
to distros that these are the releases they should prefer to ship.)
CMake's `project()` doesn't allow this version number format[1], but
we intend to use version numbers where the (major, minor, micro) tuple
is enough to uniquely identify a release, so we can just tell CMake our
version number without the suffix and there will be no ambiguity.
Similarly, the dash is not allowed in GNU ld version scripts, so use
the form of the version number without the suffix there.
[1] https://gitlab.kitware.com/cmake/cmake/-/issues/16716
Helps: dbus#530
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-12-06 17:48:04 +00:00
data_config . set ( 'DBUS_VERSION_NO_SUFFIX' , version_no_suffix )
2020-01-23 13:12:15 +01:00
build: Allow version number to be followed by "-" and a suffix
Some distributions are known to have shipped dbus 1.15.x as though it
was a stable release, and it isn't clear whether they knew that we use
the odd/even versioning convention like GLib does.
If we add a -alpha, -beta, -rc suffix to development versions starting
from 1.17.0, then distros that know we use odd/even versioning will
know that our development versions are not a stable-branch, and so will
distros that mistakenly think we use the "semantic versioning"
versioning convention popularized by <https://semver.org/>.
(We intentionally do not use semver, because semver would require us to
ship a new minor version every time we add new API, and we do not have
the resources to provide security support for an unlimited number of
minor versions in parallel: we need to be able to nominate a subset of
our releases as having longer-term security support, in a way that signals
to distros that these are the releases they should prefer to ship.)
CMake's `project()` doesn't allow this version number format[1], but
we intend to use version numbers where the (major, minor, micro) tuple
is enough to uniquely identify a release, so we can just tell CMake our
version number without the suffix and there will be no ambiguity.
Similarly, the dash is not allowed in GNU ld version scripts, so use
the form of the version number without the suffix there.
[1] https://gitlab.kitware.com/cmake/cmake/-/issues/16716
Helps: dbus#530
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-12-06 17:48:04 +00:00
ver_array = version_no_suffix . split ( '.' )
2020-01-23 13:12:15 +01:00
arch_config . set ( 'DBUS_VERSION' , version )
arch_config . set ( 'DBUS_MAJOR_VERSION' , ver_array [ 0 ] )
arch_config . set ( 'DBUS_MINOR_VERSION' , ver_array [ 1 ] )
arch_config . set ( 'DBUS_MICRO_VERSION' , ver_array [ 2 ] )
config . set_quoted ( 'DBUS_DAEMON_NAME' , 'dbus-daemon' )
###############################################################################
# libtool versioning - this applies to libdbus
# http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91
2023-01-02 17:10:19 +01:00
#
# These variables are parsed automatically by cmake/modules/MacrosMeson.cmake,
# be careful if changing the formatting
2020-01-23 13:12:15 +01:00
## increment if the interface has additions, changes, removals.
2024-12-16 15:29:15 +00:00
lt_current = 42
2020-01-23 13:12:15 +01:00
## increment any time the source changes;
## set to 0 if you increment CURRENT
2024-12-16 15:29:15 +00:00
lt_revision = 0
2020-01-23 13:12:15 +01:00
## increment if any interfaces have been added;
## set to 0 if any interfaces have been changed or removed.
## removal has precedence over adding, so set to 0 if both happened.
2024-12-16 15:29:15 +00:00
lt_age = 39
2020-01-23 13:12:15 +01:00
soversion = ( lt_current - lt_age )
version_info = '@0@.@1@.@2@' . format ( soversion , lt_age , lt_revision )
data_config . set ( 'SOVERSION' , soversion )
###############################################################################
# System detection
python = find_program ( 'python3' )
host_os = host_machine . system ( )
platform_windows = host_os . contains ( 'windows' )
2022-07-25 14:30:02 +01:00
if platform_windows
# On Windows, we use C++ constructors to initialize global locks
using_cpp = true
2023-08-14 20:32:03 +01:00
add_languages ( 'cpp' , required : true , native : false )
2022-07-25 14:30:02 +01:00
cpp = meson . get_compiler ( 'cpp' )
else
using_cpp = false
endif
2020-01-23 13:12:15 +01:00
platform_cygwin = host_os . contains ( 'cygwin' )
# TODO: meson doesn't actually have WinCE support
platform_win32ce = host_os . contains ( 'mingw32ce' )
platform_unix = not platform_windows
2025-08-16 15:37:51 -07:00
# "sunos" is either Solaris or illumos in meson
platform_sunos = ( host_os == 'sunos' )
2020-01-23 13:12:15 +01:00
config . set ( 'DBUS_UNIX' , platform_unix )
config . set ( 'DBUS_CYGWIN' , platform_cygwin )
config . set ( 'DBUS_WIN' , platform_windows )
config . set ( 'DBUS_WINCE' , platform_win32ce )
if platform_unix
platform = 'Unix'
elif platform_cygwin
platform = 'cygwin'
elif platform_win32ce
platform = 'win32ce'
elif platform_windows
platform = 'windows'
else
platform = 'unknown'
endif
message ( 'Detected platform : @0@ (@1@)' . format ( platform , host_os ) )
if platform_windows
config . set ( 'FD_SETSIZE' , 8192 ,
description : 'The maximum number of connections that can be handled at once'
)
if platform_win32ce
config . set ( '_WIN32_WCE' , '0x0502' , description : 'Get newer W32 CE APIs' )
else
config . set ( '_WIN32_WINNT' , '0x0600' ,
description : 'Define to the minimum supported Windows version (Vista)'
)
endif
build_timestamp = run_command (
find_program ( 'tools/build-timestamp.py' ) ,
check : true ,
) . stdout ( ) . strip ( )
data_config . set ( 'BUILD_TIMESTAMP' , build_timestamp )
build: Allow version number to be followed by "-" and a suffix
Some distributions are known to have shipped dbus 1.15.x as though it
was a stable release, and it isn't clear whether they knew that we use
the odd/even versioning convention like GLib does.
If we add a -alpha, -beta, -rc suffix to development versions starting
from 1.17.0, then distros that know we use odd/even versioning will
know that our development versions are not a stable-branch, and so will
distros that mistakenly think we use the "semantic versioning"
versioning convention popularized by <https://semver.org/>.
(We intentionally do not use semver, because semver would require us to
ship a new minor version every time we add new API, and we do not have
the resources to provide security support for an unlimited number of
minor versions in parallel: we need to be able to nominate a subset of
our releases as having longer-term security support, in a way that signals
to distros that these are the releases they should prefer to ship.)
CMake's `project()` doesn't allow this version number format[1], but
we intend to use version numbers where the (major, minor, micro) tuple
is enough to uniquely identify a release, so we can just tell CMake our
version number without the suffix and there will be no ambiguity.
Similarly, the dash is not allowed in GNU ld version scripts, so use
the form of the version number without the suffix there.
[1] https://gitlab.kitware.com/cmake/cmake/-/issues/16716
Helps: dbus#530
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-12-06 17:48:04 +00:00
data_config . set ( 'BUILD_FILEVERSION' , ',' . join ( version_no_suffix . split ( '.' ) ) )
2020-01-23 13:12:15 +01:00
data_config . set ( 'DBUS_VER_FILE_TYPE' , 'VFT_DLL' )
data_config . set ( 'DBUS_VER_INTERNAL_NAME' , 'libdbus-1-@0@' . format ( soversion ) )
data_config . set ( 'DBUS_VER_ORIGINAL_NAME' , 'libdbus-1-@0@.dll' . format ( soversion ) )
endif
if platform_windows
conf_maybe_external = '<!--<auth>EXTERNAL</auth>-->'
else
conf_maybe_external = '<auth>EXTERNAL</auth>'
endif
data_config . set ( 'DBUS_SESSION_CONF_MAYBE_AUTH_EXTERNAL' , conf_maybe_external )
2022-07-15 12:13:43 +01:00
###############################################################################
# Functionally necessary compiler arguments
# Note that these must be set up before we do any checks like
# cc.has_header_symbol, otherwise we'll fail to find symbols that only exist
# when a particular feature-test macro like _GNU_SOURCE is defined.
compile_args = [
'-D_GNU_SOURCE' ,
]
2022-07-15 10:42:19 +01:00
# dbus makes assumptions about aliasing that Standard C does not guarantee,
# particularly in DBusString.
# See https://gitlab.freedesktop.org/dbus/dbus/-/issues/4
compile_args + = [ '-fno-strict-aliasing' ]
2025-08-16 15:37:51 -07:00
if platform_sunos
2025-08-12 15:00:14 -07:00
# The headers on illumos systems and Solaris versions prior to 11.4.0
# default to an early draft of the POSIX re-entrant functions that is
# not compatible with the final standard, and need a flag to enable the
# common standard versions of these functions.
pthread_check_code = '' ' #include <pwd.h>
int func ( const char * name , struct passwd * pwd , struct passwd * * result ) {
static char buffer [ 1024 ] ;
return getpwnam_r ( name , pwd , buffer , sizeof ( buffer ) , result ) ;
} '' '
if not cc . compiles ( pthread_check_code , name : 'sunos pthread check' )
compile_args + = [ '-D_POSIX_PTHREAD_SEMANTICS' ]
endif
# The headers on illumos systems and Solaris versions prior to 11.4.0
# require an extra flag to expose POSIX file descriptor passing support.
if not cc . has_member ( 'struct msghdr' , 'msg_control' , prefix : '#include <sys/socket.h>' )
compile_args + = [ '-D_XOPEN_SOURCE=600' ]
endif
# The standard headers on illumos & Solaris systems limit themselves to
# defining just the interfaces from the standard when _XOPEN_SOURCE or
# _POSIX_SOURCE are defined, unless __EXTENSIONS__ is also defined to
# allow defining non-standard extensions to the interfaces.
if not cc . has_function ( 'clearenv' , prefix : '#include <stdlib.h>' , args : compile_args )
compile_args + = [ '-D__EXTENSIONS__' ]
endif
2020-01-23 13:12:15 +01:00
endif
2022-07-15 12:13:43 +01:00
dbus_static_flags = ( get_option ( 'default_library' ) == 'static'
2023-01-13 14:04:19 +01:00
? [ '-DDBUS_STATIC_BUILD' ]
2022-07-15 12:13:43 +01:00
: [ ]
)
compile_args + = dbus_static_flags
if cc . get_id ( ) != 'msvc'
compile_args + = [
# On Windows, we expect to be using msvcrt.dll-compatible printf
# (%I64u instead of %llu)
'-D__USE_MINGW_ANSI_STDIO=0' ,
]
endif
compile_args_c = cc . get_supported_arguments ( compile_args )
add_project_arguments ( compile_args_c , language : 'c' )
2022-07-25 14:30:02 +01:00
if using_cpp
compile_args_cpp = cpp . get_supported_arguments ( compile_args )
add_project_arguments ( compile_args_cpp , language : 'cpp' )
endif
2022-07-15 12:13:43 +01:00
2023-01-06 13:49:17 +00:00
# Try to use hidden visibility on Unix. We don't do this on Windows to avoid
# interfering with use of __declspec(dllexport) and __declspec(dllimport),
# which have a similar effect.
if cc . has_argument ( '-fvisibility=hidden' ) and not platform_windows
default_visibility = '__attribute__ ((__visibility__ ("default")))'
test_visibility = '' '
@ 0 @ void public_func ( void ) ;
@ 0 @ int public_var ;
int main ( void ) { return 0 ; }
'' ' . format ( default_visibility )
if cc . compiles ( test_visibility , args : compile_args_c + [ '-fvisibility=hidden' ] )
add_project_arguments ( [ '-fvisibility=hidden' ] , language : 'c' )
config . set ( 'DBUS_PRIVATE_EXPORT' , default_visibility )
config . set ( 'DBUS_EXPORT' , default_visibility )
# If we were using C++ then we'd need to add -fvisibility=hidden
# to the C++ arguments too, but that's not currently applicable here.
assert ( not using_cpp , 'C++ only used on Windows' )
endif
endif
2020-01-23 13:12:15 +01:00
if host_machine . endian ( ) == 'big'
config . set ( 'WORDS_BIGENDIAN' , 1 )
endif
# Integer sizes
int_types = [
{
'type' : 'short' ,
'size' : cc . sizeof ( 'short' ) ,
} , {
'type' : 'int' ,
'size' : cc . sizeof ( 'int' ) ,
'type_c' : '(val)' ,
'type_u_c' : '(val)' ,
'type_m' : '' ,
} , {
'type' : 'long' ,
'size' : cc . sizeof ( 'long' ) ,
'type_c' : '(val##L)' ,
'type_u_c' : '(val##UL)' ,
'type_m' : 'l' ,
} , {
'type' : 'long long' ,
'size' : cc . sizeof ( 'long long' ) ,
'type_c' : '(val##LL)' ,
'type_u_c' : '(val##ULL)' ,
'type_m' : 'll' ,
} , {
'type' : '__int64' ,
'size' : cc . sizeof ( '__int64' ) ,
'type_c' : '(val##i64)' ,
'type_u_c' : '(val##ui64)' ,
'type_m' : 'I64' ,
} , {
'type' : 'err'
} ,
]
foreach type : int_types
if type . get ( 'type' ) == 'err'
error ( 'Could not find a 64-bit integer type.' )
endif
if type . get ( 'size' ) == 8
arch_config . set ( 'DBUS_INT64_TYPE' , type . get ( 'type' ) )
arch_config . set ( 'DBUS_INT64_CONSTANT' , type . get ( 'type_c' ) )
arch_config . set ( 'DBUS_UINT64_CONSTANT' , type . get ( 'type_u_c' ) )
if platform_windows
2022-06-24 12:51:12 +01:00
# MSVCRT.dll printf() doesn't support %lld
2020-01-23 13:12:15 +01:00
arch_config . set ( 'DBUS_INT64_MODIFIER' , 'I64' )
else
arch_config . set ( 'DBUS_INT64_MODIFIER' , type . get ( 'type_m' ) )
endif
break
endif
endforeach
foreach type : int_types
if type . get ( 'type' ) == 'err'
error ( 'Could not find a 32-bit integer type.' )
endif
if type . get ( 'size' ) == 4
arch_config . set ( 'DBUS_INT32_TYPE' , type . get ( 'type' ) )
break
endif
endforeach
foreach type : int_types
if type . get ( 'type' ) == 'err'
error ( 'Could not find a 16-bit integer type.' )
endif
if type . get ( 'size' ) == 2
arch_config . set ( 'DBUS_INT16_TYPE' , type . get ( 'type' ) )
break
endif
endforeach
2022-08-14 16:28:56 +00:00
arch_config . set ( 'DBUS_SIZEOF_VOID_P' , cc . sizeof ( 'void *' ) )
2020-01-23 13:12:15 +01:00
###############################################################################
# Dependencies
xsltproc = find_program ( 'xsltproc' , required : get_option ( 'xml_docs' ) )
build_xml_docs = false
if xsltproc . found ( )
build_xml_docs = true
foreach fmt : [ 'html' , 'manpages' ]
xsl = 'http://docbook.sourceforge.net/release/xsl/current/@0@/docbook.xsl' . format ( fmt )
if run_command ( [ xsltproc , '--nonet' , xsl ] , check : false ) . returncode ( ) == 0
continue
endif
build_xml_docs = false
if get_option ( 'xml_docs' ) . enabled ( )
error ( 'Docbook XSL "@0@" not found' . format ( fmt ) )
else
message ( 'Docbook XSL "@0@" not found, disabled automatically' . format ( fmt ) )
endif
endforeach
endif
# For doxygen
doxygen = find_program ( 'doxygen' , required : get_option ( 'doxygen_docs' ) )
ducktype = find_program ( 'ducktype' , required : get_option ( 'ducktype_docs' ) )
2022-06-24 12:19:58 +01:00
yelpbuild = find_program ( 'yelp-build' , required : get_option ( 'ducktype_docs' ) )
2020-01-23 13:12:15 +01:00
can_upload_docs = doxygen . found ( ) and xsltproc . found ( ) and ducktype . found ( )
qhelpgen = find_program ( 'qhelpgenerator' , 'qhelpgenerator-qt5' , required : get_option ( 'qt_help' ) )
qt_help_generate = doxygen . found ( ) and qhelpgen . found ( )
2024-09-25 15:39:49 +01:00
data_config . set (
'DBUS_APIDOC_LINK' ,
doxygen . found ( ) ? '<a href="api/html/index.html">libdbus API Documentation</a>' : '' ,
)
2020-01-23 13:12:15 +01:00
data_config . set ( 'DBUS_GENERATE_MAN' , platform_windows ? 'NO' : 'YES' )
data_config . set ( 'DOXYGEN_QCH_FILE' , meson . current_build_dir ( )
/ 'doc' / 'api' / 'qch' / 'dbus-@0@.qch' . format ( version ) )
if qhelpgen . found ( )
data_config . set ( 'DOXYGEN_QHG_LOCATION' , qhelpgen . full_path ( ) )
data_config . set ( 'DOXYGEN_GENERATE_QHP' , 'YES' )
else
data_config . set ( 'DOXYGEN_QHG_LOCATION' , '' )
data_config . set ( 'DOXYGEN_GENERATE_QHP' , 'NO' )
endif
data_config . set ( 'top_srcdir' , meson . project_source_root ( ) )
data_config . set ( 'top_builddir' , meson . project_build_root ( ) )
threads = dependency ( 'threads' )
2022-07-15 11:42:11 +01:00
config . set (
'HAVE_MONOTONIC_CLOCK' ,
2022-10-06 08:56:36 -05:00
cc . has_header_symbol ( 'pthread.h' , 'CLOCK_MONOTONIC' , args : compile_args_c )
and cc . has_header_symbol ( 'pthread.h' , 'pthread_condattr_setclock' , args : compile_args_c )
and cc . has_header_symbol ( 'time.h' , 'clock_getres' , args : compile_args_c ) ,
2022-07-15 11:42:11 +01:00
)
2020-01-23 13:12:15 +01:00
2025-02-28 12:29:55 +00:00
fallback_subproject_options = [
'werror=false' ,
]
2025-02-28 12:31:01 +00:00
if cc . get_id ( ) != 'msvc'
# TODO: Ideally we'd have default_library=static with MSVC too,
# but see https://gitlab.freedesktop.org/dbus/dbus/-/issues/549
fallback_subproject_options + = [ 'default_library=static' ]
endif
meson: Introduce message_bus and tools command line option
To make the consume libdbus via Meson's subproject use case more useful,
introduce message_bus and tools command line options which control if
the D-Bus daemon and/or the tools are build. The idea here is that
depending projects are interested only in the library.
The strong recommendation is only to build libdbus as static library:
libdbus_dep = dependency(
'dbus-1',
required: get_option('libdbus'),
fallback: ['dbus', 'libdbus_dep'],
default_options: [
'default_library=static',
'embedded_tests=false',
'message_bus=false',
'modular_tests=disabled',
'tools=false',
],
)
This ensures that any installed D-Bus infrastructure on the target
system is not overwritten.
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2022-11-24 09:17:45 +01:00
# Controls whether message bus daemon is built. Tests which depend on
# a running dbus-daemon will be disabled if message_bus is not set.
message_bus = get_option ( 'message_bus' )
if get_option ( 'modular_tests' ) . disabled ( )
glib = dependency ( '' , required : false )
else
glib = dependency (
'glib-2.0' , version : '>=2.40' ,
required : get_option ( 'modular_tests' ) ,
fallback : [ 'glib' , 'libglib_dep' ] ,
2025-02-28 12:29:55 +00:00
default_options : fallback_subproject_options + [
2025-02-28 12:15:22 +00:00
'introspection=disabled' ,
2025-02-28 12:05:02 +00:00
'tests=false' ,
meson: Introduce message_bus and tools command line option
To make the consume libdbus via Meson's subproject use case more useful,
introduce message_bus and tools command line options which control if
the D-Bus daemon and/or the tools are build. The idea here is that
depending projects are interested only in the library.
The strong recommendation is only to build libdbus as static library:
libdbus_dep = dependency(
'dbus-1',
required: get_option('libdbus'),
fallback: ['dbus', 'libdbus_dep'],
default_options: [
'default_library=static',
'embedded_tests=false',
'message_bus=false',
'modular_tests=disabled',
'tools=false',
],
)
This ensures that any installed D-Bus infrastructure on the target
system is not overwritten.
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2022-11-24 09:17:45 +01:00
] ,
)
endif
if glib . found ( )
if platform_windows
gio = dependency ( 'gio-windows-2.0' , required : glib . found ( ) )
have_gio_unix = false
else
gio = dependency ( 'gio-unix-2.0' , required : glib . found ( ) )
have_gio_unix = gio . found ( )
endif
2020-01-23 13:12:15 +01:00
else
meson: Introduce message_bus and tools command line option
To make the consume libdbus via Meson's subproject use case more useful,
introduce message_bus and tools command line options which control if
the D-Bus daemon and/or the tools are build. The idea here is that
depending projects are interested only in the library.
The strong recommendation is only to build libdbus as static library:
libdbus_dep = dependency(
'dbus-1',
required: get_option('libdbus'),
fallback: ['dbus', 'libdbus_dep'],
default_options: [
'default_library=static',
'embedded_tests=false',
'message_bus=false',
'modular_tests=disabled',
'tools=false',
],
)
This ensures that any installed D-Bus infrastructure on the target
system is not overwritten.
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2022-11-24 09:17:45 +01:00
gio = dependency ( '' , required : false )
have_gio_unix = false
2020-01-23 13:12:15 +01:00
endif
use_glib = glib . found ( ) and gio . found ( )
meson: Introduce message_bus and tools command line option
To make the consume libdbus via Meson's subproject use case more useful,
introduce message_bus and tools command line options which control if
the D-Bus daemon and/or the tools are build. The idea here is that
depending projects are interested only in the library.
The strong recommendation is only to build libdbus as static library:
libdbus_dep = dependency(
'dbus-1',
required: get_option('libdbus'),
fallback: ['dbus', 'libdbus_dep'],
default_options: [
'default_library=static',
'embedded_tests=false',
'message_bus=false',
'modular_tests=disabled',
'tools=false',
],
)
This ensures that any installed D-Bus infrastructure on the target
system is not overwritten.
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2022-11-24 09:17:45 +01:00
if message_bus
2025-02-28 12:03:55 +00:00
expat = dependency (
'expat' ,
2025-02-28 12:29:55 +00:00
default_options : fallback_subproject_options + [
2025-02-28 12:03:55 +00:00
'build_tests=false' ,
] ,
)
meson: Introduce message_bus and tools command line option
To make the consume libdbus via Meson's subproject use case more useful,
introduce message_bus and tools command line options which control if
the D-Bus daemon and/or the tools are build. The idea here is that
depending projects are interested only in the library.
The strong recommendation is only to build libdbus as static library:
libdbus_dep = dependency(
'dbus-1',
required: get_option('libdbus'),
fallback: ['dbus', 'libdbus_dep'],
default_options: [
'default_library=static',
'embedded_tests=false',
'message_bus=false',
'modular_tests=disabled',
'tools=false',
],
)
This ensures that any installed D-Bus infrastructure on the target
system is not overwritten.
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2022-11-24 09:17:45 +01:00
else
expat = dependency ( '' , required : false )
endif
2022-06-24 14:27:10 +01:00
if expat . type_name ( ) == 'internal'
# Configure-time checks can't act on subprojects that haven't been
# built yet, but we know that subprojects/expat.wrap is a new enough
# version to have this
config . set ( 'HAVE_XML_SETHASHSALT' , true )
else
config . set ( 'HAVE_XML_SETHASHSALT' , cc . has_function ( 'XML_SetHashSalt' , dependencies : expat ) )
endif
2020-01-23 13:12:15 +01:00
selinux = dependency ( 'libselinux' , version : '>=2.0.86' , required : get_option ( 'selinux' ) )
# the selinux code creates threads which requires libpthread even on linux
# TODO: smcv: actually we've stopped doing that. We still include <pthread.h> in
# selinux.c (but probably shouldn't), and we don't actually create the thread;
# so this can probably be simplified.
config . set ( 'HAVE_SELINUX' , selinux . found ( ) and threads . found ( ) )
apparmor = dependency ( 'libapparmor' , version : '>=2.8.95' , required : get_option ( 'apparmor' ) )
config . set ( 'HAVE_APPARMOR' , apparmor . found ( ) )
config . set ( 'HAVE_APPARMOR_2_10' , apparmor . version ( ) . version_compare ( '>=2.10' ) )
if get_option ( 'inotify' ) . disabled ( )
use_inotify = false
else
2022-07-15 11:42:11 +01:00
use_inotify = cc . has_header ( 'sys/inotify.h' , args : compile_args_c )
2020-01-23 13:12:15 +01:00
if get_option ( 'inotify' ) . enabled ( ) and not use_inotify
error ( 'inotify support requested but not found' )
endif
endif
2025-08-16 16:01:06 -07:00
if get_option ( 'epoll' ) . disabled ( ) or ( get_option ( 'epoll' ) . auto ( ) and ( host_os != 'linux' ) )
2020-01-23 13:12:15 +01:00
use_linux_epoll = false
else
use_linux_epoll = (
2022-07-15 11:42:11 +01:00
cc . has_header ( 'sys/epoll.h' , args : compile_args_c ) and
cc . has_function (
'epoll_create1' ,
prefix : '#include <sys/epoll.h>' ,
args : compile_args_c ,
)
2020-01-23 13:12:15 +01:00
)
if get_option ( 'epoll' ) . enabled ( ) and not use_linux_epoll
error ( 'epoll support requested but not found' )
endif
endif
config . set ( 'DBUS_HAVE_LINUX_EPOLL' , use_linux_epoll )
if get_option ( 'kqueue' ) . disabled ( )
use_kqueue = false
else
use_kqueue = (
2022-07-15 11:42:11 +01:00
cc . has_header ( 'sys/event.h' , args : compile_args_c ) and
cc . has_function (
'kqueue' ,
prefix : '#include <sys/event.h>' ,
args : compile_args_c ,
)
2020-01-23 13:12:15 +01:00
)
if get_option ( 'kqueue' ) . enabled ( ) and not use_kqueue
error ( 'kqueue support requested but not found' )
endif
endif
if get_option ( 'launchd' ) . disabled ( )
use_launchd = false
else
launchctl = find_program ( 'launchctl' , required : get_option ( 'launchd' ) )
2022-07-15 11:42:11 +01:00
use_launchd = cc . has_header ( 'launch.h' , args : compile_args_c ) and launchctl . found ( )
2020-01-23 13:12:15 +01:00
if get_option ( 'launchd' ) . enabled ( ) and not use_launchd
error ( 'launchd support requested but not found' )
endif
endif
2024-07-21 14:24:13 +02:00
config . set ( 'DBUS_ENABLE_LAUNCHD' , use_launchd )
2020-01-23 13:12:15 +01:00
if use_launchd
launchd_agent_dir = get_option ( 'launchd_agent_dir' )
if launchd_agent_dir == ''
launchd_agent_dir = '/Library/LaunchAgents'
endif
endif
systemd = dependency ( 'libsystemd' , version : '>=209' , required : get_option ( 'systemd' ) )
use_systemd = systemd . found ( )
config . set ( 'HAVE_SYSTEMD' , use_systemd )
if use_systemd
# If not found in $PATH, we might still have systemd and systemctl at runtime
# (perhaps dbus is being compiled in a minimal chroot with no systemd).
# Assume the upstream-recommended location. Distributors with split /usr
# can override this with --native-file (see https://mesonbuild.com/Machine-files.html)
systemctl = find_program ( 'systemctl' , required : false )
if systemctl . found ( )
systemctl = systemctl . full_path ( )
else
systemctl = '/usr/bin/systemctl'
endif
systemd_system_unitdir = get_option ( 'systemd_system_unitdir' )
systemd_user_unitdir = get_option ( 'systemd_user_unitdir' )
systemd_dirs = dependency ( 'systemd' , required : false )
if systemd_system_unitdir == ''
systemd_system_unitdir = ( systemd_dirs . found ( )
? systemd_dirs . get_variable ( pkgconfig : 'systemdsystemunitdir' )
: '/lib/systemd/system'
)
endif
if systemd_user_unitdir == ''
systemd_user_unitdir = ( systemd_dirs . found ( )
? systemd_dirs . get_variable ( pkgconfig : 'systemduserunitdir' )
: '/usr/lib/systemd/user'
)
endif
else
systemctl = ''
endif
data_config . set ( 'SYSTEMCTL' , systemctl )
2024-12-20 10:53:28 -06:00
elogind_opt = get_option ( 'elogind' )
if use_systemd
if elogind_opt . enabled ( )
error ( '-Dsystemd and -Delogind are mutually exclusive' )
endif
elogind = dependency ( '' , required : false )
else
elogind = dependency ( 'libelogind' , version : '>=209' , required : elogind_opt )
endif
use_elogind = elogind . found ( )
config . set ( 'HAVE_ELOGIND' , use_elogind )
2020-01-23 13:12:15 +01:00
meson: Introduce message_bus and tools command line option
To make the consume libdbus via Meson's subproject use case more useful,
introduce message_bus and tools command line options which control if
the D-Bus daemon and/or the tools are build. The idea here is that
depending projects are interested only in the library.
The strong recommendation is only to build libdbus as static library:
libdbus_dep = dependency(
'dbus-1',
required: get_option('libdbus'),
fallback: ['dbus', 'libdbus_dep'],
default_options: [
'default_library=static',
'embedded_tests=false',
'message_bus=false',
'modular_tests=disabled',
'tools=false',
],
)
This ensures that any installed D-Bus infrastructure on the target
system is not overwritten.
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2022-11-24 09:17:45 +01:00
use_traditional_activation = message_bus and get_option ( 'traditional_activation' )
2020-01-23 13:12:15 +01:00
config . set ( 'ENABLE_TRADITIONAL_ACTIVATION' , use_traditional_activation )
if not ( use_systemd or use_traditional_activation )
warning ( 'Traditional activation and systemd activation are both disabled, '
+ 'so service activation (automatically starting services that '
+ 'receive messages) will not work' )
endif
have_console_owner_file = false
console_owner_file = get_option ( 'solaris_console_owner_file' )
2025-08-12 15:00:14 -07:00
if console_owner_file == 'auto'
if platform_sunos
console_owner_file = '/dev/console'
else
console_owner_file = ''
endif
endif
2020-01-23 13:12:15 +01:00
if console_owner_file != ''
2025-08-16 15:37:51 -07:00
if not platform_sunos
error ( 'solaris_console_owner_file is only supported on Solaris or illumos' )
2020-01-23 13:12:15 +01:00
endif
have_console_owner_file = true
endif
2025-08-12 15:00:14 -07:00
2020-01-23 13:12:15 +01:00
config . set ( 'HAVE_CONSOLE_OWNER_FILE' , have_console_owner_file )
config . set_quoted ( 'DBUS_CONSOLE_OWNER_FILE' , console_owner_file )
if get_option ( 'libaudit' ) . disabled ( )
have_libaudit = false
else
libaudit = cc . find_library ( 'audit' , required : false )
libaudit_ok = cc . has_function ( 'audit_log_user_avc_message' , dependencies : libaudit )
cap_ng = cc . find_library ( 'cap-ng' , required : false )
cap_ng_ok = cc . has_function ( 'capng_clear' , dependencies : cap_ng )
have_libaudit = libaudit_ok and cap_ng_ok
if get_option ( 'libaudit' ) . enabled ( ) and not have_libaudit
error ( 'libaudit support requested but not found' )
endif
2023-03-20 01:48:06 +00:00
# For the systemd system unit
data_config . set ( 'AMBIENT_CAPS' , 'AmbientCapabilities=CAP_AUDIT_WRITE' )
2020-01-23 13:12:15 +01:00
endif
config . set ( 'HAVE_LIBAUDIT' , have_libaudit )
if have_libaudit
selinux = [ selinux , libaudit , cap_ng ]
endif
# Check for ADT API (Solaris Basic Security Mode auditing)
adt_api_check = cc . compiles ( '' '
#include <bsm/adt.h>
int main ( ) {
2024-10-07 17:13:53 -07:00
int adt_user_context = ADT_USER ;
2020-01-23 13:12:15 +01:00
return 0 ;
}
2022-07-15 11:42:11 +01:00
'' ' , args : compile_args_c )
2020-01-23 13:12:15 +01:00
config . set ( 'HAVE_ADT' , adt_api_check )
if adt_api_check
adt_libs = cc . find_library ( 'bsm' )
else
adt_libs = dependency ( '' , required : false )
endif
# Check for SCM_RIGHTS
has_scm_rights = cc . compiles ( '' '
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
int main ( ) {
static int x = SCM_RIGHTS ;
return 0 ;
}
2022-07-15 11:42:11 +01:00
'' ' , args : compile_args_c )
2020-01-23 13:12:15 +01:00
config . set ( 'HAVE_UNIX_FD_PASSING' , has_scm_rights )
2022-06-28 13:23:31 +01:00
valgrind = dependency (
'valgrind' ,
version : '>=3.6' ,
required : get_option ( 'valgrind' ) ,
)
2020-01-23 13:12:15 +01:00
config . set ( 'WITH_VALGRIND' , valgrind . found ( ) )
if platform_win32ce
network_libs = [
cc . find_library ( 'ws2' ) ,
]
elif platform_windows
network_libs = [
cc . find_library ( 'ws2_32' ) ,
cc . find_library ( 'iphlpapi' ) ,
cc . find_library ( 'dbghelp' ) ,
]
else
network_libs = [ ]
endif
2024-11-29 11:46:32 +00:00
# socket(), socketpair() might be in -lsocket, for example on older Solaris
foreach function : [ 'socket' , 'socketpair' ]
if not cc . has_function (
function ,
args : compile_args_c ,
dependencies : network_libs ,
)
socket_lib = cc . find_library ( 'socket' , required : false )
if socket_lib . found ( ) and cc . has_function (
function ,
args : compile_args_c ,
dependencies : network_libs + [ socket_lib ] ,
)
network_libs + = [ socket_lib ]
break
endif
endif
endforeach
2020-01-23 13:12:15 +01:00
if get_option ( 'x11_autolaunch' ) . disabled ( )
use_x11_autolaunch = false
2022-06-24 17:53:12 +01:00
x11 = not_found
2020-01-23 13:12:15 +01:00
else
if get_option ( 'x11_autolaunch' ) . enabled ( ) and platform_windows
error ( 'X11 autolaunch is not supported on Windows' )
endif
x11 = dependency ( 'x11' , required : false )
use_x11_autolaunch = x11 . found ( )
if get_option ( 'x11_autolaunch' ) . enabled ( ) and not use_x11_autolaunch
error ( 'X11 autolaunch support requested but not found' )
endif
endif
config . set ( 'DBUS_BUILD_X11' , use_x11_autolaunch )
config . set ( 'DBUS_ENABLE_X11_AUTOLAUNCH' , use_x11_autolaunch )
On 32-bit glibc, define _TIME_BITS to 64 if not already defined
On older 32-bit architectures such as i386, this redefines time_t to be
64-bit, and correspondingly increases the size of all system data
structures that contain a time_t, such as struct timeval and struct stat.
This is necessary to allow timestamps beyond January 2038 to be
represented; as well as things that obviously deal with timestamps,
this affects functions like stat() (and therefore our wrapper
_dbus_stat()), which will fail with EOVERFLOW if asked to inspect a
file whose correct timestamp does not fit in time_t.
In particular, if the modification or access timestamp on
/etc/machine-id has somehow been set to a post-2038 time, libdbus will
consider the inability to stat() that file to be an installation error,
and when using the deprecated dbus_get_local_machine_id(), that can
cause third-party i386 software such as the Steam client to crash.
Using 64-bit timestamps avoids that failure mode.
Using 64-bit timestamps in glibc is an opt-in and not the default,
because if done carelessly it can change libraries' ABIs. However,
libdbus is careful not to include system headers and system data
types in its own headers, with the only exceptions being extremely
basic ISO C headers like <stddef.h> and <stdarg.h>; so we can safely
do this without it breaking our ABI. This is similar to the reasoning
for why commit 96ffc2a0 "configure.ac: support large-file for stat64"
was a safe change.
This change only affects glibc. Some non-GNU operating system libraries
(such as musl) are less concerned with binary backwards compatibility
than glibc, and therefore have incompatibly changed their ABI on 32-bit
platforms to switch to 64-bit timestamps throughout; no action is needed
on those platforms. If other non-GNU OS libraries have taken a route
similar to GNU's, then maintainers of those operating systems are
welcome to send tested merge requests similar to this one.
An extra subtlety here is that _TIME_BITS=64 requires
_FILE_OFFSET_BITS=64. In the Meson build, Meson unconditionally enables
_FILE_OFFSET_BITS=64 where appropriate, and in the Autotools build,
we already had that via AC_SYS_LARGEFILE, but in the CMake build we
did not necessarily have this; so we also define _FILE_OFFSET_BITS=64
there if necessary, as a continuation of commit 96ffc2a0
"configure.ac: support large-file for stat64".
On newer 32-bit architectures like x32, time_t is always 64-bit and so
this has no practical effect.
On 64-bit, setting these would have no practical effect, but to minimize
risk I'm only doing this for 32-bit architectures.
Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/465
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-07 20:19:17 +01:00
# Opt-in to large timestamp support, which we know doesn't break libdbus ABI:
# https://gitlab.freedesktop.org/dbus/dbus/-/issues/465
# Meson does the equivalent for large offsets and inode numbers automatically.
if (
cc . has_header_symbol ( 'time.h' , '__GLIBC__' , args : compile_args_c )
and not cc . has_header_symbol ( 'time.h' , '_TIME_BITS' , args : compile_args_c )
and cc . sizeof ( 'void *' ) == 4
)
config . set ( '_TIME_BITS' , '64' )
endif
2023-08-07 15:46:52 +02:00
# keep CMakeLists.txt in sync
2020-01-23 13:12:15 +01:00
check_functions = [
'accept4' ,
'clearenv' ,
'closefrom' ,
'close_range' ,
'fpathconf' ,
'getgrouplist' ,
'getpeereid' ,
'getpeerucred' ,
'getpwnam_r' ,
'getrandom' ,
'getresuid' ,
'getrlimit' ,
'inotify_init1' ,
'issetugid' ,
'localeconv' ,
'nanosleep' ,
'pipe2' ,
'poll' ,
'prctl' ,
'prlimit' ,
'raise' ,
'setenv' ,
'setlocale' ,
'setresuid' ,
'setrlimit' ,
'socketpair' ,
'unsetenv' ,
'usleep' ,
]
foreach function : check_functions
macro = 'HAVE_' + function . underscorify ( ) . to_upper ( )
2024-11-29 11:46:32 +00:00
config . set (
macro ,
cc . has_function (
function ,
args : compile_args_c ,
dependencies : network_libs ,
) ? 1 : false ,
)
2020-01-23 13:12:15 +01:00
endforeach
2023-08-07 15:46:52 +02:00
# keep CMakeLists.txt in sync
2020-01-23 13:12:15 +01:00
check_headers = [
2022-02-09 14:48:43 +04:00
'afunix.h' ,
2020-01-23 13:12:15 +01:00
'alloca.h' ,
'byteswap.h' ,
'crt_externs.h' ,
'dirent.h' ,
'errno.h' ,
'inttypes.h' ,
2022-07-08 19:47:34 +04:00
'io.h' ,
2020-01-23 13:12:15 +01:00
'linux/close_range.h' ,
2023-03-20 01:40:20 +00:00
'linux/magic.h' ,
2020-01-23 13:12:15 +01:00
'locale.h' ,
'signal.h' ,
sysdeps: Use C11 stdatomic.h where possible
On Unix, dbus has historically used gcc-specific lock-free atomic
intrinsics where available, falling back to a pthreads mutex where
possible. Meanwhile, on Windows, it has historically used
InterlockedIncrement() and similar library functions (in practice
wrappers around lock-free intrinsics on real Windows, but IPC calls into
wineserver on Wine).
ISO C11 provides a new header, stdatomic.h, with standardized support
for atomic operations. Exactly how these are implemented is a compiler
quality-of-implementation decision, but any reasonable compiler
implementation on a modern CPU should be using intrinsics. Let's use
this wherever possible, falling back to our old implementation only if
the C11 implementation is unsupported.
One concrete benefit that we get from this is that when compiling with
mingw-w64 gcc and running via Wine, this makes atomic reference counting
operations into a simple local operation, rather than IPC to wineserver
which can be very slow. This should make our CI tests considerably more
reliable.
In all vaguely modern gcc versions (gcc 5.5 or later) and in contemporary
versions of clang, the default compiler mode is C11 or later with GNU
extensions. We intentionally do not ask for any specific C standard, so
we can use C11 features like this one, as long as we do so conditionally.
The Microsoft Visual C compiler does not currently support this without
special options, so we still use the Interlocked family of functions
when compiling for Windows with MSVC.
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-14 19:53:11 +01:00
'stdatomic.h' ,
2020-01-23 13:12:15 +01:00
'syslog.h' ,
'sys/prctl.h' ,
'sys/random.h' ,
'sys/resource.h' ,
'sys/syscall.h' ,
'sys/time.h' ,
2025-03-13 11:27:21 +03:00
'sys/ucred.h' ,
2023-03-20 01:40:20 +00:00
'sys/vfs.h' ,
2020-01-23 13:12:15 +01:00
'unistd.h' ,
'ws2tcpip.h' ,
]
foreach header : check_headers
macro = 'HAVE_' + header . underscorify ( ) . to_upper ( )
2024-01-04 17:45:46 +01:00
config . set ( macro , cc . check_header ( header , args : compile_args_c ) ? 1 : false )
2020-01-23 13:12:15 +01:00
endforeach
execinfo = cc . find_library ( 'execinfo' , required : false )
2022-07-15 11:42:11 +01:00
have_backtrace = ( cc . has_header ( 'execinfo.h' , args : compile_args_c )
and cc . has_function ( 'backtrace' , dependencies : execinfo , args : compile_args_c )
2020-01-23 13:12:15 +01:00
)
config . set ( 'HAVE_BACKTRACE' , have_backtrace )
2022-06-28 12:30:55 +01:00
# Can't use cc.has_function here because atomic operations are not
# exactly functions
config . set10 (
'DBUS_USE_SYNC' ,
cc . links ( '' '
int main ( void )
{
int a = 4 ;
int b = __sync_sub_and_fetch ( & a , 4 ) ;
return b ;
}
2022-07-15 11:42:11 +01:00
'' ' , args : compile_args_c )
2022-06-28 12:30:55 +01:00
)
2020-01-23 13:12:15 +01:00
2022-07-15 11:42:11 +01:00
config . set10 (
'HAVE_DECL_ENVIRON' ,
cc . has_header_symbol ( 'unistd.h' , 'environ' , args : compile_args_c ) ,
)
2022-06-28 12:42:09 +01:00
config . set10 ( 'HAVE_DECL_LOG_PERROR' ,
2022-07-15 11:42:11 +01:00
cc . has_header_symbol ( 'syslog.h' , 'LOG_PERROR' , args : compile_args_c ) ,
2022-06-28 12:42:09 +01:00
)
2022-06-28 12:28:08 +01:00
config . set10 ( 'HAVE_DECL_MSG_NOSIGNAL' ,
2022-07-15 11:42:11 +01:00
cc . has_header_symbol (
'sys/socket.h' ,
'MSG_NOSIGNAL' ,
args : compile_args_c ,
) ,
2020-01-23 13:12:15 +01:00
)
config . set ( 'HAVE_SOCKLEN_T' ,
2022-07-15 11:42:11 +01:00
cc . has_type (
'socklen_t' ,
prefix : '#include <sys/socket.h>' ,
args : compile_args_c ,
)
2020-01-23 13:12:15 +01:00
)
config . set ( 'HAVE_CMSGCRED' ,
2022-07-15 11:42:11 +01:00
cc . has_type (
'struct cmsgcred' ,
prefix : '#include <sys/socket.h>' ,
args : compile_args_c ,
)
2020-01-23 13:12:15 +01:00
)
config . set ( 'HAVE_WRITEV' ,
2022-07-15 11:42:11 +01:00
cc . has_header_symbol (
'sys/uio.h' ,
'writev' ,
args : compile_args_c ,
)
2020-01-23 13:12:15 +01:00
)
config . set ( 'HAVE_UNPCBID' ,
2022-07-15 11:42:11 +01:00
cc . has_member (
'struct unpcbid' ,
'unp_pid' ,
prefix : '#include <sys/un.h>' ,
args : compile_args_c ,
)
2020-01-23 13:12:15 +01:00
)
2023-03-20 01:40:20 +00:00
config . set ( 'HAVE_FSTATFS' ,
cc . has_function (
'fstatfs' ,
prefix : '#include <sys/vfs.h>' ,
args : compile_args_c ,
)
)
2020-01-23 13:12:15 +01:00
2023-03-20 02:00:51 +00:00
config . set10 ( 'HAVE_DECL_SYS_PIDFD_OPEN' ,
cc . has_header_symbol (
'sys/syscall.h' ,
'SYS_pidfd_open' ,
args : compile_args_c ,
)
)
2020-01-23 13:12:15 +01:00
###############################################################################
# Project options
2022-07-15 12:13:43 +01:00
warning_args = [ ]
link_args = [ ]
2020-01-23 13:12:15 +01:00
# Verbose mode
verbose_mode = get_option ( 'verbose_mode' )
config . set ( 'DBUS_ENABLE_VERBOSE_MODE' , verbose_mode )
# Asserts defaults to developer mode
asserts = get_option ( 'asserts' )
config . set ( 'DBUS_ENABLE_ASSERT' , asserts ? 1 : false )
config . set ( 'DBUS_DISABLE_ASSERT' , not asserts ? 1 : false )
# -rdynamic is needed for glibc's backtrace_symbols to work.
# No clue how much overhead this adds, but it's useful
# to do this on any assertion failure,
# so for now it's enabled anytime asserts are (currently not
# in production builds).
# To get -rdynamic you pass -export-dynamic to libtool.
config . set ( 'DBUS_BUILT_R_DYNAMIC' , asserts ? 1 : false )
if asserts
link_args + = '-export-dynamic'
endif
if not asserts
2022-07-15 12:13:43 +01:00
warning_args + = [
2020-01-23 13:12:15 +01:00
'-Wno-unused-function' ,
]
endif
checks = get_option ( 'checks' )
config . set ( 'DBUS_ENABLE_CHECKS' , checks ? 1 : false )
config . set ( 'DBUS_DISABLE_CHECKS' , not checks ? 1 : false )
config . set ( 'G_DISABLE_CHECKS' , not checks ? 1 : false )
2022-06-28 12:50:06 +01:00
config . set ( 'HAVE_GIO_UNIX' , have_gio_unix ? 1 : false )
2022-06-28 12:50:32 +01:00
# Ignore post-2.38 deprecations, prevent use of post-2.44 APIs.
2023-01-02 17:10:19 +01:00
# keep in sync with CMakeLists.txt
2022-06-28 12:50:32 +01:00
config . set ( 'GLIB_VERSION_MIN_REQUIRED' , 'GLIB_VERSION_2_38' )
config . set ( 'GLIB_VERSION_MAX_ALLOWED' , 'G_ENCODE_VERSION(2,44)' )
2020-01-23 13:12:15 +01:00
2023-06-06 13:07:04 +01:00
if not checks
warning_args + = [
'-Wno-unused-label' ,
]
endif
if not ( asserts and checks )
warning_args + = [
'-Wno-unused-but-set-variable' ,
'-Wno-unused-variable' ,
]
endif
2022-07-08 19:29:06 +04:00
windows_output_debug = get_option ( 'windows_output_debug_string' )
config . set ( 'DBUS_USE_OUTPUT_DEBUG_STRING' , windows_output_debug )
meson: Introduce message_bus and tools command line option
To make the consume libdbus via Meson's subproject use case more useful,
introduce message_bus and tools command line options which control if
the D-Bus daemon and/or the tools are build. The idea here is that
depending projects are interested only in the library.
The strong recommendation is only to build libdbus as static library:
libdbus_dep = dependency(
'dbus-1',
required: get_option('libdbus'),
fallback: ['dbus', 'libdbus_dep'],
default_options: [
'default_library=static',
'embedded_tests=false',
'message_bus=false',
'modular_tests=disabled',
'tools=false',
],
)
This ensures that any installed D-Bus infrastructure on the target
system is not overwritten.
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2022-11-24 09:17:45 +01:00
# Controls whether the tools are built.
tools = get_option ( 'tools' )
2024-12-09 17:45:32 +00:00
# DBUS_ENABLE_INTRUSIVE_TESTS controls unit tests built in to .c files
2020-01-23 13:12:15 +01:00
# and some stuff in the test/ subdir.
2024-12-09 17:45:32 +00:00
intrusive_tests = get_option ( 'intrusive_tests' )
config . set ( 'DBUS_ENABLE_INTRUSIVE_TESTS' , intrusive_tests )
# An older name for the same thing
config . set ( 'DBUS_ENABLE_EMBEDDED_TESTS' , intrusive_tests )
2020-01-23 13:12:15 +01:00
# DBUS_ENABLE_MODULAR_TESTS controls tests that work based on public API.
# These use GTest, from GLib, because life's too short. They're enabled by
# default (unless you don't have GLib), because they don't bloat the library
# or binaries.
dbus_enable_modular_tests = (
2022-06-23 20:03:47 +01:00
not get_option ( 'modular_tests' ) . disabled ( )
2020-01-23 13:12:15 +01:00
and glib . version ( ) . version_compare ( '>=2.40' )
and gio . found ( )
)
###############################################################################
# Paths and directories
docs_dir = get_option ( 'datadir' ) / 'doc' / 'dbus'
2022-06-24 13:17:26 +01:00
# TODO: If a future Meson version gets a runstatedir option, try both.
# https://github.com/mesonbuild/meson/issues/4141
runstatedir = get_option ( 'runtime_dir' )
if runstatedir == ''
if get_option ( 'prefix' ) == '/usr'
runstatedir = '/run'
else
runstatedir = get_option ( 'localstatedir' ) / 'run'
endif
endif
2022-06-24 12:47:25 +01:00
data_config . set ( 'EXPANDED_LOCALSTATEDIR' , get_option ( 'prefix' ) / get_option ( 'localstatedir' ) )
data_config . set ( 'EXPANDED_SYSCONFDIR' , get_option ( 'prefix' ) / get_option ( 'sysconfdir' ) )
2022-06-24 13:17:26 +01:00
data_config . set ( 'EXPANDED_RUNSTATEDIR' , get_option ( 'prefix' ) / runstatedir )
2020-01-23 13:12:15 +01:00
data_config . set ( 'EXPANDED_BINDIR' , get_option ( 'prefix' ) / get_option ( 'bindir' ) )
data_config . set ( 'EXPANDED_DATADIR' , get_option ( 'prefix' ) / get_option ( 'datadir' ) )
data_config . set ( 'DBUS_PREFIX' , get_option ( 'prefix' ) )
config . set_quoted ( 'DBUS_PREFIX' , get_option ( 'prefix' ) )
config . set_quoted ( 'DBUS_BINDIR' , get_option ( 'prefix' ) / get_option ( 'bindir' ) )
config . set_quoted ( 'DBUS_DATADIR' , get_option ( 'prefix' ) / get_option ( 'datadir' ) )
data_config . set ( 'DBUS_LIBEXECDIR' , get_option ( 'prefix' ) / get_option ( 'libexecdir' ) )
config . set_quoted ( 'DBUS_RUNSTATEDIR' ,
2022-06-24 13:17:26 +01:00
get_option ( 'prefix' ) / runstatedir
2020-01-23 13:12:15 +01:00
)
config . set_quoted ( 'DBUS_MACHINE_UUID_FILE' ,
2022-06-24 12:47:58 +01:00
get_option ( 'prefix' ) / get_option ( 'localstatedir' ) / 'lib' / 'dbus' / 'machine-id'
2020-01-23 13:12:15 +01:00
)
config . set_quoted ( 'DBUS_SYSTEM_CONFIG_FILE' ,
get_option ( 'prefix' ) / get_option ( 'datadir' ) / 'dbus-1' / 'system.conf'
)
config . set_quoted ( 'DBUS_SESSION_CONFIG_FILE' ,
get_option ( 'prefix' ) / get_option ( 'datadir' ) / 'dbus-1' / 'session.conf'
)
system_socket = get_option ( 'system_socket' )
if system_socket == ''
2022-06-24 12:47:25 +01:00
system_socket = (
2021-06-18 21:20:21 -04:00
get_option ( 'prefix' ) / runstatedir / 'dbus' / 'system_bus_socket'
2022-06-24 12:47:25 +01:00
)
2020-01-23 13:12:15 +01:00
endif
2022-05-18 16:13:36 +01:00
# This check assumes that the disposition of /run and /var/run on the
# system where we're building is the same as on the system we're building
# for, so we can't usefully do this check if we're building for Windows,
# or if we're cross-building for Unix on a Windows machine.
#
# The check is shared between Autotools, CMake and Meson.
# Because we only run it on Unix, it's fine to make it a shell script.
if platform_unix and build_machine . system ( ) != 'windows'
msg = run_command (
find_program ( 'tools/check-runstatedir.sh' ) ,
system_socket ,
check : false ,
) . stdout ( )
if msg != ''
warning ( msg )
endif
endif
2020-01-23 13:12:15 +01:00
data_config . set ( 'DBUS_SYSTEM_SOCKET' , system_socket )
## System bus only listens on local domain sockets, and never
## on an abstract socket (so only root can create the socket).
##
## This won't work on Windows. It's not meant to - the system bus is
## meaningless on Windows anyway.
##
## This has to be suitable for hard-coding in client libraries as well as
## in the dbus-daemon's configuration, so it has to be valid to listen on
## and also to connect to. If this ever changes, it'll need to be split into
## two variables, one for the listening address and one for the connecting
## address.
system_bus_default_address = 'unix:path=@0@' . format ( system_socket )
data_config . set ( 'DBUS_SYSTEM_BUS_DEFAULT_ADDRESS' , system_bus_default_address )
config . set_quoted ( 'DBUS_SYSTEM_BUS_DEFAULT_ADDRESS' , system_bus_default_address )
system_pid_file = get_option ( 'system_pid_file' )
if system_pid_file == ''
2022-06-24 13:17:26 +01:00
system_pid_file = get_option ( 'prefix' ) / runstatedir / 'dbus' / 'pid'
2020-01-23 13:12:15 +01:00
endif
data_config . set ( 'DBUS_SYSTEM_PID_FILE' , system_pid_file )
dbus_user = get_option ( 'dbus_user' )
data_config . set ( 'DBUS_USER' , dbus_user )
config . set_quoted ( 'DBUS_USER' , dbus_user )
test_user = get_option ( 'test_user' )
config . set_quoted ( 'DBUS_TEST_USER' , test_user )
daemon_dir = get_option ( 'dbus_daemondir' )
if daemon_dir == ''
daemon_dir = get_option ( 'prefix' ) / get_option ( 'bindir' )
endif
data_config . set ( 'DBUS_DAEMONDIR' , daemon_dir )
config . set_quoted ( 'DBUS_DAEMONDIR' , daemon_dir )
# Relocation is disabled by default, let's check if we need to enable it
relocation = false
if get_option ( 'relocation' ) . enabled ( )
# Manually forced at true
relocation = true
endif
if get_option ( 'relocation' ) . auto ( ) and platform_windows
# By default, on Windows we are relocatable if possible
relocation = true
endif
# Now check if it's not possible
# Meson does not separate exec_prefix and prefix (hopefully)
if relocation and not ( get_option ( 'libdir' ) in [ 'lib' , 'lib64' , ] )
message = (
'Relocatable pkg-config metadata requires default libdir, '
+ 'not @0@' . format ( get_option ( 'libdir' ) )
)
if get_option ( 'relocation' ) . enabled ( )
error ( message )
else
warning ( message )
endif
endif
#### Directory to source sysconfdir configuration from
# On Windows this is relative to where we put the bus setup, in
# ${datadir}/dbus-1. For simplicity, we only do this if
# ${sysconfdir} = ${prefix}/etc and ${datadir} = ${prefix}/share.
#
# On Unix, or on Windows with weird install layouts, it's the absolute path.
if ( platform_windows
and data_config . get ( 'EXPANDED_SYSCONFDIR' ) == get_option ( 'prefix' ) / 'etc'
and data_config . get ( 'EXPANDED_DATADIR' ) == get_option ( 'prefix' ) / 'share'
)
sysconfdir_from_pkgdatadir = '../../etc'
datadir_from_pkgsysconfdir = '../../share'
else
sysconfdir_from_pkgdatadir = data_config . get ( 'EXPANDED_SYSCONFDIR' )
datadir_from_pkgsysconfdir = data_config . get ( 'EXPANDED_DATADIR' )
endif
data_config . set ( 'SYSCONFDIR_FROM_PKGDATADIR' , sysconfdir_from_pkgdatadir )
data_config . set ( 'DATADIR_FROM_PKGSYSCONFDIR' , datadir_from_pkgsysconfdir )
2025-04-28 13:26:56 +01:00
if platform_unix
2025-04-28 13:36:17 +01:00
session_socket_dir = get_option ( 'session_socket_dir' )
if session_socket_dir == ''
build: Don't use build-time TMPDIR, TEMP, TMP as socket directory
When the ancestor of this code was introduced in 2003 (commit e45e4382),
it was presumably most common to have these variables either unset, or
set to a value that is system-wide and remains valid in the long term,
such as /tmp or /var/tmp.
However, on modern systems they are sometimes set to a value that is
itself temporary, for example /var/folders/${some_long_path}/T on macOS,
or user-specific, for example /tmp/user/$(id -u) on Linux with
libpam-tmpdir. These values are certainly not useful to hard-code into
libdbus and dbus-daemon during installation: they will not be usable
when running dbus-related programs after a reboot or as a different user.
So, instead of assuming TMPDIR, TEMP and TMP remain valid long-term,
we now hard-code /tmp as our default.
As before, system integrators can override this default with
`-Dsession_socket_dir=...` (Meson) or `-DDBUS_SESSION_SOCKET_DIR=...`
(CMake) if a different directory is more appropriate than /tmp.
However, system integrators should note that because AF_UNIX paths have
a relatively short length limit (typically 108 bytes), a short path is
better than a long path in this context.
Resolves: dbus/dbus#551
Signed-off-by: Simon McVittie <smcv@collabora.com>
2025-04-28 14:06:39 +01:00
session_socket_dir = '/tmp'
2025-04-28 13:36:17 +01:00
endif
config . set_quoted ( 'DBUS_SESSION_SOCKET_DIR' , session_socket_dir )
2025-04-28 13:26:56 +01:00
test_socket_dir = get_option ( 'test_socket_dir' )
if test_socket_dir == ''
2025-04-28 13:43:56 +01:00
test_socket_dir = session_socket_dir
2025-04-28 13:26:56 +01:00
endif
config . set_quoted ( 'DBUS_TEST_SOCKET_DIR' , test_socket_dir )
test_listen = 'unix:tmpdir=' + test_socket_dir
else
test_listen = 'tcp:host=localhost'
2020-01-23 13:12:15 +01:00
endif
config . set_quoted ( 'TEST_LISTEN' , test_listen )
data_config . set ( 'TEST_LISTEN' , test_listen )
2022-06-24 12:51:12 +01:00
# This must be a listening address. It doesn't necessarily need to be an
# address you can connect to - it can be something vague like
# "nonce-tcp:".
2020-01-23 13:12:15 +01:00
session_bus_listen_address = get_option ( 'dbus_session_bus_listen_address' )
if session_bus_listen_address == ''
if platform_windows
2022-06-24 12:51:12 +01:00
# On Windows, you can (and should) listen on autolaunch addresses,
# because autolaunching is not the same as X11 autolaunching.
2020-01-23 13:12:15 +01:00
session_bus_listen_address = 'autolaunch:'
elif use_launchd
2022-06-24 12:51:12 +01:00
# macOS default is to use launchd
2020-01-23 13:12:15 +01:00
session_bus_listen_address = 'launchd:env=DBUS_LAUNCHD_SESSION_BUS_SOCKET'
else
2022-06-24 12:51:12 +01:00
# The default on all other Unix platforms (notably Linux)
# is to create a randomly named socket in /tmp or similar
2020-01-23 13:12:15 +01:00
session_bus_listen_address = 'unix:tmpdir=@0@' . format ( session_socket_dir )
endif
endif
data_config . set ( 'DBUS_SESSION_BUS_LISTEN_ADDRESS' , session_bus_listen_address )
2022-06-24 12:51:12 +01:00
# This must be an address you can connect to. It doesn't necessarily
# need to be an address you can listen on - it can be "autolaunch:",
# even on Unix.
2020-01-23 13:12:15 +01:00
session_bus_connect_address = get_option ( 'dbus_session_bus_connect_address' )
if session_bus_connect_address == ''
session_bus_connect_address = 'autolaunch:'
endif
config . set_quoted ( 'DBUS_SESSION_BUS_CONNECT_ADDRESS' , session_bus_connect_address )
config . set ( 'DBUS_ENABLE_STATS' , get_option ( 'stats' ) )
config . set ( 'DBUS_ENABLE_CONTAINERS' , get_option ( 'containers' ) )
enable_user_session = get_option ( 'user_session' )
config . set ( 'DBUS_COMPILATION' , true )
exe_ext = platform_windows ? '.exe' : ''
config . set_quoted ( 'DBUS_EXEEXT' , exe_ext )
2022-07-15 12:13:43 +01:00
compile_warnings = [ ]
compile_warnings_c = [ ]
2020-01-23 13:12:15 +01:00
2022-07-15 12:18:04 +01:00
# -fno-common makes the linker more strict: on some systems the linker
# is *always* this strict, so we want to behave like that everywhere.
# We treat this like a warning, since that's basically how we're using it.
compile_warnings + = [ '-fno-common' ]
2020-01-23 13:12:15 +01:00
if cc . get_id ( ) == 'msvc'
2022-07-15 12:13:43 +01:00
compile_warnings + = [
2020-01-23 13:12:15 +01:00
# once
'/wo4018' , # 'expression' : signed/unsigned mismatch
# disabled
'/wd4090' , # 'operation' : different 'modifier' qualifiers
'/wd4101' , # 'identifier' : unreferenced local variable
'/wd4127' , # conditional expression is constant
'/wd4244' , # 'argument' : conversion from 'type1' to 'type2', possible loss of data
# error
'/we4002' , # too many actual parameters for macro 'identifier'
'/we4003' , # not enough actual parameters for macro 'identifier'
'/we4013' , # 'function' undefined; assuming extern returning int
'/we4028' , # formal parameter 'number' different from declaration
'/we4031' , # second formal parameter list longer than the first list
'/we4047' , # operator' : 'identifier1' differs in levels of indirection from 'identifier2'
'/we4114' , # same type qualifier used more than once
'/we4133' , # 'type' : incompatible types - from 'type1' to 'type2'
]
else
2022-07-15 12:13:43 +01:00
compile_warnings + = [
2022-07-15 12:14:45 +01:00
# These warnings are intentionally disabled:
# - missing field initializers being implicitly 0 is a feature,
# not a bug
# - -Wunused-parameter is annoying when writing callbacks that follow
# a fixed signature but do not necessarily need all of its parameters
2020-01-23 13:12:15 +01:00
'-Wno-missing-field-initializers' ,
'-Wno-unused-parameter' ,
2022-07-15 12:14:45 +01:00
2022-07-15 11:38:26 +01:00
# General warnings for both C and C++
# TODO: Some of these are probably redundant with Meson's warning_level
'-Warray-bounds' ,
'-Wcast-align' ,
2020-01-23 13:12:15 +01:00
'-Wchar-subscripts' ,
2022-07-15 11:38:26 +01:00
'-Wdouble-promotion' ,
'-Wduplicated-branches' ,
'-Wduplicated-cond' ,
2020-01-23 13:12:15 +01:00
'-Wfloat-equal' ,
2022-07-15 11:38:26 +01:00
'-Wformat-nonliteral' ,
'-Wformat-security' ,
'-Wformat=2' ,
'-Winit-self' ,
'-Winline' ,
'-Wlogical-op' ,
'-Wmissing-declarations' ,
'-Wmissing-format-attribute' ,
'-Wmissing-include-dirs' ,
'-Wmissing-noreturn' ,
'-Wnull-dereference' ,
'-Wpacked' ,
'-Wpointer-arith' ,
'-Wredundant-decls' ,
'-Wrestrict' ,
'-Wreturn-type' ,
'-Wshadow' ,
'-Wsign-compare' ,
'-Wstrict-aliasing' ,
'-Wswitch-default' ,
'-Wswitch-enum' ,
'-Wundef' ,
'-Wunused-but-set-variable' ,
'-Wwrite-strings' ,
2020-01-23 13:12:15 +01:00
]
2022-07-15 12:13:43 +01:00
compile_warnings_c + = [
2022-07-15 11:38:26 +01:00
# Extra warnings just for C
'-Wdeclaration-after-statement' ,
'-Wimplicit-function-declaration' ,
'-Wjump-misses-init' ,
'-Wmissing-prototypes' ,
'-Wnested-externs' ,
'-Wold-style-definition' ,
2020-01-23 13:12:15 +01:00
'-Wpointer-sign' ,
2022-07-15 11:38:26 +01:00
'-Wstrict-prototypes' ,
2020-01-23 13:12:15 +01:00
]
endif
2022-07-15 12:13:43 +01:00
compile_warnings_c = cc . get_supported_arguments ( compile_warnings + compile_warnings_c )
add_project_arguments ( compile_warnings_c , language : 'c' )
link_args = cc . get_supported_link_arguments ( link_args )
2022-07-25 14:30:02 +01:00
add_project_link_arguments ( link_args , language : [ 'c' ] )
if using_cpp
compile_warnings_cpp = cpp . get_supported_arguments ( compile_warnings )
add_project_arguments ( compile_warnings_cpp , language : 'cpp' )
add_project_link_arguments ( link_args , language : [ 'cpp' ] )
endif
2020-01-23 13:12:15 +01:00
root_include = include_directories ( '.' )
configure_file (
output : 'config.h' ,
configuration : config ,
)
bonus_files = files (
'AUTHORS' ,
'CONTRIBUTING.md' ,
'COPYING' ,
'NEWS' ,
'README' ,
)
2022-06-24 13:41:27 +01:00
if platform_unix
run_target (
'maintainer-update-authors' ,
command : 'maint/update-authors.sh' ,
)
endif
2020-01-23 13:12:15 +01:00
subdir ( 'dbus' )
meson: Introduce message_bus and tools command line option
To make the consume libdbus via Meson's subproject use case more useful,
introduce message_bus and tools command line options which control if
the D-Bus daemon and/or the tools are build. The idea here is that
depending projects are interested only in the library.
The strong recommendation is only to build libdbus as static library:
libdbus_dep = dependency(
'dbus-1',
required: get_option('libdbus'),
fallback: ['dbus', 'libdbus_dep'],
default_options: [
'default_library=static',
'embedded_tests=false',
'message_bus=false',
'modular_tests=disabled',
'tools=false',
],
)
This ensures that any installed D-Bus infrastructure on the target
system is not overwritten.
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2022-11-24 09:17:45 +01:00
if message_bus
subdir ( 'bus' )
endif
if tools
subdir ( 'tools' )
endif
2020-01-23 13:12:15 +01:00
subdir ( 'test' )
subdir ( 'doc' )
subdir ( 'cmake' )
meson . add_install_script ( 'meson_post_install.py' ,
'@0@' . format ( relocation ) ,
)
pkgconfig . generate (
libdbus ,
name : 'dbus' ,
filebase : 'dbus-1' ,
description : 'Free desktop message bus' ,
subdirs : [ 'dbus-1.0' ] ,
extra_cflags : [
'-I${libdir}/dbus-1.0/include' ,
] + dbus_static_flags ,
variables : {
'original_prefix' : get_option ( 'prefix' ) ,
'exec_prefix' : '${prefix}' ,
'bindir' : '${prefix}' / get_option ( 'bindir' ) ,
'datadir' : '${prefix}' / get_option ( 'datadir' ) ,
'datarootdir' : '${prefix}' / get_option ( 'datadir' ) ,
2022-06-24 12:47:25 +01:00
'sysconfdir' : '${prefix}' / get_option ( 'sysconfdir' ) ,
2020-01-23 13:12:15 +01:00
'daemondir' : '${bindir}' ,
'system_bus_default_address' : system_bus_default_address ,
'session_bus_services_dir' : '${datadir}/dbus-1/services' ,
'system_bus_services_dir' : '${datadir}/dbus-1/system-services' ,
'interfaces_dir' : '${datadir}/dbus-1/interfaces' ,
}
)
2022-06-27 15:37:17 +01:00
if meson . version ( ) . version_compare ( '>=0.60.0' )
foreach dir : install_emptydirs
install_emptydir ( dir )
endforeach
else
meson . add_install_script (
'tools/meson-compat-install-emptydirs.py' ,
':' . join ( install_emptydirs ) ,
)
endif
2022-06-27 15:12:54 +01:00
foreach symlink : install_symlinks
if not platform_unix
warning (
'Not creating symbolic link @0@/@1@ -> @2@' . format (
symlink [ 'install_dir' ] ,
symlink [ 'link_name' ] ,
symlink [ 'pointing_to' ] ,
)
)
elif meson . version ( ) . version_compare ( '>=0.61.0' )
install_symlink (
symlink [ 'link_name' ] ,
install_dir : symlink [ 'install_dir' ] ,
pointing_to : symlink [ 'pointing_to' ] ,
)
else
meson . add_install_script (
'tools/meson-compat-install-symlink.py' ,
symlink [ 'link_name' ] ,
symlink [ 'install_dir' ] ,
symlink [ 'pointing_to' ] ,
)
endif
endforeach
2020-01-23 13:12:15 +01:00
summary_dict = {
'prefix' : get_option ( 'prefix' ) ,
'exec_prefix' : get_option ( 'prefix' ) ,
'libdir' : get_option ( 'prefix' ) / get_option ( 'libdir' ) ,
'libexecdir' : get_option ( 'prefix' ) / get_option ( 'libexecdir' ) ,
'bindir' : get_option ( 'prefix' ) / get_option ( 'bindir' ) ,
'sysconfdir' : data_config . get ( 'EXPANDED_SYSCONFDIR' ) ,
'localstatedir' : data_config . get ( 'EXPANDED_LOCALSTATEDIR' ) ,
'runstatedir' : data_config . get ( 'EXPANDED_RUNSTATEDIR' ) ,
'datadir' : data_config . get ( 'EXPANDED_DATADIR' ) ,
'source code location' : meson . project_source_root ( ) ,
'compiler' : cc . get_id ( ) ,
2022-07-15 12:13:43 +01:00
'cflags' : compile_args_c + compile_warnings_c ,
2022-07-25 14:30:02 +01:00
}
if using_cpp
summary_dict + = {
'cxxflags' : compile_args_cpp + compile_warnings_cpp ,
}
endif
summary_dict + = {
2020-01-23 13:12:15 +01:00
'ldflags' : ( link_args . length ( ) == 0 ) ? '[]' : link_args ,
'64-bit int' : arch_config . get ( 'DBUS_INT64_TYPE' ) ,
'32-bit int' : arch_config . get ( 'DBUS_INT32_TYPE' ) ,
'16-bit int' : arch_config . get ( 'DBUS_INT16_TYPE' ) ,
2022-08-14 16:28:56 +00:00
'pointer size' : arch_config . get ( 'DBUS_SIZEOF_VOID_P' ) ,
2020-01-23 13:12:15 +01:00
'xsltproc' : xsltproc . found ( ) ? xsltproc . full_path ( ) : '' ,
'Doxygen' : doxygen . found ( ) ? doxygen . full_path ( ) : '' ,
'ducktype' : ducktype . found ( ) ? ducktype . full_path ( ) : '' ,
'yelp-build' : yelpbuild . found ( ) ? yelpbuild . full_path ( ) : '' ,
'gcc coverage' : get_option ( 'b_coverage' ) ,
'gcc profiling' : get_option ( 'b_pgo' ) ,
2024-12-09 17:45:32 +00:00
'Building intrusive tests' : intrusive_tests ,
2020-01-23 13:12:15 +01:00
'Building modular tests' : dbus_enable_modular_tests ,
'- with GLib' : use_glib ,
'Installing tests' : get_option ( 'installed_tests' ) ,
'Building verbose mode' : verbose_mode ,
'Building assertions' : asserts ,
'Building checks' : checks ,
'Building bus stats API' : get_option ( 'stats' ) ,
'Building container API' : get_option ( 'containers' ) ,
'Building SELinux support' : config . get ( 'HAVE_SELINUX' ) ,
'Building AppArmor support' : apparmor . found ( ) ,
'Building inotify support' : use_inotify ,
'Building kqueue support' : use_kqueue ,
'Building systemd support' : use_systemd ,
2024-12-20 10:53:28 -06:00
'Building elogind support' : use_elogind ,
2020-01-23 13:12:15 +01:00
'Traditional activation' : use_traditional_activation ,
'Building X11 code' : config . get ( 'DBUS_BUILD_X11' ) ,
'Building Doxygen docs' : doxygen . found ( ) ,
'Building Qt help file' : qt_help_generate ,
'Building Ducktype docs' : ducktype . found ( ) ,
'Building XML docs' : build_xml_docs ,
'Building launchd support' : use_launchd ,
meson: Introduce message_bus and tools command line option
To make the consume libdbus via Meson's subproject use case more useful,
introduce message_bus and tools command line options which control if
the D-Bus daemon and/or the tools are build. The idea here is that
depending projects are interested only in the library.
The strong recommendation is only to build libdbus as static library:
libdbus_dep = dependency(
'dbus-1',
required: get_option('libdbus'),
fallback: ['dbus', 'libdbus_dep'],
default_options: [
'default_library=static',
'embedded_tests=false',
'message_bus=false',
'modular_tests=disabled',
'tools=false',
],
)
This ensures that any installed D-Bus infrastructure on the target
system is not overwritten.
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2022-11-24 09:17:45 +01:00
'Building dbus-daemon' : message_bus ,
'Building tools' : tools ,
2020-01-23 13:12:15 +01:00
'System bus socket' : data_config . get ( 'DBUS_SYSTEM_SOCKET' ) ,
'System bus address' : config . get ( 'DBUS_SYSTEM_BUS_DEFAULT_ADDRESS' ) ,
'System bus PID file' : data_config . get ( 'DBUS_SYSTEM_PID_FILE' ) ,
'Session bus listens on' : data_config . get ( 'DBUS_SESSION_BUS_LISTEN_ADDRESS' ) ,
'Session clients connect to' : config . get ( 'DBUS_SESSION_BUS_CONNECT_ADDRESS' ) ,
'System bus user' : dbus_user ,
'Session bus services dir' :
get_option ( 'prefix' ) / get_option ( 'datadir' ) / 'dbus-1' / 'services' ,
}
2025-04-28 13:26:56 +01:00
if platform_unix
summary_dict + = {
'Tests socket dir' : test_socket_dir ,
}
endif
2025-08-16 15:37:51 -07:00
if platform_sunos
2020-01-23 13:12:15 +01:00
summary_dict + = {
'Console owner file' : console_owner_file ,
}
endif
summary ( summary_dict , bool_yn : true )
2024-12-09 17:45:32 +00:00
if intrusive_tests
warning ( 'building with intrusive tests increases the size of the installed library and renders it insecure.' )
2020-01-23 13:12:15 +01:00
if not asserts
2024-12-09 17:45:32 +00:00
warning ( 'building with intrusive tests but without assertions means tests may not properly report failures (this configuration is only useful when doing something like profiling the tests)' )
2020-01-23 13:12:15 +01:00
endif
endif
if get_option ( 'b_coverage' )
warning ( 'Building with coverage profiling is definitely for developers only.' )
endif
if verbose_mode
warning ( 'building with verbose mode increases library size, may slightly increase security risk, and decreases performance.' )
endif
if asserts
warning ( 'building with assertions increases library size and decreases performance.' )
endif
if not checks
warning ( 'building without checks for arguments passed to public API makes it harder to debug apps using D-Bus, but will slightly decrease D-Bus library size and _very_ slightly improve performance.' )
endif