From ed020a688a846f7014e8f1f9169f207a1c63b816 Mon Sep 17 00:00:00 2001 From: Michael Catanzaro Date: Wed, 15 May 2024 15:09:46 -0500 Subject: [PATCH 1/3] Convert dtrace from bool to feature option type Now dtrace can be enabled by default in distros that use -Dauto_features=enabled or for developers who already have dtrace installed, while it's still disabled for developers who do not have dtrace installed. See #3354 --- .gitlab-ci.yml | 14 +++++++------- meson.build | 35 +++++++++++++++++++++++++---------- meson_options.txt | 5 +++-- 3 files changed, 35 insertions(+), 19 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d4d0691d6..ea5453445 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -186,7 +186,7 @@ fedora-x86_64: --localstatedir=/var --libdir=lib -Dsystemtap=true - -Ddtrace=true + -Ddtrace=enabled -Dinstalled_tests=true -Ddocumentation=true -Dintrospection=enabled @@ -241,7 +241,7 @@ debian-stable-x86_64: --localstatedir=/var --libdir=lib -Dsystemtap=true - -Ddtrace=true + -Ddtrace=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 @@ -384,7 +384,7 @@ G_DISABLE_ASSERT: - meson setup ${MESON_COMMON_OPTIONS} --werror -Dsystemtap=true - -Ddtrace=true + -Ddtrace=enabled -Dinstalled_tests=true -Dglib_assert=false -Dintrospection=enabled @@ -422,7 +422,7 @@ valgrind: - meson setup ${MESON_COMMON_OPTIONS} --werror -Dsystemtap=true - -Ddtrace=true + -Ddtrace=enabled -Dinstalled_tests=true -Dintrospection=enabled _build @@ -767,7 +767,7 @@ scan-build: --libdir=lib -Dglib_debug=enabled -Dsystemtap=true - -Ddtrace=true + -Ddtrace=enabled -Dinstalled_tests=true -Dintrospection=enabled _scan_build @@ -797,7 +797,7 @@ scan-build: --localstatedir=/var --libdir=lib -Dsystemtap=true - -Ddtrace=true + -Ddtrace=enabled -Dinstalled_tests=true -Dintrospection=enabled _coverity_build diff --git a/meson.build b/meson.build index aad78f574..b650fe717 100644 --- a/meson.build +++ b/meson.build @@ -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') @@ -2696,7 +2711,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'), diff --git a/meson_options.txt b/meson_options.txt index 69a2135bc..bf641b0ce 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -50,8 +50,9 @@ 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', From 153cda6669a52b35cb9e243b902547f40aa6071c Mon Sep 17 00:00:00 2001 From: Michael Catanzaro Date: Wed, 15 May 2024 15:48:44 -0500 Subject: [PATCH 2/3] Convert systemtap from bool to feature option type Now systemtap can be enabled by default in distros that use -Dauto_features=enabled or for developers who already have systemtap installed, while it's still disabled for developers who do not have systemtap installed. See #3354 --- .gitlab-ci.yml | 14 +++++++------- meson.build | 7 +++---- meson_options.txt | 5 +++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ea5453445..9395a225f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -185,7 +185,7 @@ fedora-x86_64: --prefix=$HOME/glib-installed --localstatedir=/var --libdir=lib - -Dsystemtap=true + -Dsystemtap=enabled -Ddtrace=enabled -Dinstalled_tests=true -Ddocumentation=true @@ -240,7 +240,7 @@ debian-stable-x86_64: --prefix=$HOME/glib-installed --localstatedir=/var --libdir=lib - -Dsystemtap=true + -Dsystemtap=enabled -Ddtrace=enabled _build - meson compile -C _build @@ -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 @@ -383,7 +383,7 @@ G_DISABLE_ASSERT: script: - meson setup ${MESON_COMMON_OPTIONS} --werror - -Dsystemtap=true + -Dsystemtap=enabled -Ddtrace=enabled -Dinstalled_tests=true -Dglib_assert=false @@ -421,7 +421,7 @@ valgrind: script: - meson setup ${MESON_COMMON_OPTIONS} --werror - -Dsystemtap=true + -Dsystemtap=enabled -Ddtrace=enabled -Dinstalled_tests=true -Dintrospection=enabled @@ -766,7 +766,7 @@ scan-build: --localstatedir=/var --libdir=lib -Dglib_debug=enabled - -Dsystemtap=true + -Dsystemtap=enabled -Ddtrace=enabled -Dinstalled_tests=true -Dintrospection=enabled @@ -796,7 +796,7 @@ scan-build: --prefix=$HOME/glib-installed --localstatedir=/var --libdir=lib - -Dsystemtap=true + -Dsystemtap=enabled -Ddtrace=enabled -Dinstalled_tests=true -Dintrospection=enabled diff --git a/meson.build b/meson.build index b650fe717..25dc0f2bc 100644 --- a/meson.build +++ b/meson.build @@ -2575,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()) @@ -2587,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 diff --git a/meson_options.txt b/meson_options.txt index bf641b0ce..a9248ff18 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -56,8 +56,9 @@ option('dtrace', 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', From 329a69e558dfb053398ee9d564cd64f586fa52fe Mon Sep 17 00:00:00 2001 From: Michael Catanzaro Date: Thu, 16 May 2024 13:57:38 -0500 Subject: [PATCH 3/3] Change sysprof build option default value to 'auto' Now sysprof can be enabled by default in distros that use -Dauto_features=enabled or for developers who already have sysprof installed, while it's still disabled for developers who do not have sysprof installed. See #3354 --- meson_options.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson_options.txt b/meson_options.txt index a9248ff18..14ece1039 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -68,7 +68,7 @@ option('tapset_install_dir', option('sysprof', type : 'feature', - value : 'disabled', + value : 'auto', description : 'include tracing support for sysprof') option('documentation',