build: fix some various build options

This commit is contained in:
Christian Hergert
2023-07-19 12:13:27 -07:00
parent 71f73309de
commit 8078ecc60a
5 changed files with 17 additions and 15 deletions

View File

@ -37,14 +37,14 @@ podir = join_paths(meson.current_source_dir(), 'po')
need_gtk = get_option('gtk')
need_glib = (need_gtk or
get_option('examples') or
get_option('libsysprof') or
get_option('sysprofd') != 'none' or
get_option('agent'))
get_option('agent') or
get_option('tests'))
# Determine what libraries to build
need_libsysprof_capture = true
need_libsysprof_profile = get_option('libsysprof') or get_option('agent')
need_libsysprof_analyze = get_option('libsysprof') or get_option('agent')
need_libsysprof_profile = get_option('gtk') or get_option('agent')
need_libsysprof_analyze = get_option('gtk') or get_option('agent')
dex_req = '0.3'
glib_req = '2.76.0'
@ -92,12 +92,6 @@ if get_option('default_library') != 'static'
endif
endif
debugdir = get_option('debugdir')
if debugdir == ''
debugdir = join_paths(get_option('prefix'), get_option('libdir'), 'debug')
endif
config_h.set_quoted('DEBUGDIR', debugdir)
config_h.set('HAVE_EXECINFO_H', cc.has_header('execinfo.h'))
config_h.set('HAVE_REALLOCARRAY', cc.has_function('reallocarray'))
config_h.set('HAVE_STRLCPY', cc.has_function('strlcpy'))

View File

@ -26,9 +26,12 @@ libsysprof_profile_private_sources = [
'sysprof-perf-event-stream.c',
'sysprof-journald-source.c',
'sysprof-podman.c',
'sysprof-polkit.c',
]
if polkit_dep.found()
libsysprof_profile_private_sources += ['sysprof-polkit.c']
endif
libsysprof_profile_public_headers = [
'sysprof-profile.h',
@ -65,8 +68,8 @@ libsysprof_profile_deps = [
required: host_machine.system() != 'windows'),
dependency('json-glib-1.0'),
dependency('libdex-1', version: dex_req_version),
dependency('polkit-gobject-1', version: polkit_req_version),
libsystemd_dep,
polkit_dep,
liblinereader_static_dep,
libsysprof_analyze_dep,

View File

@ -21,7 +21,10 @@
#include "config.h"
#include "sysprof-instrument-private.h"
#include "sysprof-polkit-private.h"
#if HAVE_POLKIT
# include "sysprof-polkit-private.h"
#endif
G_DEFINE_ABSTRACT_TYPE (SysprofInstrument, sysprof_instrument, G_TYPE_OBJECT)
@ -193,6 +196,7 @@ _sysprof_instruments_acquire_policy (GPtrArray *instruments,
*/
if ((required_policy = _sysprof_instruments_list_required_policy (instruments)))
{
#if HAVE_POLKIT
for (guint i = 0; required_policy[i]; i++)
{
if (!dex_await_boolean (_sysprof_polkit_authorize (connection,
@ -201,6 +205,7 @@ _sysprof_instruments_acquire_policy (GPtrArray *instruments,
TRUE), &error))
return dex_future_new_for_error (g_steal_pointer (&error));
}
#endif
}
return dex_future_new_for_boolean (TRUE);

View File

@ -27,7 +27,6 @@
#include "sysprof-diagnostic-private.h"
#include "sysprof-instrument-private.h"
#include "sysprof-polkit-private.h"
#include "sysprof-recording-private.h"
typedef enum _SysprofRecordingCommand

View File

@ -26,7 +26,8 @@ sysprofd_deps = [
dependency('glib-2.0', version: glib_req_version),
dependency('gio-2.0', version: glib_req_version),
dependency('gio-unix-2.0', version: glib_req_version),
dependency('polkit-gobject-1', version: polkit_req_version),
polkit_dep,
libsysprof_capture_dep,
]