[libvirt PATCH] rpm: merge mingw sub-packages into native spec

Daniel P. Berrangé posted 1 patch 1 year, 8 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20220808172217.164715-1-berrange@redhat.com
.gitlab-ci.yml        |   2 +-
libvirt.spec.in       | 287 ++++++++++++++++++++++++++++++++++++
meson.build           |  17 +--
mingw-libvirt.spec.in | 327 ------------------------------------------
4 files changed, 293 insertions(+), 340 deletions(-)
delete mode 100644 mingw-libvirt.spec.in
[libvirt PATCH] rpm: merge mingw sub-packages into native spec
Posted by Daniel P. Berrangé 1 year, 8 months ago
One specfile containing both native and mingw builds is the
new best practice for Fedora. This reduces the maint burden
and ensures the mingw packages don't fall behind.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 .gitlab-ci.yml        |   2 +-
 libvirt.spec.in       | 287 ++++++++++++++++++++++++++++++++++++
 meson.build           |  17 +--
 mingw-libvirt.spec.in | 327 ------------------------------------------
 4 files changed, 293 insertions(+), 340 deletions(-)
 delete mode 100644 mingw-libvirt.spec.in

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6a8b89729f..39c5f8fb6d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -33,7 +33,7 @@ include:
     - meson dist -C build --no-tests
     - if test -x /usr/bin/rpmbuild && test "$RPM" != "skip";
       then
-        rpmbuild --clean --nodeps --define "_topdir $PWD/rpmbuild/" -ta build/meson-dist/libvirt-*.tar.xz;
+        rpmbuild --clean --nodeps --define "_without_mingw 1" --define "_topdir $PWD/rpmbuild/" -ta build/meson-dist/libvirt-*.tar.xz;
         mv rpmbuild/RPMS/x86_64/ libvirt-rpms/;
       else
         meson compile -C build;
diff --git a/libvirt.spec.in b/libvirt.spec.in
index a238edf2aa..fe386bfef2 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -197,6 +197,10 @@
 %define qemu_moddir %{_libdir}/qemu
 %define qemu_datadir %{_datadir}/qemu
 
+%define with_mingw 0
+%if 0%{?fedora}
+    %define with_mingw 0%{!?_without_mingw:1}
+%endif
 
 # RHEL releases provide stable tool chains and so it is safe to turn
 # compiler warning into errors without being worried about frequent
@@ -393,6 +397,36 @@ BuildRequires: libtirpc-devel
 BuildRequires: firewalld-filesystem
 %endif
 
+%if %{with_mingw}
+BuildRequires: mingw32-filesystem
+BuildRequires: mingw32-gcc
+BuildRequires: mingw32-binutils
+BuildRequires: mingw32-glib2 >= 2.48
+BuildRequires: mingw32-libgpg-error
+BuildRequires: mingw32-libgcrypt
+BuildRequires: mingw32-gnutls
+BuildRequires: mingw32-gettext
+BuildRequires: mingw32-libxml2
+BuildRequires: mingw32-portablexdr
+BuildRequires: mingw32-dlfcn
+BuildRequires: mingw32-libssh2
+BuildRequires: mingw32-curl
+
+BuildRequires: mingw64-filesystem
+BuildRequires: mingw64-gcc
+BuildRequires: mingw64-binutils
+BuildRequires: mingw64-glib2 >= 2.48
+BuildRequires: mingw64-libgpg-error
+BuildRequires: mingw64-libgcrypt
+BuildRequires: mingw64-gnutls
+BuildRequires: mingw64-gettext
+BuildRequires: mingw64-libxml2
+BuildRequires: mingw64-portablexdr
+BuildRequires: mingw64-dlfcn
+BuildRequires: mingw64-libssh2
+BuildRequires: mingw64-curl
+%endif
+
 %description
 Libvirt is a C toolkit to interact with the virtualization capabilities
 of recent versions of Linux (and other OSes). The main package includes
@@ -948,6 +982,25 @@ Requires: libvirt-daemon-driver-network = %{version}-%{release}
 %description nss
 Libvirt plugin for NSS for translating domain names into IP addresses.
 
+%if %{with_mingw}
+%package -n mingw32-libvirt
+Summary: %{summary}
+Obsoletes: mingw32-libvirt-static < 7.0.0
+BuildArch: noarch
+
+%description -n mingw32-libvirt
+MinGW Windows libvirt virtualization library.
+
+%package -n mingw64-libvirt
+Summary: %{summary}
+Obsoletes: mingw64-libvirt-static < 7.0.0
+BuildArch: noarch
+
+%description -n mingw64-libvirt
+MinGW Windows libvirt virtualization library.
+
+%{?mingw_debug_package}
+%endif
 
 %prep
 
@@ -1191,6 +1244,84 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/%{name}.spec)
 
 %meson_build
 
