File OpenOffice_org-LanguageTool.spec of Package OpenOffice_org-LanguageTool

#
# spec file for package OpenOffice_org-LanguageTool (Version 0.9.9)
#
# Copyright (c) 2009 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/
#

# norootforbuild


Name:           OpenOffice_org-LanguageTool
Version:        0.9.9
Release:        2
BuildRequires:  OpenOffice_org-ure ant java-devel
#!BuildIgnore:  OpenOffice_org
%define	        ooo_prefix	%_libdir
%define	        ooo_home		ooo3
# ignore cs because of an unlclear license; also unsupported
# ignore sk unknown license; almost empty dictionary
# ignore uk (unsupported)
%define	        langtool_langs  de en es fr it pl nl ro ru sv
License:        BSD 3-clause (or similar) ; BSD 4-clause (or similar) ; LGPL v2.1 only ;   Other uncritical OpenSource License  ;   Public Domain, Freeware  ; Apache Software License ..
Group:          Productivity/Office/Suite
AutoReqProv:    on
PreReq:         OpenOffice_org >= 3.0.99
Requires:       OpenOffice_org >= 3.0.99
Requires:       jre >= 1.6
# the Czech stuff newer worked; the package was created by mistake
Obsoletes:      OpenOffice_org-LanguageTool-cs < 0.9.9
Summary:        Language Checker for OpenOffice.org
Url:            http://www.languagetool.org/
# cvs -z3 -d:pserver:anonymous@languagetool.cvs.sourceforge.net:/cvsroot/languagetool co -r V_0_9_9 -P JLanguageTool
# rm src/resource/cs/{*.dict,*.info}  because of unclear licese; also it is not longer supported (only a bachelor's thesis)
# rm libs/{activation.jar,jaxb-api.jar,jaxb-impl.jar,jsr173_1.0_api.jar}:
#    + part of JDK 1.6 => not needed
#    + under CDDL or GPL => remove them to avoid necessity to include the related sources
# rm libs/commons-lang-2.4.jar
#    + unused
# rm libs/bliki-3.0.3.jar:
#    + needed only to run the project wiki page => not needed for the plugin
#    + GPL => remove it to avoid necessity to include the related sources
# FIXME: wanted to remove libs/commons-logging-1.1.1.jar but it was not available on SLED11
#        it is small file (60kB) => it is not worth doing special hacks for SLED11 and other distros
Source0:        JLanguageTool-%version.tar.bz2
# the Jaminid and jdic sources are unused during build but they should be in
# the package sources according to LGPL (bnc#487807)
# URL: http://jaminid.sourceforge.net/
# Version 0.99 is mentioned in libs/README
Source1:        Jaminid-0.99.tar.bz2
# URL: http://jdic.dev.java.net/
# Version 20061102 is mentioned in the cvs log
Source2:        jdic-20061102-src.tar.bz2
# helper script and data file to create pieces of the spec file
Source100:      ooo-LanguageTool-data
Source101:      ooo-LanguageTool-gen-spec
Patch0:         JLanguageTool-0.9.9-package-dicts-separately.diff
Patch1:         JLanguageTool-0.9.3-system-ooo-jars.diff
Patch2:         JLanguageTool-0.9.9-find-junit-jar.diff
Patch3:         JLanguageTool-0.9.9-ignore-jre-1.5.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
This package provides the language checker extension for
OpenOffice.org. It allows to detect errors that a simple spell checker
cannot detect, e.g. mixing up there/their, no/now etc. It can also
detect some grammar mistakes. It does not include spell checking.

The language checker uses special dictionaries that are provided by the
OpenOffice_org-LanguageTool-<lang> packages.



%package -n OpenOffice_org-LanguageTool-de
License:        Other uncritical OpenSource License
Summary:        German Dictionary for OpenOffice.org Language Tool
Group:          Productivity/Office/Dictionary
Provides:       locale(OpenOffice_org-LanguageTool:de)
PreReq:         OpenOffice_org-ure >= 2.99
Requires:       OpenOffice_org-LanguageTool = %version

%description -n OpenOffice_org-LanguageTool-de
The German dictionary that can be used to check grammar and other more
complex mistakes using the OpenOffice.org language tool extension.



%package -n OpenOffice_org-LanguageTool-en
License:        BSD 3-clause (or similar) ; BSD 4-clause (or similar) ;   Public Domain, Freeware
Summary:        English Dictionary for OpenOffice.org Language Tool
Group:          Productivity/Office/Dictionary
Provides:       locale(OpenOffice_org-LanguageTool:en)
PreReq:         OpenOffice_org-ure >= 2.99
Requires:       OpenOffice_org-LanguageTool = %version

