[spice-protocol,v4,4/5] build-sys: Allows spec file to build MingW packages

Submitted by Frediano Ziglio on Oct. 23, 2019, 10:06 a.m.

Details

Message ID 20191023100632.26265-4-fziglio@redhat.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Frediano Ziglio Oct. 23, 2019, 10:06 a.m.
Add MingW support. This allows to build MingW packages easily with a

  $ rpmbuild -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@redhat.com>
Signed-off-by: Victor Toso <victortoso@redhat.com>
--
Changes since v3:
- add gitlab ci from Victor
---
 .gitlab-ci.yml         |  3 ++-
 spice-protocol.spec.in | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a20776e..02406ca 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,9 +4,10 @@  variables:
   DEPS_COMMON: git libtool make python3 python3-six redhat-rpm-config
                python3-pyparsing meson ninja-build gtk-doc glib2-devel
                gettext gettext-devel bzip2 rpmlint rpm-build python-unversioned-command
+  DEPS_MINGW: mingw32-filesystem mingw64-filesystem
 
 before_script:
-- dnf install -y $DEPS_COMMON
+- dnf install -y $DEPS_COMMON $DEPS_MINGW
 
 fedora-autotools:
   script:
diff --git a/spice-protocol.spec.in b/spice-protocol.spec.in
index 49724c6..54aacfd 100644
--- a/spice-protocol.spec.in
+++ b/spice-protocol.spec.in
@@ -8,21 +8,53 @@  License:        BSD and LGPLv2+
 URL:            https://www.spice-space.org
 Source0:        https://www.spice-space.org/download/releases/%{name}-%{version}.tar.bz2
 BuildArch:      noarch
+BuildRequires:  mingw32-filesystem >= 95
+BuildRequires:  mingw64-filesystem >= 95
 
 %description
 Header files describing the spice protocol
 and the para-virtual graphics card QXL.
 
 
+%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
+
+
 %prep
 %setup -q
 
 %build
+cp -rl . ../build_spice_protocol_tmp
+mv ../build_spice_protocol_tmp build
+pushd build
 %configure
 make %{?_smp_mflags}
+popd
+
+%mingw_configure
+%mingw_make %{?_smp_mflags} V=1
+
 
 %install
+pushd build
 make DESTDIR=%{buildroot} install
+popd
+
+%mingw_make install DESTDIR=%{buildroot}
 
 
 %files

Comments