File myspell-dictionaries.spec.in of Package myspell-dictionaries

#
# spec file for package myspell-dictionaries
#
# Copyright (c) 2012 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/
#

###################################################################
## @DO_NOT_EDIT_COMMENT@
## Generate: sh update.sh
###################################################################
Name:           myspell-dictionaries
Version:        @VERSION@
Release:        0
Summary:        A Source Package for Dictionaries Used by MySpell
License:        AGPL-3.0 and BSD-2-Clause and BSD-3-Clause and BSD-4-Clause and CC-BY-SA-1.0 and CC-BY-SA-3.0 and GFDL-1.1 and GPL-2.0 and GPL-2.0+ and GPL-3.0 and GPL-3.0+ and LGPL-2.0 and LGPL-2.1 and LGPL-2.1+ and LGPL-3.0 and LGPL-3.0+ and MPL-1.1
Group:          Productivity/Text/Spell
Url:            http://cgit.freedesktop.org/libreoffice/dictionaries/
Source0:        dictionaries.tar.xz
BuildRequires:  dos2unix
BuildRequires:  xz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
Obsoletes:      myspell-african
Obsoletes:      myspell-albanian
Obsoletes:      myspell-american
Obsoletes:      myspell-arabic
Obsoletes:      myspell-armenian
Obsoletes:      myspell-assamese
Obsoletes:      myspell-asturian
Obsoletes:      myspell-australian
Obsoletes:      myspell-austrian
Obsoletes:      myspell-belarusian
Obsoletes:      myspell-bengali
Obsoletes:      myspell-brazilian
Obsoletes:      myspell-breton
Obsoletes:      myspell-british
Obsoletes:      myspell-bulgarian
Obsoletes:      myspell-canadian
Obsoletes:      myspell-catalan
Obsoletes:      myspell-chichewa
Obsoletes:      myspell-coptic
Obsoletes:      myspell-croatian
Obsoletes:      myspell-czech
Obsoletes:      myspell-danish
Obsoletes:      myspell-dutch
Obsoletes:      myspell-esperanto
Obsoletes:      myspell-estonian
Obsoletes:      myspell-faroese
Obsoletes:      myspell-french
Obsoletes:      myspell-friulian
Obsoletes:      myspell-gaelic-scots
Obsoletes:      myspell-galician
Obsoletes:      myspell-german
Obsoletes:      myspell-greek
Obsoletes:      myspell-gujarati
Obsoletes:      myspell-haitian
Obsoletes:      myspell-hebrew
Obsoletes:      myspell-hindi
Obsoletes:      myspell-hungarian
Obsoletes:      myspell-icelandic
Obsoletes:      myspell-indonese
Obsoletes:      myspell-irish
Obsoletes:      myspell-italian
Obsoletes:      myspell-kazakh
Obsoletes:      myspell-khmer
Obsoletes:      myspell-kichwa
Obsoletes:      myspell-kikuyu
Obsoletes:      myspell-kinyarwanda
Obsoletes:      myspell-kiswahili
Obsoletes:      myspell-korean
Obsoletes:      myspell-kurdish
Obsoletes:      myspell-latin
Obsoletes:      myspell-latvian
Obsoletes:      myspell-lithuanian
Obsoletes:      myspell-lower-sorbian
Obsoletes:      myspell-macedonian
Obsoletes:      myspell-maithili
Obsoletes:      myspell-malagasy
Obsoletes:      myspell-malay
Obsoletes:      myspell-malayalam
Obsoletes:      myspell-maory
Obsoletes:      myspell-marathi
Obsoletes:      myspell-mexican
Obsoletes:      myspell-ndebele
Obsoletes:      myspell-new-zealand
Obsoletes:      myspell-norsk-bokmaal
Obsoletes:      myspell-norsk-nynorsk
Obsoletes:      myspell-nswiss
Obsoletes:      myspell-occitan-lengadocian
Obsoletes:      myspell-persian
Obsoletes:      myspell-polish
Obsoletes:      myspell-portuguese
Obsoletes:      myspell-romanian
Obsoletes:      myspell-russian
Obsoletes:      myspell-serbian-cyrillic
Obsoletes:      myspell-serbian-latin
Obsoletes:      myspell-setswana
Obsoletes:      myspell-sinhala
Obsoletes:      myspell-slovak
Obsoletes:      myspell-slovene
Obsoletes:      myspell-sotho-northern
Obsoletes:      myspell-south-african-english
Obsoletes:      myspell-spanish
Obsoletes:      myspell-spanish-argentine
Obsoletes:      myspell-spanish-bolivian
Obsoletes:      myspell-spanish-chilean
Obsoletes:      myspell-spanish-colombian
Obsoletes:      myspell-spanish-costa-rican
Obsoletes:      myspell-spanish-dominican
Obsoletes:      myspell-spanish-ecuadorian
Obsoletes:      myspell-spanish-guatemalan
Obsoletes:      myspell-spanish-honduran
Obsoletes:      myspell-spanish-nicaraguan
Obsoletes:      myspell-spanish-panamanian
Obsoletes:      myspell-spanish-paraguayan
Obsoletes:      myspell-spanish-peruvian
Obsoletes:      myspell-spanish-puerto-rican
Obsoletes:      myspell-spanish-salvadorean
Obsoletes:      myspell-spanish-uruguayan
Obsoletes:      myspell-spanish-venezuelan
Obsoletes:      myspell-swati
Obsoletes:      myspell-swedish
Obsoletes:      myspell-swedish-finland
Obsoletes:      myspell-tagalog
Obsoletes:      myspell-thai
Obsoletes:      myspell-tsonga
Obsoletes:      myspell-ukrainian
Obsoletes:      myspell-valencian
Obsoletes:      myspell-venda
Obsoletes:      myspell-vietnamese
Obsoletes:      myspell-welsh
Obsoletes:      myspell-xhosa
Obsoletes:      myspell-yiddish
Obsoletes:      myspell-zulu
Obsoletes:      libreoffice-thesaurus-bg
Obsoletes:      libreoffice-thesaurus-ca
Obsoletes:      libreoffice-thesaurus-cs
Obsoletes:      libreoffice-thesaurus-da
Obsoletes:      libreoffice-thesaurus-de
Obsoletes:      libreoffice-thesaurus-de-AT
Obsoletes:      libreoffice-thesaurus-de-CH
Obsoletes:      libreoffice-thesaurus-el
Obsoletes:      libreoffice-thesaurus-en-AU
Obsoletes:      libreoffice-thesaurus-en-GB
Obsoletes:      libreoffice-thesaurus-en-US
Obsoletes:      libreoffice-thesaurus-es
Obsoletes:      libreoffice-thesaurus-es-AR
Obsoletes:      libreoffice-thesaurus-es-VE
Obsoletes:      libreoffice-thesaurus-fr
Obsoletes:      libreoffice-thesaurus-ga
Obsoletes:      libreoffice-thesaurus-hu
Obsoletes:      libreoffice-thesaurus-it
Obsoletes:      libreoffice-thesaurus-nb
Obsoletes:      libreoffice-thesaurus-ne
Obsoletes:      libreoffice-thesaurus-pl
Obsoletes:      libreoffice-thesaurus-pt
Obsoletes:      libreoffice-thesaurus-ro
Obsoletes:      libreoffice-thesaurus-ru
Obsoletes:      libreoffice-thesaurus-sk
Obsoletes:      libreoffice-thesaurus-sl
Obsoletes:      libreoffice-thesaurus-sv
Obsoletes:      libreoffice-hyphen