+%if %{with_mingw}
+%mingw_meson \
+  --auto-features=enabled \
+  -Ddriver_remote=enabled \
+  -Ddriver_test=enabled \
+  -Ddriver_esx=enabled \
+  -Dcurl=enabled \
+  -Ddocs=enabled \
+  -Dapparmor=disabled \
+  -Dapparmor_profiles=disabled \
+  -Dattr=disabled \
+  -Daudit=disabled \
+  -Dbash_completion=disabled \
+  -Dblkid=disabled \
+  -Dcapng=disabled \
+  -Ddriver_bhyve=disabled \
+  -Ddriver_hyperv=disabled \
+  -Ddriver_interface=disabled \
+  -Ddriver_libvirtd=disabled \
+  -Ddriver_libxl=disabled \
+  -Ddriver_lxc=disabled \
+  -Ddriver_network=disabled \
+  -Ddriver_openvz=disabled \
+  -Ddriver_qemu=disabled \
+  -Ddriver_secrets=disabled \
+  -Ddriver_vbox=disabled \
+  -Ddriver_vmware=disabled \
+  -Ddriver_vz=disabled \
+  -Ddtrace=disabled \
+  -Dexpensive_tests=enabled \
+  -Dfirewalld=disabled \
+  -Dfirewalld_zone=disabled \
+  -Dfuse=disabled \
+  -Dglusterfs=disabled \
+  -Dhost_validate=disabled \
+  -Dlibiscsi=disabled \
+  -Dlibnl=disabled \
+  -Dlibpcap=disabled \
+  -Dlibssh2=disabled \
+  -Dlibssh=disabled \
+  -Dlogin_shell=disabled \
+  -Dnetcf=disabled \
+  -Dnls=disabled \
+  -Dnss=disabled \
+  -Dnumactl=disabled \
+  -Dnumad=disabled \
+  -Dopenwsman=disabled \
+  -Dpciaccess=disabled \
+  -Dpm_utils=disabled \
+  -Dpolkit=disabled \
+  -Dreadline=disabled \
+  -Drpath=disabled \
+  -Dsanlock=disabled \
+  -Dsasl=disabled \
+  -Dsecdriver_apparmor=disabled \
+  -Dsecdriver_selinux=disabled \
+  -Dselinux=disabled \
+  -Dstorage_dir=disabled \
+  -Dstorage_disk=disabled \
+  -Dstorage_fs=disabled \
+  -Dstorage_gluster=disabled \
+  -Dstorage_iscsi_direct=disabled \
+  -Dstorage_iscsi=disabled \
+  -Dstorage_lvm=disabled \
+  -Dstorage_mpath=disabled \
+  -Dstorage_rbd=disabled \
+  -Dstorage_scsi=disabled \
+  -Dstorage_sheepdog=disabled \
+  -Dstorage_vstorage=disabled \
+  -Dstorage_zfs=disabled \
+  -Dsysctl_config=disabled \
+  -Dtests=disabled \
+  -Dudev=disabled \
+  -Dwireshark_dissector=disabled \
+  -Dyajl=disabled
+%mingw_ninja
+%endif
+
 %install
 rm -fr %{buildroot}
 
@@ -1259,6 +1390,26 @@ mv $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/libvirt_qemu_probes.stp \
     %endif
 %endif
 
