File libreoffice-extensions.spec of Package libreoffice-extensions

#
# spec file for package libreoffice-extensions
#
# Copyright (c) 2011 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:           libreoffice-extensions
Version:        3.3.1.2
Release:        1.<RELEASE2>
%define         piece              extensions
%define         ooo_build_version  3.3.1.2
%define         ooo_piece_version  3.3.1.2
%define         ooo_sourcedirname  libreoffice-build-%ooo_piece_version
%define         ooo_prefix         %_libdir
%define         ooo_home           libreoffice
%define         ct2n_version       1.3.2
%define         gdocs_version      2.1.0
%define         numbertext_version 0.8.2
#!BuildIgnore:  libreoffice
BuildRequires:  ImageMagick ant ant-apache-regexp ant-nodeps bison boost-devel ccache cups-devel curl-devel flac-devel flex gcc-c++ gnome-vfs2-devel gperf gtk2-devel icu java-devel libexif libxml2-devel mono-devel neon-devel pam-devel perl-Archive-Zip perl-Compress-Zlib python-devel recode unixODBC-devel unzip xml-commons-apis zip
%if 0%{?suse_version}
BuildRequires:  db-devel krb5 openldap2-devel python-xml xorg-x11
%endif
%if 0%{?meego_version}
BuildRequires:  db4-devel krb5-devel openldap-devel
%endif
BuildRequires:  libreoffice-libs-core-devel = %version
BuildRequires:  libreoffice-l10n-extras-devel = %version
BuildRequires:  libreoffice-components-devel = %version
BuildRequires:  libreoffice-artwork-devel = %version
# filters-devel provides odt2mediawiki.xsl and other files for the mediawiki extension
BuildRequires:  libreoffice-filters-devel = %version
############################
# KDE3 stuff
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
BuildRequires:  kdelibs3-devel
%endif
############################
# mysql stuff
%if 0%{?suse_version}
BuildRequires:  libmysqlclient-devel
%endif
%if 0%{?suse_version} > 01210
# mysqlcppconn >= 1.0.6 is needed
BuildRequires:  libmysqlcppconn-devel
%endif
############################
# poppler is needed to build the PDF import extension
# the needed version 0.8.0 has been avaiable only since openSUSE-11.0
%if 0%{?suse_version} >= 01100
BuildRequires:  libpoppler-devel
%endif
%if 0%{?meego_version}
BuildRequires:  poppler-devel
%endif
License:        GPLv2 ; LGPLv2.1+ ; LGPLv3 ; Other uncritical OpenSource License
Group:          Productivity/Office/Suite
AutoReqProv:    on
Requires:       libreoffice-libs-core = %version
# compat stuff
Provides:       OpenOffice_org-extensions = %version
Obsoletes:      OpenOffice_org-extensions <= %version
Summary:        LibreOffice Extensions
Url:            http://extensions.services.openoffice.org
Source0:        libreoffice-%piece-%ooo_piece_version.tar.bz2
Source2:        README-scsolver.txt
# prebuilt extensions
Source100:      gdocs_%{gdocs_version}_modified.oxt
Source101:      numbertext-%{numbertext_version}.oxt
# FIXME: this is just because of license; we do not build gdocs from sources now
# gdocs sources
Source500:      gdocs_%{gdocs_version}.tar.bz2
Source501:      gdocs_%{gdocs_version}.diff
# gdata-*.jar and google-*.jar are under Apache License, Version 2.0
# activation.jar is part of "JavaTM Web Services Developer Pack 1.5 Release
#	Notes" and is mentioned there between "Redistributable Components", see
#	http://java.sun.com/webservices/docs/1.5/ReleaseNotes.html#RedistributableComponents
# mail-1.4-sources.jar is taken from http://ftp.us.xemacs.org/pub/mirrors/maven2/javax/mail/mail/1.4/
#	the mail-1.4.jar in the above URL is not exactly the same but it is evident that it is built from the same sources:
#	class files are exactly the same; sligtly newer ant and Sun JRE has been used for the build;
#	text files has DOS end of lines
Source502:      mail-1.4-sources.jar
# taken from netbeans-6.8 installed from netbeans-6.8-ml-javase-linux.sh
Source503:      AbsoluteLayout.tar.bz2
# taken from netbeans-6.8 installed from netbeans-6.8-ml-javase-linux.sh
Source504:      swing-layout-1.0.4-doc.zip
# taken from netbeans-6.8 installed from netbeans-6.8-ml-javase-linux.sh
Source505:      swing-layout-1.0.4-src.zip
# external source tarballs
Source1000:     af3c3acf618de6108d65fcdc92b492e1-commons-codec-1.3-src.tar.gz
Source1001:     a06a496d7a43cbdc35e69dbe678efadb-libloader.zip
Source1002:     dbb3757275dc5cc80820c0b4dd24ed95-librepository.zip
Source1003:     d1a3205871c3c52e8a50c9f18510ae12-libformula.zip
Source1004:     d4c4d91ab3a8e52a2e69d48d34ef4df4-core.zip
Source1005:     f3e2febd267c8e4b13df00dac211dd6d-flute.zip
Source1006:     f7925ba8491fe570e5164d2c72791358-libfonts.zip
Source1007:     2ae988b339daec234019a7066f96733e-commons-lang-2.3-src.tar.gz
Source1008:     2a177023f9ea8ec8bd00837605c5df1b-jakarta-tomcat-5.0.30-src.tar.gz
Source1009:     2c9b0f83ed5890af02c0df1c1776f39b-commons-httpclient-3.1-src.tar.gz
Source1010:     3c219630e4302863a9a83d0efde889db-commons-logging-1.1.1-src.tar.gz
Source1011:     39bb3fcea1514f1369fcfc87542390fd-sacjava-1.3.zip
Source1012:     451ccf439a36a568653b024534669971-ConvertTextToNumber-1.3.2.oxt
Source1013:     451ccf439a36a568653b024534669971-ConvertTextToNumber-1.3.2.zip
Source1014:     5aba06ede2daa9f2c11892fbd7bc3057-libserializer.zip
Source1015:     67b42915c8432abf0a922438f00860a2-libxml.zip
Source1016:     79600e696a98ff95c2eba976f7a8dfbb-liblayout.zip
Source1017:     8ea307d71d11140574bfb9fcc2487e33-libbase.zip
Source1018:     90401bca927835b6fbae4a707ed187c8-nlpsolver-0.9.tar.bz2
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
ExclusiveArch:  %ix86 x86_64 ppc

