[sysprof] tools: add -Dagent=true option



commit c3035efd52ae0c009db37015433e9fbd1bd80192
Author: Christian Hergert <chergert redhat com>
Date:   Thu Jul 21 18:35:35 2022 -0700

    tools: add -Dagent=true option
    
    This also builds the agent statically with libsysprof_static_dep since
    we'd need that to avoid installing libsysprof when that isn't wanted.
    It also ensures the LD_PRELOAD libraries are installed for use by the
    agent.

 meson_options.txt          |  4 ++++
 src/libsysprof/meson.build |  2 ++
 src/meson.build            |  2 +-
 src/tools/meson.build      | 18 ++++++++++--------
 4 files changed, 17 insertions(+), 9 deletions(-)
---
diff --git a/meson_options.txt b/meson_options.txt
index 3562830b..8d9df543 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -44,3 +44,7 @@ option('tests', type: 'boolean')
 # Optionally disable the examples (this is mostly only useful for building only
 # libsysprof-capture as a subproject)
 option('examples', type: 'boolean')
+
+# Optionally build the sysprof-agent tool to allow profiling inside of
+# containers from external system
+option('agent', type: 'boolean', description: 'Build the sysprof-agent utility')
diff --git a/src/libsysprof/meson.build b/src/libsysprof/meson.build
index bd6e8a70..9eeb25ab 100644
--- a/src/libsysprof/meson.build
+++ b/src/libsysprof/meson.build
@@ -166,6 +166,7 @@ libsysprof_static_dep = declare_dependency(
    include_directories: [include_directories('.'), libsysprof_capture_include_dirs],
 )
 
+if get_option('libsysprof')
 libsysprof = shared_library('sysprof-@0@'.format(libsysprof_api_version),
            dependencies: libsysprof_deps + [libsysprof_static_dep],
                 install: true,
@@ -191,5 +192,6 @@ pkgconfig.generate(
 )
 
 install_headers(libsysprof_public_headers, subdir: sysprof_header_subdir)
+endif
 
 subdir('preload')
diff --git a/src/meson.build b/src/meson.build
index 6b2bb828..1a9ebd84 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -58,7 +58,7 @@ subdir('libsysprof-capture')
 if get_option('sysprofd') == 'bundled'
   subdir('sysprofd')
 endif
-if get_option('libsysprof')
+if get_option('libsysprof') or get_option('agent')
   subdir('libsysprof')
 endif
 if get_option('gtk') and get_option('libsysprof')
diff --git a/src/tools/meson.build b/src/tools/meson.build
index 0f6536bb..543f5b01 100644
--- a/src/tools/meson.build
+++ b/src/tools/meson.build
@@ -12,14 +12,6 @@ if get_option('libsysprof')
      install_dir: get_option('bindir'),
          install: true,
   )
-
-  sysprof_agent = executable('sysprof-agent',
-    ['sysprof-agent.c', ipc_agent_src],
-    dependencies: [libsysprof_dep],
-          c_args: tools_cflags,
-     install_dir: get_option('bindir'),
-         install: true,
-  )
 endif
 
 sysprof_cat = executable('sysprof-cat', 'sysprof-cat.c',
@@ -48,3 +40,13 @@ list_threads = executable('list-threads', ['list-threads.c'],
         c_args: tools_cflags,
        install: false,
 )
+
+if get_option('agent')
+  sysprof_agent = executable('sysprof-agent',
+    ['sysprof-agent.c', ipc_agent_src],
+    dependencies: [libsysprof_static_dep],
+          c_args: tools_cflags,
+     install_dir: get_option('bindir'),
+         install: true,
+  )
+endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]