+%if %{with_mingw}
+%mingw_ninja_install
+
+rm -rf $RPM_BUILD_ROOT%{mingw32_sysconfdir}/libvirt/nwfilter
+rm -rf $RPM_BUILD_ROOT%{mingw64_sysconfdir}/libvirt/nwfilter
+rm -rf $RPM_BUILD_ROOT%{mingw32_datadir}/doc/*
+rm -rf $RPM_BUILD_ROOT%{mingw64_datadir}/doc/*
+rm -rf $RPM_BUILD_ROOT%{mingw32_datadir}/gtk-doc/*
+rm -rf $RPM_BUILD_ROOT%{mingw64_datadir}/gtk-doc/*
+
+rm -rf $RPM_BUILD_ROOT%{mingw32_libexecdir}/libvirt_iohelper.exe
+rm -rf $RPM_BUILD_ROOT%{mingw64_libexecdir}/libvirt_iohelper.exe
+rm -rf $RPM_BUILD_ROOT%{mingw32_libexecdir}/libvirt-guests.sh
+rm -rf $RPM_BUILD_ROOT%{mingw64_libexecdir}/libvirt-guests.sh
+
+%mingw_debug_install_post
+
+%endif
+
+
 %check
 # Building on slow archs, like emulated s390x in Fedora copr, requires
 # raising the test timeout
@@ -2119,5 +2270,141 @@ exit 0
 %{_datadir}/libvirt/api/libvirt-qemu-api.xml
 %{_datadir}/libvirt/api/libvirt-lxc-api.xml
 
+%if %{with_mingw}
+%files -n mingw32-libvirt
+%dir %{mingw32_sysconfdir}/libvirt/
+%config(noreplace) %{mingw32_sysconfdir}/libvirt/libvirt.conf
+%config(noreplace) %{mingw32_sysconfdir}/libvirt/libvirt-admin.conf
+
+%{mingw32_bindir}/libvirt-0.dll
+%{mingw32_bindir}/virsh.exe
+%{mingw32_bindir}/virt-admin.exe
+%{mingw32_bindir}/virt-xml-validate
+%{mingw32_bindir}/virt-pki-query-dn.exe
+%{mingw32_bindir}/virt-pki-validate
+%{mingw32_bindir}/libvirt-lxc-0.dll
+%{mingw32_bindir}/libvirt-qemu-0.dll
+%{mingw32_bindir}/libvirt-admin-0.dll
+
+%{mingw32_libdir}/libvirt.dll.a
+%{mingw32_libdir}/pkgconfig/libvirt.pc
+%{mingw32_libdir}/pkgconfig/libvirt-qemu.pc
+%{mingw32_libdir}/pkgconfig/libvirt-lxc.pc
+%{mingw32_libdir}/pkgconfig/libvirt-admin.pc
+%{mingw32_libdir}/libvirt-lxc.dll.a
+%{mingw32_libdir}/libvirt-qemu.dll.a
+%{mingw32_libdir}/libvirt-admin.dll.a
+
+%dir %{mingw32_datadir}/libvirt/
+%dir %{mingw32_datadir}/libvirt/schemas/
+%{mingw32_datadir}/libvirt/schemas/*.rng
+
+%dir %{mingw32_datadir}/libvirt/api/
+%{mingw32_datadir}/libvirt/api/libvirt-api.xml
+%{mingw32_datadir}/libvirt/api/libvirt-lxc-api.xml
+%{mingw32_datadir}/libvirt/api/libvirt-qemu-api.xml
+%{mingw32_datadir}/libvirt/api/libvirt-admin-api.xml
+
+%{mingw32_datadir}/libvirt/cpu_map/*.xml
+
+%{mingw32_datadir}/libvirt/test-screenshot.png
+
+%{mingw32_datadir}/locale/*/LC_MESSAGES/libvirt.mo
+
+%dir %{mingw32_includedir}/libvirt
+%{mingw32_includedir}/libvirt/libvirt.h
+%{mingw32_includedir}/libvirt/libvirt-common.h
+%{mingw32_includedir}/libvirt/libvirt-domain.h
+%{mingw32_includedir}/libvirt/libvirt-domain-checkpoint.h
+%{mingw32_includedir}/libvirt/libvirt-domain-snapshot.h
+%{mingw32_includedir}/libvirt/libvirt-event.h
+%{mingw32_includedir}/libvirt/libvirt-host.h
+%{mingw32_includedir}/libvirt/libvirt-interface.h
+%{mingw32_includedir}/libvirt/libvirt-network.h
+%{mingw32_includedir}/libvirt/libvirt-nodedev.h
+%{mingw32_includedir}/libvirt/libvirt-nwfilter.h
+%{mingw32_includedir}/libvirt/libvirt-secret.h
+%{mingw32_includedir}/libvirt/libvirt-storage.h
+%{mingw32_includedir}/libvirt/libvirt-stream.h
+%{mingw32_includedir}/libvirt/virterror.h
+%{mingw32_includedir}/libvirt/libvirt-lxc.h
+%{mingw32_includedir}/libvirt/libvirt-qemu.h
+%{mingw32_includedir}/libvirt/libvirt-admin.h
+
+%{mingw32_mandir}/man1/virsh.1*
+%{mingw32_mandir}/man1/virt-admin.1*
+%{mingw32_mandir}/man1/virt-xml-validate.1*
+%{mingw32_mandir}/man1/virt-pki-query-dn.1*
+%{mingw32_mandir}/man1/virt-pki-validate.1*
+%{mingw32_mandir}/man7/virkey*.7*
+
+
+%files -n mingw64-libvirt
+%dir %{mingw64_sysconfdir}/libvirt/
+%config(noreplace) %{mingw64_sysconfdir}/libvirt/libvirt.conf
+%config(noreplace) %{mingw64_sysconfdir}/libvirt/libvirt-admin.conf
+
+%{mingw64_bindir}/libvirt-0.dll
+%{mingw64_bindir}/virsh.exe
+%{mingw64_bindir}/virt-admin.exe
+%{mingw64_bindir}/virt-xml-validate
+%{mingw64_bindir}/virt-pki-query-dn.exe
+%{mingw64_bindir}/virt-pki-validate
+%{mingw64_bindir}/libvirt-lxc-0.dll
+%{mingw64_bindir}/libvirt-qemu-0.dll
+%{mingw64_bindir}/libvirt-admin-0.dll
+
+%{mingw64_libdir}/libvirt.dll.a
+%{mingw64_libdir}/pkgconfig/libvirt.pc
+%{mingw64_libdir}/pkgconfig/libvirt-qemu.pc
+%{mingw64_libdir}/pkgconfig/libvirt-lxc.pc
+%{mingw64_libdir}/pkgconfig/libvirt-admin.pc
+%{mingw64_libdir}/libvirt-lxc.dll.a
+%{mingw64_libdir}/libvirt-qemu.dll.a
+%{mingw64_libdir}/libvirt-admin.dll.a
+
+%dir %{mingw64_datadir}/libvirt/
+%dir %{mingw64_datadir}/libvirt/schemas/
+%{mingw64_datadir}/libvirt/schemas/*.rng
+
+%dir %{mingw64_datadir}/libvirt/api/
+%{mingw64_datadir}/libvirt/api/libvirt-api.xml
+%{mingw64_datadir}/libvirt/api/libvirt-lxc-api.xml
+%{mingw64_datadir}/libvirt/api/libvirt-qemu-api.xml
+%{mingw64_datadir}/libvirt/api/libvirt-admin-api.xml
+
+%{mingw64_datadir}/libvirt/cpu_map/*.xml
+
+%{mingw64_datadir}/libvirt/test-screenshot.png
+
+%{mingw64_datadir}/locale/*/LC_MESSAGES/libvirt.mo
+
+%dir %{mingw64_includedir}/libvirt
+%{mingw64_includedir}/libvirt/libvirt.h
+%{mingw64_includedir}/libvirt/libvirt-common.h
+%{mingw64_includedir}/libvirt/libvirt-domain.h
+%{mingw64_includedir}/libvirt/libvirt-domain-checkpoint.h
+%{mingw64_includedir}/libvirt/libvirt-domain-snapshot.h
+%{mingw64_includedir}/libvirt/libvirt-event.h
+%{mingw64_includedir}/libvirt/libvirt-host.h
+%{mingw64_includedir}/libvirt/libvirt-interface.h
+%{mingw64_includedir}/libvirt/libvirt-network.h
+%{mingw64_includedir}/libvirt/libvirt-nodedev.h
+%{mingw64_includedir}/libvirt/libvirt-nwfilter.h
+%{mingw64_includedir}/libvirt/libvirt-secret.h
+%{mingw64_includedir}/libvirt/libvirt-storage.h
+%{mingw64_includedir}/libvirt/libvirt-stream.h
+%{mingw64_includedir}/libvirt/virterror.h
+%{mingw64_includedir}/libvirt/libvirt-lxc.h
+%{mingw64_includedir}/libvirt/libvirt-qemu.h
+%{mingw64_includedir}/libvirt/libvirt-admin.h
+
+%{mingw64_mandir}/man1/virsh.1*
+%{mingw64_mandir}/man1/virt-admin.1*
+%{mingw64_mandir}/man1/virt-xml-validate.1*
+%{mingw64_mandir}/man1/virt-pki-query-dn.1*
+%{mingw64_mandir}/man1/virt-pki-validate.1*
+%{mingw64_mandir}/man7/virkey*.7*
+%endif
 
 %changelog
