libsysprof-capture: Move autocleanup definitions to libsysprof

In preparation for dropping the GLib dependency from libsysprof-capture,
move the autocleanup definitions up to libsysprof. Add a new header for
them.

This is slightly awkward in the tools, which depend on
libsysprof-capture but not libsysprof. Rather than make them depend on
libsysprof (which might be disabled at configure time), include the
`sysprof-capture-autocleanups.h` file between source directories.
`SYSPROF_COMPILATION` needs to be defined for this to work.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #40
This commit is contained in:
Philip Withnall
2020-06-30 16:30:14 +01:00
parent 16bf945d34
commit d2047fb557
13 changed files with 56 additions and 7 deletions

View File

@ -24,6 +24,8 @@
#include <sysprof-capture.h>
#include <unistd.h>
#include "../libsysprof/sysprof-capture-autocleanups.h"
static gboolean
foreach_cb (const SysprofCaptureFrame *frame,
gpointer user_data)

View File

@ -3,10 +3,13 @@ tools_deps = [
libsysprof_capture_dep,
]
tools_cflags = [ '-DSYSPROF_COMPILATION ']
if get_option('libsysprof') and host_machine.system() == 'linux'
polkit_agent_dep = dependency('polkit-agent-1')
sysprof_cli = executable('sysprof-cli', 'sysprof-cli.c',
dependencies: tools_deps + [libsysprof_dep, polkit_dep, polkit_agent_dep],
c_args: tools_cflags,
install_dir: get_option('bindir'),
install: true,
)
@ -14,21 +17,25 @@ endif
sysprof_cat = executable('sysprof-cat', 'sysprof-cat.c',
dependencies: tools_deps,
c_args: tools_cflags,
install: false,
)
sysprof_dump = executable('sysprof-dump', 'sysprof-dump.c',
dependencies: tools_deps,
c_args: tools_cflags,
install: false,
)
sysprof_profiler_ctl = executable('sysprof-profiler-ctl',
[ 'sysprof-profiler-ctl.c', ipc_profiler_src ],
dependencies: [ tools_deps, gio_unix_dep ],
c_args: tools_cflags,
install: false,
)
list_threads = executable('list-threads', ['list-threads.c'],
dependencies: [ tools_deps ],
c_args: tools_cflags,
install: false,
)

View File

@ -29,6 +29,7 @@
#include <sysprof-capture.h>
#include <unistd.h>
#include "../libsysprof/sysprof-capture-autocleanups.h"
#include "sysprof-capture-util-private.h"
gint