[glib/wip/meson: 29/53] meson: add support for dtrace/systemtap
- From: Tim-Philipp Müller <tpm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/meson: 29/53] meson: add support for dtrace/systemtap
- Date: Sat, 13 May 2017 14:09:52 +0000 (UTC)
commit 4068d76eb0b499ca11257063746dd38e71db4913
Author: Tim-Philipp Müller <tim centricular com>
Date: Wed Jan 25 17:02:51 2017 +0000
meson: add support for dtrace/systemtap
Still at least one FIXME. And untested so far. It builds.
gio/meson.build | 17 +++++++++++++++++
glib/meson.build | 17 +++++++++++++++++
gobject/meson.build | 17 +++++++++++++++++
meson.build | 44 ++++++++++++++++++++++++++++++++++++++++++++
meson_options.txt | 6 ++++++
5 files changed, 101 insertions(+), 0 deletions(-)
---
diff --git a/gio/meson.build b/gio/meson.build
index 7fa3968..79c477e 100644
--- a/gio/meson.build
+++ b/gio/meson.build
@@ -681,8 +681,17 @@ install_data([
],
install_dir: join_paths(get_option('datadir'), 'bash-completion/completions'))
+if enable_dtrace
+ gio_dtrace_obj = dtrace_obj_gen.process('gio_probes.d')
+ gio_dtrace_hdr = dtrace_hdr_gen.process('gio_probes.d')
+else
+ gio_dtrace_obj = []
+ gio_dtrace_hdr = []
+endif
+
libgio = shared_library('gio-2.0',
gioenumtypes_h, gioenumtypes_c, gnetworking_h, gio_sources,
+ gio_dtrace_hdr, gio_dtrace_obj,
version : library_version,
soversion : soversion,
install : true,
@@ -802,6 +811,14 @@ if host_system != 'windows'
dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
endif
+if enable_systemtap
+ gio_stp = configure_file(input : 'gio.stp.in',
+ output : '@0@.stp'.format(libgio.full_path().split('/').get(-1)),
+ configuration : stp_cdata,
+ install_dir : tapset_install_dir,
+ install : true)
+endif
+
if host_system != 'windows'
subdir('tests')
endif
diff --git a/glib/meson.build b/glib/meson.build
index 6dc7109..026381c 100644
--- a/glib/meson.build
+++ b/glib/meson.build
@@ -199,7 +199,16 @@ else
platform_deps = []
endif
+if enable_dtrace
+ glib_dtrace_obj = dtrace_obj_gen.process('glib_probes.d')
+ glib_dtrace_hdr = dtrace_hdr_gen.process('glib_probes.d')
+else
+ glib_dtrace_obj = []
+ glib_dtrace_hdr = []
+endif
+
libglib = shared_library('glib-2.0',
+ glib_dtrace_obj, glib_dtrace_hdr,
sources : [deprecated_sources, glib_sources, thread_src, plat_src],
version : library_version,
soversion : soversion,
@@ -264,6 +273,14 @@ configure_file(
install_dir: join_paths(get_option('datadir'), 'gdb/auto-load' + glib_libdir)
)
+if enable_systemtap
+ glib_stp = configure_file(input : 'glib.stp.in',
+ output : '@0@.stp'.format(libglib.full_path().split('/').get(-1)),
+ configuration : stp_cdata,
+ install_dir : tapset_install_dir,
+ install : true)
+endif
+
# gtester doesn't work on native windows
if cc.get_id() != 'msvc'
subdir('tests')
diff --git a/gobject/meson.build b/gobject/meson.build
index 979f4e6..ed7e654 100644
--- a/gobject/meson.build
+++ b/gobject/meson.build
@@ -45,7 +45,16 @@ gobject_c_sources = [
'gvaluetypes.c',
]
+if enable_dtrace
+ gobject_dtrace_obj = dtrace_obj_gen.process('gobject_probes.d')
+ gobject_dtrace_hdr = dtrace_hdr_gen.process('gobject_probes.d')
+else
+ gobject_dtrace_obj = []
+ gobject_dtrace_hdr = []
+endif
+
libgobject = shared_library('gobject-2.0',
+ gobject_dtrace_obj, gobject_dtrace_hdr,
sources : [gobject_c_sources],
version : library_version,
soversion : soversion,
@@ -94,4 +103,12 @@ configure_file(
install_dir: join_paths(get_option('datadir'), 'gdb/auto-load/' + glib_libdir)
)
+if enable_systemtap
+ gobject_stp = configure_file(input : 'gobject.stp.in',
+ output : '@0@.stp'.format(libgobject.full_path().split('/').get(-1)),
+ configuration : stp_cdata,
+ install_dir : tapset_install_dir,
+ install : true)
+endif
+
subdir('tests')
diff --git a/meson.build b/meson.build
index a30962a..aec0099 100644
--- a/meson.build
+++ b/meson.build
@@ -1340,6 +1340,50 @@ glib_conf.set('GIO_MODULE_DIR', '${libdir}/gio/modules')
# @G_MODULE_LIBS@ @SELINUX_LIBS@ @COCOA_LIBS@ @CARBON_LIBS@ @G_LIBS_EXTRA@
# @PCRE_REQUIRES@ @GLIB_EXTRA_CFLAGS@ @G_THREAD_CFLAGS@
+# Tracing: dtrace
+want_dtrace = get_option('enable-dtrace')
+enable_dtrace = false
+
+# Since dtrace support is opt-in we just error out if it was requested but
+# is not available. We don't bother with autodetection yet.
+if want_dtrace
+ if glib_have_carbon
+ error('GLib dtrace support not yet compatible with macOS dtrace')
+ endif
+ dtrace = find_program('dtrace', required : true) # error out if not found
+ if not cc.has_header('sys/sdt.h')
+ error('dtrace support needs sys/sdt.h header')
+ endif
+ # FIXME: autotools build also passes -fPIC -DPIC but is it needed in this case?
+ dtrace_obj_gen = generator(dtrace,
+ output : '@BASENAME@.o',
+ arguments : ['-G', '-s', '@INPUT@', '-o', '@OUTPUT@'])
+ # FIXME: $(SED) -e "s,define STAP_HAS_SEMAPHORES 1,undef STAP_HAS_SEMAPHORES,"
+ # -e "s,define _SDT_HAS_SEMAPHORES 1,undef _SDT_HAS_SEMAPHORES,"
+ dtrace_hdr_gen = generator(dtrace,
+ output : '@BASENAME@.h',
+ arguments : ['-h', '-s', '@INPUT@', '-o', '@OUTPUT@'])
+ glib_conf.set('HAVE_DTRACE', 1)
+ enable_dtrace = true
+endif
+
+# systemtap
+want_systemtap = get_option('enable-systemtap')
+enable_systemtap = false
+
+if want_systemtap and enable_dtrace
+ tapset_install_dir = get_option('tapset-install-dir')
+ if tapset_install_dir == ''
+ tapset_install_dir = join_paths(get_option('datadir'), 'systemtap/tapset')
+ endif
+ stp_cdata = configuration_data()
+ stp_cdata.set('ABS_GLIB_RUNTIME_LIBDIR', glib_libdir)
+ stp_cdata.set('LT_CURRENT', minor_version.to_int() * 100)
+ stp_cdata.set('LT_REVISION', micro_version.to_int())
+ enable_systemtap = true
+endif
+
+
subdir('glib')
subdir('gobject')
subdir('gthread')
diff --git a/meson_options.txt b/meson_options.txt
index 2c987de..f622206 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,3 +1,9 @@
option('with-docs', type : 'boolean', value : false)
option('with-man', type : 'boolean', value : true)
option('enable-libmount', type : 'combo', choices : ['auto', 'yes', 'no'], value : 'yes')
+option('enable-dtrace', type : 'boolean', value : false,
+ description : 'include tracing support for dtrace')
+option('enable-systemtap', type : 'boolean', value : false,
+ description : 'include tracing support for systemtap')
+option('tapset-install-dir', type : 'string', value : '',
+ description : 'path where systemtap tapsets are installed')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]