%description
This source package contains dictionaries for MySpell.

The MySpell spell-checker is used by the OpenOffice.org office suite,
the Mozilla Composer, and the Mozilla Mail message composition window.

@METADATA@
%prep
%setup -q -n dictionaries

%build

%install
function install_dictionary_files
{
  locale_dir=$1
  system_dir=$2
  files=$3

  if [ ! -z "$files" ]; then
    for file in $files; do
      # install file
      cp -P $file %{buildroot}%{_datadir}/$system_dir/
      # symlink
      ln -s %{_datadir}/$system_dir/$file %{buildroot}%{_datadir}/$compat_dir/$file
      # file list
      echo %{_datadir}/$system_dir/$file >> $locale_dir.list
      echo %{_datadir}/$compat_dir/$file >> $locale_dir.list
    done 
  fi
}
function install_doc_files
{
  locale_dir=$1
  doc_files=$2
  dos2unix -q $doc_files
  install -m 755 -d %{buildroot}%{_docdir}/myspell-$locale_dir
  install -m 644 `echo $doc_files | tr '\n' ' '` %{buildroot}%{_docdir}/myspell-$locale_dir
  echo "%{_docdir}/myspell-$locale_dir" >> $locale_dir.list
}
dic_dir="hunspell"
hyph_dir="hyphen"
th_dir="mythes"
compat_dir="myspell"
for system_dir in $dic_dir $hyph_dir $th_dir $compat_dir; do
  install -m 755 -d %{buildroot}%{_datadir}/$system_dir/
done
for locale_dir in @LANG_DIRS@ ; do
  pushd $locale_dir
  dic_files=`find -maxdepth 1 -name '*.dic' -a ! -name 'hyph*' -o -name '*.aff'`
  hyph_files=`find -maxdepth 1 -name 'hyph*.dic'`
  th_files=`find  -maxdepth 1 -name 'th*.dat' -o -name 'th*.idx'`
  doc_files=`find -maxdepth 1 -type f | grep '.txt\|.xcu\|.xml\|.png\|.tex\|^[^.]*$' || true`
  # install dictionary files  
  echo '%%defattr(-,root,root,-)' > $locale_dir.list
  install_dictionary_files $locale_dir $dic_dir  "$dic_files"
  install_dictionary_files $locale_dir $hyph_dir "$hyph_files"
  install_dictionary_files $locale_dir $th_dir   "$th_files"
  # install documentation
  install_doc_files $locale_dir $doc_files
  popd
  mv $locale_dir/$locale_dir.list .
done


%files
%defattr(-,root,root)
%dir %{_datadir}/hunspell/
%dir %{_datadir}/hyphen/
%dir %{_datadir}/mythes/
%dir %{_datadir}/myspell/

@FILES@
%changelog
openSUSE Build Service is sponsored by