diff --git a/meson.build b/meson.build
index 2d1ae4091a..0b3187ad88 100644
--- a/meson.build
+++ b/meson.build
@@ -2161,22 +2161,15 @@ endforeach
 # generate dist files
 
 if git
-  spec_files = [
-    'libvirt.spec.in',
-    'mingw-libvirt.spec.in',
-  ]
-
   spec_conf = configuration_data({
     'VERSION': meson.project_version(),
   })
 
-  foreach file : spec_files
-    configure_file(
-      input: file,
-      output: '@BASENAME@',
-      configuration: spec_conf,
-    )
-  endforeach
+  configure_file(
+    input: 'libvirt.spec.in',
+    output: '@BASENAME@',
+    configuration: spec_conf,
+  )
 
   authors = run_command(python3_prog, meson_gen_authors_prog.path(),
                         env: runutf8, check: true)
diff --git a/mingw-libvirt.spec.in b/mingw-libvirt.spec.in
deleted file mode 100644
index dbcb6d4b8f..0000000000
--- a/mingw-libvirt.spec.in
+++ /dev/null
@@ -1,327 +0,0 @@
-%{?mingw_package_header}
-
-# This spec file assumes you are building on a Fedora version
-# that's still supported by the vendor. It may work on other distros
-# or versions, but no effort will be made to ensure that going forward.
-%define min_fedora 33
-
-Name:           mingw-libvirt
-Version:        @VERSION@
-Release:        1%{?dist}
-Summary:        MinGW Windows libvirt virtualization library
-
-License:        LGPLv2+
-URL:            https://libvirt.org/
-
-%if %(echo %{version} | grep -q "\.0$"; echo $?) == 1
-    %define mainturl stable_updates/
-%endif
-Source: https://libvirt.org/sources/%{?mainturl}libvirt-%{version}.tar.xz
-
-BuildRequires:  mingw32-filesystem >= 95
-BuildRequires:  mingw64-filesystem >= 95
-BuildRequires:  mingw32-gcc
-BuildRequires:  mingw64-gcc
-BuildRequires:  mingw32-binutils
-BuildRequires:  mingw64-binutils
-BuildRequires:  mingw32-glib2 >= 2.48
-BuildRequires:  mingw64-glib2 >= 2.48
-BuildRequires:  mingw32-libgpg-error
-BuildRequires:  mingw64-libgpg-error
-BuildRequires:  mingw32-libgcrypt
-BuildRequires:  mingw64-libgcrypt
-BuildRequires:  mingw32-gnutls
-BuildRequires:  mingw64-gnutls
-BuildRequires:  mingw32-gettext
-BuildRequires:  mingw64-gettext
-BuildRequires:  mingw32-libxml2
-BuildRequires:  mingw64-libxml2
-BuildRequires:  mingw32-portablexdr
-BuildRequires:  mingw64-portablexdr
-BuildRequires:  mingw32-dlfcn
-BuildRequires:  mingw64-dlfcn
-
-BuildRequires:  pkgconfig
-# Need native version for msgfmt
-BuildRequires:  gettext
-BuildRequires:  libxslt
-BuildRequires:  python3
-BuildRequires:  perl-interpreter
-BuildRequires:  perl(Getopt::Long)
-BuildRequires:  meson
-BuildRequires:  ninja-build
-BuildRequires: python3-docutils
-
-BuildRequires: mingw32-libssh2
-BuildRequires: mingw64-libssh2
-BuildRequires: mingw32-curl
-BuildRequires: mingw64-curl
-BuildRequires: cpp
-%if 0%{?fedora} || 0%{?rhel} > 7
-BuildRequires: rpcgen
-%endif
-
-BuildArch:      noarch
-
-%description
-MinGW Windows libvirt virtualization library.
-
-# Mingw32
-%package -n mingw32-libvirt
-Summary: %{summary}
-Obsoletes: mingw32-libvirt-static < 7.0.0
-
-%description -n mingw32-libvirt
-MinGW Windows libvirt virtualization library.
-
-# Mingw64
-%package -n mingw64-libvirt
-Summary: %{summary}
-Obsoletes: mingw64-libvirt-static < 7.0.0
-
-%description -n mingw64-libvirt
-MinGW Windows libvirt virtualization library.
-
-%{?mingw_debug_package}
-
-
-%prep
-%setup -q -n libvirt-%{version}
-
-%build
-%if 0%{?fedora} >= %{min_fedora}
-    %define supported_platform 1
-%else
-    %define supported_platform 0
-%endif
-
-%if ! %{supported_platform}
-echo "This RPM requires Fedora >= %{min_fedora}"
-exit 1
-%endif
-
-%mingw_meson \
-  --auto-features=enabled \
-  -Ddriver_remote=enabled \
-  -Ddriver_test=enabled \
-  -Ddriver_esx=enabled \
-  -Dcurl=enabled \
-  -Ddocs=enabled \
-  -Dapparmor=disabled \
-  -Dapparmor_profiles=disabled \
-  -Dattr=disabled \
-  -Daudit=disabled \
-  -Dbash_completion=disabled \
-  -Dblkid=disabled \
-  -Dcapng=disabled \
-  -Ddriver_bhyve=disabled \
-  -Ddriver_hyperv=disabled \
-  -Ddriver_interface=disabled \
-  -Ddriver_libvirtd=disabled \
-  -Ddriver_libxl=disabled \
-  -Ddriver_lxc=disabled \
-  -Ddriver_network=disabled \
-  -Ddriver_openvz=disabled \
-  -Ddriver_qemu=disabled \
-  -Ddriver_secrets=disabled \
-  -Ddriver_vbox=disabled \
-  -Ddriver_vmware=disabled \
-  -Ddriver_vz=disabled \
-  -Ddtrace=disabled \
-  -Dexpensive_tests=enabled \
-  -Dfirewalld=disabled \
-  -Dfirewalld_zone=disabled \
-  -Dfuse=disabled \
-  -Dglusterfs=disabled \
-  -Dhost_validate=disabled \
-  -Dlibiscsi=disabled \
-  -Dlibnl=disabled \
-  -Dlibpcap=disabled \
-  -Dlibssh2=disabled \
-  -Dlibssh=disabled \
-  -Dlogin_shell=disabled \
-  -Dnetcf=disabled \
-  -Dnls=disabled \
-  -Dnss=disabled \
-  -Dnumactl=disabled \
-  -Dnumad=disabled \
-  -Dopenwsman=disabled \
-  -Dpciaccess=disabled \
-  -Dpm_utils=disabled \
-  -Dpolkit=disabled \
-  -Dreadline=disabled \
-  -Drpath=disabled \
-  -Dsanlock=disabled \
-  -Dsasl=disabled \
-  -Dsecdriver_apparmor=disabled \
-  -Dsecdriver_selinux=disabled \
-  -Dselinux=disabled \
-  -Dstorage_dir=disabled \
-  -Dstorage_disk=disabled \
-  -Dstorage_fs=disabled \
-  -Dstorage_gluster=disabled \
-  -Dstorage_iscsi_direct=disabled \
-  -Dstorage_iscsi=disabled \
-  -Dstorage_lvm=disabled \
-  -Dstorage_mpath=disabled \
-  -Dstorage_rbd=disabled \
-  -Dstorage_scsi=disabled \
-  -Dstorage_sheepdog=disabled \
-  -Dstorage_vstorage=disabled \
-  -Dstorage_zfs=disabled \
-  -Dsysctl_config=disabled \
-  -Dtests=disabled \
-  -Dudev=disabled \
-  -Dwireshark_dissector=disabled \
-  -Dyajl=disabled
-%mingw_ninja
-
-%install
-%mingw_ninja_install
-
-rm -rf $RPM_BUILD_ROOT%{mingw32_sysconfdir}/libvirt/nwfilter
-rm -rf $RPM_BUILD_ROOT%{mingw64_sysconfdir}/libvirt/nwfilter
-rm -rf $RPM_BUILD_ROOT%{mingw32_datadir}/doc/*
-rm -rf $RPM_BUILD_ROOT%{mingw64_datadir}/doc/*
-rm -rf $RPM_BUILD_ROOT%{mingw32_datadir}/gtk-doc/*
-rm -rf $RPM_BUILD_ROOT%{mingw64_datadir}/gtk-doc/*
-
-rm -rf $RPM_BUILD_ROOT%{mingw32_libexecdir}/libvirt_iohelper.exe
-rm -rf $RPM_BUILD_ROOT%{mingw64_libexecdir}/libvirt_iohelper.exe
-rm -rf $RPM_BUILD_ROOT%{mingw32_libexecdir}/libvirt-guests.sh
-rm -rf $RPM_BUILD_ROOT%{mingw64_libexecdir}/libvirt-guests.sh
-
-
-# Mingw32
-%files -n mingw32-libvirt
-%dir %{mingw32_sysconfdir}/libvirt/
-%config(noreplace) %{mingw32_sysconfdir}/libvirt/libvirt.conf
-%config(noreplace) %{mingw32_sysconfdir}/libvirt/libvirt-admin.conf
-
-%{mingw32_bindir}/libvirt-0.dll
-%{mingw32_bindir}/virsh.exe
-%{mingw32_bindir}/virt-admin.exe
-%{mingw32_bindir}/virt-xml-validate
-%{mingw32_bindir}/virt-pki-validate
-%{mingw32_bindir}/libvirt-lxc-0.dll
-%{mingw32_bindir}/libvirt-qemu-0.dll
-%{mingw32_bindir}/libvirt-admin-0.dll
-
-%{mingw32_libdir}/libvirt.dll.a
-%{mingw32_libdir}/pkgconfig/libvirt.pc
-%{mingw32_libdir}/pkgconfig/libvirt-qemu.pc
-%{mingw32_libdir}/pkgconfig/libvirt-lxc.pc
-%{mingw32_libdir}/pkgconfig/libvirt-admin.pc
-%{mingw32_libdir}/libvirt-lxc.dll.a
-%{mingw32_libdir}/libvirt-qemu.dll.a
-%{mingw32_libdir}/libvirt-admin.dll.a
-
-%dir %{mingw32_datadir}/libvirt/
-%dir %{mingw32_datadir}/libvirt/schemas/
-%{mingw32_datadir}/libvirt/schemas/*.rng
-
-%dir %{mingw32_datadir}/libvirt/api/
-%{mingw32_datadir}/libvirt/api/libvirt-api.xml
-%{mingw32_datadir}/libvirt/api/libvirt-lxc-api.xml
-%{mingw32_datadir}/libvirt/api/libvirt-qemu-api.xml
-%{mingw32_datadir}/libvirt/api/libvirt-admin-api.xml
-
-%{mingw32_datadir}/libvirt/cpu_map/*.xml
-
-%{mingw32_datadir}/libvirt/test-screenshot.png
-
-%{mingw32_datadir}/locale/*/LC_MESSAGES/libvirt.mo
-
-%dir %{mingw32_includedir}/libvirt
-%{mingw32_includedir}/libvirt/libvirt.h
-%{mingw32_includedir}/libvirt/libvirt-common.h
-%{mingw32_includedir}/libvirt/libvirt-domain.h
-%{mingw32_includedir}/libvirt/libvirt-domain-checkpoint.h
-%{mingw32_includedir}/libvirt/libvirt-domain-snapshot.h
-%{mingw32_includedir}/libvirt/libvirt-event.h
-%{mingw32_includedir}/libvirt/libvirt-host.h
-%{mingw32_includedir}/libvirt/libvirt-interface.h
-%{mingw32_includedir}/libvirt/libvirt-network.h
-%{mingw32_includedir}/libvirt/libvirt-nodedev.h
-%{mingw32_includedir}/libvirt/libvirt-nwfilter.h
-%{mingw32_includedir}/libvirt/libvirt-secret.h
-%{mingw32_includedir}/libvirt/libvirt-storage.h
-%{mingw32_includedir}/libvirt/libvirt-stream.h
-%{mingw32_includedir}/libvirt/virterror.h
-%{mingw32_includedir}/libvirt/libvirt-lxc.h
-%{mingw32_includedir}/libvirt/libvirt-qemu.h
-%{mingw32_includedir}/libvirt/libvirt-admin.h
-
-%{mingw32_mandir}/man1/virsh.1*
-%{mingw32_mandir}/man1/virt-admin.1*
-%{mingw32_mandir}/man1/virt-xml-validate.1*
-%{mingw32_mandir}/man1/virt-pki-validate.1*
-%{mingw32_mandir}/man7/virkey*.7*
-
-# Mingw64
-%files -n mingw64-libvirt
-%dir %{mingw64_sysconfdir}/libvirt/
-%config(noreplace) %{mingw64_sysconfdir}/libvirt/libvirt.conf
-%config(noreplace) %{mingw64_sysconfdir}/libvirt/libvirt-admin.conf
-
-%{mingw64_bindir}/libvirt-0.dll
-%{mingw64_bindir}/virsh.exe
-%{mingw64_bindir}/virt-admin.exe
-%{mingw64_bindir}/virt-xml-validate
-%{mingw64_bindir}/virt-pki-validate
-%{mingw64_bindir}/libvirt-lxc-0.dll
-%{mingw64_bindir}/libvirt-qemu-0.dll
-%{mingw64_bindir}/libvirt-admin-0.dll
-
-%{mingw64_libdir}/libvirt.dll.a
-%{mingw64_libdir}/pkgconfig/libvirt.pc
-%{mingw64_libdir}/pkgconfig/libvirt-qemu.pc
-%{mingw64_libdir}/pkgconfig/libvirt-lxc.pc
-%{mingw64_libdir}/pkgconfig/libvirt-admin.pc
-%{mingw64_libdir}/libvirt-lxc.dll.a
-%{mingw64_libdir}/libvirt-qemu.dll.a
-%{mingw64_libdir}/libvirt-admin.dll.a
-
-%dir %{mingw64_datadir}/libvirt/
-%dir %{mingw64_datadir}/libvirt/schemas/
-%{mingw64_datadir}/libvirt/schemas/*.rng
-
-%dir %{mingw64_datadir}/libvirt/api/
-%{mingw64_datadir}/libvirt/api/libvirt-api.xml
-%{mingw64_datadir}/libvirt/api/libvirt-lxc-api.xml
-%{mingw64_datadir}/libvirt/api/libvirt-qemu-api.xml
-%{mingw64_datadir}/libvirt/api/libvirt-admin-api.xml
-
-%{mingw64_datadir}/libvirt/cpu_map/*.xml
-
-%{mingw64_datadir}/libvirt/test-screenshot.png
-
-%{mingw64_datadir}/locale/*/LC_MESSAGES/libvirt.mo
-
-%dir %{mingw64_includedir}/libvirt
-%{mingw64_includedir}/libvirt/libvirt.h
-%{mingw64_includedir}/libvirt/libvirt-common.h
-%{mingw64_includedir}/libvirt/libvirt-domain.h
-%{mingw64_includedir}/libvirt/libvirt-domain-checkpoint.h
-%{mingw64_includedir}/libvirt/libvirt-domain-snapshot.h
-%{mingw64_includedir}/libvirt/libvirt-event.h
-%{mingw64_includedir}/libvirt/libvirt-host.h
-%{mingw64_includedir}/libvirt/libvirt-interface.h
-%{mingw64_includedir}/libvirt/libvirt-network.h
-%{mingw64_includedir}/libvirt/libvirt-nodedev.h
-%{mingw64_includedir}/libvirt/libvirt-nwfilter.h
-%{mingw64_includedir}/libvirt/libvirt-secret.h
-%{mingw64_includedir}/libvirt/libvirt-storage.h
-%{mingw64_includedir}/libvirt/libvirt-stream.h
-%{mingw64_includedir}/libvirt/virterror.h
-%{mingw64_includedir}/libvirt/libvirt-lxc.h
-%{mingw64_includedir}/libvirt/libvirt-qemu.h
-%{mingw64_includedir}/libvirt/libvirt-admin.h
-
-%{mingw64_mandir}/man1/virsh.1*
-%{mingw64_mandir}/man1/virt-admin.1*
-%{mingw64_mandir}/man1/virt-xml-validate.1*
-%{mingw64_mandir}/man1/virt-pki-validate.1*
-%{mingw64_mandir}/man7/virkey*.7*
-
-%changelog
-- 
2.37.1