%description
This package provides various extensions for LibreOffice office
suite.



%package -n libreoffice-base-extensions
License:        GPLv2 ; LGPLv2.1+ ; LGPLv3 ; Other uncritical OpenSource License
Summary:        LibreOffice Base Extensions
Group:          Productivity/Office/Suite
PreReq:         libreoffice-libs-core = %version
Requires:       libreoffice-base = %version
%if 0%{?suse_version} && 0%{?suse_version} < 01120
# use wake dependency for the mysql driver on older distros
# the extension is unpacked and the dependency automatically detected on newer
# distros
Recommends:     libmysqlclient15
%endif
# compat stuff
Provides:       OpenOffice_org-base-extensions = %version
Obsoletes:      OpenOffice_org-base-extensions <= %version

%description -n libreoffice-base-extensions
This package provides extensions for LibreOffice Base:

%if 0%{?suse_version} && 0%{?suse_version} < 01120
- MySQL connector
%endif
- Report Builder

# new packages are not allowed on SLED11
# put the mysql driver into separate package on newer distros
%if 0%{?suse_version} >= 01120

%package -n libreoffice-base-drivers-mysql
License:        GPLv2 ; LGPLv3
Summary:        MySQL Database Driver for LibreOffice
Group:          Productivity/Office/Suite
PreReq:         libreoffice-libs-core = %version
Requires:       libreoffice-base = %version
Supplements:    packageand(libreoffice-base:mysql-client)
# compat stuff
Provides:       OpenOffice_org-base-drivers-mysql = %version
Obsoletes:      OpenOffice_org-base-drivers-mysql <= %version

%description -n libreoffice-base-drivers-mysql
This package allows to access MySQL databases from LibreOffice
Base.
%endif

