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

Submitted by Frediano Ziglio on Oct. 11, 2019, 9:56 a.m.

Details

Message ID 20191011095629.28447-4-fziglio@redhat.com
State New
Headers show
Series "SPEC integration" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Frediano Ziglio Oct. 11, 2019, 9:56 a.m.
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@redhat.com>
---
 spice-protocol.spec.in | 50 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

Patch hide | download patch | download mbox

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

Comments

On 10/11/19 6:56 AM, Frediano Ziglio wrote:
> 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@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
> +

This global flag should not be necessary, because the spice-protocol 
package is a noarch, thus mingw-packages should always be built.

>   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
>
> 
> On 10/11/19 6:56 AM, Frediano Ziglio wrote:
> > 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@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
> > +
> 
> This global flag should not be necessary, because the spice-protocol
> package is a noarch, thus mingw-packages should always be built.
> 

Not sure if Mingw packages can be build on arm (for instance).
Did you try?

> >   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
> > 

Frediano