%description -n OpenOffice_org-LanguageTool-en
The English dictionary that can be used to check grammar and other more
complex mistakes using the OpenOffice.org language tool extension.



%package -n OpenOffice_org-LanguageTool-es
License:        LGPL v2.1 only
Summary:        Spanish Dictionary for OpenOffice.org Language Tool
Group:          Productivity/Office/Dictionary
Provides:       locale(OpenOffice_org-LanguageTool:es)
PreReq:         OpenOffice_org-ure >= 2.99
Requires:       OpenOffice_org-LanguageTool = %version

%description -n OpenOffice_org-LanguageTool-es
The Spanish dictionary that can be used to check grammar and other more
complex mistakes using the OpenOffice.org language tool extension.



%package -n OpenOffice_org-LanguageTool-fr
License:        LGPL v2.1 only
Summary:        French Dictionary for OpenOffice.org Language Tool
Group:          Productivity/Office/Dictionary
Provides:       locale(OpenOffice_org-LanguageTool:fr)
PreReq:         OpenOffice_org-ure >= 2.99
Requires:       OpenOffice_org-LanguageTool = %version

%description -n OpenOffice_org-LanguageTool-fr
The French dictionary that can be used to check grammar and other more
complex mistakes using the OpenOffice.org language tool extension.



%package -n OpenOffice_org-LanguageTool-it
License:        Other uncritical OpenSource License
Summary:        Italian Dictionary for OpenOffice.org Language Tool
Group:          Productivity/Office/Dictionary
Provides:       locale(OpenOffice_org-LanguageTool:it)
PreReq:         OpenOffice_org-ure >= 2.99
Requires:       OpenOffice_org-LanguageTool = %version

%description -n OpenOffice_org-LanguageTool-it
The Italian dictionary that can be used to check grammar and other more
complex mistakes using the OpenOffice.org language tool extension.



%package -n OpenOffice_org-LanguageTool-nl
License:        LGPL v2.1 only
Summary:        Dutch Dictionary for OpenOffice.org Language Tool
Group:          Productivity/Office/Dictionary
Provides:       locale(OpenOffice_org-LanguageTool:nl)
PreReq:         OpenOffice_org-ure >= 2.99
Requires:       OpenOffice_org-LanguageTool = %version

%description -n OpenOffice_org-LanguageTool-nl
The Dutch dictionary that can be used to check grammar and other more
complex mistakes using the OpenOffice.org language tool extension.



%package -n OpenOffice_org-LanguageTool-pl
License:        LGPL v2.1 only
Summary:        Polish Dictionary for OpenOffice.org Language Tool
Group:          Productivity/Office/Dictionary
Provides:       locale(OpenOffice_org-LanguageTool:pl)
PreReq:         OpenOffice_org-ure >= 2.99
Requires:       OpenOffice_org-LanguageTool = %version

%description -n OpenOffice_org-LanguageTool-pl
The Polish dictionary that can be used to check grammar and other more
complex mistakes using the OpenOffice.org language tool extension.



%package -n OpenOffice_org-LanguageTool-ro
License:        LGPL v2.1 only
Summary:        Romanian Dictionary for OpenOffice.org Language Tool
Group:          Productivity/Office/Dictionary
Provides:       locale(OpenOffice_org-LanguageTool:ro)
PreReq:         OpenOffice_org-ure >= 2.99
Requires:       OpenOffice_org-LanguageTool = %version

%description -n OpenOffice_org-LanguageTool-ro
The Romanian dictionary that can be used to check grammar and other
more complex mistakes using the OpenOffice.org language tool extension.



%package -n OpenOffice_org-LanguageTool-ru
License:        LGPL v2.1 only
Summary:        Russian Dictionary for OpenOffice.org Language Tool
Group:          Productivity/Office/Dictionary
Provides:       locale(OpenOffice_org-LanguageTool:ru)
PreReq:         OpenOffice_org-ure >= 2.99
Requires:       OpenOffice_org-LanguageTool = %version

%description -n OpenOffice_org-LanguageTool-ru
The Russian dictionary that can be used to check grammar and other more
complex mistakes using the OpenOffice.org language tool extension.



%package -n OpenOffice_org-LanguageTool-sv
License:        LGPL v2.1 or later
Summary:        Swedish Dictionary for OpenOffice.org Language Tool
Group:          Productivity/Office/Dictionary
Provides:       locale(OpenOffice_org-LanguageTool:sv)
PreReq:         OpenOffice_org-ure >= 2.99
Requires:       OpenOffice_org-LanguageTool = %version