Re: [libvirt PATCH] rpm: merge mingw sub-packages into native spec
Posted by Pavel Hrdina 1 year, 8 months ago
On Mon, Aug 08, 2022 at 01:22:17PM -0400, Daniel P. Berrangé wrote:
> One specfile containing both native and mingw builds is the
> new best practice for Fedora. This reduces the maint burden
> and ensures the mingw packages don't fall behind.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  .gitlab-ci.yml        |   2 +-
>  libvirt.spec.in       | 287 ++++++++++++++++++++++++++++++++++++
>  meson.build           |  17 +--
>  mingw-libvirt.spec.in | 327 ------------------------------------------
>  4 files changed, 293 insertions(+), 340 deletions(-)
>  delete mode 100644 mingw-libvirt.spec.in

The patch looks good but there are some changes not mentioned directly.

With this patch we will build MinGW packages by default on Fedora. Not
sure if that is desirable. I would rather have it the other way around
if it works for Fedora best practice.

We also lose the ability to build only MinGW packages but I don't think
that's a big deal.

Pavel
Re: [libvirt PATCH] rpm: merge mingw sub-packages into native spec
Posted by Daniel P. Berrangé 1 year, 8 months ago
On Tue, Aug 09, 2022 at 01:52:33PM +0200, Pavel Hrdina wrote:
> On Mon, Aug 08, 2022 at 01:22:17PM -0400, Daniel P. Berrangé wrote:
> > One specfile containing both native and mingw builds is the
> > new best practice for Fedora. This reduces the maint burden
> > and ensures the mingw packages don't fall behind.
> > 
> > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> > ---
> >  .gitlab-ci.yml        |   2 +-
> >  libvirt.spec.in       | 287 ++++++++++++++++++++++++++++++++++++
> >  meson.build           |  17 +--
> >  mingw-libvirt.spec.in | 327 ------------------------------------------
> >  4 files changed, 293 insertions(+), 340 deletions(-)
> >  delete mode 100644 mingw-libvirt.spec.in
> 
> The patch looks good but there are some changes not mentioned directly.
> 
> With this patch we will build MinGW packages by default on Fedora. Not
> sure if that is desirable. I would rather have it the other way around
> if it works for Fedora best practice.

