#
# TODO:
-# - most of the qemu config options aren't detected (NPTL, vde, fdt)
# - check if other tools/libs are not usable in domU, move them to -guest
# packages if so
# - pass bconds to qemu configure script (tricky, as the script is called from
# Xen Makefiles)
+# - fix %doc - some files are installed in docdir both by make install and %d,
+# other are installed once
+# - now the build dependencies are insane (because of what qemu can use)
+# we should make them optional or get rid of them all properly
#
#
# Conditional build:
-%bcond_with OpenGL # enable OpenGL support in Xen qemu
-%bcond_without SDL # disable SDL support in Xen tools
-%bcond_without bluetooth # disable bluetooth support in Xen tools
-%bcond_without brlapi # disable brlapi support in Xen tools
+%bcond_without opengl # disable OpenGL support in Xen qemu
+%bcond_without sdl # disable SDL support in Xen qemu
+%bcond_without bluetooth # disable bluetooth support in Xen qemu
+%bcond_without brlapi # disable brlapi support in Xen qemu
%bcond_without ocaml # build Ocaml libraries for Xen tools
-#
+%bcond_without efi # build the EFI hypervisor
+
+%ifnarch %{x8664}
+%undefine with_efi
+%endif
+
# from Config.mk:
%define seabios_version 1.6.3.2
-#
+
%define xen_extfiles_url http://xenbits.xensource.com/xen-extfiles
Summary: Xen - a virtual machine monitor
Summary(pl.UTF-8): Xen - monitor maszyny wirtualnej
Name: xen
Version: 4.2.0
-Release: 0.1
+Release: 3
License: GPL v2, interface parts on BSD-like
Group: Applications/System
Source0: http://bits.xensource.com/oss-xen/release/%{version}/%{name}-%{version}.tar.gz
Source53: xen-watchdog.init
Source54: xendomains.init
Source55: xen.logrotate
+Source56: xen.tmpfiles
Patch0: %{name}-python_scripts.patch
Patch1: %{name}-symbols.patch
Patch2: %{name}-curses.patch
Patch8: xen-configure-xend.patch
Patch9: xen-initscript.patch
Patch10: xen-quemu-softloat-c99.patch
+Patch11: xen-qemu.patch
+Patch12: xen-scripts-locking.patch
+Patch13: xen-close_lockfd_after_lock_attempt.patch
URL: http://www.xen.org/products/xenhyp.html
-%{?with_OpenGL:BuildRequires: OpenGL-devel}
-%{?with_SDL:BuildRequires: SDL-devel}
+%{?with_opengl:BuildRequires: OpenGL-devel}
+%{?with_sdl:BuildRequires: SDL-devel >= 1.2.1}
+%ifarch %{ix86} %{x8664}
BuildRequires: acpica
BuildRequires: bcc
+%endif
%{?with_bluetooth:BuildRequires: bluez-libs-devel}
%{?with_brlapi:BuildRequires: brlapi-devel}
+%{?with_efi:BuildRequires: binutils >= 3:2.23.51.0.3-2}
+BuildRequires: bzip2-devel
+BuildRequires: ceph-devel
BuildRequires: curl-devel
+BuildRequires: cyrus-sasl-devel >= 2
BuildRequires: e2fsprogs-devel
BuildRequires: gcc >= 5:3.4
BuildRequires: gettext-devel
+BuildRequires: glib2-devel >= 1:2.12
BuildRequires: gnutls-devel
BuildRequires: latex2html >= 2008
+BuildRequires: libaio-devel
+BuildRequires: libiscsi-devel
+BuildRequires: libjpeg-devel
+BuildRequires: libpng-devel
+BuildRequires: libuuid-devel
+BuildRequires: lzo-devel >= 2
BuildRequires: ncurses-devel
%if %{with ocaml}
BuildRequires: ocaml >= 3.04-7
BuildRequires: ocaml-findlib
%endif
+BuildRequires: nss-devel >= 3.12.8
+BuildRequires: openssl-devel
BuildRequires: pciutils-devel
+BuildRequires: perl-base
BuildRequires: pkgconfig
BuildRequires: python-devel
BuildRequires: rpm-pythonprov
BuildRequires: rpmbuild(macros) >= 1.647
+BuildRequires: spice-protocol >= 0.6.0
+BuildRequires: spice-server-devel >= 0.6.0
BuildRequires: texi2html
BuildRequires: texlive-dvips
BuildRequires: texlive-latex-psnfss
BuildRequires: texlive-xetex
+BuildRequires: usbredir-devel
+BuildRequires: vde2-devel
BuildRequires: which
+# for xfsctl (<xfs/xfs.h>)
+BuildRequires: xfsprogs-devel
BuildRequires: xorg-lib-libX11-devel
BuildRequires: xorg-lib-libXext-devel
BuildRequires: xz-devel
BuildRequires: yajl-devel
BuildRequires: zlib-devel
+# FIXME: see qemu configure comments on top of spec
+%{!?with_opengl:BuildConflicts: OpenGL-devel}
+%{!?with_sdl:BuildConflicts: SDL-devel}
+%{!?with_sdl:BuildConflicts: SDL-devel}
+%{!?with_bluetooth:BuildConflicts: bluez-libs-devel}
+%{!?with_brlapi:BuildConflicts: brlapi-devel}
Requires(post,preun): /sbin/chkconfig
Requires(post,preun,postun): systemd-units >= 38
Requires: %{name}-libs = %{version}-%{release}
ExclusiveArch: %{ix86} %{x8664}
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
-# some PPC/SPARC boot image in ELF format
-%define _noautostrip .*%{_datadir}/xen/qemu/openbios-.*
+# some PPC/SPARC boot images in ELF format
+%define _noautostrip .*%{_datadir}/\\(xen/qemu\\|qemu-xen\\)/\\(openbios-.*\\|palcode-clipper\\)
%description
This package contains the Xen hypervisor and Xen tools, needed to run
Summary: Xen libraries
Summary(pl.UTF-8): Biblioteki Xena
Group: Libraries
+Requires: %{name}-libs-guest = %{version}-%{release}
%description libs
Xen libraries.
Summary(pl.UTF-8): Moduły Pythona dla Xena
Group: Libraries
Requires: %{name}-libs = %{version}-%{release}
-Requires: %{name}-xen-guest = %{version}-%{release}
Conflicts: xen < 3.2.1-0.3
%description -n python-xen
%description -n bash-completion-%{name} -l pl.UTF-8
Ten pakiet zapewnia bashowe dopełnianie poleceń dla Xena (xl).
+%package efi
+Summary: Xen hypervisor binary for EFI
+Summary(pl.UTF-8): Hipernadzorca Xen dla EFI
+Group: Applications/System
+Requires: %{name}-libs-guest = %{version}-%{release}
+
+%description efi
+Xen hypervisor EFI binary, which can be booted directly from (U)EFI
+firmware without help from any additional bootloader.
+
+%description efi -l pl.UTF-8
+Nadzorca Xen w postaci, która może być uruchomiona wprost z firmware
+(U)EFI, bez potrzeby oddzielnego bootloadera.
+
%prep
%setup -q -a 16
%patch0 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
+%patch11 -p1
+%patch12 -p1
+%patch13 -p1
# stubdom sources
ln -s %{SOURCE10} %{SOURCE11} %{SOURCE12} %{SOURCE13} %{SOURCE14} stubdom
export CFLAGS="%{rpmcflags} -I/usr/include/ncurses"
export CXXFLAGS="%{rpmcflags} -I/usr/include/ncurses"
+# NOTE:
+# - there is a quoting bug (in tools/driver/Makefile) that causes
+# openssl is used instead of gcrypt; that's OK, openssl is obligatory
+# anyway (see configure), gcrypt is optional
+# - prevent libiconv from being detected (not needed with glibc)
cd tools
%configure \
- --disable-debug \
- CPPFLAGS="%{rpmcppflags} -I/usr/include/ncurses"
+ CPPFLAGS="%{rpmcppflags} -I/usr/include/ncurses" \
+ ac_cv_lib_iconv_libiconv_open=no \
+ --disable-debug
cd ..
%{__make} dist-xen dist-tools dist-docs \
%{__make} -j1 dist-stubdom \
%{!?with_ocaml:OCAML_TOOLS=n} \
CC="%{__cc}" \
- CXX="%{__cxx}"
+ CXX="%{__cxx}" \
+ V=1
%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT/etc/{xen/examples,modules-load.d,logrotate.d} \
- $RPM_BUILD_ROOT{/usr/lib/tmpfiles.d,%{systemdunitdir},/var/log/xen/console}
+ $RPM_BUILD_ROOT{%{systemdtmpfilesdir},%{systemdunitdir},/var/log/xen/console}
%{__make} -j1 install-xen install-tools install-stubdom install-docs \
%{!?with_ocaml:OCAML_TOOLS=n} \
install %{SOURCE35} $RPM_BUILD_ROOT/etc/sysconfig/xenconsoled
install %{SOURCE36} $RPM_BUILD_ROOT%{systemdunitdir}/xenstored.service
install %{SOURCE37} $RPM_BUILD_ROOT/etc/sysconfig/xenstored
-install %{SOURCE38} $RPM_BUILD_ROOT/usr/lib/tmpfiles.d/xenstored.conf
+install %{SOURCE38} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/xenstored.conf
install %{SOURCE39} $RPM_BUILD_ROOT%{systemdunitdir}/xend.service
-install %{SOURCE40} $RPM_BUILD_ROOT/usr/lib/tmpfiles.d/xend.conf
+install %{SOURCE40} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/xend.conf
install %{SOURCE41} $RPM_BUILD_ROOT%{systemdunitdir}/xen-watchdog.service
install %{SOURCE42} $RPM_BUILD_ROOT/etc/modules-load.d/xen-dom0.conf
# sysvinit scripts
install %{SOURCE53} $RPM_BUILD_ROOT/etc/rc.d/init.d/xen-watchdog
install %{SOURCE54} $RPM_BUILD_ROOT/etc/rc.d/init.d/xendomains
install %{SOURCE55} $RPM_BUILD_ROOT/etc/logrotate.d/xen
+install %{SOURCE56} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/xen.conf
mv $RPM_BUILD_ROOT/etc/xen/{x{m,l}example*,examples}
%py_postclean
+%{__rm} $RPM_BUILD_ROOT%{_mandir}/man1/qemu.1
mv $RPM_BUILD_ROOT%{_mandir}/man1/qemu-img{,-xen}.1
mv $RPM_BUILD_ROOT%{_mandir}/man8/qemu-nbd{,-xen}.8
+# seems not needed, the path is wrong anyway
+%{__rm} $RPM_BUILD_ROOT%{_prefix}/etc/qemu/target-x86_64.conf
# remove unneeded files
%{__rm} $RPM_BUILD_ROOT/boot/xen-4.2.gz
%{__rm} -r $RPM_BUILD_ROOT%{_docdir}/qemu
%{__rm} $RPM_BUILD_ROOT%{_includedir}/%{name}/COPYING
-# strip complains on those
-%{__rm} $RPM_BUILD_ROOT%{_datadir}/qemu-xen/openbios-ppc
-%{__rm} $RPM_BUILD_ROOT%{_datadir}/qemu-xen/openbios-sparc32
-%{__rm} $RPM_BUILD_ROOT%{_datadir}/qemu-xen/openbios-sparc64
-%{__rm} $RPM_BUILD_ROOT%{_datadir}/qemu-xen/palcode-clipper
-
%clean
rm -rf $RPM_BUILD_ROOT
%{_sharedstatedir}/xenstored
%dir /var/run/xenstored
%{systemdtmpfilesdir}/xenstored.conf
+%{systemdtmpfilesdir}/xen.conf
%dir %attr(0700,root,root) /var/log/xen
%dir %attr(0700,root,root) /var/log/xen/console
%{_datadir}/qemu-xen
%files -n bash-completion-%{name}
%defattr(644,root,root,755)
/etc/bash_completion.d/xl.sh
+
+%if %{with efi}
+%files efi
+%defattr(644,root,root,755)
+%dir %{_libdir}/efi
+%{_libdir}/efi/*.efi
+%endif