%description -n OpenOffice_org-LanguageTool-sv
The Swedish dictionary that can be used to check grammar and other more
complex mistakes using the OpenOffice.org language tool extension.



%prep
%setup -q -a1 -n JLanguageTool-%version
%patch0
%patch1
%patch2
%patch3
mkdir jdic
tar -xjf %{S:2} -C jdic
cp libs/README libs/README-libs.txt

%build
ant -Dsys.ooo.dir=%{_libdir}/%ooo_home dist

%install
# main package
mkdir -p $RPM_BUILD_ROOT%_datadir/%ooo_home/share/extension/install
cp dist/LanguageTool-%version.oxt $RPM_BUILD_ROOT%_datadir/%ooo_home/share/extension/install
# dictionaries
for lang in %langtool_langs ; do
    # dir
    mkdir -p $RPM_BUILD_ROOT%_datadir/%ooo_home/ure/lib/resource/$lang
    echo "%dir %_datadir/%ooo_home" >files-langtool-$lang.txt
    echo "%dir %_datadir/%ooo_home/ure" >>files-langtool-$lang.txt
    echo "%dir %_datadir/%ooo_home/ure/lib" >>files-langtool-$lang.txt
    echo "%dir %_datadir/%ooo_home/ure/lib/resource" >>files-langtool-$lang.txt
    echo "%dir %_datadir/%ooo_home/ure/lib/resource/$lang" >>files-langtool-$lang.txt
    # files
    for file in src/resource/$lang/{*.dict,*.info} ; do
	filename=${file#src/resource/$lang/}
	cp $file $RPM_BUILD_ROOT%_datadir/%ooo_home/ure/lib/resource/$lang/$filename
	echo "%_datadir/%ooo_home/ure/lib/resource/$lang/$filename" >>files-langtool-$lang.txt
    done
    cp files-langtool-$lang.txt $RPM_BUILD_ROOT%_datadir/%ooo_home
    echo "%_datadir/%ooo_home/files-langtool-$lang.txt" >>files-langtool-$lang.txt
    # common README.txt
    echo "%doc README.txt" >>files-langtool-$lang.txt
done

%clean
#rm -rf $RPM_BUILD_ROOT

%pre
if test $1 -gt 1 ; then
    echo "Unregistering the older LangTool extension from OpenOffice.org..."
    unopkg remove --shared org.openoffice.languagetool.oxt || true;
    # clear disk cache
    unopkg list --shared > /dev/null 2>&1 || true
fi

%post
echo "Registering the LangTool extension in OpenOffice.org..."
unopkg add --shared --force %_datadir/%ooo_home/share/extension/install/LanguageTool-%version.oxt || true;

%preun 
if test $1 = 0 ; then
    echo "Unregistering the LangTool extension from OpenOffice.org..."
    unopkg remove --shared org.openoffice.languagetool.oxt || true;
    # clear disk cache
    unopkg list --shared > /dev/null 2>&1 || :
fi

%files
%defattr(-,root,root)
%doc CHANGES.txt COPYING.txt README.txt libs/*.txt libs/build/junit-license.txt
%dir %_datadir/%ooo_home
%dir %_datadir/%ooo_home/share
%dir %_datadir/%ooo_home/share/extension
%dir %_datadir/%ooo_home/share/extension/install
%_datadir/%ooo_home/share/extension/install/LanguageTool-%version.oxt
########################################################
# Start of a section generated by ooo-langtool-gen-spec
# Do not edit!
########################################################
#
# langtool dictionaries
#
# de

%posttrans -n OpenOffice_org-LanguageTool-de
%_datadir/%ooo_home/link-to-ooo-home %_datadir/%ooo_home/files-langtool-de.txt || true

%preun -n OpenOffice_org-LanguageTool-de
test "$1" = "0" && %_datadir/%ooo_home/link-to-ooo-home --unlink %_datadir/%ooo_home/files-langtool-de.txt || true
# en

%posttrans -n OpenOffice_org-LanguageTool-en
%_datadir/%ooo_home/link-to-ooo-home %_datadir/%ooo_home/files-langtool-en.txt || true

%preun -n OpenOffice_org-LanguageTool-en
test "$1" = "0" && %_datadir/%ooo_home/link-to-ooo-home --unlink %_datadir/%ooo_home/files-langtool-en.txt || true
# es

%posttrans -n OpenOffice_org-LanguageTool-es
%_datadir/%ooo_home/link-to-ooo-home %_datadir/%ooo_home/files-langtool-es.txt || true

%preun -n OpenOffice_org-LanguageTool-es
test "$1" = "0" && %_datadir/%ooo_home/link-to-ooo-home --unlink %_datadir/%ooo_home/files-langtool-es.txt || true
# fr

%posttrans -n OpenOffice_org-LanguageTool-fr
%_datadir/%ooo_home/link-to-ooo-home %_datadir/%ooo_home/files-langtool-fr.txt || true

%preun -n OpenOffice_org-LanguageTool-fr
test "$1" = "0" && %_datadir/%ooo_home/link-to-ooo-home --unlink %_datadir/%ooo_home/files-langtool-fr.txt || true
# it

%posttrans -n OpenOffice_org-LanguageTool-it
%_datadir/%ooo_home/link-to-ooo-home %_datadir/%ooo_home/files-langtool-it.txt || true

%preun -n OpenOffice_org-LanguageTool-it
test "$1" = "0" && %_datadir/%ooo_home/link-to-ooo-home --unlink %_datadir/%ooo_home/files-langtool-it.txt || true
# nl

%posttrans -n OpenOffice_org-LanguageTool-nl
%_datadir/%ooo_home/link-to-ooo-home %_datadir/%ooo_home/files-langtool-nl.txt || true

%preun -n OpenOffice_org-LanguageTool-nl
test "$1" = "0" && %_datadir/%ooo_home/link-to-ooo-home --unlink %_datadir/%ooo_home/files-langtool-nl.txt || true
# pl

%posttrans -n OpenOffice_org-LanguageTool-pl
%_datadir/%ooo_home/link-to-ooo-home %_datadir/%ooo_home/files-langtool-pl.txt || true

%preun -n OpenOffice_org-LanguageTool-pl
test "$1" = "0" && %_datadir/%ooo_home/link-to-ooo-home --unlink %_datadir/%ooo_home/files-langtool-pl.txt || true
# ro

%posttrans -n OpenOffice_org-LanguageTool-ro
%_datadir/%ooo_home/link-to-ooo-home %_datadir/%ooo_home/files-langtool-ro.txt || true

%preun -n OpenOffice_org-LanguageTool-ro
test "$1" = "0" && %_datadir/%ooo_home/link-to-ooo-home --unlink %_datadir/%ooo_home/files-langtool-ro.txt || true
# ru

%posttrans -n OpenOffice_org-LanguageTool-ru
%_datadir/%ooo_home/link-to-ooo-home %_datadir/%ooo_home/files-langtool-ru.txt || true

%preun -n OpenOffice_org-LanguageTool-ru
test "$1" = "0" && %_datadir/%ooo_home/link-to-ooo-home --unlink %_datadir/%ooo_home/files-langtool-ru.txt || true
# sv

%posttrans -n OpenOffice_org-LanguageTool-sv
%_datadir/%ooo_home/link-to-ooo-home %_datadir/%ooo_home/files-langtool-sv.txt || true

%preun -n OpenOffice_org-LanguageTool-sv
test "$1" = "0" && %_datadir/%ooo_home/link-to-ooo-home --unlink %_datadir/%ooo_home/files-langtool-sv.txt || true
#
# langtool dictionaries
#

%files -f files-langtool-de.txt -n OpenOffice_org-LanguageTool-de
%defattr(-,root,root)
%doc src/resource/de/{errors.txt,tagset.txt}

%files -f files-langtool-en.txt -n OpenOffice_org-LanguageTool-en
%defattr(-,root,root)
%doc src/resource/en/{12dicts-readme.html,agid-readme.txt,errors.txt,pos-readme.txt}

%files -f files-langtool-es.txt -n OpenOffice_org-LanguageTool-es
%defattr(-,root,root)

%files -f files-langtool-fr.txt -n OpenOffice_org-LanguageTool-fr
%defattr(-,root,root)
%doc src/resource/fr/readme.txt

%files -f files-langtool-it.txt -n OpenOffice_org-LanguageTool-it
%defattr(-,root,root)
%doc src/resource/it/readme-morph-it.txt

%files -f files-langtool-nl.txt -n OpenOffice_org-LanguageTool-nl
%defattr(-,root,root)

%files -f files-langtool-pl.txt -n OpenOffice_org-LanguageTool-pl
%defattr(-,root,root)

%files -f files-langtool-ro.txt -n OpenOffice_org-LanguageTool-ro
%defattr(-,root,root)

%files -f files-langtool-ru.txt -n OpenOffice_org-LanguageTool-ru
%defattr(-,root,root)

%files -f files-langtool-sv.txt -n OpenOffice_org-LanguageTool-sv
%defattr(-,root,root)
######################################################
# End of a section generated by ooo-langtool-gen-spec
######################################################

%changelog
openSUSE Build Service is sponsored by