Fedora has shipped the native & mingw builds for years now. This just
merges them into one spec. There's no change in what we actually build
from Fedora POV. Or am I misunderstanding what you mean ?

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

Re: [libvirt PATCH] rpm: merge mingw sub-packages into native spec
Posted by Pavel Hrdina 1 year, 8 months ago
On Tue, Aug 09, 2022 at 12:54:09PM +0100, Daniel P. Berrangé wrote:
> On Tue, Aug 09, 2022 at 01:52:33PM +0200, Pavel Hrdina wrote:
> > On Mon, Aug 08, 2022 at 01:22:17PM -0400, Daniel P. Berrangé wrote:
> > > One specfile containing both native and mingw builds is the
> > > new best practice for Fedora. This reduces the maint burden
> > > and ensures the mingw packages don't fall behind.
> > > 
> > > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> > > ---
> > >  .gitlab-ci.yml        |   2 +-
> > >  libvirt.spec.in       | 287 ++++++++++++++++++++++++++++++++++++
> > >  meson.build           |  17 +--
> > >  mingw-libvirt.spec.in | 327 ------------------------------------------
> > >  4 files changed, 293 insertions(+), 340 deletions(-)
> > >  delete mode 100644 mingw-libvirt.spec.in
> > 
> > The patch looks good but there are some changes not mentioned directly.
> > 
> > With this patch we will build MinGW packages by default on Fedora. Not
> > sure if that is desirable. I would rather have it the other way around
> > if it works for Fedora best practice.
> 
> Fedora has shipped the native & mingw builds for years now. This just
> merges them into one spec. There's no change in what we actually build
> from Fedora POV. Or am I misunderstanding what you mean ?

