diff --git a/rpm_spec/gui-daemon.spec.in b/rpm_spec/gui-daemon.spec.in index b644364f..01cb60d0 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 "%{?backend_vmm}" == "xen" +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