File hunspell.spec of Package mingw64-hunspell

#
# spec file for package mingw64-hunspell
#
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%define ver     1.7
%define libname lib%{_name}-1_7-0
%bcond_with     check
%define _name   hunspell
Name:           mingw64-%{_name}
Version:        1.7.0
Release:        0
Summary:        A spell checker and morphological analyzer library
License:        (GPL-2.0-or-later OR LGPL-2.1-or-later OR MPL-1.1+) AND LGPL-2.1-or-later
Group:          Productivity/Office/Other
URL:            https://hunspell.github.io
Source0:        https://github.com/%{_name}/%{_name}/archive/v%{version}.tar.gz#/%{_name}-%{version}.tar.gz
# CVE-2019-16707 [bsc#1151867], invalid read operation in SuggestMgr:leftcommonsubstring in suggestmgr.cxx
Patch0:         hunspell-CVE-2019-16707.patch
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  bison
BuildRequires:  libtool
BuildRequires:  mingw64-cross-gcc-c++
BuildRequires:  mingw64-cross-pkgconf
%if %{with check}
BuildRequires:  mingw64-cross-wine
%endif
BuildRequires:  mingw64-ncurses-devel >= 5.0
BuildRequires:  mingw64-readline-devel
Recommends:     %{name}-tools
Recommends:     mingw64-unzip
%_mingw64_package_header_debug
BuildArch:      noarch

%description
Hunspell is a spell checker and morphological analyzer library and
program designed for languages with rich morphology and complex word
compounding or character encoding. Hunspell interfaces: Ispell-like
terminal interface using Curses library, Ispell pipe interface,
LibreOffice or OpenOffice.org UNO module.

%package -n mingw64-%{libname}
Summary:        A spell checker and morphological analyzer library
# same libname, support migration
Group:          System/Libraries
Conflicts:      mingw64-hunspell = 1.4.0

%description -n mingw64-%{libname}
Hunspell is a spell checker and morphological analyzer library and
program designed for languages with rich morphology and complex word
compounding or character encoding. Hunspell interfaces: Ispell-like
terminal interface using Curses library, Ispell pipe interface,
LibreOffice or OpenOffice.org UNO module.

This package contains the shared library.

%package tools
Summary:        Hunspell tools
Group:          Development/Libraries/Other
Requires:       %{name} = %{version}

%description tools
This package contains the munch and unmunch programs.

%package devel
Summary:        Files for developing with hunspell
Group:          Development/Libraries/C and C++
Requires:       mingw64-%{libname} = %{version}-%{release}
Requires:       mingw64-cross-gcc-c++

%description devel
Includes and definitions for developing with hunspell.

%_mingw64_debug_package

%prep
%setup -q -n %{_name}-%{version}
%patch -P 0 -p1

%build
# latest released tarball does not contain generated configure
autoreconf -fiv
%_mingw64_configure \
	--disable-silent-rules \
	--enable-nls \
	--disable-static \
	--disable-rpath \
	--with-ui \
	--with-readline
make %{?_smp_mflags}

%install
%make_install
find %{buildroot} -type f -name "*.la" -delete -print
rm -f %{buildroot}%{_mingw64_bindir}/example.exe
install -p -m 644 src/tools/{,un}munch.h %{buildroot}%{_mingw64_includedir}

%check
%if %{with check}
%_mingw64_cross_wine_init
%_mingw64_cross_wine_run make check %{?_smp_mflags}
%endif

%files
%license COPYING license.hunspell license.myspell
%doc README README.md AUTHORS THANKS
%attr(755,root,root) %{_mingw64_bindir}/hunspell.exe
%dir %{_mingw64_mandir}/hu
%dir %{_mingw64_mandir}/hu/man1
%{_mingw64_mandir}/man1/hunspell.1%{?ext_man}
%lang(hu) %{_mingw64_mandir}/hu/man1/hunspell.1*

%files -n mingw64-%{libname}
%{_mingw64_bindir}/libhunspell-%{ver}*.dll

%files tools
%{_mingw64_bindir}/analyze.exe
%{_mingw64_bindir}/chmorph.exe
%{_mingw64_bindir}/munch.exe
%{_mingw64_bindir}/unmunch.exe
%{_mingw64_bindir}/hunzip.exe
%{_mingw64_bindir}/hzip.exe
%{_mingw64_bindir}/affixcompress
%{_mingw64_bindir}/ispellaff2myspell
%{_mingw64_bindir}/makealias
%{_mingw64_bindir}/wordforms
%{_mingw64_bindir}/wordlist2hunspell
%{_mingw64_mandir}/man1/hunzip.1%{?ext_man}
%{_mingw64_mandir}/man1/hzip.1%{?ext_man}

%files devel
%{_mingw64_libdir}/libhunspell-%{ver}.dll.a
%{_mingw64_mandir}/man3/hunspell.3%{?ext_man}
%{_mingw64_mandir}/man5/hunspell.5%{?ext_man}
%{_mingw64_includedir}/%{_name}
%{_mingw64_includedir}/munch.h
%{_mingw64_includedir}/unmunch.h
%{_mingw64_libdir}/pkgconfig/hunspell.pc

%changelog
openSUSE Build Service is sponsored by