mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
build: allow using a host-installed sysprofd
In case we are building in a flatpak, we might want to rely on a system installed sysprofd. This means we might want to pretend we have sysprofd support (to be found on the system), but not actually build sysprofd.
This commit is contained in:
21
configure.ac
21
configure.ac
@ -133,22 +133,23 @@ PKG_CHECK_MODULES(SYSTEMD,
|
||||
|
||||
# sysprofd requires libsystemd and polkit, and is required to run
|
||||
# the ui without root permissions
|
||||
AC_ARG_ENABLE([sysprofd],
|
||||
[AS_HELP_STRING([--enable-sysprofd=@<:@yes/no/auto@:>@],
|
||||
AC_ARG_WITH([sysprofd],
|
||||
[AS_HELP_STRING([--with-sysprofd=@<:@host/bundled/no/auto@:>@],
|
||||
[Build Sysprof D-Bus daemon.])],
|
||||
[enable_sysprofd=$enableval],
|
||||
[enable_sysprofd=auto])
|
||||
AS_IF([test "$enable_sysprofd" = "auto"],[
|
||||
[with_sysprofd=$withval],
|
||||
[with_sysprofd=auto])
|
||||
AS_IF([test "$with_sysprofd" = "auto"],[
|
||||
AS_IF([test "$have_polkit" = "yes" && test "$have_systemd" = "yes"],
|
||||
[enable_sysprofd=yes],
|
||||
[enable_sysprofd=no])
|
||||
[with_sysprofd=bundled],
|
||||
[with_sysprofd=no])
|
||||
])
|
||||
AS_IF([test "$enable_sysprofd" = "yes"],[
|
||||
AS_IF([test "$with_sysprofd" = "bundled"],[
|
||||
AS_IF([test "$have_systemd" = "yes" && test "$have_polkit" = "yes"],[],[
|
||||
AC_MSG_ERROR([--enable-sysprofd requires libsystemd >= systemd_required_version and polkit-gobject-1])
|
||||
])
|
||||
])
|
||||
AM_CONDITIONAL(ENABLE_SYSPROFD, [test "$enable_sysprofd" = "yes"])
|
||||
AM_CONDITIONAL(ENABLE_SYSPROFD, [test "$with_sysprofd" = "bundled"])
|
||||
AM_CONDITIONAL(ENABLE_POLKIT, [test "$with_sysprofd" = "host" || test "$with_sysprofd" = "bundled"])
|
||||
|
||||
# we might be building sysprof-cli without the UI
|
||||
AC_ARG_ENABLE([gtk],
|
||||
@ -282,7 +283,7 @@ echo " The GTK interface can explore sysprof capture"
|
||||
echo " files. If you want the user interface, ensure"
|
||||
echo " this is yes."
|
||||
echo ""
|
||||
echo " sysprofd ..................................... : ${enable_sysprofd}"
|
||||
echo " sysprofd ..................................... : ${with_sysprofd}"
|
||||
echo ""
|
||||
echo " The sysprofd system daemon provides support"
|
||||
echo " for accessing hardware performance counters"
|
||||
|
||||
@ -107,9 +107,9 @@ libsysprof_@API_VERSION@_la_LIBADD = \
|
||||
$(GIO_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
if ENABLE_SYSPROFD
|
||||
if ENABLE_POLKIT
|
||||
libsysprof_@API_VERSION@_la_LIBADD += $(POLKIT_LIBS)
|
||||
libsysprof_@API_VERSION@_la_CFLAGS += $(POLKIT_CFLAGS) -DENABLE_SYSPROFD
|
||||
libsysprof_@API_VERSION@_la_CFLAGS += $(POLKIT_CFLAGS) -DENABLE_POLKIT
|
||||
endif
|
||||
|
||||
libsysprof_@API_VERSION@_la_LDFLAGS = \
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
#include <sys/syscall.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef ENABLE_SYSPROFD
|
||||
#ifdef ENABLE_POLKIT
|
||||
# include <polkit/polkit.h>
|
||||
#endif
|
||||
|
||||
@ -124,7 +124,7 @@ G_DEFINE_BOXED_TYPE (SpPerfCounter,
|
||||
(GBoxedCopyFunc)sp_perf_counter_ref,
|
||||
(GBoxedFreeFunc)sp_perf_counter_unref)
|
||||
|
||||
#ifdef ENABLE_SYSPROFD
|
||||
#ifdef ENABLE_POLKIT
|
||||
static GDBusConnection *shared_conn;
|
||||
#endif
|
||||
|
||||
@ -420,7 +420,7 @@ sp_perf_counter_take_fd (SpPerfCounter *self,
|
||||
sp_perf_counter_add_info (self, fd, -1);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_SYSPROFD
|
||||
#ifdef ENABLE_POLKIT
|
||||
static GDBusProxy *
|
||||
get_proxy (void)
|
||||
{
|
||||
@ -641,7 +641,7 @@ sp_perf_counter_authorize_async (GCancellable *cancellable,
|
||||
|
||||
task = g_task_new (NULL, cancellable, callback, user_data);
|
||||
|
||||
#ifdef ENABLE_SYSPROFD
|
||||
#ifdef ENABLE_POLKIT
|
||||
g_bus_get (G_BUS_TYPE_SYSTEM,
|
||||
cancellable,
|
||||
sp_perf_counter_get_bus_cb,
|
||||
@ -671,7 +671,7 @@ sp_perf_counter_open (SpPerfCounter *self,
|
||||
gint group_fd,
|
||||
gulong flags)
|
||||
{
|
||||
#ifdef ENABLE_SYSPROFD
|
||||
#ifdef ENABLE_POLKIT
|
||||
g_autoptr(GError) error = NULL;
|
||||
g_autoptr(GDBusProxy) proxy = NULL;
|
||||
g_autoptr(GUnixFDList) fdlist = NULL;
|
||||
@ -694,7 +694,7 @@ sp_perf_counter_open (SpPerfCounter *self,
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_SYSPROFD
|
||||
#ifdef ENABLE_POLKIT
|
||||
params = g_variant_new_parsed (
|
||||
"("
|
||||
"["
|
||||
|
||||
Reference in New Issue
Block a user