File libreoffice-thesaurus.spec of Package libreoffice-thesaurus
#
# spec file for package libreoffice-thesaurus
#
# 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/
#
Name: libreoffice-thesaurus
###################################################################
## DO NOT EDIT THIS SPEC FILE
## Generated by:
## perl libreoffice-thesaurus-gen-spec libreoffice-thesaurus.spec.in libreoffice-thesaurus.data
###################################################################
BuildRequires: dos2unix
BuildRequires: recode
BuildRequires: unzip
Version: 20110202
Release: 0
Summary: A Source Package for LibreOffice Thesaurus Dictionaries
License: AGPL-3.0 and BSD-3-Clause and BSD-4-Clause and GFDL-1.2 and GPL-2.0 and GPL-2.0+ and GPL-3.0+ and LGPL-2.1 and LGPL-2.1+ and LGPL-3.0 and MPL-1.1
Group: Productivity/Office/Dictionary
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
Url: http://wiki.services.openoffice.org/wiki/Dictionaries
Source0: libreoffice-thesaurus-gen-spec
Source1: libreoffice-thesaurus.spec.in
Source2: libreoffice-thesaurus.data
Source1000: thes_bg_BG_v2.tar.bz2
Source1001: thesaurus-ca.oxt
Source1002: thes_cs_CZ_v2.tar.bz2
Source1003: DanskeSynonymer.oxt
Source1004: dict-de_DE-frami_2010-03-07.oxt
Source1005: dict-de_AT-frami_2010-03-07.oxt
Source1006: dict-de_CH-frami_2010-03-07.oxt
Source1007: th_el.tar.bz2
Source1008: dict-en-au-2008-12-15.oxt
Source1009: thes_en_GB_v2.tar.bz2
Source1010: thes_en_US_v2.tar.bz2
Source1011: thes_es_ES_v2.tar.bz2
Source1012: Diccionarios-Argentina_1.oxt
Source1013: dict-es_VE.oxt
Source1014: ooo-dictionnaire-fr-reforme1990-v3.5.oxt
Source1015: focloiri-gaeilge-4.4.oxt
Source1016: thes_hu_HU_v2.tar.bz2
Source1017: Dizionari.IT_20081129.oxt
Source1018: thes_nb_NO_v2.tar.bz2
Source1019: thes_ne_NP_v2.tar.bz2
Source1020: pl-dict.oxt
Source1021: oo3x-pt-PT.oxt
Source1022: dict-ro.1.1.oxt
Source1023: dict_ru_RU-0.3.4.oxt
Source1024: dict-sk.oxt
Source1025: thes_sl_SI_v2.tar.bz2
Source1026: SwedishThesaurus.oxt
%description
This source package is used to build LibreOffice thesaurus
dictionaries.
%package bg
Version: 20071210.1
Release: 0
Summary: Bulgarian Thesaurus Dictionary for LibreOffice
License: GPL-2.0+
Group: Productivity/Office/Dictionary
Provides: locale(OpenOffice_org:bg)
Provides: locale(libreoffice:bg)
# compat stuff
Provides: OpenOffice_org-thesaurus-bg = %version
Provides: OpenOffice_org:/usr/lib/ooo-2.0/share/dict/ooo/th_bg_BG_v2.dat
Obsoletes: OpenOffice_org-thesaurus-bg <= %version
%description bg
The Bulgarian thesaurus dictionary that can be used to look up for
synonyms and related words in the LibreOffice office suite.
%package ca
Version: 1.5.0.1
Release: 0
Summary: Catalan Thesaurus Dictionary for LibreOffice
License: GPL-2.0 or LGPL-2.1
Group: Productivity/Office/Dictionary
Provides: locale(OpenOffice_org:ca)
Provides: locale(libreoffice:ca)
# compat stuff
Provides: OpenOffice_org-thesaurus-ca = %version
Provides: OpenOffice_org:/usr/lib/ooo-2.0/share/dict/ooo/th_ca_ES_v2.dat
Obsoletes: OpenOffice_org-thesaurus-ca <= %version
%description ca
The Catalan thesaurus dictionary that can be used to look up for
synonyms and related words in the LibreOffice office suite.
%package cs
Version: 20070913.1
Release: 0
Summary: Czech Thesaurus Dictionary for LibreOffice
License: BSD-3-Clause
Group: Productivity/Office/Dictionary
Provides: locale(OpenOffice_org:cs)
Provides: locale(libreoffice:cs)
# compat stuff
Provides: OpenOffice_org-thesaurus-cs = %version
Provides: OpenOffice_org:/usr/lib/ooo-2.0/share/dict/ooo/th_cs_CZ_v2.dat
Obsoletes: OpenOffice_org-thesaurus-cs <= %version
%description cs
The Czech thesaurus dictionary that can be used to look up for
synonyms and related words in the LibreOffice office suite.
%package da
Version: 20100126.1
Release: 0
Summary: Danish Thesaurus Dictionary for LibreOffice
License: GPL-2.0 or LGPL-2.1 or MPL-1.1
Group: Productivity/Office/Dictionary
Provides: locale(OpenOffice_org:da)
Provides: locale(libreoffice:da)
# compat stuff
Provides: OpenOffice_org-thesaurus-da = %version
Provides: OpenOffice_org:/usr/lib/ooo-2.0/share/dict/ooo/th_da_DK_v2.dat
Obsoletes: OpenOffice_org-thesaurus-da <= %version
%description da
The Danish thesaurus dictionary that can be used to look up for
synonyms and related words in the LibreOffice office suite.
%package de
Version: 20100307.1
Release: 0
Summary: German Thesaurus Dictionary for LibreOffice
License: LGPL-2.1+
Group: Productivity/Office/Dictionary
Provides: locale(OpenOffice_org:de)
Provides: locale(libreoffice:de)
# compat stuff
Provides: OpenOffice_org-thesaurus-de = %version
Provides: OpenOffice_org:/usr/lib/ooo-2.0/share/dict/ooo/th_de_DE_v2.dat
Obsoletes: OpenOffice_org-thesaurus-de <= %version
%description de
The German thesaurus dictionary that can be used to look up for
synonyms and related words in the LibreOffice office suite.
%package de-AT
Version: 20100307.1
Release: 0
Summary: Austrian Thesaurus Dictionary for LibreOffice
License: LGPL-2.1+
Group: Productivity/Office/Dictionary
Provides: locale(OpenOffice_org:de_AT)
Provides: locale(libreoffice:de_AT)
# compat stuff
Provides: OpenOffice_org-thesaurus-de-AT = %version
Provides: OpenOffice_org:/usr/lib/ooo-2.0/share/dict/ooo/th_de_AT_v2.dat
Obsoletes: OpenOffice_org-thesaurus-de-AT <= %version
%description de-AT
The Austrian thesaurus dictionary that can be used to look up for
synonyms and related words in the LibreOffice office suite.
%package de-CH
Version: 20100307.1
Release: 0
Summary: German-Swiss Thesaurus Dictionary for LibreOffice
License: LGPL-2.1+
Group: Productivity/Office/Dictionary
Provides: locale(OpenOffice_org:de_CH)
Provides: locale(libreoffice:de_CH)
# compat stuff
Provides: OpenOffice_org-thesaurus-de-CH = %version
Provides: OpenOffice_org:/usr/lib/ooo-2.0/share/dict/ooo/th_de_CH_v2.dat
Obsoletes: OpenOffice_org-thesaurus-de-CH <= %version
%description de-CH
The German-Swiss thesaurus dictionary that can be used to look up for
synonyms and related words in the LibreOffice office suite.
%package el
Version: 20061203.1
Release: 0
Summary: Greek Thesaurus Dictionary for LibreOffice
License: GPL-2.0+
Group: Productivity/Office/Dictionary
Provides: locale(OpenOffice_org:el)
Provides: locale(libreoffice:el)
# compat stuff
Provides: OpenOffice_org-thesaurus-el = %version
Provides: OpenOffice_org:/usr/lib/ooo-2.0/share/dict/ooo/th_el_GR_v2.dat
Obsoletes: OpenOffice_org-thesaurus-el <= %version
%description el
The Greek thesaurus dictionary that can be used to look up for
synonyms and related words in the LibreOffice office suite.
%package en-AU
Version: 20081215.1
Release: 0
Summary: Australian Thesaurus Dictionary for LibreOffice
License: BSD-4-Clause
Group: Productivity/Office/Dictionary
Provides: locale(OpenOffice_org:en_AU)
Provides: locale(libreoffice:en_AU)
# compat stuff
Provides: OpenOffice_org-thesaurus-en-AU = %version
Provides: OpenOffice_org:/usr/lib/ooo-2.0/share/dict/ooo/th_en_AU_v2.dat
Obsoletes: OpenOffice_org-thesaurus-en-AU <= %version
%description en-AU
The Australian thesaurus dictionary that can be used to look up for
synonyms and related words in the LibreOffice office suite.
%package en-GB
Version: 20051128.1
Release: 0
Summary: British Thesaurus Dictionary for LibreOffice
License: BSD-4-Clause
Group: Productivity/Office/Dictionary
Provides: locale(OpenOffice_org:en_GB)
Provides: locale(libreoffice:en_GB)
# compat stuff
Provides: OpenOffice_org-thesaurus-en-GB = %version
Provides: OpenOffice_org:/usr/lib/ooo-2.0/share/dict/ooo/th_en_GB_v2.dat
Obsoletes: OpenOffice_org-thesaurus-en-GB <= %version
%description en-GB
The British thesaurus dictionary that can be used to look up for
synonyms and related words in the LibreOffice office suite.
%package en-US
Version: 20060111.1
Release: 0
Summary: American Thesaurus Dictionary for LibreOffice
License: BSD-4-Clause
Group: Productivity/Office/Dictionary
Provides: locale(OpenOffice_org:en_US)
Provides: locale(libreoffice:en_US)
# compat stuff
Provides: OpenOffice_org-thesaurus-en-US = %version
Provides: OpenOffice_org:/usr/lib/ooo-2.0/share/dict/ooo/th_en_US_v2.dat
Obsoletes: OpenOffice_org-thesaurus-en-US <= %version
Provides: OpenOffice_org-thesaurus-en = %version
Obsoletes: OpenOffice_org-thesaurus-en <= %version
%description en-US
The American thesaurus dictionary that can be used to look up for
synonyms and related words in the LibreOffice office suite.
%package es
Version: 20050720.1
Release: 0
Summary: Spanish Thesaurus Dictionary for LibreOffice
License: LGPL-2.1+
Group: Productivity/Office/Dictionary
Provides: locale(OpenOffice_org:es)
Provides: locale(libreoffice:es)
# compat stuff
Provides: OpenOffice_org-thesaurus-es = %version
Provides: OpenOffice_org:/usr/lib/ooo-2.0/share/dict/ooo/th_es_ES_v2.dat
Obsoletes: OpenOffice_org-thesaurus-es <= %version
%description es
The Spanish thesaurus dictionary that can be used to look up for
synonyms and related words in the LibreOffice office suite.
%package es-AR
Version: 0.1.1
Release: 0
Summary: Argentine Spanish Thesaurus Dictionary for LibreOffice
License: LGPL-2.1
Group: Productivity/Office/Dictionary
Provides: locale(OpenOffice_org:es_AR)
Provides: locale(libreoffice:es_AR)
# compat stuff
Provides: OpenOffice_org-thesaurus-es-AR = %version
Provides: OpenOffice_org:/usr/lib/ooo-2.0/share/dict/ooo/th_es_AR_v2.dat
Obsoletes: OpenOffice_org-thesaurus-es-AR <= %version
%description es-AR
The Argentine Spanish thesaurus dictionary that can be used to look up for
synonyms and related words in the LibreOffice office suite.
%package es-VE
Version: 1.0.1.1
Release: 0
Summary: Venezuelan Spanish Thesaurus Dictionary for LibreOffice
License: GPL-3.0+
Group: Productivity/Office/Dictionary
Provides: locale(OpenOffice_org:es_VE)
Provides: locale(libreoffice:es_VE)
# compat stuff
Provides: OpenOffice_org-thesaurus-es-VE = %version
Provides: OpenOffice_org:/usr/lib/ooo-2.0/share/dict/ooo/th_es_VE_v2.dat
Obsoletes: OpenOffice_org-thesaurus-es-VE <= %version
%description es-VE
The Venezuelan Spanish thesaurus dictionary that can be used to look up for
synonyms and related words in the LibreOffice office suite.
%package fr
Version: 20100125.1
Release: 0
Summary: French Thesaurus Dictionary for LibreOffice
License: LGPL-2.1+
Group: Productivity/Office/Dictionary
Provides: locale(OpenOffice_org:fr)
Provides: locale(libreoffice:fr)
# compat stuff
Provides: OpenOffice_org-thesaurus-fr = %version
Provides: OpenOffice_org:/usr/lib/ooo-2.0/share/dict/ooo/th_fr_FR_v2.dat
Obsoletes: OpenOffice_org-thesaurus-fr <= %version
%description fr
The French thesaurus dictionary that can be used to look up for
synonyms and related words in the LibreOffice office suite.
%package ga
Version: 20071002.1
Release: 0
Summary: Irish Thesaurus Dictionary for LibreOffice
License: GFDL-1.2
Group: Productivity/Office/Dictionary
Provides: locale(OpenOffice_org:ga)
Provides: locale(libreoffice:ga)
# compat stuff
Provides: OpenOffice_org-thesaurus-ga = %version
Provides: OpenOffice_org:/usr/lib/ooo-2.0/share/dict/ooo/th_ga_IE_v2.dat
Obsoletes: OpenOffice_org-thesaurus-ga <= %version
%description ga
The Irish thesaurus dictionary that can be used to look up for
synonyms and related words in the LibreOffice office suite.
%package hu
Version: 20080319.1
Release: 0
Summary: Hungarian Thesaurus Dictionary for LibreOffice
License: LGPL-2.1+
Group: Productivity/Office/Dictionary
Provides: locale(OpenOffice_org:hu)
Provides: locale(libreoffice:hu)
# compat stuff
Provides: OpenOffice_org-thesaurus-hu = %version
Provides: OpenOffice_org:/usr/lib/ooo-2.0/share/dict/ooo/th_hu_HU_v2.dat
Obsoletes: OpenOffice_org-thesaurus-hu <= %version
%description hu
The Hungarian thesaurus dictionary that can be used to look up for
synonyms and related words in the LibreOffice office suite.
%package it
Version: 20081129.1
Release: 0
Summary: Italian Thesaurus Dictionary for LibreOffice
License: AGPL-3.0
Group: Productivity/Office/Dictionary
Provides: locale(OpenOffice_org:it)
Provides: locale(libreoffice:it)
# compat stuff
Provides: OpenOffice_org-thesaurus-it = %version
Provides: OpenOffice_org:/usr/lib/ooo-2.0/share/dict/ooo/th_it_IT_v2.dat
Obsoletes: OpenOffice_org-thesaurus-it <= %version
%description it
The Italian thesaurus dictionary that can be used to look up for
synonyms and related words in the LibreOffice office suite.
%package nb
Version: 20080310.1
Release: 0
Summary: Norwegian Bokmaal Thesaurus Dictionary for LibreOffice
License: GPL-2.0+
Group: Productivity/Office/Dictionary
Provides: locale(OpenOffice_org:nb)
Provides: locale(libreoffice:nb)
# compat stuff
Provides: OpenOffice_org-thesaurus-nb = %version
Provides: OpenOffice_org:/usr/lib/ooo-2.0/share/dict/ooo/th_nb_NO_v2.dat
Obsoletes: OpenOffice_org-thesaurus-nb <= %version
%description nb
The Norwegian Bokmaal thesaurus dictionary that can be used to look up for
synonyms and related words in the LibreOffice office suite.
%package ne
Version: 1.1.1
Release: 0
Summary: Nepali Thesaurus Dictionary for LibreOffice
License: LGPL-2.1+
Group: Productivity/Office/Dictionary
Provides: locale(OpenOffice_org:ne)
Provides: locale(libreoffice:ne)
# compat stuff
Provides: OpenOffice_org-thesaurus-ne = %version
Provides: OpenOffice_org:/usr/lib/ooo-2.0/share/dict/ooo/th_ne_NP_v2.dat
Obsoletes: OpenOffice_org-thesaurus-ne <= %version
%description ne
The Nepali thesaurus dictionary that can be used to look up for
synonyms and related words in the LibreOffice office suite.
%package pl
Version: 20081206.1
Release: 0
Summary: Polish Thesaurus Dictionary for LibreOffice
License: LGPL-2.1
Group: Productivity/Office/Dictionary
Provides: locale(OpenOffice_org:pl)
Provides: locale(libreoffice:pl)
# compat stuff
Provides: OpenOffice_org-thesaurus-pl = %version
Provides: OpenOffice_org:/usr/lib/ooo-2.0/share/dict/ooo/th_pl_PL_v2.dat
Obsoletes: OpenOffice_org-thesaurus-pl <= %version
%description pl
The Polish thesaurus dictionary that can be used to look up for
synonyms and related words in the LibreOffice office suite.
%package pt
Version: 20091015.1
Release: 0
Summary: Portuguese Thesaurus Dictionary for LibreOffice
License: GPL-2.0+
Group: Productivity/Office/Dictionary
Provides: locale(OpenOffice_org:pt)
Provides: locale(libreoffice:pt)
# compat stuff
Provides: OpenOffice_org-thesaurus-pt = %version
Provides: OpenOffice_org:/usr/lib/ooo-2.0/share/dict/ooo/th_pt_PT_v2.dat
Obsoletes: OpenOffice_org-thesaurus-pt <= %version
%description pt
The Portuguese thesaurus dictionary that can be used to look up for
synonyms and related words in the LibreOffice office suite.
%package ro
Version: 20091130.1
Release: 0
Summary: Romanian Thesaurus Dictionary for LibreOffice
License: GPL-2.0+
Group: Productivity/Office/Dictionary
Provides: locale(OpenOffice_org:ro)
Provides: locale(libreoffice:ro)
# compat stuff
Provides: OpenOffice_org-thesaurus-ro = %version
Provides: OpenOffice_org:/usr/lib/ooo-2.0/share/dict/ooo/th_ro_RO_v2.dat
Obsoletes: OpenOffice_org-thesaurus-ro <= %version
%description ro
The Romanian thesaurus dictionary that can be used to look up for
synonyms and related words in the LibreOffice office suite.
%package ru
Version: 20081013.1
Release: 0
Summary: Russian Thesaurus Dictionary for LibreOffice
License: LGPL-3.0
Group: Productivity/Office/Dictionary
Provides: locale(OpenOffice_org:ru)
Provides: locale(libreoffice:ru)
# compat stuff
Provides: OpenOffice_org-thesaurus-ru = %version
Provides: OpenOffice_org:/usr/lib/ooo-2.0/share/dict/ooo/th_ru_RU_v2.dat
Obsoletes: OpenOffice_org-thesaurus-ru <= %version
%description ru
The Russian thesaurus dictionary that can be used to look up for
synonyms and related words in the LibreOffice office suite.
%package sk
Version: 20100208.1
Release: 0
Summary: Slovak Thesaurus Dictionary for LibreOffice
License: BSD-3-Clause
Group: Productivity/Office/Dictionary
Provides: locale(OpenOffice_org:sk)
Provides: locale(libreoffice:sk)
# compat stuff
Provides: OpenOffice_org-thesaurus-sk = %version
Provides: OpenOffice_org:/usr/lib/ooo-2.0/share/dict/ooo/th_sk_SK_v2.dat
Obsoletes: OpenOffice_org-thesaurus-sk <= %version
%description sk
The Slovak thesaurus dictionary that can be used to look up for
synonyms and related words in the LibreOffice office suite.
%package sl
Version: 20080601.1
Release: 0
Summary: Slovenian Thesaurus Dictionary for LibreOffice
License: LGPL-2.1+
Group: Productivity/Office/Dictionary
Provides: locale(OpenOffice_org:sl)
Provides: locale(libreoffice:sl)
# compat stuff
Provides: OpenOffice_org-thesaurus-sl = %version
Provides: OpenOffice_org:/usr/lib/ooo-2.0/share/dict/ooo/th_sl_SI_v2.dat
Obsoletes: OpenOffice_org-thesaurus-sl <= %version
%description sl
The Slovenian thesaurus dictionary that can be used to look up for
synonyms and related words in the LibreOffice office suite.
%package sv
Version: 20090624.1
Release: 0
Summary: Swedish Thesaurus Dictionary for LibreOffice
License: BSD-3-Clause
Group: Productivity/Office/Dictionary
Provides: locale(OpenOffice_org:sv)
Provides: locale(libreoffice:sv)
# compat stuff
Provides: OpenOffice_org-thesaurus-sv = %version
Provides: OpenOffice_org:/usr/lib/ooo-2.0/share/dict/ooo/th_sv_SE_v2.dat
Obsoletes: OpenOffice_org-thesaurus-sv <= %version
%description sv
The Swedish thesaurus dictionary that can be used to look up for
synonyms and related words in the LibreOffice office suite.
%prep
%setup -T -c
# unpack sources
for archive in \
%{S:1000} \
%{S:1001} \
%{S:1002} \
%{S:1003} \
%{S:1004} \
%{S:1005} \
%{S:1006} \
%{S:1007} \
%{S:1008} \
%{S:1009} \
%{S:1010} \
%{S:1011} \
%{S:1012} \
%{S:1013} \
%{S:1014} \
%{S:1015} \
%{S:1016} \
%{S:1017} \
%{S:1018} \
%{S:1019} \
%{S:1020} \
%{S:1021} \
%{S:1022} \
%{S:1023} \
%{S:1024} \
%{S:1025} \
%{S:1026} \
; do
archive_name=`basename $archive | sed -e "s|.zip$||" -e "s|.oxt$||" -e "s|.tar.gz$||" -e "s|.tar.bz2$||"`
mkdir $archive_name || exit 1;
case $archive in
*.zip|*.oxt)
cd $archive_name; unzip $archive || exit 1; cd -
;;
*.tar.gz)
tar -xzf $archive -C $archive_name || exit 1;
;;
*.tar.bz2)
tar -xjf $archive -C $archive_name || exit 1;
;;
*)
echo "Error: Do not know how to uncompress $archive"
exit 1;
;;
esac
done
#
# fix file names
mv thesaurus-ca/dictionaries/README_th_ca_ES_v3.txt thesaurus-ca/dictionaries/README_th_ca_ES_v2.txt
mv thesaurus-ca/dictionaries/th_ca_ES_v3.dat thesaurus-ca/dictionaries/th_ca_ES_v2.dat
mv thesaurus-ca/dictionaries/th_ca_ES_v3.idx thesaurus-ca/dictionaries/th_ca_ES_v2.idx
mv thes_en_GB_v2/th_en_GB_final.dat thes_en_GB_v2/th_en_GB_v2.dat
mv thes_en_GB_v2/th_en_GB_final.idx thes_en_GB_v2/th_en_GB_v2.idx
mv ooo-dictionnaire-fr-reforme1990-v3.5/dictionaries/thes_fr.dat ooo-dictionnaire-fr-reforme1990-v3.5/dictionaries/th_fr_FR_v2.dat
mv ooo-dictionnaire-fr-reforme1990-v3.5/dictionaries/thes_fr.idx ooo-dictionnaire-fr-reforme1990-v3.5/dictionaries/th_fr_FR_v2.idx
#
# rename thes_ to th_ and add _v2 suffix
for suffix in idx dat ; do
for file in `find . -name "th*_*.$suffix" -type f` ; do
dir=$(dirname $file)
fname=$(basename $file)
fname_new=`echo $fname | sed -e "s|^thes_|th_|" -e "s|\.$suffix$|_v2.$suffix|" -e "s|_v2_v2|_v2|"`
test "$fname" = "$fname_new" || mv -v "$dir/$fname" "$dir/$fname_new"
done
done
#
# fix permissions
find . -type f -exec chmod 644 {} \;
%build
%install
rm -f filelist.template
install -m 755 -d $RPM_BUILD_ROOT%{_datadir}/mythes
# compat dir
install -m 755 -d $RPM_BUILD_ROOT%{_datadir}/ooo/thesaurus
for lang_dir in * ; do
test -d $lang_dir || continue
# temporary file list
filelist=`mktemp /tmp/lo-thes-XXXXXX`
echo "%%defattr(-,root,root)" >$filelist
echo "%%dir %{_datadir}/mythes" >>$filelist
# compat dir
echo "%%dir %{_datadir}/ooo" >>$filelist
echo "%%dir %{_datadir}/ooo/thesaurus" >>$filelist
# install dictionaries
dic=
# support locales with 2 and 3 letters in the language code: th_ll_CC_v2.idx and th_lll_CC_v2.idx
for idx in `find $lang_dir -regextype posix-extended -regex ".*/th_[[:lower:]][[:lower:]][[:lower:]]?_[[:upper:]][[:upper:]]_v2.idx" | sort` ; do
dat=`echo $idx | sed -e "s|.idx$|.dat|"`
if ! test -f $dat ; then
echo "Warning: Found $idx but not $dat"
echo "Skipping $idx"
continue;
fi
# both .idx and .dat files exists => install them
for f in $idx $dat ; do
fname=$(basename $f)
if test -f $RPM_BUILD_ROOT%{_datadir}/mythes/$fname ; then
echo "Error: file already installed: $f"
echo " Probably is provided by two source tarballs"
exit 1;
fi
install -m 644 $f $RPM_BUILD_ROOT%{_datadir}/mythes/
echo %{_datadir}/mythes/$fname >>$filelist
# compat stuff
ln -sf ../../mythes/$fname $RPM_BUILD_ROOT%{_datadir}/ooo/thesaurus/
echo %{_datadir}/ooo/thesaurus/$fname >>$filelist
done
done
# detect locale, lang and country
if test -n $idx ; then
# replace the underscore with a dot to be able to separate the language and the coutry code with the command "cut"
dic_pname=`basename $idx | sed "s|_|.|g"`
lang=`echo $dic_pname | cut -d "." -f2`
country=`echo $dic_pname | cut -d "." -f3`
else
echo "Error: No dictionary found in $lang_dir"
exit 1;
fi
locale="${lang}_${country}"
# detect long language name
case "$locale" in
"bg_BG") lang_name="bg" ;;
"ca_ES") lang_name="ca" ;;
"cs_CZ") lang_name="cs" ;;
"da_DK") lang_name="da" ;;
"de_DE") lang_name="de" ;;
"de_AT") lang_name="de-AT" ;;
"de_CH") lang_name="de-CH" ;;
"el_GR") lang_name="el" ;;
"en_AU") lang_name="en-AU" ;;
"en_GB") lang_name="en-GB" ;;
"en_US") lang_name="en-US" ;;
"es_ES") lang_name="es" ;;
"es_AR") lang_name="es-AR" ;;
"es_VE") lang_name="es-VE" ;;
"fr_FR") lang_name="fr" ;;
"ga_IE") lang_name="ga" ;;
"hu_HU") lang_name="hu" ;;
"it_IT") lang_name="it" ;;
"nb_NO") lang_name="nb" ;;
"ne_NP") lang_name="ne" ;;
"pl_PL") lang_name="pl" ;;
"pt_PT") lang_name="pt" ;;
"ro_RO") lang_name="ro" ;;
"ru_RU") lang_name="ru" ;;
"sk_SK") lang_name="sk" ;;
"sl_SI") lang_name="sl" ;;
"sv_SE") lang_name="sv" ;;
*) lang_name="$lang" ;;
esac
# detect README encoding
case "$locale" in
*) coding=`LC_CTYPE="$locale" locale -k LC_CTYPE | grep charmap | sed "s|charmap=\"\(.*\)\"\$|\1|"` ;;
esac
# install documentation
docdir=%{_docdir}/libreoffice-thesaurus-$lang_name
mkdir -p $RPM_BUILD_ROOT$docdir
echo "%%doc $docdir" >>$filelist
for doc in `find $lang_dir -type f -printf "%%P\n" | \
grep -v -e ".aff$" -e ".dic$" -e ".dat$" -e ".idx$" \
-e ".orig$" -e ".old$" -e "~$" \
-e ".sh$" -e "makefile" -e "META-INF"` ; do
if ! test -f $lang_dir/$doc ; then
echo "Error: is not a file: $lang_dir/$doc"
exit 1;
fi
recode utf8..utf16 <$lang_dir/$doc >/dev/null 2>&1 || recode $coding..utf8 $lang_dir/$doc
dos2unix $lang_dir/$doc
dname=$(dirname $doc)
install -m 755 -d $RPM_BUILD_ROOT$docdir/$dname
install -m 644 $lang_dir/$doc $RPM_BUILD_ROOT$docdir/$dname
done
# rename the file list according to the detacted lang and country
mv $filelist $locale.list
# generate tempalte for the %files section
echo "%%files -f $locale.list $lang_name" >>filelist.template
echo "" >>filelist.template
done
%clean
rm -rf $RPM_BUILD_ROOT
%files -f bg_BG.list bg
%files -f ca_ES.list ca
%files -f cs_CZ.list cs
%files -f da_DK.list da
%files -f de_DE.list de
%files -f de_AT.list de-AT
%files -f de_CH.list de-CH
%files -f el_GR.list el
%files -f en_AU.list en-AU
%files -f en_GB.list en-GB
%files -f en_US.list en-US
%files -f es_ES.list es
%files -f es_AR.list es-AR
%files -f es_VE.list es-VE
%files -f fr_FR.list fr
%files -f ga_IE.list ga
%files -f hu_HU.list hu
%files -f it_IT.list it
%files -f nb_NO.list nb
%files -f ne_NP.list ne
%files -f pl_PL.list pl
%files -f pt_PT.list pt
%files -f ro_RO.list ro
%files -f ru_RU.list ru
%files -f sk_SK.list sk
%files -f sl_SI.list sl
%files -f sv_SE.list sv
%changelog