%package -n libreoffice-calc-extensions
License:        LGPLv2.1+,LGPLv3
Summary:        LibreOffice Calc Extensions
Group:          Productivity/Office/Suite
PreReq:         libreoffice-libs-core = %version
Requires:       libreoffice-calc = %version
# pyuno is needed for the numbertext extension
Requires:       libreoffice-pyuno = %version
# the watchWindow extension is written in java
%if 0%{?suse_version}
# the gcj is required by the main package on 10.2 and lower
%if %suse_version > 01020
%ifarch %ix86 ppc
# the 32-bit build requires 32-bit JRE, bnc#222708
Recommends:     jre-32 >= 1.6
%if 0%{?suse_version} > 01110
# jre-32 is not provided by the preferred openjdk until openSUSE-11.2
Requires:       jre-32 > 1.5
%endif
%endif
# ---
%ifarch x86_64
Recommends:     jre-64 >= 1.6
%if 0%{?suse_version} > 01110
# jre-64 is not provided by the preferred openjdk until openSUSE-11.2
Requires:       jre-64 > 1.5
%endif
%endif
%endif
%endif
%if 0%{?meego_version}
Requires:       jre >= 1.5
%endif
# compat stuff
Provides:       OpenOffice_org-calc-extensions = %version
Obsoletes:      OpenOffice_org-calc-extensions <= %version

%description -n libreoffice-calc-extensions
This package provides extensions for LibreOffice Calc:

- Convert Text to Number
- New Functions NUMBERTEXT and MONEYTEXT
- Solver for Nonlinear Programming

%package -n libreoffice-draw-extensions
License:        LGPLv3
Summary:        LibreOffice Draw Extensions
Group:          Productivity/Office/Suite
PreReq:         libreoffice-libs-core = %version
Requires:       libreoffice-draw = %version
# compat stuff
Provides:       OpenOffice_org-draw-extensions = %version
Obsoletes:      OpenOffice_org-draw-extensions <= %version

%description -n libreoffice-draw-extensions
This package provides extensions for LibreOffice Draw:

- PDF Import



%package -n libreoffice-impress-extensions
License:        LGPLv3
Summary:        LibreOffice Impress Extensions
Group:          Productivity/Office/Suite
PreReq:         libreoffice-libs-core = %version
Requires:       libreoffice-impress = %version
# compat stuff
Provides:       OpenOffice_org-impress-extensions = %version
Obsoletes:      OpenOffice_org-impress-extensions <= %version

%description -n libreoffice-impress-extensions
This package provides extensions for LibreOffice Impress:

- Presentation Minimizer

- Presenter Console



%package -n libreoffice-writer-extensions
License:        LGPLv3 ; ASLv.. ; CDDL ; Other uncritical OpenSource License
Summary:        LibreOffice Writer Extensions
Group:          Productivity/Office/Suite
PreReq:         libreoffice-libs-core = %version
Requires:       libreoffice-writer = %version
# the wiki extension is written in java
%if 0%{?suse_version}
# the gcj is required by the main package on 10.2 and lower
%if 0%{?suse_version} > 01020
%ifarch %ix86 ppc
# the 32-bit build requires 32-bit JRE, bnc#222708
Recommends:     jre-32 >= 1.6
%if 0%{?suse_version} > 01110
# jre-32 is not provided by the preferred openjdk until openSUSE-11.2
Requires:       jre-32 > 1.5
%endif
%endif
# ---
%ifarch x86_64
Recommends:     jre-64 >= 1.6
%if %suse_version > 01110
# jre-64 is not provided by the preferred openjdk until openSUSE-11.2
Requires:       jre-64 > 1.5
%endif
%endif
%endif
%endif
%if 0%{?meego_version}
Requires:       jre >= 1.5
%endif
# compat stuff
Provides:       OpenOffice_org-writer-extensions = %version
Obsoletes:      OpenOffice_org-writer-extensions <= %version

%description -n libreoffice-writer-extensions
This package provides extensions for LibreOffice Writer:

- Google Docs, Zoho, and WebDAV Export/Import
- MediaWiki Publisher

%pre -n libreoffice-base-extensions
if test $1 -gt 1 ; then
    # unregister all extensions that were registered by LibO <= 3.2.99.3
    # note that mysql connector has been put into separate package since openSUSE 11.2
    if unopkg list --shared | grep -q "com.sun.star.mysql-connector-ooo" ; then
	unopkg remove --shared "com.sun.star.mysql-connector-ooo" || true;
    fi
    if unopkg list --shared | grep -q "com.sun.reportdesigner" ; then
	unopkg remove --shared "com.sun.reportdesigner" || true;
    fi
    # clear disk cache
    unopkg list --shared > /dev/null 2>&1 || true
fi

