Merge branch 'mcatanzaro/#3354' into 'main'

Convert dtrace and systemtap to feature option type, and fix sysprof option

Closes #3354

See merge request GNOME/glib!4076
This commit is contained in:
Michael Catanzaro 2024-05-17 20:38:17 +00:00
commit c88cbd06de
3 changed files with 49 additions and 33 deletions

View File

@ -185,8 +185,8 @@ fedora-x86_64:
--prefix=$HOME/glib-installed
--localstatedir=/var
--libdir=lib
-Dsystemtap=true
-Ddtrace=true
-Dsystemtap=enabled
-Ddtrace=enabled
-Dinstalled_tests=true
-Ddocumentation=true
-Dintrospection=enabled
@ -240,8 +240,8 @@ debian-stable-x86_64:
--prefix=$HOME/glib-installed
--localstatedir=/var
--libdir=lib
-Dsystemtap=true
-Ddtrace=true
-Dsystemtap=enabled
-Ddtrace=enabled
_build
- meson compile -C _build
- .gitlab-ci/run-tests.sh
@ -312,7 +312,7 @@ muslc-alpine-x86_64:
--prefix=$HOME/glib-installed
--localstatedir=/var
--libdir=lib
-Dsystemtap=true
-Dsystemtap=enabled
_build
- meson compile -C _build
- .gitlab-ci/run-tests.sh
@ -343,7 +343,7 @@ installed-tests:
--prefix=/usr --libdir=/usr/lib64
-Dinstalled_tests=true
-Ddefault_library=both
-Ddtrace=false
-Ddtrace=disabled
_build
- meson compile -C _build
- sudo meson install -C _build
@ -383,8 +383,8 @@ G_DISABLE_ASSERT:
script:
- meson setup ${MESON_COMMON_OPTIONS}
--werror
-Dsystemtap=true
-Ddtrace=true
-Dsystemtap=enabled
-Ddtrace=enabled
-Dinstalled_tests=true
-Dglib_assert=false
-Dintrospection=enabled
@ -421,8 +421,8 @@ valgrind:
script:
- meson setup ${MESON_COMMON_OPTIONS}
--werror
-Dsystemtap=true
-Ddtrace=true
-Dsystemtap=enabled
-Ddtrace=enabled
-Dinstalled_tests=true
-Dintrospection=enabled
_build
@ -766,8 +766,8 @@ scan-build:
--localstatedir=/var
--libdir=lib
-Dglib_debug=enabled
-Dsystemtap=true
-Ddtrace=true
-Dsystemtap=enabled
-Ddtrace=enabled
-Dinstalled_tests=true
-Dintrospection=enabled
_scan_build
@ -796,8 +796,8 @@ scan-build:
--prefix=$HOME/glib-installed
--localstatedir=/var
--libdir=lib
-Dsystemtap=true
-Ddtrace=true
-Dsystemtap=enabled
-Ddtrace=enabled
-Dinstalled_tests=true
-Dintrospection=enabled
_coverity_build

View File

@ -2519,19 +2519,35 @@ elif host_system == 'cygwin'
endif
# Tracing: dtrace
want_dtrace = get_option('dtrace')
enable_dtrace = false
dtrace_option = get_option('dtrace')
enable_dtrace = dtrace_option.allowed()
# 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
if glib_have_carbon
if dtrace_option.enabled()
error('GLib dtrace support not yet compatible with macOS dtrace')
else
enable_dtrace = false
endif
dtrace = find_program('dtrace', required : true) # error out if not found
endif
if enable_dtrace
dtrace = find_program('dtrace', required : dtrace_option)
if not dtrace.found()
enable_dtrace = false
endif
endif
if enable_dtrace
if not cc.has_header('sys/sdt.h')
error('dtrace support needs sys/sdt.h header')
if dtrace_option.enabled()
error('dtrace support needs sys/sdt.h header')
else
enable_dtrace = false
endif
endif
endif
if enable_dtrace
# FIXME: autotools build also passes -fPIC -DPIC but is it needed in this case?
dtrace_obj_gen = generator(dtrace,
output : '@BASENAME@.o',
@ -2552,7 +2568,6 @@ with open(output, "w") as f:
f.write(contents)
''', dtrace.full_path(), '-h', '-s', '@INPUT@', '-o', '@OUTPUT@'])
glib_conf.set('HAVE_DTRACE', 1)
enable_dtrace = true
endif
if cc.has_header_symbol('sys/ptrace.h', 'PTRACE_O_EXITKILL')
@ -2560,10 +2575,10 @@ if cc.has_header_symbol('sys/ptrace.h', 'PTRACE_O_EXITKILL')
endif
# systemtap
want_systemtap = get_option('systemtap')
enable_systemtap = false
systemtap = get_option('systemtap').require(enable_dtrace, error_message: 'Cannot enable systemtap because dtrace feature is disabled')
enable_systemtap = systemtap.allowed()
if want_systemtap and enable_dtrace
if enable_systemtap
tapset_install_dir = get_option('tapset_install_dir')
if tapset_install_dir == ''
tapset_install_dir = join_paths(get_option('datadir'), 'systemtap/tapset', host_machine.cpu_family())
@ -2572,7 +2587,6 @@ if want_systemtap and enable_dtrace
stp_cdata.set('ABS_GLIB_RUNTIME_LIBDIR', glib_libdir)
stp_cdata.set('LT_CURRENT', minor_version * 100)
stp_cdata.set('LT_REVISION', micro_version)
enable_systemtap = true
endif
# introspection
@ -2696,7 +2710,7 @@ endif
summary({
'xattr' : xattr_dep.length() > 0,
'man-pages' : get_option('man-pages'),
'dtrace' : get_option('dtrace'),
'dtrace' : enable_dtrace,
'systemtap' : enable_systemtap,
'sysprof' : libsysprof_capture_dep.found(),
'documentation' : get_option('documentation'),

View File

@ -50,13 +50,15 @@ option('man-pages',
deprecated : { 'true': 'enabled', 'false': 'disabled' })
option('dtrace',
type : 'boolean',
value : false,
type : 'feature',
value : 'auto',
deprecated : { 'true': 'enabled', 'false': 'disabled' },
description : 'include tracing support for dtrace')
option('systemtap',
type : 'boolean',
value : false,
type : 'feature',
value : 'auto',
deprecated : { 'true': 'enabled', 'false': 'disabled' },
description : 'include tracing support for systemtap')
option('tapset_install_dir',
@ -66,7 +68,7 @@ option('tapset_install_dir',
option('sysprof',
type : 'feature',
value : 'disabled',
value : 'auto',
description : 'include tracing support for sysprof')
option('documentation',