From 348c2fe9f4e69a801aafb477d6a38760215f0d14 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 23 Jan 2024 14:17:52 +0000 Subject: [PATCH] Add mingw{32,64}-nbdkit subpackages --- nbdkit.spec | 140 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) diff --git a/nbdkit.spec b/nbdkit.spec index 797ed0c..67ea91f 100644 --- a/nbdkit.spec +++ b/nbdkit.spec @@ -25,6 +25,11 @@ # but somehow "fixed itself", keep an eye on it. %global have_blkio 1 +# Enable mingw subpackage on Fedora only. +%if 0%{?fedora} +%global have_mingw 1 +%endif + # Enable nbdkit-selinux package. %global with_selinux 1 %global modulename nbdkit @@ -168,6 +173,25 @@ BuildRequires: %{_bindir}/stat # itself, but it's a simple noarch package so easy to install. BuildRequires: nbdkit-srpm-macros >= 1.30.0 +%if 0%{?have_mingw} +BuildRequires: mingw32-filesystem +BuildRequires: mingw64-filesystem +BuildRequires: mingw32-gcc +BuildRequires: mingw64-gcc +BuildRequires: mingw32-gcc-c++ +BuildRequires: mingw64-gcc-c++ +BuildRequires: mingw32-dlfcn +BuildRequires: mingw64-dlfcn +BuildRequires: mingw32-gnutls +BuildRequires: mingw64-gnutls +BuildRequires: mingw32-winpthreads +BuildRequires: mingw64-winpthreads +BuildRequires: mingw32-xz +BuildRequires: mingw64-xz +BuildRequires: mingw32-zlib +BuildRequires: mingw64-zlib +%endif + # nbdkit is a metapackage pulling the server and a useful subset # of the plugins and filters. Requires: nbdkit-server%{?_isa} = %{version}-%{release} @@ -689,6 +713,43 @@ BuildRequires: selinux-policy-devel %endif +%if 0%{?have_mingw} +%package -n mingw32-%{name} +Summary: nbdkit binary, plugins, filters, development files for Windows +BuildArch: noarch +Requires: mingw32-filesystem +Requires: pkgconfig + +%description -n mingw32-%{name} +NBD is a protocol for accessing block devices (hard disks and +disk-like things) over the network. + +nbdkit is a toolkit for creating NBD servers. + +This package contains the nbdkit binary, plugins, filters and +development kit for 32 bit versions of Windows. + + +%package -n mingw64-%{name} +Summary: nbdkit binary, plugins, filters, development files for Windows +BuildArch: noarch +Requires: mingw64-filesystem +Requires: pkgconfig + +%description -n mingw64-%{name} +NBD is a protocol for accessing block devices (hard disks and +disk-like things) over the network. + +nbdkit is a toolkit for creating NBD servers. + +This package contains the nbdkit binary, plugins, filters and +development kit for 64 bit versions of Windows. + + +%{?mingw_debug_package} +%endif + + %prep %if 0%{verify_tarball_signature} %{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}' @@ -797,6 +858,44 @@ bzip2 -9 %{modulename}.pp popd +%if 0%{?have_mingw} +%mingw_configure \ + --disable-static \ + --enable-shared \ + --with-extra='%{name}-%{version}-%{release}' \ + --with-tls-priority=@NBDKIT,SYSTEM \ + --disable-golang \ + --disable-libguestfs-tests \ + --disable-linuxdisk \ + --disable-lua \ + --disable-ocaml \ + --disable-perl \ + --disable-python \ + --disable-ruby \ + --disable-rust \ + --disable-tcl \ + --disable-torrent \ + --disable-valgrind \ + --disable-vddk \ + --without-bash-completions \ + --without-curl \ + --without-ext2 \ + --with-gnutls \ + --without-iso \ + --without-libblkio \ + --without-libguestfs \ + --without-libnbd \ + --without-libvirt \ + --with-liblzma \ + --without-manpages \ + --without-selinux \ + --without-ssh \ + --with-zlib \ + %{nil} + +%mingw_make %{?_smp_mflags} +%endif + %install pushd build_native @@ -832,6 +931,24 @@ install -D -p -m 0644 selinux/%{modulename}.if $RPM_BUILD_ROOT%{_datadir}/selinu %endif popd +%if 0%{?have_mingw} +%mingw_make_install + +# Remove .la files +rm -f $RPM_BUILD_ROOT%{mingw32_libdir}/*.la +rm -f $RPM_BUILD_ROOT%{mingw64_libdir}/*.la + +# The .def files aren't interesting for other binaries +rm -f $RPM_BUILD_ROOT%{mingw32_bindir}/*.def +rm -f $RPM_BUILD_ROOT%{mingw64_bindir}/*.def + +# Remove man pages which duplicate stuff in Fedora already. +rm -rf $RPM_BUILD_ROOT%{mingw32_mandir} +rm -rf $RPM_BUILD_ROOT%{mingw64_mandir} + +%mingw_debug_install_post +%endif + %check %ifnarch %{broken_test_arches} @@ -1331,7 +1448,30 @@ fi %endif +%if 0%{?have_mingw} +%files -n mingw32-%{name} +%license LICENSE +%{mingw32_sbindir}/nbdkit.exe +%{mingw32_libdir}/%{name}/ +%{mingw32_libdir}/libnbdkit.a +%{mingw32_libdir}/pkgconfig/%{name}.pc +%{mingw32_includedir}/*.h + + +%files -n mingw64-%{name} +%license LICENSE +%{mingw64_sbindir}/nbdkit.exe +%{mingw64_libdir}/%{name}/ +%{mingw64_libdir}/libnbdkit.a +%{mingw64_libdir}/pkgconfig/%{name}.pc +%{mingw64_includedir}/*.h +%endif + + %changelog +* Tue Jan 23 2024 Richard W.M. Jones - 1.37.5-2 +- Add mingw{32,64}-nbdkit subpackages + * Sun Jan 21 2024 Fedora Release Engineering - 1.37.5-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild