2010-04-08 12:36:00 +02:00
|
|
|
#
|
2011-05-27 11:27:43 +02:00
|
|
|
# spec file for package myspell-dictionaries
|
2010-04-08 12:36:00 +02:00
|
|
|
#
|
2012-04-12 09:42:27 +02:00
|
|
|
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
2010-04-08 12:36:00 +02:00
|
|
|
#
|
|
|
|
# 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/
|
|
|
|
#
|
|
|
|
|
2010-04-13 21:35:20 +02:00
|
|
|
@DO_NOT_EDIT_COMMENT@
|
2012-04-12 09:42:27 +02:00
|
|
|
Name: myspell-dictionaries
|
2014-01-02 11:51:03 +01:00
|
|
|
Version: 20140102
|
2012-04-12 09:42:27 +02:00
|
|
|
Release: 0
|
2010-04-08 12:36:00 +02:00
|
|
|
Summary: A Source Package for Dictionaries Used by MySpell
|
2012-04-12 09:42:27 +02:00
|
|
|
License: @ALL_LICENSES@
|
|
|
|
Group: Productivity/Text/Spell
|
2010-04-08 12:36:00 +02:00
|
|
|
Url: http://lingucomponent.openoffice.org/download_dictionary.html
|
|
|
|
# Novell jargon bnc#306333
|
|
|
|
Source0: Nwordlist.tgz
|
|
|
|
Source1: myspell-dictionaries-gen-spec
|
2010-04-13 21:35:20 +02:00
|
|
|
Source2: myspell-dictionaries.spec.in
|
|
|
|
Source3: myspell-dictionaries.data
|
2010-04-08 12:36:00 +02:00
|
|
|
# dictionaries
|
|
|
|
@SOURCES@
|
2012-04-12 09:42:27 +02:00
|
|
|
BuildRequires: dos2unix
|
|
|
|
BuildRequires: recode
|
|
|
|
BuildRequires: unzip
|
|
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
|
|
BuildArch: noarch
|
2010-04-08 12:36:00 +02:00
|
|
|
|
|
|
|
%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 -c
|
2012-04-12 09:42:27 +02:00
|
|
|
install -m 644 %{SOURCE1} .
|
2010-04-08 12:36:00 +02:00
|
|
|
# unpack sources
|
|
|
|
for archive in \
|
|
|
|
@SOURCES_UNPACK@ ; 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 wrong filenames
|
|
|
|
@PREP_HACKS@#
|
|
|
|
# fix permissions
|
|
|
|
#
|
|
|
|
find . -type f -exec chmod 644 {} \;
|
|
|
|
|
|
|
|
%build
|
|
|
|
# add the Novell jargon into all dictionaries bnc#306333
|
|
|
|
# Beware! The Nwordlist must begin with a newline. Some files do not contain
|
|
|
|
# LF at the end of file.
|
|
|
|
for dic in `find . -name "*.dic` ; do
|
|
|
|
cat Nwordlist >> $dic
|
|
|
|
# delete empty lines if they were created in some cases
|
|
|
|
grep -v "^$" $dic > $dic.no_space && mv $dic.no_space $dic
|
|
|
|
done
|
|
|
|
|
|
|
|
%install
|
|
|
|
rm -f filelist.template
|
2012-04-12 09:42:27 +02:00
|
|
|
install -m 755 -d %{buildroot}%{_datadir}/myspell/
|
2010-04-08 12:36:00 +02:00
|
|
|
for lang_dir in * ; do
|
|
|
|
test -d $lang_dir || continue
|
|
|
|
# support locales with 2 and 3 letters in the language code: ll_CC.aff and lll_CC.aff
|
|
|
|
for aff in `find $lang_dir -regextype posix-extended -regex ".*/[[:lower:]][[:lower:]][[:lower:]]?_[[:upper:]][[:upper:]].aff" | sort` ; do
|
2010-12-02 17:06:49 +01:00
|
|
|
# find dictionaries
|
2010-04-08 12:36:00 +02:00
|
|
|
dic=`echo $aff | sed -e "s|.aff$|.dic|"`
|
|
|
|
if ! test -f $dic ; then
|
|
|
|
echo "Warning: Found $aff but not $dic"
|
|
|
|
echo "Skipping $aff"
|
|
|
|
continue;
|
|
|
|
fi
|
2010-12-02 17:06:49 +01:00
|
|
|
|
|
|
|
# both .dic and .aff files exists => valid dictionary
|
|
|
|
# initialize file list
|
|
|
|
filelist=`mktemp /tmp/myspell-dictionaries-XXXXXX`
|
2012-04-12 09:42:27 +02:00
|
|
|
echo "%%defattr(-,root,root,-)" >$filelist
|
2010-12-02 17:06:49 +01:00
|
|
|
echo "%%dir %{_datadir}/myspell/" >>$filelist
|
|
|
|
|
|
|
|
# install the dictionary
|
2010-04-08 12:36:00 +02:00
|
|
|
for f in $aff $dic ; do
|
|
|
|
fname=$(basename $f)
|
2012-04-12 09:42:27 +02:00
|
|
|
if test -f %{buildroot}%{_datadir}/myspell/$fname ; then
|
2010-04-08 12:36:00 +02:00
|
|
|
echo "Error: file already installed: $f"
|
|
|
|
echo " Probably is provided by two source tarballs"
|
|
|
|
exit 1;
|
|
|
|
fi
|
2012-04-12 09:42:27 +02:00
|
|
|
install -m 644 $f %{buildroot}%{_datadir}/myspell/
|
2010-04-08 12:36:00 +02:00
|
|
|
echo %{_datadir}/myspell/$fname >>$filelist
|
|
|
|
done
|
|
|
|
|
2010-12-02 17:06:49 +01:00
|
|
|
# detect locale, lang and country
|
|
|
|
if test -n $dic ; 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 $dic | sed "s|_|.|"`
|
|
|
|
lang=`echo $dic_pname | cut -d "." -f1`
|
|
|
|
country=`echo $dic_pname | cut -d "." -f2`
|
|
|
|
else
|
|
|
|
echo "Error: No dictionary found in $lang_dir"
|
2010-04-08 12:36:00 +02:00
|
|
|
exit 1;
|
|
|
|
fi
|
2010-12-02 17:06:49 +01:00
|
|
|
locale="${lang}_${country}"
|
|
|
|
|
|
|
|
# detect long language name
|
2012-04-12 09:42:27 +02:00
|
|
|
case "$locale" in
|
2010-12-02 17:06:49 +01:00
|
|
|
@LANG_NAME@ *) echo "Error: do not know language name for the locale $locale"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# detect README encoding
|
|
|
|
coding=`LC_CTYPE="$locale" locale -k LC_CTYPE | grep charmap | sed "s|charmap=\"\(.*\)\"\$|\1|"`
|
|
|
|
# special hack for some locales
|
2012-04-12 09:42:27 +02:00
|
|
|
case "$locale" in
|
2010-12-02 17:06:49 +01:00
|
|
|
@ENCODING@ esac
|
|
|
|
|
|
|
|
# install documentation
|
|
|
|
docdir=%{_docdir}/myspell-$lang_name
|
2012-04-12 09:42:27 +02:00
|
|
|
mkdir -p %{buildroot}$docdir
|
2010-12-02 17:06:49 +01:00
|
|
|
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)
|
2012-04-12 09:42:27 +02:00
|
|
|
install -m 755 -d %{buildroot}$docdir/$dname
|
|
|
|
install -m 644 $lang_dir/$doc %{buildroot}$docdir/$dname
|
2010-12-02 17:06:49 +01:00
|
|
|
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 -n myspell-$lang_name" >>filelist.template
|
|
|
|
echo "" >>filelist.template
|
2010-04-08 12:36:00 +02:00
|
|
|
done
|
|
|
|
done
|
|
|
|
|
2010-04-22 12:57:47 +02:00
|
|
|
echo "******"
|
|
|
|
|
2010-04-08 12:36:00 +02:00
|
|
|
@FILES@
|
|
|
|
%changelog
|