From Fedora POV everything is probably the same but for everybody else
this might be regression that would require using the --define as we
need to do for gitlab-ci.

Pavel
Re: [libvirt PATCH] rpm: merge mingw sub-packages into native spec
Posted by Daniel P. Berrangé 1 year, 8 months ago
On Tue, Aug 09, 2022 at 01:56:43PM +0200, Pavel Hrdina wrote:
> On Tue, Aug 09, 2022 at 12:54:09PM +0100, Daniel P. Berrangé wrote:
> > On Tue, Aug 09, 2022 at 01:52:33PM +0200, Pavel Hrdina wrote:
> > > On Mon, Aug 08, 2022 at 01:22:17PM -0400, Daniel P. Berrangé wrote:
> > > > One specfile containing both native and mingw builds is the
> > > > new best practice for Fedora. This reduces the maint burden
> > > > and ensures the mingw packages don't fall behind.
> > > > 
> > > > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> > > > ---
> > > >  .gitlab-ci.yml        |   2 +-
> > > >  libvirt.spec.in       | 287 ++++++++++++++++++++++++++++++++++++
> > > >  meson.build           |  17 +--
> > > >  mingw-libvirt.spec.in | 327 ------------------------------------------
> > > >  4 files changed, 293 insertions(+), 340 deletions(-)
> > > >  delete mode 100644 mingw-libvirt.spec.in
> > > 
> > > The patch looks good but there are some changes not mentioned directly.
> > > 
> > > With this patch we will build MinGW packages by default on Fedora. Not
> > > sure if that is desirable. I would rather have it the other way around
> > > if it works for Fedora best practice.
> > 
> > Fedora has shipped the native & mingw builds for years now. This just
> > merges them into one spec. There's no change in what we actually build
> > from Fedora POV. Or am I misunderstanding what you mean ?
> 
> From Fedora POV everything is probably the same but for everybody else
> this might be regression that would require using the --define as we
> need to do for gitlab-ci.

