# forget using %configure macro. Simply use `./configure`
time rpmbuild -bb  --with efi --with xsm --define 'dist .fc24'  --define '_libdir /usr/lib64' --with scmgit xen47.spec > ~/xendout.out

time mock -r fedora-24-x86_64 --with efi --with xsm --define 'dist .fc24' --resultdir=~/mock xen-4.7.0-rc2.fc24.src.rpm > ~/mkxen461.out

# %setup
%(%{_buildshell} -c '(k=0;for i in {1..7};do echo %patch$i -p1;done)')
time mock -r fedora-24-x86_64  --define '_proj fedora' --define '_xenlib /usr/lib' --with scmgit --with efi --with xsm --define 'dist .fc24' --define 'ocamllib /usr/lib64/ocaml' --resultdir=~/mock rpmbuild/SRPMS/xen-4.7.0-rc2.fc24.src.rpm > mkxen.out

# to get syntax highlight, need in ~/.bashrc
export TERM=xterm-256color

# remove trailing whitespace
sed -i  's/[[:space:]]*$//' xen*spec

# C7 xen49
time rpmbuild -bp  --with efi --with xsm --define '_xenlib /usr/lib' --define 'dist .el7'  --define '_libdir /usr/lib64' --with scmgit xen49.spec

# C7 xen4b
time 
rpmbuild -bp  --with efi --with xsm --with xenxsm --with scmgit --with tumeq --with efi --with xsm --define '_xenlib /usr/lib' --define '_libdir /usr/lib64' --with scmgit xen4b.spec

# shortcut to run qemu-xen
# needs this patch: 0404-build-shortcut-to-make-qemu-xen.patch
CONFIG_UUMEQ=y make subdir-install-qemu-xen-dir -C tools DESTDIR=$PWD/dist/uumeq

# shortcut to install qemu-trad after tools has run
make subdir-install-qemu-xen-traditional-dir -C tools DESTDIR=$PWD/dist/tumeq

# grab all missing sources, or got nosrc to full source
spectool -g -S -R -d '_topdir /builddir/build' -d '_sourcedir %{_topdir}/SOURCES' xen4a.spec

// must install python3
PYTHON=/usr/bin/python3 CONFIG_UUMEQ=y make -j3 subdir-install-qemu-xen-dir -C tools DESTDIR=$PWD/dist/uumeq

// add in tools-config, qemu extra args
--extra-cflags=\" -I$(XEN_ROOT)/tools/include -DHAVE_FSXATTR=1 \"

dnf builddep -D '_topdir /builddir/build' -D '_with_tumeq 1' /builddir/build/SPECS/xen4f.spec

// new in 4.16 is the conditional pkg: xenstore-guest-utils
rpmbuild -bb --with reuse --with storeutils --with tumeq --nocheck xen4g.spec

