File igerman98.spec of Package igerman98

#
# spec file for package igerman98
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


Name:           igerman98
Version:        20131206
Release:        0
Summary:        German Spell Check Dictionaries
License:        GPL-2.0 and LGPL-2.1
Group:          Productivity/Text/Spell
# According to Documentation/Copyright we can distribute program under GPL-2.0
# or GPL-3.0. We have choosed GPL-2.0. More over, aspell/de_all_phonet.dat.in
# is LGPL-2.1, so adding it to license string.
Url:            http://www.j3e.de/ispell/igerman98/dict/
BuildRequires:  aspell
BuildRequires:  hunspell
BuildRequires:  ispell
Source0:        %{name}-%{version}.tar.bz2
Source1:        Nwordlist.tgz
Source2:        fix8bit.c
Source3:        austrian.el
Source4:        german.el
Source5:        swiss.el
Patch0:         %{name}-ispell-sort.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%define aspell_dict_dir %(aspell dump config dict-dir)
%define ispell_dict_dir %(ispell -vv|grep LIBDIR|sed \"s/.*\=//;s/^ //g\" |tr -d \\")
%define ispell_emacs_lib_dir /usr/lib/ispell/emacs
%define hunspell_dict_dir /usr/share/myspell/

%description
A meta package for German, Swiss, and Austrian dictionaries for the ispell, 
aspell and myspell spell checkers.


Authors:
--------
Björn JACKE
Daniel NABER
Werner LEMBERG
László NÉMETH
Jan SCHREIBER
Roland ROSENFELD
Till BERGER
Franz Michael BAUMANN
many other contributors ...

%package doc
Summary:        Documentation for German dictionaries
License:        GPL-2.0+
Group:          Productivity/Text/Spell
%if 0%{?suse_version} >= 1120
BuildArch:      noarch
%endif

%description doc
Documentation for German, Swiss, and Austrian dictionaries for the ispell, 
aspell and myspell spell checkers.

%package -n aspell-de
Summary:        A German Dictionary for ASpell
License:        GPL-2.0+
Group:          Productivity/Text/Spell
Provides:       locale(aspell:de)
Requires:       aspell >= 0.60

%description -n aspell-de
A German dictionary for the ASpell spell checker.

%package -n ispell-ngerman
Summary:        New German ispell dictionary
License:        BSD-3-Clause
Group:          Productivity/Text/Spell
Provides:       ispell_dictionary
Provides:       locale(ispell:de;de_DE)

%description -n ispell-ngerman
This package includes a ready German dictionary for ispell. A short
usage description is given in /usr/share/doc/packages/ispell/README of
the package ispell. 

%package -n ispell-nswiss
Summary:        New Swiss ispell dictionary
License:        GPL-2.0+
Group:          Productivity/Text/Spell
Provides:       ispell_dictionary
Provides:       locale(ispell:de_CH)

%description -n ispell-nswiss
This package includes a ready Swiss dictionary for ispell according
the new spelling rules.  The name of the dictionary is nswiss to be able
to distinguish it from those of the German packages. A short usage
description is given in /usr/share/doc/packages/ispell/README of the
package ispell. 

%package -n ispell-naustrian
Summary:        New Austrian ispell dictionary
License:        GPL-2.0+
Group:          Productivity/Text/Spell
Provides:       ispell_dictionary
Provides:       locale(ispell:de_AT)

%description -n ispell-naustrian
This package includes a ready Austrian dictionary for ispell according
the new spelling rules.  The name of the dictionary is naustrian to be able
to distinguish it from those of the German packages. A short usage
description is given in /usr/share/doc/packages/ispell/README of the
package ispell. 

%package -n myspell-nswiss
Summary:        Swiss Dictionary for MySpell
License:        GPL-2.0+
Group:          Productivity/Text/Spell
Provides:       myspell-dictionary
Provides:       ooo-dictionaries:/usr/lib/ooo-1.1/share/dict/ooo/de_CH.dic
Provides:       locale(OpenOffice_org:de_CH)
Provides:       locale(libreoffice:de_CH)
Provides:       locale(seamonkey-spellchecker:de_CH)
%if 0%{?suse_version} >= 1120
BuildArch:      noarch
%endif

%description -n myspell-nswiss
MySpell dictionaries are compatible with MySpell and Hunspell spell-checker.
They are used by various desktop applications, for example, LibreOffice,
Mozilla Thunderbird, and Mozilla Firefox.

%package -n myspell-german
Summary:        German Dictionary for MySpell
License:        GPL-2.0+
Group:          Productivity/Text/Spell
Provides:       myspell-dictionary
Provides:       myspell-german-dictionary
Provides:       ooo-dictionaries:/usr/lib/ooo-1.1/share/dict/ooo/de_DE.dic
Conflicts:      myspell-german-old
Provides:       locale(OpenOffice_org:de)
Provides:       locale(libreoffice:de)
Provides:       locale(seamonkey-spellchecker:de)
%if 0%{?suse_version} >= 1120
BuildArch:      noarch
%endif

%description -n myspell-german
MySpell dictionaries are compatible with MySpell and Hunspell spell-checker.
They are used by various desktop applications, for example, LibreOffice,
Mozilla Thunderbird, and Mozilla Firefox.

%package -n myspell-austrian
Summary:        Austrian Dictionary for MySpell
License:        GPL-2.0+
Group:          Productivity/Text/Spell
Provides:       myspell-dictionary
Provides:       ooo:/usr/lib/ooo-1.1/share/dict/ooo/de_AT.dic
Provides:       locale(OpenOffice_org:de_AT)
Provides:       locale(libreoffice:de_AT)
Provides:       locale(seamonkey-spellchecker:de_AT)
%if 0%{?suse_version} >= 1120
BuildArch:      noarch
%endif

