Name:          hunspell-en
Version:       2019.10.06
Release:       4
Summary:       English hunspell dictionaries
License:       LGPLv2+ and LGPLv2 and BSD
URL:           https://anaconda.org/conda-forge/hunspell-en
Source0:       https://github.com/en-wl/wordlist/archive/rel-%{version}.tar.gz

Patch0001:     hunspell-en-fixbuild-err.patch

BuildArch:     noarch
BuildRequires: git aspell zip dos2unix perl-Getopt-Long gcc-c++
Requires:      hunspell

Provides:      %{name}-US = %{version}-%{release}
Obsoletes:     %{name}-US < %{version}-%{release}

%description
English (US, UK, etc.) hunspell dictionaries

%package_help

%prep
%autosetup -n wordlist-rel-2019.10.06 -p1

%build
export PERL5LIB=`pwd`/scowl/r/varcon${PERL5LIB:+:${PERL5LIB}}
make
cd scowl/speller
make hunspell
for i in README_en_CA.txt README_en_US.txt; do
  if ! iconv -f utf-8 -t utf-8 -o /dev/null $i > /dev/null 2>&1; then
    iconv -f ISO-8859-1 -t UTF-8 $i > $i.new
    touch -r $i $i.new
    mv -f $i.new $i
  fi
  tr -d '\r' < $i > $i.new
  touch -r $i $i.new
  mv -f $i.new $i
done

%install
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/myspell
cd scowl/speller
cp -p en_??.dic en_??.aff $RPM_BUILD_ROOT/%{_datadir}/myspell

pushd $RPM_BUILD_ROOT/%{_datadir}/myspell/
en_US_aliases="en_PH"
for lang in $en_US_aliases; do
        ln -s en_US.aff $lang.aff
        ln -s en_US.dic $lang.dic
done
popd

%files
%defattr(-,root,root)
%doc scowl/speller/README_en_*.txt README.md
%license scowl/speller/aspell/Copyright.sh
%{_datadir}/myspell/*

%files help
%defattr(-,root,root)
%doc scowl/speller/aspell/doc/ChangeLog 

%changelog
* Wed Dec 16 2020 hanhui <hanhui15@huawei.com> - 2019.10.06-4
- modify url

* Thu Aug 20 2020 jinzhimin<jinzhimin2@huawei.com> - 2019.10.06-3
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: fix the version as 2019.10.06

* Tue Feb 25 2020 xiaoweiwei<xiaoweiwei5@huawei.com> - 0.201910.06-2
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: fix build err

* Wed Jan 8 2020 songnannan<songnannan2@huawei.com> - 0.201910.06-1
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: update to 201910.06

* Sat Oct 19 2019 openEuler Buildteam <buildteam@openeuler.org> - 0.20140811.1-15
- Type:bugfix
- Id:NA
- SUG:NA
- DESC:add license files to rpm package

* Fri Sep 20 2019 openEuler Buildteam <buildteam@openeuler.org> - 0.20140811.1-14
- Package init