IMHO if a contributor using the upstream spec to build RPMs, they need
to just deal with whatever the current packaging has defined. Ultimately
you can still do 'dnf builddep' to get the list of deps installeds,
including the mingw ones now.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

Re: [libvirt PATCH] rpm: merge mingw sub-packages into native spec
Posted by Pavel Hrdina 1 year, 8 months ago
On Tue, Aug 09, 2022 at 12:59:36PM +0100, Daniel P. Berrangé wrote:
> On Tue, Aug 09, 2022 at 01:56:43PM +0200, Pavel Hrdina wrote:
> > On Tue, Aug 09, 2022 at 12:54:09PM +0100, Daniel P. Berrangé wrote:
> > > On Tue, Aug 09, 2022 at 01:52:33PM +0200, Pavel Hrdina wrote:
> > > > On Mon, Aug 08, 2022 at 01:22:17PM -0400, Daniel P. Berrangé wrote:
> > > > > One specfile containing both native and mingw builds is the
> > > > > new best practice for Fedora. This reduces the maint burden
> > > > > and ensures the mingw packages don't fall behind.
> > > > > 
> > > > > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> > > > > ---
> > > > >  .gitlab-ci.yml        |   2 +-
> > > > >  libvirt.spec.in       | 287 ++++++++++++++++++++++++++++++++++++
> > > > >  meson.build           |  17 +--
> > > > >  mingw-libvirt.spec.in | 327 ------------------------------------------
> > > > >  4 files changed, 293 insertions(+), 340 deletions(-)
> > > > >  delete mode 100644 mingw-libvirt.spec.in
> > > > 
> > > > The patch looks good but there are some changes not mentioned directly.
> > > > 
> > > > With this patch we will build MinGW packages by default on Fedora. Not
> > > > sure if that is desirable. I would rather have it the other way around
> > > > if it works for Fedora best practice.
> > > 
> > > Fedora has shipped the native & mingw builds for years now. This just
> > > merges them into one spec. There's no change in what we actually build
> > > from Fedora POV. Or am I misunderstanding what you mean ?
> > 
> > From Fedora POV everything is probably the same but for everybody else
> > this might be regression that would require using the --define as we
> > need to do for gitlab-ci.
> 
> IMHO if a contributor using the upstream spec to build RPMs, they need
> to just deal with whatever the current packaging has defined. Ultimately
> you can still do 'dnf builddep' to get the list of deps installeds,
> including the mingw ones now.

I just wanted to point it out as it was not mentioned in the commit
message and might not be obvious from the code itself. Since I don't
have a strong opinion about this change

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Re: [libvirt PATCH] rpm: merge mingw sub-packages into native spec
Posted by Daniel P. Berrangé 1 year, 8 months ago
On Tue, Aug 09, 2022 at 02:05:10PM +0200, Pavel Hrdina wrote:
> On Tue, Aug 09, 2022 at 12:59:36PM +0100, Daniel P. Berrangé wrote:
> > On Tue, Aug 09, 2022 at 01:56:43PM +0200, Pavel Hrdina wrote:
> > > On Tue, Aug 09, 2022 at 12:54:09PM +0100, Daniel P. Berrangé wrote:
> > > > On Tue, Aug 09, 2022 at 01:52:33PM +0200, Pavel Hrdina wrote:
> > > > > On Mon, Aug 08, 2022 at 01:22:17PM -0400, Daniel P. Berrangé wrote:
> > > > > > One specfile containing both native and mingw builds is the
> > > > > > new best practice for Fedora. This reduces the maint burden
> > > > > > and ensures the mingw packages don't fall behind.
> > > > > > 
> > > > > > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> > > > > > ---
> > > > > >  .gitlab-ci.yml        |   2 +-
> > > > > >  libvirt.spec.in       | 287 ++++++++++++++++++++++++++++++++++++
> > > > > >  meson.build           |  17 +--
> > > > > >  mingw-libvirt.spec.in | 327 ------------------------------------------
> > > > > >  4 files changed, 293 insertions(+), 340 deletions(-)
> > > > > >  delete mode 100644 mingw-libvirt.spec.in
> > > > > 
> > > > > The patch looks good but there are some changes not mentioned directly.
> > > > > 
> > > > > With this patch we will build MinGW packages by default on Fedora. Not
> > > > > sure if that is desirable. I would rather have it the other way around
> > > > > if it works for Fedora best practice.
> > > > 
> > > > Fedora has shipped the native & mingw builds for years now. This just
> > > > merges them into one spec. There's no change in what we actually build
> > > > from Fedora POV. Or am I misunderstanding what you mean ?
> > > 
> > > From Fedora POV everything is probably the same but for everybody else
> > > this might be regression that would require using the --define as we
> > > need to do for gitlab-ci.
> > 
> > IMHO if a contributor using the upstream spec to build RPMs, they need
> > to just deal with whatever the current packaging has defined. Ultimately
> > you can still do 'dnf builddep' to get the list of deps installeds,
> > including the mingw ones now.
> 
> I just wanted to point it out as it was not mentioned in the commit
> message and might not be obvious from the code itself. Since I don't
> have a strong opinion about this change
> 
> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>

I'll add a line to the commit message mentioning that RPM builds now
need extra BRs to be installed.


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|