%post -n libreoffice-base-extensions
if test -f %ooo_prefix/ooo3/share/extension/install/report-builder.oxt ; then
    echo
    echo "WARNING: Please ignore the following error about the extension:"
    echo "WARNING:     com.sun.reportdesigner"
    echo "WARNING: It is printed by the old OpenOffice_org package. The extension cannot"
    echo "WARNING: be unregistered from the OOo cache because unopkg tool already"
    echo "WARNING: works with the LO cache. The LO installation will be correct!"
    echo
fi
if test -f %ooo_prefix/ooo3/share/extension/install/mysql-connector-ooo.oxt ; then
    echo
    echo "WARNING: Please ignore the following error about the extension:"
    echo "WARNING:     com.sun.star.mysql-connector-ooo"
    echo "WARNING: It is printed by the old OpenOffice_org package. The extension cannot"
    echo "WARNING: be unregistered from the OOo cache because unopkg tool already"
    echo "WARNING: works with the LO cache. The LO installation will be correct!"
    echo
fi

# MySQL driver

%if 0%{?suse_version} >= 01120

%pre -n libreoffice-base-drivers-mysql
if test $1 -gt 1 ; then
    # unregister all extensions that were registered by LibO <= 3.2.99.3
    if unopkg list --shared | grep -q "com.sun.star.mysql-connector-ooo" ; then
	unopkg remove --shared "com.sun.star.mysql-connector-ooo" || true;
    fi
    # clear disk cache
    unopkg list --shared > /dev/null 2>&1 || true
fi

%post -n libreoffice-base-drivers-mysql
if test -f %ooo_prefix/ooo3/share/extension/install/mysql-connector-ooo.oxt ; then
    echo
    echo "WARNING: Please ignore the following error about the extension:"
    echo "WARNING:     com.sun.star.mysql-connector-ooo"
    echo "WARNING: It is printed by the old OpenOffice_org package. The extension cannot"
    echo "WARNING: be unregistered from the OOo cache because unopkg tool already"
    echo "WARNING: works with the LO cache. The LO installation will be correct!"
    echo
fi

%endif

# calc

%pre -n libreoffice-calc-extensions
if test $1 -gt 1 ; then
    # unregister all extensions that were registered by LibO <= 3.2.99.3
    # Calc solver has been completely removed in 3.0.99.6 (bnc#523588)
    if unopkg list --shared | grep -q "org.go-oo.CalcSolver" ; then
	unopkg remove --shared "org.go-oo.CalcSolver" || true;
    fi
    if unopkg list --shared | grep -q "nl.nouenoff.ct2n" ; then
	unopkg remove --shared "nl.nouenoff.ct2n" || true;
    fi
    if unopkg list --shared | grep -q "com.sun.star.comp.Calc.NLPSolver" ; then
	unopkg remove --shared "com.sun.star.comp.Calc.NLPSolver" || true;
    fi
    if unopkg list --shared | grep -q "org.numbertext-calc-addin" ; then
	unopkg remove --shared "org.numbertext-calc-addin" || true;
    fi
    if unopkg list --shared | grep -q "org.openoffice.extensions.watchwindow.WatchWindow" ; then
	unopkg remove --shared "org.openoffice.extensions.watchwindow.WatchWindow" || true;
    fi
    # clear disk cache
    unopkg list --shared > /dev/null 2>&1 || true
fi

%post -n libreoffice-calc-extensions
if test -f %ooo_prefix/ooo3/share/extension/install/ConvertTextToNumber-*.oxt ; then
    echo
    echo "WARNING: Please ignore the following error about the extension:"
    echo "WARNING:     nl.nouenoff.ct2n"
    echo "WARNING: It is printed by the old OpenOffice_org package. The extension cannot"
    echo "WARNING: be unregistered from the OOo cache because unopkg tool already"
    echo "WARNING: works with the LO cache. The LO installation will be correct!"
    echo
fi
if test -f %ooo_prefix/ooo3/share/extension/install/NLPSolver.oxt ; then
    echo
    echo "WARNING: Please ignore the following error about the extension:"
    echo "WARNING:     com.sun.star.comp.Calc.NLPSolver"
    echo "WARNING: It is printed by the old OpenOffice_org package. The extension cannot"
    echo "WARNING: be unregistered from the OOo cache because unopkg tool already"
    echo "WARNING: works with the LO cache. The LO installation will be correct!"
    echo
fi
if test -f %ooo_prefix/ooo3/share/extension/install/numbertext-*.oxt ; then
    echo
    echo "WARNING: Please ignore the following error about the extension:"
    echo "WARNING:     org.numbertext-calc-addin"
    echo "WARNING: It is printed by the old OpenOffice_org package. The extension cannot"
    echo "WARNING: be unregistered from the OOo cache because unopkg tool already"
    echo "WARNING: works with the LO cache. The LO installation will be correct!"
    echo
