[Spice-devel] [PATCH spice-protocol 3/5] build-sys: Allows spec file to build MingW packages
Frediano Ziglio
fziglio at redhat.com
Fri Oct 11 09:56:27 UTC 2019
Add MingW support. This allows to build MingW packages easily with a
$ rpmbuild -ta spice-protocol-XXXX.tar.bz2
It's possible to disable MingW build using
$ rpmbuild --without mingw -ta spice-protocol-XXXX.tar.bz2
This is base on some work by Eduardo Lima adding MingW support to SPEC
files.
Part of dependencies, description and names came from Fedora SPEC file
for mingw-spice-protocol package.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
spice-protocol.spec.in | 50 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
diff --git a/spice-protocol.spec.in b/spice-protocol.spec.in
index cc1fadc..a6a570d 100644
--- a/spice-protocol.spec.in
+++ b/spice-protocol.spec.in
@@ -1,3 +1,11 @@
+%bcond_without mingw
+
+%if "%{_arch}" == "x86_64" && %{with mingw}
+%global build_mingw 1
+%else
+%global build_mingw 0
+%endif
+
Name: spice-protocol
Version: @VERSION@
Release: 1%{?dist}
@@ -8,21 +16,63 @@ License: BSD and LGPLv2+
URL: http://www.spice-space.org/
Source0: http://www.spice-space.org/download/releases/%{name}-%{version}.tar.bz2
BuildArch: noarch
+%if %{build_mingw}
+BuildRequires: mingw32-filesystem >= 95
+BuildRequires: mingw64-filesystem >= 95
+%endif
%description
Header files describing the spice protocol
and the para-virtual graphics card QXL.
+%if %{build_mingw}
+
+%define mingw_files() \
+%package -n %{1}-spice-protocol \
+Summary: Spice protocol header files \
+Requires: pkgconfig \
+\
+%description -n %{1}-spice-protocol \
+Header files describing the spice protocol \
+and the para-virtual graphics card QXL. \
+\
+%files -n %{1}-spice-protocol \
+%doc COPYING CHANGELOG.md \
+%{expand:%%{%{1}_includedir}}/spice-1 \
+%{expand:%%{%{1}_datadir}}/pkgconfig/spice-protocol.pc
+
+%mingw_files mingw32
+%mingw_files mingw64
+
+%endif
+
+
%prep
%setup -q
%build
+cp -rl . ../build_spice_protocol_tmp
+mv ../build_spice_protocol_tmp build
+pushd build
%configure
make %{?_smp_mflags}
+popd
+
+%if %{build_mingw}
+%mingw_configure
+%mingw_make %{?_smp_mflags} V=1
+%endif
+
%install
+pushd build
make DESTDIR=%{buildroot} install
+popd
+
+%if %{build_mingw}
+%mingw_make install DESTDIR=%{buildroot}
+%endif
%files
--
2.21.0
More information about the Spice-devel
mailing list