From 7d0e660e0e2808e098ab9d4de843e9b31c64af21 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 27 Aug 2019 15:54:42 -0400 Subject: [PATCH] meson: Add dtrace support --- dix/meson.build | 14 +++++++++++++- include/meson.build | 13 ++++++++++++- meson.build | 5 +++++ meson_options.txt | 3 +++ os/meson.build | 1 + 5 files changed, 34 insertions(+), 2 deletions(-) diff --git a/dix/meson.build b/dix/meson.build index 0ed4f8210..ddc5cc392 100644 --- a/dix/meson.build +++ b/dix/meson.build @@ -33,10 +33,22 @@ srcs_dix = [ 'window.c', ] +dtrace_src = [] +if with_dtrace + dtrace_object = generator(dtrace, + output: '@BASENAME@.o', + arguments: ['-G', '-s', '@INPUT@', '-o', '@OUTPUT@'] + ) + + dtrace_src += dtrace_object.process(dtrace_tmpl) +endif + +dtrace_dep = declare_dependency(sources: [dtrace_src, dtrace_hdr]) + libxserver_dix = static_library('libxserver_dix', srcs_dix, include_directories: inc, - dependencies: common_dep, + dependencies: [ dtrace_dep, common_dep, ] ) libxserver_main = static_library('libxserver_main', diff --git a/include/meson.build b/include/meson.build index 3c72e5bbb..bb89493e1 100644 --- a/include/meson.build +++ b/include/meson.build @@ -31,7 +31,7 @@ cc.compiles(''' ''', name: 'CLOCK_MONOTONIC')) -#conf_data.set('XSERVER_DTRACE', '1') # XXX +conf_data.set('XSERVER_DTRACE', with_dtrace) if host_machine.endian() == 'little' conf_data.set('X_BYTE_ORDER', 'X_LITTLE_ENDIAN') @@ -402,6 +402,17 @@ configure_file(output : 'xwayland-config.h', input : 'xwayland-config.h.meson.in', configuration : xwayland_data) +dtrace_hdr = [] +dtrace_tmpl = files('Xserver.d') +if with_dtrace + dtrace_header = generator(dtrace, + output: '@BASENAME@-dtrace.h', + arguments: ['-h', '-s', '@INPUT@', '-o', '@OUTPUT@'] + ) + + dtrace_hdr += dtrace_header.process(dtrace_tmpl) +endif + if build_xorg install_data( [ diff --git a/meson.build b/meson.build index def32e9b9..00a7e3c86 100644 --- a/meson.build +++ b/meson.build @@ -175,6 +175,11 @@ else build_systemd_logind = get_option('systemd_logind') == 'true' endif +with_dtrace = get_option('dtrace') +if with_dtrace + dtrace = find_program('dtrace', required: true) +endif + build_xorg = false if (host_machine.system() != 'darwin' and host_machine.system() != 'windows') diff --git a/meson_options.txt b/meson_options.txt index 7d3bbe535..94a782a92 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -50,6 +50,9 @@ option('vendor_name', type: 'string', value: 'The X.Org Foundation') option('vendor_name_short', type: 'string', value: 'X.Org') option('vendor_web', type: 'string', value: 'http://wiki.x.org') +option('dtrace', type: 'boolean', value: false, + description: 'Enable dtrace hooks') + option('listen_tcp', type: 'boolean', value: false, description: 'Listen on TCP by default') option('listen_unix', type: 'boolean', value: true, diff --git a/os/meson.build b/os/meson.build index 39440a7c3..337306bcd 100644 --- a/os/meson.build +++ b/os/meson.build @@ -91,6 +91,7 @@ libxserver_os = static_library('libxserver_os', srcs_os, include_directories: inc, dependencies: [ + dtrace_dep, common_dep, dl_dep, sha1_dep,