%{?mingw_package_header}

Name: mingw-libosinfo
Version: @VERSION@
Release: 1%{?dist}
Summary: MinGW Windows port of a library for managing OS information for virtualization
License: LGPLv2+
Group: Development/Libraries
Source: https://releases.pagure.io/libosinfo/libosinfo-%{version}.tar.gz
URL: https://libosinfo.org/

BuildArch: noarch

BuildRequires: intltool

BuildRequires: mingw32-filesystem >= 95
BuildRequires: mingw64-filesystem >= 95
BuildRequires: mingw32-gcc
BuildRequires: mingw64-gcc
BuildRequires: mingw32-binutils
BuildRequires: mingw64-binutils

BuildRequires: mingw32-glib2
BuildRequires: mingw64-glib2
BuildRequires: mingw32-libxml2
BuildRequires: mingw64-libxml2
BuildRequires: mingw32-libxslt
BuildRequires: mingw64-libxslt

BuildRequires: pkgconfig

BuildRequires: /usr/bin/pod2man

%description
libosinfo is a library that allows virtualization provisioning tools to
determine the optimal device settings for a hypervisor/operating system
combination.

%package -n mingw32-libosinfo
Summary: %{summary}

Requires: pkgconfig
Requires: mingw32-osinfo-db
Requires: mingw32-osinfo-db-tools

%description -n mingw32-libosinfo
libosinfo is a library that allows virtualization provisioning tools to
determine the optimal device settings for a hypervisor/operating system
combination.

%package -n mingw64-libosinfo
Summary: %{summary}

Requires: pkgconfig
Requires: mingw64-osinfo-db
Requires: mingw64-osinfo-db-tools

%description -n mingw64-libosinfo
libosinfo is a library that allows virtualization provisioning tools to
determine the optimal device settings for a hypervisor/operating system
combination.

%{?mingw_debug_package}

%prep
%setup -q -n libosinfo-%{version}

%build
%mingw_configure \
    --enable-introspection=no \
    --enable-tests=no

%mingw_make %{?_smp_mflags}


%install
%mingw_make_install DESTDIR=$RPM_BUILD_ROOT

# Remove static libraries but DON'T remove *.dll.a files.
rm -f $RPM_BUILD_ROOT%{mingw32_libdir}/libosinfo-1.0.a
rm -f $RPM_BUILD_ROOT%{mingw64_libdir}/libosinfo-1.0.a

# Libtool files don't need to be bundled
find $RPM_BUILD_ROOT -name "*.la" -delete

# Manpages don't need to be bundled
rm -rf $RPM_BUILD_ROOT%{mingw32_datadir}/man
rm -rf $RPM_BUILD_ROOT%{mingw64_datadir}/man

rm -rf $RPM_BUILD_ROOT%{mingw32_datadir}/gtk-doc
rm -rf $RPM_BUILD_ROOT%{mingw64_datadir}/gtk-doc

%files -n mingw32-libosinfo
%doc AUTHORS ChangeLog COPYING.LIB NEWS README
%{mingw32_bindir}/osinfo-detect.exe
%{mingw32_bindir}/osinfo-install-script.exe
%{mingw32_bindir}/osinfo-query.exe
%{mingw32_bindir}/libosinfo-1.0-0.dll
%{mingw32_libdir}/libosinfo-1.0.dll.a
%{mingw32_libdir}/pkgconfig/libosinfo-1.0.pc
%dir %{mingw32_includedir}/libosinfo-1.0/
%dir %{mingw32_includedir}/libosinfo-1.0/osinfo
%{mingw32_includedir}/libosinfo-1.0/osinfo/*.h
%dir %{mingw32_datadir}/libosinfo
%{mingw32_datadir}/libosinfo/usb.ids
%{mingw32_datadir}/libosinfo/pci.ids
%{mingw32_datadir}/locale/*/LC_MESSAGES/libosinfo.mo

%files -n mingw64-libosinfo
%doc AUTHORS ChangeLog COPYING.LIB NEWS README
%{mingw64_bindir}/osinfo-detect.exe
%{mingw64_bindir}/osinfo-install-script.exe
%{mingw64_bindir}/osinfo-query.exe
%{mingw64_bindir}/libosinfo-1.0-0.dll
%{mingw64_libdir}/libosinfo-1.0.dll.a
%{mingw64_libdir}/pkgconfig/libosinfo-1.0.pc
%dir %{mingw64_includedir}/libosinfo-1.0/
%dir %{mingw64_includedir}/libosinfo-1.0/osinfo
%{mingw64_includedir}/libosinfo-1.0/osinfo/*.h
%dir %{mingw64_datadir}/libosinfo
%{mingw64_datadir}/libosinfo/usb.ids
%{mingw64_datadir}/libosinfo/pci.ids
%{mingw64_datadir}/locale/*/LC_MESSAGES/libosinfo.mo

%changelog