fi

# draw

%pre -n libreoffice-draw-extensions
if test $1 -gt 1 ; then
    # unregister all extensions that were registered by LibO <= 3.2.99.3
    if unopkg list --shared | grep -q "com.sun.star.PDFImport" ; then
        unopkg remove --shared com.sun.star.PDFImport || true;
    fi
    # clear disk cache
    unopkg list --shared > /dev/null 2>&1 || true
fi

%post -n libreoffice-draw-extensions
if test -f %ooo_prefix/ooo3/share/extension/install/pdfimport.oxt ; then
    echo
    echo "WARNING: Please ignore the following error about the extension:"
    echo "WARNING:     com.sun.star.PDFImport"
    echo "WARNING: It is printed by the old OpenOffice_org package. The extension cannot"
    echo "WARNING: be unregistered from the OOo cache because unopkg tool already"
    echo "WARNING: works with the LO cache. The LO installation will be correct!"
    echo
fi

# impress

%pre -n libreoffice-impress-extensions
if test $1 -gt 1 ; then
    # unregister all extensions that were registered by LibO <= 3.2.99.3
    if unopkg list --shared | grep -q "com.sun.star.PresentationMinimizer" ; then
        unopkg remove --shared com.sun.star.PresentationMinimizer || true;
    fi
    if unopkg list --shared | grep -q "com.sun.PresenterScreen" ; then
            unopkg remove --shared com.sun.PresenterScreen || true;
    fi
    # clear disk cache
    unopkg list --shared > /dev/null 2>&1 || true
fi

%post -n libreoffice-impress-extensions
if test -f %ooo_prefix/ooo3/share/extension/install/presentation-minimizer.oxt ; then
    echo
    echo "WARNING: Please ignore the following error about the extension:"
    echo "WARNING:     com.sun.star.PresentationMinimizer"
    echo "WARNING: It is printed by the old OpenOffice_org package. The extension cannot"
    echo "WARNING: be unregistered from the OOo cache because unopkg tool already"
    echo "WARNING: works with the LO cache. The LO installation will be correct!"
    echo
fi
if test -f %ooo_prefix/ooo3/share/extension/install/presenter-screen.oxt ; then
    echo
    echo "WARNING: Please ignore the following error about the extension:"
    echo "WARNING:     com.sun.PresenterScreen"
    echo "WARNING: It is printed by the old OpenOffice_org package. The extension cannot"
    echo "WARNING: be unregistered from the OOo cache because unopkg tool already"
    echo "WARNING: works with the LO cache. The LO installation will be correct!"
    echo
fi

# writer

%pre -n libreoffice-writer-extensions
if test $1 -gt 1 ; then
    # unregister all extensions that were registered by LibO <= 3.2.99.3
    if unopkg list --shared | grep -q "org.openoffice.gdocs.oxt" ; then
	unopkg remove --shared org.openoffice.gdocs.oxt || true;
    fi
    # the blogger extension existed only in few 3.2-beta versions
    if unopkg list --shared | grep -q "org.openoffice.caolan.blogger" ; then
        unopkg remove --shared org.openoffice.caolan.blogger >/dev/null 2>&1 || true;
    fi
    if unopkg list --shared | grep -q "com.sun.star.PDFImport" ; then
        unopkg remove --shared com.sun.star.PDFImport || true;
    fi
    # clear disk cache
    unopkg list --shared > /dev/null 2>&1 || true
fi

%post -n libreoffice-writer-extensions
if test -f %ooo_prefix/ooo3/share/extension/install/gdocs*.oxt ; then
    echo
    echo "WARNING: Please ignore the following error about the extension:"
    echo "WARNING:     org.openoffice.gdocs.oxt"
    echo "WARNING: It is printed by the old OpenOffice_org package. The extension cannot"
    echo "WARNING: be unregistered from the OOo cache because unopkg tool already"
    echo "WARNING: works with the LO cache. The LO installation will be correct!"
    echo
fi
if test -f %ooo_prefix/ooo3/share/extension/install/wiki-publisher.oxt ; then
    echo
    echo "WARNING: Please ignore the following error about the extension:"
    echo "WARNING:     com.sun.wiki-publisher"
    echo "WARNING: It is printed by the old OpenOffice_org package. The extension cannot"
    echo "WARNING: be unregistered from the OOo cache because unopkg tool already"
    echo "WARNING: works with the LO cache. The LO installation will be correct!"
    echo