%description -n myspell-austrian
MySpell dictionaries are compatible with MySpell and Hunspell spell-checker.
They are used by various desktop applications, for example, LibreOffice,
Mozilla Thunderbird, and Mozilla Firefox.


%prep
%setup -q -a1
%patch0 -p1

%build

# prepare ispell dictionary
cp %{S:2} .
gcc -O2 -o fix8bit fix8bit.c
mv ispell/de_DE.aff.in ispell/de_DE.aff.in-bj
./fix8bit -8 < ispell/de_DE.aff.in-bj > ispell/de_DE.aff.in

for l in DE AT CH; do
  make ispell/de_$l.{aff,hash}
  make aspell/de_$l.rws
  make hunspell/de_$l.{dic,aff}
  make myspell/de_$l.{dic,aff}
done

make ligature/rmligs

# aspell -- creating extra dictionary with Novell jargon
/usr/bin/word-list-compress c < Nwordlist > Nwordlist.cwl
/usr/bin/word-list-compress d < Nwordlist.cwl | aspell --lang=de_DE --local-data-dir=./aspell/ create master ./deNovellwords
for i in aspell/*.multi; do echo "add deNovellwords" >> $i; done

# hunspell -- add the Novell jargon into all dictionaries bnc#306333
pushd hunspell
for l in DE AT CH; do
    cat ../Nwordlist >> de_$l.dic
    # delete empty lines if they were created in some cases
    grep -v "^$" de_$l.dic > de_$l.no_space && mv de_$l.no_space de_$l.dic
done
popd

%install
mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}

# aspell
mkdir -p $RPM_BUILD_ROOT%{aspell_dict_dir}
install -m 644 aspell/*.{rws,dat,alias,multi} $RPM_BUILD_ROOT%{aspell_dict_dir}
install -m 644 ./deNovellwords $RPM_BUILD_ROOT%{aspell_dict_dir}
echo "add de_DE.multi" > $RPM_BUILD_ROOT%{aspell_dict_dir}/deutsch.alias
echo "add de_DE.multi" > $RPM_BUILD_ROOT%{aspell_dict_dir}/german.alias
echo "add de_CH.multi" > $RPM_BUILD_ROOT%{aspell_dict_dir}/swiss.alias

# ispell
mkdir -p $RPM_BUILD_ROOT%{ispell_dict_dir}
install -m 644 ispell/de_??.{aff,hash} $RPM_BUILD_ROOT%{ispell_dict_dir}
mkdir -p $RPM_BUILD_ROOT%{_bindir}
install -m 755 ligature/rmligs $RPM_BUILD_ROOT%{_bindir}
gzip ligature/rmligs.1
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1
install -m 644 ligature/rmligs.1.gz $RPM_BUILD_ROOT%{_mandir}/man1
mkdir -p $RPM_BUILD_ROOT%{ispell_emacs_lib_dir}
install -m 644 %{S:3} %{S:4} %{S:5} $RPM_BUILD_ROOT%{ispell_emacs_lib_dir}
for ext in aff hash; do
  ln -s %{ispell_dict_dir}/de_DE.$ext $RPM_BUILD_ROOT%{ispell_dict_dir}/german.$ext
  ln -s %{ispell_dict_dir}/de_CH.$ext $RPM_BUILD_ROOT%{ispell_dict_dir}/swiss.$ext 
  ln -s %{ispell_dict_dir}/de_AT.$ext $RPM_BUILD_ROOT%{ispell_dict_dir}/austrian.$ext
done

# myspell
mkdir -p $RPM_BUILD_ROOT%{hunspell_dict_dir}
install -m 644 hunspell/de_??.{aff,dic} $RPM_BUILD_ROOT%{hunspell_dict_dir}

%files doc
%defattr(-,root,root)
%doc Documentation/* 

%files -n aspell-de
%defattr(-,root,root)
%{aspell_dict_dir}/*.rws
%{aspell_dict_dir}/*.multi
%{aspell_dict_dir}/*.alias
%{aspell_dict_dir}/*.dat
%{aspell_dict_dir}/deNovellwords

%files -n ispell-ngerman
%defattr(-,root,root)
%{ispell_dict_dir}/de_DE.aff
%{ispell_dict_dir}/de_DE.hash
%{ispell_dict_dir}/german.aff
%{ispell_dict_dir}/german.hash
%{ispell_emacs_lib_dir}/german.el
%{_bindir}/rmligs
%{_mandir}/man1/rmligs.1.gz

%files -n ispell-nswiss
%defattr(-,root,root)
%{ispell_dict_dir}/de_CH.aff
%{ispell_dict_dir}/de_CH.hash
%{ispell_dict_dir}/swiss.aff
%{ispell_dict_dir}/swiss.hash
%{ispell_emacs_lib_dir}/swiss.el

%files -n ispell-naustrian
%defattr(-,root,root)
%{ispell_dict_dir}/de_AT.aff
%{ispell_dict_dir}/de_AT.hash
%{ispell_dict_dir}/austrian.aff
%{ispell_dict_dir}/austrian.hash
%{ispell_emacs_lib_dir}/austrian.el

%files -n myspell-german
%defattr(-,root,root)
%dir %{hunspell_dict_dir}
%{hunspell_dict_dir}/de_DE.aff
%{hunspell_dict_dir}/de_DE.dic

%files -n myspell-nswiss
%defattr(-,root,root)
%dir %{hunspell_dict_dir}
%{hunspell_dict_dir}/de_CH.aff
%{hunspell_dict_dir}/de_CH.dic

%files -n myspell-austrian
%defattr(-,root,root)
%dir %{hunspell_dict_dir}
%{hunspell_dict_dir}/de_AT.aff
%{hunspell_dict_dir}/de_AT.dic

%changelog