From c30fc326a8d1e27222df6229258981ecb7225552 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?= Date: Sun, 21 Nov 2021 11:03:12 +0100 Subject: [PATCH 1/2] DONTMERGE: Allow building (not usable) with BACKEND_VMM=kvm From https://github.com/qubes-ppc64le/qubes-gui-daemon/commit/32868ef9dc7382af7513b1df8e252ad491b1ad69 --- rpm_spec/gui-daemon.spec.in | 6 +++++- shmoverride/Makefile | 14 +++++++++----- shmoverride/shmoverride.c | 3 +++ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/rpm_spec/gui-daemon.spec.in b/rpm_spec/gui-daemon.spec.in index b644364f..2a82d910 100644 --- a/rpm_spec/gui-daemon.spec.in +++ b/rpm_spec/gui-daemon.spec.in @@ -22,6 +22,8 @@ # # +%define backend_vmm @BACKEND_VMM@ + Name: qubes-gui-daemon Version: @VERSION@ Release: 1%{dist} @@ -52,7 +54,9 @@ BuildRequires: libXrandr-devel BuildRequires: libconfig-devel BuildRequires: libpng-devel BuildRequires: libnotify-devel -BuildRequires: xen-devel +%if x%{?backend_vmm} == xxen +BuildRequires: xen-devel +%endif BuildRequires: qubes-db-devel BuildRequires: help2man BuildRequires: gcc diff --git a/shmoverride/Makefile b/shmoverride/Makefile index 0dc808a9..73bbbc86 100644 --- a/shmoverride/Makefile +++ b/shmoverride/Makefile @@ -20,10 +20,9 @@ # # -BACKEND_VMM_PKGCONFIG = $(shell pkg-config --variable=backend_vmm vchan) -BACKEND_VMM ?= $(firstword $(BACKEND_VMM_PKGCONFIG) xen) -ifneq ($(BACKEND_VMM),xen) -$(error shmoverride currently supports Xen only, '$(BACKEND_VMM)' set) +BACKEND_VMM ?= $(shell pkg-config --cflags vchan | sed 's/.*vchan-//') +ifeq ($(filter $(BACKEND_VMM), xen kvm),) +$(error shmoverride currently supports only Xen and KVM, '$(BACKEND_VMM)' set) endif LIBDIR ?= /usr/lib64 @@ -32,12 +31,17 @@ extra_cflags := -g -O2 -I../include/ -fPIC -Wall -Wextra -Werror \ -DSHMOVERRIDE_LIB_PATH=\"$(LIBDIR)/qubes-gui-daemon/shmoverride.so\" \ -I../include -fvisibility=hidden CC=gcc +LIBS=-ldl + +ifeq ($(BACKEND_VMM),xen) +LIBS+=-lxenctrl -lxengnttab +endif all: shmoverride.so X-wrapper-qubes shmoverride.so: shmoverride.o ./list.o $(CC) $(CFLAGS) $(extra_cflags) -shared -o shmoverride.so \ - shmoverride.o list.o -ldl -lxenctrl -lxengnttab + shmoverride.o list.o $(LIBS) vpath %.c ../common diff --git a/shmoverride/shmoverride.c b/shmoverride/shmoverride.c index 0f2d99bd..eff93730 100644 --- a/shmoverride/shmoverride.c +++ b/shmoverride/shmoverride.c @@ -20,6 +20,7 @@ */ // #define DEBUG +#ifdef BACKEND_VMM_xen #define _GNU_SOURCE 1 #define XC_WANT_COMPAT_MAP_FOREIGN_API @@ -414,3 +415,5 @@ int __attribute__ ((destructor)) descfunc(void) return 0; } + +#endif // BACKEND_VMM_xen From fd0c939e2bcb4419ee7e4fe840c6b72b3729f259 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?= Date: Sun, 21 Nov 2021 11:07:21 +0100 Subject: [PATCH 2/2] spec: update backend_vmm equal checks --- rpm_spec/gui-daemon.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpm_spec/gui-daemon.spec.in b/rpm_spec/gui-daemon.spec.in index 2a82d910..01cb60d0 100644 --- a/rpm_spec/gui-daemon.spec.in +++ b/rpm_spec/gui-daemon.spec.in @@ -54,7 +54,7 @@ BuildRequires: libXrandr-devel BuildRequires: libconfig-devel BuildRequires: libpng-devel BuildRequires: libnotify-devel -%if x%{?backend_vmm} == xxen +%if "%{?backend_vmm}" == "xen" BuildRequires: xen-devel %endif BuildRequires: qubes-db-devel