fi

%prep
%setup -q -n libreoffice-%piece-%ooo_piece_version
# external source tarbals
mkdir -p ooo-build/src
install -m 644 %{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} \
	       ooo-build/src
# we do not want to build some stuff on linux
mkdir -p ooo-build/ooo/do-not-build
mv languagetool ooo-build/ooo/do-not-build
# we want to build some extra extensions
# create empty dir to tell apply to apply the needed patches
mkdir -p nlpsolver
mkdir -p ct2n
# we do not want to build mysql on Meego
%if 0%{?meego_version}
mkdir -p ooo-build/ooo/do-not-build
mv mysqlc ooo-build/ooo/do-not-build
%endif
# README-scsolver.txt
cp %{S:2} .

%build
# setup env.
export OO_INSTDIR=%{_libdir}/%ooo_home
export OO_TOOLSDIR=$OO_INSTDIR/build/bin
export VERBOSE=1
export PIECE_BUILD_NCPUS_AUTO=1
export PIECE_USE_JOBS="%{?jobs:%jobs}"
# FIXME: hack to avoid dependecy problem
$OO_TOOLSDIR/piece/build-generic %piece %ooo_sourcedirname || $OO_TOOLSDIR/piece/build-generic %piece %ooo_sourcedirname || $OO_TOOLSDIR/piece/build-generic %piece %ooo_sourcedirname || $OO_TOOLSDIR/piece/build-generic %piece %ooo_sourcedirname

%install
# hack to install the extensions
mkdir -p $RPM_BUILD_ROOT%ooo_prefix/%ooo_home/share/extensions
find . -name "*.oxt" -exec cp {} $RPM_BUILD_ROOT%ooo_prefix/%ooo_home/share/extensions \;
# remove the non-patched ct2n extension (taken from the ooo-build.src dir)
rm $RPM_BUILD_ROOT%ooo_prefix/%ooo_home/share/extensions/*-ConvertTextToNumber*.oxt
# prebuilt extensions
cp %{S:100} $RPM_BUILD_ROOT%ooo_prefix/%ooo_home/share/extensions
cp %{S:101} $RPM_BUILD_ROOT%ooo_prefix/%ooo_home/share/extensions
# unpack the extensions
cd $RPM_BUILD_ROOT%ooo_prefix/%ooo_home/share/extensions
for file in *.oxt ; do
    dir=`echo $file | sed s/.oxt$//`
    mkdir $dir
    # FIXME: gdocs_2.1.0_modified.oxt includes AbsoluteLayout.jar twice => we must force overwriting
    unzip -o -d $dir $file
    rm $file
done
cd - >/dev/null

%clean
rm -rf $RPM_BUILD_ROOT

%files -n libreoffice-base-extensions
%defattr(-,root,root)
%ooo_prefix/%ooo_home/share/extensions/report-builder
%if 0%{?suse_version} && 0%{?suse_version} < 01120
%ooo_prefix/%ooo_home/share/extensions/mysql-connector-ooo
%endif

%if 0%{?suse_version} >= 01120

%files -n libreoffice-base-drivers-mysql
%defattr(-,root,root)
%ooo_prefix/%ooo_home/share/extensions/mysql-connector-ooo
%endif

%files -n libreoffice-calc-extensions
%defattr(-,root,root)
%doc README-scsolver.txt
%ooo_prefix/%ooo_home/share/extensions/ConvertTextToNumber
%ooo_prefix/%ooo_home/share/extensions/NLPSolver
%ooo_prefix/%ooo_home/share/extensions/numbertext-%{numbertext_version}

%files -n libreoffice-draw-extensions
%defattr(-,root,root)
%ooo_prefix/%ooo_home/share/extensions/pdfimport

%files -n libreoffice-impress-extensions
%defattr(-,root,root)
%ooo_prefix/%ooo_home/share/extensions/presentation-minimizer
%ooo_prefix/%ooo_home/share/extensions/presenter-screen

%files -n libreoffice-writer-extensions
%defattr(-,root,root)
%ooo_prefix/%ooo_home/share/extensions/gdocs_%{gdocs_version}_modified
%ooo_prefix/%ooo_home/share/extensions/wiki-publisher

%changelog