File libreoffice.spec of Package libreoffice-branding-upstream.385

#
# spec file for package libreoffice
#
# 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
BuildRequires:  ImageMagick
BuildRequires:  ant
BuildRequires:  ant-apache-regexp
BuildRequires:  ant-nodeps
BuildRequires:  bison
BuildRequires:  boost-devel
BuildRequires:  ccache
BuildRequires:  cups-devel
BuildRequires:  curl-devel
BuildRequires:  dbus-1-glib-devel
BuildRequires:  flac-devel
BuildRequires:  flex
BuildRequires:  gcc-c++
BuildRequires:  gnome-vfs2-devel
BuildRequires:  gperf
BuildRequires:  gtk2-devel
BuildRequires:  icu
BuildRequires:  java-devel
BuildRequires:  libexif
BuildRequires:  libxml2-devel
BuildRequires:  mono-devel
BuildRequires:  neon-devel
BuildRequires:  orbit2-devel
BuildRequires:  pam-devel
BuildRequires:  patch
BuildRequires:  perl-Archive-Zip
BuildRequires:  perl-Compress-Zlib
BuildRequires:  postgresql-devel
BuildRequires:  python-devel
BuildRequires:  recode
BuildRequires:  unixODBC-devel
BuildRequires:  unzip
BuildRequires:  xml-commons-apis
BuildRequires:  zip
############################
# basic stuff
%if 0%{?suse_version}
BuildRequires:  db-devel
BuildRequires:  krb5
BuildRequires:  openldap2-devel
BuildRequires:  python-xml
BuildRequires:  xorg-x11
BuildRequires:  xorg-x11-fonts
# LO-3.3 fixed all most annoying KDE4-related bugs => time to enable KDE4 support for SLED11
BuildRequires:  libkde4-devel
%endif
%if 0%{?meego_version}
BuildRequires:  db4-devel
BuildRequires:  db4-devel
BuildRequires:  imake
BuildRequires:  krb5-devel
BuildRequires:  krb5-devel
BuildRequires:  libjpeg-devel
BuildRequires:  libxslt-devel
BuildRequires:  openldap-devel
BuildRequires:  openldap-devel
BuildRequires:  openssl-devel
BuildRequires:  xorg-x11-proto-xproto
BuildRequires:  xorg-x11-server-devel
BuildRequires:  xorg-x11-utils
BuildRequires:  pkgconfig(gl)
BuildRequires:  pkgconfig(glu)
BuildRequires:  pkgconfig(xau)
BuildRequires:  pkgconfig(xaw7)
%endif
############################
# KDE3 stuff
%if 0%{?suse_version}
BuildRequires:  kdelibs3-devel
%endif
############################
# cppunit stuff
%if 0%{?suse_version} >= 01100
BuildRequires:  libcppunit-devel
%endif
%if 0%{?meego_version}
BuildRequires:  cppunit-devel
%endif
############################
# mysql stuff
%if 0%{?suse_version}
BuildRequires:  libmysqlclient-devel
%endif
%if 0%{?suse_version} > 01220
# mysqlcppconn >= 1.0.6 is needed
BuildRequires:  libmysqlcppconn-devel
%endif
############################
# mozilla stuff
BuildRequires:  mozilla-nspr-devel
BuildRequires:  mozilla-nss-devel
############################
# expat stuff
%if 0%{?suse_version} > 01100
# libexpat-devel is explicitely needed since openSUSE-11.1
BuildRequires:  libexpat-devel
%endif
%if 0%{?meego_version}
BuildRequires:  expat-devel
%endif
############################
# lpsolve stuff
%if 0%{?suse_version} > 01100 || 0%{?meego_version}
# lpsolve-devel has been available since openSUSE-11.1
BuildRequires:  lpsolve-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
############################
# junit stuff
%if %suse_version > 1110
BuildRequires:  junit4
%endif
############################
# openSUSE 10.3 features
%if 0%{?suse_version} > 01020 || 0%{?meego_version}
BuildRequires:  libicu-devel
%endif
############################
# openSUSE 11.0 features
%if 0%{?suse_version} > 01030 || 0%{?meego_version}
BuildRequires:  hunspell-devel
BuildRequires:  libwpd-devel
BuildRequires:  libwpg-devel
BuildRequires:  libwps-devel
%endif
############################
# CODE10 features
############################
%if 0%{?suse_version} > 01000
BuildRequires:  gstreamer010-plugins-base-devel
BuildRequires:  python-lxml
BuildRequires:  sablot-devel
BuildRequires:  xalan-j2
BuildRequires:  xerces-j2
BuildRequires:  xml-commons-apis
%endif
%if 0%{?meego_version}
BuildRequires:  gst-plugins-base-devel
BuildRequires:  sablot-devel
BuildRequires:  xalan-j2
BuildRequires:  xerces-j2
BuildRequires:  xml-commons-apis
%endif
# FIXME: part of the language-dependant stuff is still built here and
# put into the -devel package
# test_build_langs:   	   0 = only en-US
#			   1 = en-US, de, and cs
#			   2 = all supported languages 
%define		test_build_langs 	2
# test_build_binfilters:   0 = no
#			   1 = yes
%define		test_build_binfilters 	1
# test_build_SDK:  	   0 = no
#			   1 = yes (if possible, see below the definition of lo_build_sdk)
%define		test_build_sdk 		1
# build_module_in_parallel 0 = no
#			   1 = yes (the number is defined be the number of cpus)
#			   2,3,4... = yes (force the number of modules to be built in parallel)
%define		build_module_in_parallel	1
# prepare_build:	   0 = no
#			   1 = yes (just build, install and create packages; without %%prep section and configure)
%define		prepare_build 		1
#
%if %test_build_langs == 0
%define       lo_langs		""
%else
%if %test_build_langs == 1
%define       lo_langs		"en-US cs de hu ja"
%else
%define       lo_langs		"en-US af ar be bg br ca cs cy da de el en-GB en-ZA es et fi fr ga gl gu he hi hu hr it ja ka km ko lt mk nb nl nn nr pa-IN pl pt pt-BR ru rw sh sk sl sr ss st sv tg th tr ts uk ve vi xh zh-TW zh-CN zu"
%endif
%endif
%define       lo_poor_help_localizations "af bg be br ca cy el fi ga he hr ka lt mk nb nn nr rw sh sr sk ss st tg th tr th ts uk ve vi xh zu"
# sdk stuff enable only on SL 10.2, SLED10 and higher
# force no if test_build_sdk is disabled
%if %test_build_sdk == 0
%define		lo_build_sdk 		no
%else
%if 0%{?suse_version} > 01010 || 0%{?sles_version} == 010 || 0%{?meego_version}
%define		lo_build_sdk 		yes
%else
%define		lo_build_sdk 		no
%endif
%endif
# java target bytecode; should be compatible with the gcj
%if 0%{?suse_version} > 01030 || 0%{?meego_version}
%define       java_target_version	1.5
%else
%define       java_target_version	1.4
%endif
# python paths
%if 0%{?suse_version} <= 01110
%define python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; import sys; sys.stdout.write(get_python_lib())")
%endif
# LO paths
%define	      lo_prefix	%_libdir
%define	      lo_home		libreoffice
%define	      lo_basis_dir	basis3.4
# extensions
%define       ct2n_version       1.3.2
%define       gdocs_version      3.0.0
%define       numbertext_version 0.8.2
%if 0%{?meego_version}
# the manifest file must be in the right place; registration does not work with some repacked jars
%define		__jar_repack	%{nil}
%endif
Version:        3.4.5.5
Release:        0
Requires:       libreoffice-branding < 4
Requires:       libreoffice-branding > 3.2.99.3
Requires:       libreoffice-icon-themes = %version
# we need a JRE for oobase and the other stuff
%if 0%{?suse_version}
# gij is enough on SL 10.1 and higher
%if 0%{?suse_version} > 01000
# --- 
%ifarch %ix86
# the 32-bit build requires 32-bit JRE, #222708
Recommends:     jre-32 >= 1.6
%endif
# ---
%ifarch x86_64
%if 0%{?suse_version} > 01020
Recommends:     jre-64 >= 1.6
%endif
# the 64-bit build does not work with Sun Java on older distributions, #219982
%if 0%{?suse_version} == 01020
Requires:       gcc-gij
%endif
%if 0%{?suse_version} && 0%{?suse_version} < 01020
Requires:       libgcj
%endif
%endif
# ---
%ifarch ppc
%if 0%{?suse_version} > 01020
Recommends:     jre-32 >= 1.6
%endif
# there were problems with the commercial Java on ppc on older distribtions
%if 0%{?suse_version} == 01020
Requires:       gcc-gij
%endif
%if 0%{?suse_version} && 0%{?suse_version} < 01020
Requires:       libgcj
%endif
%endif
%endif
%endif
%if 0%{?meego_version}
Requires:       jre >= 1.5
%endif
# ---
Requires:       xalan-j2
Requires:       xerces-j2
Requires:       xml-commons-apis
# post install scripts
%if 0%{?suse_version} > 01120
Requires(pre):    findutils
Requires(post):   gtk2 coreutils grep zip
Requires(postun): gtk2 coreutils
%endif
%if 0%{?suse_version} && 0%{?suse_version} <= 01120
PreReq:         gtk2 findutils coreutils grep zip
%endif
# compat stuff
# bootstrap package
Provides:       OpenOffice_org-bootstrap = %version
Obsoletes:      OpenOffice_org-bootstrap < %version
# libreoffice package
Provides:       OpenOffice_org = %version
Obsoletes:      OpenOffice_org <= %version
# compatibility with the older split build used in the Build Service (bnc#471280)
# the l10n package was available only for a short time
# during the 11.1 alpha phase
Provides:       OpenOffice_org-l10n-en-US = %version
Obsoletes:      OpenOffice_org-l10n-en-US <= %version
# some other compat suff
Provides:       OpenOffice_org17
Obsoletes:      OpenOffice_org17
Provides:       OpenOffice_org-en
Provides:       OpenOffice_org-en-help
Provides:       OpenOffice_org2
Obsoletes:      OpenOffice_org-en
Obsoletes:      OpenOffice_org-en-help
Obsoletes:      OpenOffice_org2
Provides:       OpenOffice_org-hunspell
Provides:       OpenOffice_org2-hunspell
Obsoletes:      OpenOffice_org-hunspell
Obsoletes:      OpenOffice_org2-hunspell
# KDE quickstarter do not support LO; we want to get rid of it anyway
Provides:       OpenOffice_org-Quickstarter = 3.3.1
Obsoletes:      OpenOffice_org-Quickstarter < 3.3.1
# split build compat stuff obsoleted with LO-3.4
# artwork
Provides:       OpenOffice_org-artwork-devel = %version
Obsoletes:      OpenOffice_org-artwork-devel < %version
Provides:       libreoffice-artwork-devel = %version
Obsoletes:      libreoffice-artwork-devel < %version
# bootstrap
Provides:       OpenOffice_org-bootstrap = %version
Obsoletes:      OpenOffice_org-bootstrap < %version
Provides:       libreoffice-bootstrap = %version
Obsoletes:      libreoffice-bootstrap < %version
# components
Provides:       OpenOffice_org-components = %version
Obsoletes:      OpenOffice_org-components < %version
Provides:       OpenOffice_org-components-devel = %version
Obsoletes:      OpenOffice_org-components-devel < %version
Provides:       libreoffice-components = %version
Obsoletes:      libreoffice-components < %version
Provides:       libreoffice-components-devel = %version
Obsoletes:      libreoffice-components-devel < %version
# filters
Provides:       OpenOffice_org-filters = %version
Obsoletes:      OpenOffice_org-filters < %version
Provides:       OpenOffice_org-filters-devel = %version
Obsoletes:      OpenOffice_org-filters-devel < %version
Provides:       libreoffice-filters = %version
Obsoletes:      libreoffice-filters < %version
Provides:       libreoffice-filters-devel = %version
Obsoletes:      libreoffice-filters-devel < %version
# l10n-extras
Provides:       OpenOffice_org-l10n-extras = %version
Obsoletes:      OpenOffice_org-l10n-extras < %version
Provides:       OpenOffice_org-l10n-extras-devel = %version
Obsoletes:      OpenOffice_org-l10n-extras-devel < %version
Provides:       libreoffice-l10n-extras = %version
Obsoletes:      libreoffice-l10n-extras < %version
Provides:       libreoffice-l10n-extras-devel = %version
Obsoletes:      libreoffice-l10n-extras-devel < %version
# libs-core
Provides:       OpenOffice_org-libs-core = %version
Obsoletes:      OpenOffice_org-libs-core < %version
Provides:       OpenOffice_org-libs-core-devel = %version
Obsoletes:      OpenOffice_org-libs-core-devel < %version
Provides:       libreoffice-libs-core = %version
Obsoletes:      libreoffice-libs-core < %version
Provides:       libreoffice-libs-core-devel = %version
Obsoletes:      libreoffice-libs-core-devel < %version
# libs-extern
Provides:       OpenOffice_org-libs-extern = %version
Obsoletes:      OpenOffice_org-libs-extern < %version
Provides:       OpenOffice_org-libs-extern-devel = %version
Obsoletes:      OpenOffice_org-libs-extern-devel < %version
Provides:       libreoffice-libs-extern = %version
Obsoletes:      libreoffice-libs-extern < %version
Provides:       libreoffice-libs-extern-devel = %version
Obsoletes:      libreoffice-libs-extern-devel < %version
# libs-gui
Provides:       OpenOffice_org-libs-gui = %version
Obsoletes:      OpenOffice_org-libs-gui < %version
Provides:       OpenOffice_org-libs-gui-devel = %version
Obsoletes:      OpenOffice_org-libs-gui-devel < %version
Provides:       libreoffice-libs-gui = %version
Obsoletes:      libreoffice-libs-gui < %version
Provides:       libreoffice-libs-gui-devel = %version
Obsoletes:      libreoffice-libs-gui-devel < %version
# testing
Provides:       OpenOffice_org-testing = %version
Obsoletes:      OpenOffice_org-testing < %version
Provides:       libreoffice-testing = %version
Obsoletes:      libreoffice-testing < %version
# ure
Provides:       OpenOffice_org-ure = %version
Obsoletes:      OpenOffice_org-ure < %version
Provides:       libreoffice-ure = %version
Obsoletes:      libreoffice-ure < %version
################
# make sure the rename to libreoffice* is complete
# SLED11-only
%if 0%{?suse_version} > 01100 && 0%{?suse_version} <= 01110
Conflicts:      OpenOffice_org-hyphen < 20110216
Conflicts:      OpenOffice_org-thesaurus < 20070719.1
Conflicts:      OpenOffice_org-thesaurus-de < 20080406.1
Conflicts:      OpenOffice_org-thesaurus-de-CH < 20080406.1
Conflicts:      OpenOffice_org-thesaurus-fr < 20060511.1
Conflicts:      OpenOffice_org-thesaurus-ne < 1.1.0.1
Conflicts:      OpenOffice_org-thesaurus-pl < 20061223.1
Conflicts:      OpenOffice_org-thesaurus-pt < 20060817.1
Conflicts:      OpenOffice_org-thesaurus-ro < 20080920.1
Conflicts:      OpenOffice_org-thesaurus-ru < 20061016.1
Conflicts:      OpenOffice_org-thesaurus-sk < 20080926.1
Conflicts:      OpenOffice_org-thesaurus-sv < 20080609.1
%endif
# openSUSE-11.2 and 11.3 only
%if 0%{?suse_version} > 01110 && 0%{?suse_version} <= 01130
Conflicts:      OpenOffice_org-icon-theme-crystal < 3.3.1
Conflicts:      OpenOffice_org-icon-theme-tango < 3.3.1
Conflicts:      OpenOffice_org-icon-theme-andromeda < 3.3.1
Conflicts:      OpenOffice_org-icon-theme-galaxy < 3.3.1
Conflicts:      OpenOffice_org-icon-theme-hicontrast < 3.3.1
Conflicts:      OpenOffice_org-icon-theme-industrial < 3.3.1
Conflicts:      OpenOffice_org-icon-theme-oxygen < 3.3.1
Conflicts:      OpenOffice_org-voikko < 3.1.2
Conflicts:      OpenOffice_org-hyphen < 20110203.1
Conflicts:      OpenOffice_org-templates-ru < 3.3
Conflicts:      OpenOffice_org-thesaurus-ca < 1.5.0.1
Conflicts:      OpenOffice_org-thesaurus-da < 20100126.1
Conflicts:      OpenOffice_org-thesaurus-de < 20100307.1
Conflicts:      OpenOffice_org-thesaurus-de-AT < 20100307.1
Conflicts:      OpenOffice_org-thesaurus-de-CH < 20100307.1
Conflicts:      OpenOffice_org-thesaurus-en-AU < 20081215.1
Conflicts:      OpenOffice_org-thesaurus-en-GB < 20051128.1
Conflicts:      OpenOffice_org-thesaurus-en-US < 20060111.1
Conflicts:      OpenOffice_org-thesaurus-es-AR < 0.1.1
Conflicts:      OpenOffice_org-thesaurus-es-VE < 1.0.1.1
Conflicts:      OpenOffice_org-thesaurus-fr < 20100125.1
Conflicts:      OpenOffice_org-thesaurus-it < 20081129.1
Conflicts:      OpenOffice_org-thesaurus-ne < 1.1.1
Conflicts:      OpenOffice_org-thesaurus-pl < 20081206.1
Conflicts:      OpenOffice_org-thesaurus-pt < 20091015.1
Conflicts:      OpenOffice_org-thesaurus-ro < 20091130.1
Conflicts:      OpenOffice_org-thesaurus-ru < 20081013.1
Conflicts:      OpenOffice_org-thesaurus-sk < 20100208.1
Conflicts:      OpenOffice_org-thesaurus-sv < 20090624.1
%endif
# SLED11 + openSUSE-11.2 + 11.3
%if 0%{?suse_version} > 01100 && 0%{?suse_version} <= 01130
Conflicts:      OpenOffice_org-openclipart < 3.3
Conflicts:      OpenOffice_org-LanguageTool < 1.2
Conflicts:      OpenOffice_org-LanguageTool-de < 1.2
Conflicts:      OpenOffice_org-LanguageTool-en < 1.2
Conflicts:      OpenOffice_org-LanguageTool-es < 1.2
Conflicts:      OpenOffice_org-LanguageTool-fr < 1.2
Conflicts:      OpenOffice_org-LanguageTool-it < 1.2
Conflicts:      OpenOffice_org-LanguageTool-nl < 1.2
Conflicts:      OpenOffice_org-LanguageTool-pl < 1.2
Conflicts:      OpenOffice_org-LanguageTool-sv < 1.2
Conflicts:      OpenOffice_org-templates-presentation-layouts < 3.3
Conflicts:      OpenOffice_org-templates-labels-a4 < 1.0.1
Conflicts:      OpenOffice_org-templates-labels-letter < 1.0.1
Conflicts:      OpenOffice_org-templates-de < 3.3
Conflicts:      OpenOffice_org-templates-en < 3.3
Conflicts:      OpenOffice_org-thesaurus-bg < 20071210.1
Conflicts:      OpenOffice_org-thesaurus-cs < 20070913.1
Conflicts:      OpenOffice_org-thesaurus-el < 20061203.1
Conflicts:      OpenOffice_org-thesaurus-en < 20060111.1
Conflicts:      OpenOffice_org-thesaurus-es < 20050720.1
Conflicts:      OpenOffice_org-thesaurus-ga < 20071002.1
Conflicts:      OpenOffice_org-thesaurus-hu < 20080319.1
Conflicts:      OpenOffice_org-thesaurus-nb < 20080310.1
Conflicts:      OpenOffice_org-thesaurus-sl < 20080601.1
Conflicts:      OpenOffice_org-converter < 3.3
Provides:       OpenOffice_org-Quickstarter = 3.3.1
Obsoletes:      OpenOffice_org-Quickstarter < 3.3.1
%endif
#
Summary:        A Free Office Suite (Framework)
License:        Apache-2.0 and Artistic-1.0 and BSD-3-Clause and GPL-2.0+ and LPPL-1.3c and LGPL-2.1+ and LGPL-3.0 and MPL-1.1 and MIT
Group:          Productivity/Office/Suite
Url:            http://www.documentfoundation.org/
Source0:        libreoffice-bootstrap-%version.tar.bz2
Source1:        libreoffice-artwork-%version.tar.bz2
Source2:        libreoffice-base-%version.tar.bz2
Source3:        libreoffice-calc-%version.tar.bz2
Source4:        libreoffice-components-%version.tar.bz2
Source5:        libreoffice-extensions-%version.tar.bz2
Source6:        libreoffice-extras-%version.tar.bz2
Source7:        libreoffice-filters-%version.tar.bz2
Source8:        libreoffice-help-%version.tar.bz2
Source9:        libreoffice-impress-%version.tar.bz2
Source10:       libreoffice-libs-core-%version.tar.bz2
Source11:       libreoffice-libs-extern-sys-%version.tar.bz2
Source12:       libreoffice-libs-extern-%version.tar.bz2
Source13:       libreoffice-libs-gui-%version.tar.bz2
Source14:       libreoffice-postprocess-%version.tar.bz2
Source15:       libreoffice-sdk-%version.tar.bz2
Source16:       libreoffice-testing-%version.tar.bz2
Source17:       libreoffice-translations-%version.tar.bz2
Source18:       libreoffice-ure-%version.tar.bz2
Source19:       libreoffice-writer-%version.tar.bz2
# 256x256 desktop icons (bnc#722644)
Source20:       libreoffice-desktop-icons-256x256.tar.bz2
# SUSE config files
Source100:      SUSE.conf
Source101:      SUSE-10.1.conf
Source102:      SUSE-11.1.conf
Source103:      SUSE-11.2.conf
Source104:      SUSE-11.3.conf
Source105:      SUSE-11.4.conf
# rpmlint complains about devel files in non-devel package
# but we would like to keep the sdk package name
# We would like to keep the -bootstrap package name
# So we need to disable these rpmlint checks
Source200:      %name-rpmlintrc
# Prebuilt sofficerc for the noarch upstream branding package
Source201:      sofficerc-upstream
# This background is used by another Novell product, added 2006-02-08
Source202:      Draft.jpg
# helper scripts
# create compat symlinks from /usr/share to /usr/lib(64); used by noarch packages
Source300:      link-to-ooo-home
# extensions
Source400:      README-scsolver.txt
# prebuilt extensions
Source401:      cea0f63d5985ba4fcbd882031df44346-gdocs_%{gdocs_version}_modified.oxt
Source402:      numbertext-%{numbertext_version}.oxt
# used extensions sources
Source450:      451ccf439a36a568653b024534669971-ConvertTextToNumber-1.3.2.oxt
Source451:      451ccf439a36a568653b024534669971-ConvertTextToNumber-1.3.2.zip
Source452:      90401bca927835b6fbae4a707ed187c8-nlpsolver-0.9.tar.bz2
# unused extensions sources
# 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
# FIXME: hack the provides and requires (bnc#411538)
# make sure external scripts are used
%define _use_internal_dependency_generator 0
%define __find_provides /bin/sh %_sourcedir/lo-provides %name
%define __find_requires /bin/sh %_sourcedir/lo-requires %name
Source900:      lo-provides
Source901:      lo-requires
#
# offical external source
Source1000:     ace6ab49184e329db254e454a010f56d-libxml-1.1.7.zip
Source1001:     ada24d37d8d638b3d8a9985e80bc2978-source-9.0.0.7-bj.zip
Source1002:     af3c3acf618de6108d65fcdc92b492e1-commons-codec-1.3-src.tar.gz
Source1003:     a7983f859eafb2677d7ff386a023bc40-xsltml_2.1.2.zip
Source1004:     ba2930200c9f019c2d93a8c88c651a0f-flow-engine-0.9.4.zip
Source1005:     b4cae0700aa1c2aef7eb7f345365e6f1-translate-toolkit-1.8.1.tar.bz2
Source1006:     ca66e26082cab8bb817185a116db809b-redland-1.0.8.tar.gz
Source1007:     db60e4fde8dd6d6807523deb71ee34dc-liblayout-0.2.10.zip
Source1008:     d8bd5eed178db6e2b18eeed243f85aa8-flute-1.1.6.zip
Source1009:     ea570af93c284aa9e5621cd563f54f4d-bsh-2.0b1-src.tar.gz
Source1010:     ea91f2fb4212a21d708aced277e6e85a-vigra1.4.0.tar.gz
Source1011:     eeb2c7ddf0d302fba4bfc6e97eac9624-libbase-1.1.6.zip
Source1012:     fca8706f2c4619e2fa3f8f42f8fc1e9d-rasqal-0.9.16.tar.gz
Source1013:     fdb27bfe2dbe2e7b57ae194d9bf36bab-SampleICC-1.3.2.tar.gz
Source1014:     f94d9870737518e3b597f9265f4e9803-libserializer-1.1.6.zip
Source1015:     3bf481ca95109b14435125c0dd1f2217-graphite2-1.0.3.tgz
Source1016:     067201ea8b126597670b5eff72e1f66c-mythes-1.2.0.tar.gz
Source1017:     1f24ab1d39f4a51faf22244c94a6203f-xmlsec1-1.2.14.tar.gz
Source1018:     128cfc86ed5953e57fe0f5ae98b62c2e-libtextcat-2.2.tar.gz
Source1019:     17410483b5b5f267aa18b7e00b65e6e0-hsqldb_1_8_0.zip
Source1020:     1756c4fa6c616ae15973c104cd8cb256-Adobe-Core35_AFMs-314.tar.gz
Source1021:     185d60944ea767075d27247c3162b3bc-unowinreg.dll
Source1022:     2ae988b339daec234019a7066f96733e-commons-lang-2.3-src.tar.gz
Source1023:     2a177023f9ea8ec8bd00837605c5df1b-jakarta-tomcat-5.0.30-src.tar.gz
Source1024:     2c9b0f83ed5890af02c0df1c1776f39b-commons-httpclient-3.1-src.tar.gz
Source1025:     284e768eeda0e2898b0d5bf7e26a016e-raptor-1.4.18.tar.gz
Source1026:     3bdf40c0d199af31923e900d082ca2dd-libfonts-1.1.6.zip
Source1027:     3c219630e4302863a9a83d0efde889db-commons-logging-1.1.1-src.tar.gz
Source1028:     3404ab6b1792ae5f16bbd603bd1e1d03-libformula-1.1.7.zip
Source1029:     35c94d2df8893241173de1d16b6034c0-swingExSrc.zip
Source1030:     39bb3fcea1514f1369fcfc87542390fd-sacjava-1.3.zip
Source1031:     48a9f787f43a09c0a9b7b00cd1fddbbf-hyphen-2.7.1.tar.gz
Source1032:     48d8169acc35f97e05d8dcdfd45be7f2-lucene-2.3.2.tar.gz
Source1033:     5ba6a61a2f66dfd5fee8cdd4cd262a37-libwpg-0.2.0.tar.bz2
Source1034:     0ff7d225d087793c8c2c680d77aac3e7-mdds_0.5.3.tar.bz2
Source1035:     798b2ffdc8bcfe7bca2cf92b62caf685-rhino1_5R5.zip
Source1036:     8ce2fcd72becf06c41f7201d15373ed9-librepository-1.1.6.zip
Source1037:     8d265a592619166f29c4672ea54812b7-libwpd-0.9.2.tar.bz2
Source1038:     83d4029aebf290c0a9a8fee9c99638d3-libwps-0.2.1.tar.bz2
Source1039:     97b2d4dba862397f446b217e2b623e71-libloader-1.1.6.zip
Source1040:     831126a1ee5af269923cfab6050769fe-mysql-connector-cpp.zip
#
# allow to build without helpcontent2
Patch0:         libreoffice-bootstrap-optional-helpcontent.diff
Patch1:         libreoffice-postprocess-optional-helpcontent.diff
# search application icons in /usr/share
# FIXME: search both lib and lib64 and push into git
Patch2:         split-icons-search-usr-share.diff
# search help icons in /usr/share
# FIXME: make it configurable in integrate into git
Patch3:         officecfg-help-in-usr-share.diff
# slower patching to debug and hopefully fix parallel build of ct2n extension; always happened only in the Build Service (bnc#595550)
Patch4:         solenv-carefull-patching-hack.diff
# change user config dir name from ~/.libreoffice/3 to ~/.libreoffice/3-suse
# to avoid BerkleyDB incompatibility with the plain build
Patch5:         scp2-user-config-suse.diff
# it created 3.8GB build log; Build Service refused to build such package
Patch6:         translations-no-warnigns-from-po2oo.diff
# build gengal again
Patch7:         gengal-svx.diff
Patch8:         gengal-scp2.diff
# search <lo-home>/share/template/common for language independent templates
# will not push it upstream because it will be replaced by upcomming kendy's work
Patch9:         office-cfg-linux-common-template-dir.diff
# correctly bootstrap python stuff with system python, (deb#501028, i#90701)
Patch10:        system-python-ure-bootstrap.diff
# do not use the broken help; unopkg complained about it when registering extensions
# FIXME: the right fix is to compile the help and produce the .db_, .ht_, and other files
Patch11:        nlpsolver-no-broken-help.diff
# make sure that the extra jar files are bundled with the script provider extensions
Patch12:        scripting-provider-build-dep.diff
# revert problematic build fix for poppler 0.17.0 on older distributions
Patch13:        libreoffice-poppler-0.17.0-reject-fix.diff
# fix build dependency problem in svx
Patch15:        svx-globlmn-hrc-build-dep.diff
# tooltips are all black in KDE4 (bnc#723074, fdo#40461)
Patch19:        kde4-tooltips-style.diff
# do not display math in desktop menu (fdo#41681)
Patch20:        do-not-display-math-in-desktop-menu.diff
# display LO application in the right desktop submenu (bnc#718694)
Patch21:        desktop-submenu.diff
# define bash completion for 'loffice' wrapper (bnc#719656)
Patch22:        bash-completion-for-loffice.diff
# add pyuno to python path
Patch26:        pyuno-path.diff
# fix build with glib-2.31; glib/gthread.h can't be included directly
Patch27:        buildfix-ucb-glib-2.31.diff
#
# PostgreSQL SDBC driver
Patch801:       801-sdbc-postgresql.diff
Patch802:       802-sdbc-postgresql-build-lst.diff
Patch803:       803-connectivity-workben-postgresql.diff
Patch804:       804-gcc-4.3-postgresql.diff
Patch805:       805-sdbc-postgresql-config_office.diff
Patch806:       806-sdbc-postgresql-oxt.diff
Patch807:       807-sdbc-postgresql-obsolete-hash-map.diff
Patch808:       808-sdbc-postgresql-deliver.diff
Patch809:       809-sdbc-postgresql-gcc-4.6.diff
# fix component mapping to get the symbol component_writeInfo; related to http://www.openoffice.org/issues/show_bug.cgi?id=115423
Patch810:       810-sdbc-postgresql-lo-3.4-registration.diff
# Firefox changed the development model, so there is not longer a stable API
# only mozilla-nss and mozilla-nspr packages are supported but not the XUL stuff
# these patches disable the mozilla plugin that needed the XUL stuff
# it was not enabled by default; it newer worked well
Patch831:       831-mozilla-no-xul-config.diff
Patch832:       832-mozilla-no-xul-cui.diff
Patch833:       833-mozilla-no-xul-extensions.diff
Patch834:       834-mozilla-no-xul-scp2.diff
#
# default to MS Office 97/2000/XP file formats on MeeGo; asked by HP
Patch900:       officecfg-defaul-export-ms-file-formats.diff
# fix build with gcc-4.6 on openSUSE-12.0; hack my Caolan McNamara, see http://permalink.gmane.org/gmane.comp.documentfoundation.libreoffice.devel/10987
Patch910:       vbahelper-sc-gcc-4.6-link-fix.diff
# crazy hack to avoid /usr/lib64 in RPATH and pass brp-rpath check (bnc#717262)
Patch920:       redland-rpath-hack.diff
#
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
ExclusiveArch:  %ix86 x86_64 ppc

%description
LibreOffice is a comprehensive office package featuring a word
processor, a spreadsheet, a presentation program, and much more. This
package provides only the basic framework. You have to install the
additional modules to get the required functionality, see packages:

- libreoffice-base

- libreoffice-calc

- libreoffice-draw

- libreoffice-impress

- libreoffice-math

- libreoffice-writer

Some optional features are provided by extra packages, for example:

- libreoffice-mailmerge

- libreoffice-filters

- libreoffice-kde

- libreoffice-gnome

Non-English localizations are provided by extra packges as well, for
example:

- libreoffice-de

- libreoffice-fr

- libreoffice-it


%package base
Summary:        LibreOffice Base
License:        LGPL-3.0
Group:          Productivity/Office/Suite
Requires:       %name = %version
%if 0%{?suse_version} 
Supplements:    %name 
%endif 
# compat stuff
Provides:       OpenOffice_org-base = %version
Obsoletes:      OpenOffice_org-base < %version
# split build compat stuff obsoleted with LO-3.4
Provides:       OpenOffice_org-base-devel = %version
Obsoletes:      OpenOffice_org-base-devel < %version
Provides:       libreoffice-base-devel = %version
Obsoletes:      libreoffice-base-devel < %version

%description base
This module allows you to manage databases, create queries and reports
to track and manage your information by using LibreOffice office
suite.



%package calc
Summary:        LibreOffice Calc
License:        LGPL-3.0
Group:          Productivity/Office/Suite
Requires:       %name = %version
%if 0%{?suse_version} 
Supplements:    %name 
%endif 
# compat stuff
Provides:       OpenOffice_org-calc = %version
Obsoletes:      OpenOffice_org-calc < %version
# split build compat stuff obsoleted with LO-3.4
Provides:       OpenOffice_org-calc-devel = %version
Obsoletes:      OpenOffice_org-calc-devel < %version
Provides:       libreoffice-calc-devel = %version
Obsoletes:      libreoffice-calc-devel < %version

%description  calc
This module allows you to perform calculation, analyze information and
manage lists in spreadsheets by using LibreOffice office suite.



%package draw
Summary:        LibreOffice Draw
License:        LGPL-3.0
Group:          Productivity/Office/Suite
Requires:       %name = %version
%if 0%{?suse_version} 
Supplements:    %name 
%endif 
# compat stuff
Provides:       OpenOffice_org-draw = %version
Obsoletes:      OpenOffice_org-draw < %version

%description  draw
This module allows you to create and edit drawings, flow charts, and
logos by using LibreOffice office suite.



%package math
Summary:        LibreOffice Math
License:        LGPL-3.0
Group:          Productivity/Office/Suite
Requires:       %name = %version
%if 0%{?suse_version} 
Supplements:    %name 
%endif 
# compat stuff
Provides:       OpenOffice_org-math = %version
Obsoletes:      OpenOffice_org-math < %version

%description math 
This module allows you to create and edit scientific formulas and
equations by using LibreOffice office suite.



%package impress
Summary:        LibreOffice Impress
License:        LGPL-3.0
Group:          Productivity/Office/Suite
Requires:       %name = %version
%if 0%{?suse_version} 
Supplements:    %name 
%endif 
# compat stuff
Provides:       OpenOffice_org-impress = %version
Obsoletes:      OpenOffice_org-impress < %version
# split build compat stuff obsoleted with LO-3.4
Provides:       OpenOffice_org-impress-devel = %version
Obsoletes:      OpenOffice_org-impress-devel < %version
Provides:       libreoffice-impress-devel = %version
Obsoletes:      libreoffice-impress-devel < %version

%description impress
This module allows you to create and edit presentations for slideshows,
meeting and Web pages by using LibreOffice office suite.



%package writer
Summary:        LibreOffice Writer and Web
License:        LGPL-3.0
Group:          Productivity/Office/Suite
Requires:       %name = %version
%if 0%{?suse_version} 
Supplements:    %name 
%endif 
# compat stuff
Provides:       OpenOffice_org-writer = %version
Obsoletes:      OpenOffice_org-writer < %version
# split build compat stuff obsoleted with LO-3.4
Provides:       OpenOffice_org-writer-devel = %version
Obsoletes:      OpenOffice_org-writer-devel < %version
Provides:       libreoffice-writer-devel = %version
Obsoletes:      libreoffice-writer-devel < %version

%description writer
This module allows you to create and edit text and graphics in letters,
reports, documents and Web pages by using LibreOffice office suite.



%package base-drivers-postgresql
Summary:        PostgreSQL Database Driver for LibreOffice
License:        LGPL-2.1+
Group:          Productivity/Office/Suite
Requires:       postgresql
# compat stuff
Provides:       OpenOffice_org-base-drivers-postgresql = %version
Obsoletes:      OpenOffice_org-base-drivers-postgresql < %version

%description base-drivers-postgresql
This package allows to access PostgreSQL databases from LibreOffice
Base.


%package filters-optional
Summary:        Additional Import and Export Filters for LibreOffice
License:        LGPL-3.0
Group:          Productivity/Office/Suite
Requires:       %name-calc = %version
Requires:       %name-draw = %version
Requires:       %name-impress = %version
Requires:       %name-math = %version
Requires:       %name-writer = %version
%if 0%{?suse_version} 
Supplements:    %name 
%endif 
# compat stuff
Provides:       OpenOffice_org-filters-optional = %version
Obsoletes:      OpenOffice_org-filters-optional < %version

%description filters-optional
This package includes some additional import and export filters for
LibreOffice:

- AportisDoc (Palm)

- Pocket Excel

- Pocket Word

- DocBook

- XHTML



%package mailmerge
Summary:        Mail Merge Functionality for LibreOffice
License:        LGPL-3.0
Group:          Productivity/Office/Suite
Requires:       %name-pyuno = %version
%if 0%{?suse_version} 
Supplements:    %name 
%endif 
# compat stuff
Provides:       OpenOffice_org-mailmerge = %version
Obsoletes:      OpenOffice_org-mailmerge < %version

%description mailmerge
This module allows you to create form letters or send E-mail messages
to many recipients using LibreOffice office suite.



%if 0%{?suse_version} <= 01130

%package mono
Summary:        Mono UNO Bridge for LibreOffice
License:        LGPL-3.0
Group:          Productivity/Office/Suite
Requires:       %name = %version
Requires:       mono-core
# compat stuff
Provides:       OpenOffice_org-mono = %version
Obsoletes:      OpenOffice_org-mono < %version

%description mono
The Mono/UNO binding allows a Mono application to access the complete
set of APIs exposed by LibreOffice via UNO. A trivial example
use-case might be a small mono application to create a spreadsheet,
populate it with data, charts, formatting, then save that in Excel
format.

Currently the use of Mono for add-ins & scripting inside OO.o itself is
not supported.

%endif

%package pyuno
Summary:        Python UNO Bridge for LibreOffice
License:        LGPL-3.0
Group:          Productivity/Office/Suite
Requires:       %name = %version
%if 0%{?suse_version} 
Supplements:    %name 
%endif 
# compat stuff
Provides:       OpenOffice_org-pyuno = %version
Obsoletes:      OpenOffice_org-pyuno < %version

%description pyuno
The Python-UNO bridge allows to use the standard LibreOffice API
from the well known Python scripting language. It can be used to
develop UNO components in python, thus python UNO components may be run
within the LibreOffice process and can be called from Java, C++ or
the built in StarBasic scripting language. You can create and invoke
scripts with the office scripting framework (OOo 2.0 and later) with
it. For example, it is used for the mail merge functionality.

You can find the more information at
http://udk.openoffice.org/python/python-bridge.html



%package testtool
Summary:        LibreOffice Test Tool
License:        LGPL-3.0
Group:          Productivity/Office/Suite
Requires:       %name = %version
# compat stuff
Provides:       OpenOffice_org-testtool = %version
Obsoletes:      OpenOffice_org-testtool < %version

%description testtool
A Tool needed for automatic testing of LibreOffice office suite.



%package gnome
Summary:        GNOME Extensions for LibreOffice
License:        LGPL-3.0
Group:          Productivity/Office/Suite
Requires:       %name = %version
# compat stuff
Provides:       OpenOffice_org17-gnome
Obsoletes:      OpenOffice_org17-gnome
Provides:       OpenOffice_org2-gnome
Obsoletes:      OpenOffice_org2-gnome
Provides:       OpenOffice_org-gnome = %version
Obsoletes:      OpenOffice_org-gnome < %version

%description gnome
This package contains some GNOME extensions for LibreOffice.


%package kde
Summary:        KDE Extensions for LibreOffice
License:        LGPL-3.0
Group:          Productivity/Office/Suite
Requires:       %name = %version
# compat stuff
Provides:       OpenOffice_org17-kde
Obsoletes:      OpenOffice_org17-kde
Provides:       OpenOffice_org2-kde
Obsoletes:      OpenOffice_org2-kde
Provides:       OpenOffice_org-kde = %version
Obsoletes:      OpenOffice_org-kde < %version

%description kde
This package contains some KDE extensions for LibreOffice.


%package kde4
Summary:        KDE4 Extensions for LibreOffice
License:        LGPL-3.0
Group:          Productivity/Office/Suite
Requires:       %name = %version
# compat stuff
Provides:       OpenOffice_org-kde4 = %version
Obsoletes:      OpenOffice_org-kde4 < %version

%description kde4
This package contains some KDE4 extensions for LibreOffice.

%if %lo_build_sdk == yes

%package sdk
Summary:        LibreOffice SDK
License:        LGPL-3.0
Group:          Documentation/HTML
Requires:       %name = %version
Requires:       gcc-c++
Requires:       make
Requires:       zip
%if %suse_version > 1000
Recommends:     java-devel
%endif
# split build compat stuff obsoleted with LO-3.4
Provides:       OpenOffice_org-ure-devel = %version
Obsoletes:      OpenOffice_org-ure-devel < %version
Provides:       libreoffice-ure-devel = %version
Obsoletes:      libreoffice-ure-devel < %version

%description sdk
This package contains the files needed to build plugins/add-ons for
LibreOffice. It includes header files, IDL files, needed build
tools, etc.

The documentation is in the package OpenOffice_org-sdk-doc



%package sdk-doc
Summary:        LibreOffice SDK Documentation
License:        LGPL-3.0
Group:          Development/Libraries/Other
%if %suse_version > 1000
Suggests:       %name-sdk = %version
Enhances:       %name-sdk = %version
%endif
# split build compat stuff obsoleted with LO-3.4
Provides:       OpenOffice_org-ure-devel-doc = %version
Obsoletes:      OpenOffice_org-ure-devel-doc < %version
Provides:       libreoffice-ure-devel-doc = %version
Obsoletes:      libreoffice-ure-devel-doc < %version

%description sdk-doc
This package includes documentation and examples for the LibreOffice
Software Development Kit (SDK).

%endif

%package officebean
Summary:        OfficeBean Java Bean component for LibreOffice
License:        LGPL-3.0
Group:          Productivity/Office/Suite
Requires:       %name = %version
# compat stuff
Provides:       OpenOffice_org2-officebean = %version
Provides:       OpenOffice_org:/usr/lib/ooo-2.0/program/libofficebean.so
Obsoletes:      OpenOffice_org2-officebean < %version
Provides:       OpenOffice_org-officebean = %version
Obsoletes:      OpenOffice_org-officebean < %version

%description officebean
With the OfficeBean, a developer can easily write Java applications,
harnessing the power of LibreOffice. It encapsulates a connection to
a locally running LibreOffice process, and hides the complexity of
establishing and maintaining that connection from the developer.

It also allows embedding of LibreOffice documents within the Java
environment. It provides an interface the developer can use to obtain
Java AWT windows into which the backend LibreOffice process draws
its visual representation. These windows are then plugged into the UI
hierarchy of the hosting Java application. The embedded document is
controlled from the Java environment, since the OfficeBean allows
developers to access the complete LibreOffice API from their Java
environment giving them full control over the embedded document, its
appearance and behavior.



%package base-extensions
Summary:        LibreOffice Base Extensions
License:        GPL-2.0 and LGPL-2.1 and LGPL-3.0 and W3C
Group:          Productivity/Office/Suite
PreReq:         libreoffice = %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 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 base-drivers-mysql
Summary:        MySQL Database Driver for LibreOffice
License:        GPL-2.0 and LGPL-3.0
Group:          Productivity/Office/Suite
PreReq:         libreoffice = %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 base-drivers-mysql
This package allows to access MySQL databases from LibreOffice
Base.
%endif

%package calc-extensions
Summary:        LibreOffice Calc Extensions
License:        LGPL-2.1+ and LGPL-3.0
Group:          Productivity/Office/Suite
PreReq:         libreoffice = %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 calc-extensions
This package provides extensions for LibreOffice Calc:

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



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

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

- PDF Import



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

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

- Presentation Minimizer

- Presenter Console



%package writer-extensions
Summary:        LibreOffice Writer Extensions
License:        Apache-2.0 and LGPL-3.0 and CDDL-1.0
Group:          Productivity/Office/Suite
PreReq:         libreoffice = %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 writer-extensions
This package provides extensions for LibreOffice Writer:

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



%package        icon-themes-prebuilt
Summary:        Prebuilt LibreOffice Icon Themes
License:        LGPL-2.0 and LGPL-3.0
Group:          Development/Sources
AutoReqProv:    off
# compat stuff
Provides:       OpenOffice_org-icon-themes-prebuilt = %version
Obsoletes:      OpenOffice_org-icon-themes-prebuilt < %version

%description icon-themes-prebuilt
This package includes the prebuilt LibreOffice Icon Themes. It is
not intended for real use. It needs to be repacked to the real
architecture independent package.

This is only temporary solution to get an installable set of
LibreOffice packages for a new version as fast as possible. The
architecture independent package will be built from the original
sources in the future.



%package        l10n-prebuilt
Summary:        Prebuilt LibreOffice Localization
License:        LGPL-2.0 and LGPL-3.0
Group:          Development/Sources
AutoReqProv:    off
# compat stuff 
Provides:       OpenOffice_org-l10n-prebuilt = %version
Obsoletes:      OpenOffice_org-l10n-prebuilt < %version
# split build compat stuff obsoleted with LO-3.4
# components
Provides:       OpenOffice_org-components-l10n-prebuilt = %version
Obsoletes:      OpenOffice_org-components-l10n-prebuilt < %version
Provides:       libreoffice-components-l10n-prebuilt = %version
Obsoletes:      libreoffice-components-l10n-prebuilt < %version
# extensions
Provides:       OpenOffice_org-extensions = %version
Obsoletes:      OpenOffice_org-extensions < %version
# filters
Provides:       OpenOffice_org-filters-l10n-prebuilt = %version
Obsoletes:      OpenOffice_org-filters-l10n-prebuilt < %version
Provides:       libreoffice-filters-l10n-prebuilt = %version
Obsoletes:      libreoffice-filters-l10n-prebuilt < %version
# l10n-extras
Provides:       OpenOffice_org-l10n-extras-prebuilt = %version
Obsoletes:      OpenOffice_org-l10n-extras-prebuilt < %version
Provides:       libreoffice-l10n-extras-prebuilt = %version
Obsoletes:      libreoffice-l10n-extras-prebuilt < %version
# libs-core
Provides:       OpenOffice_org-libs-core-l10n-prebuilt = %version
Obsoletes:      OpenOffice_org-libs-core-l10n-prebuilt < %version
Provides:       libreoffice-libs-core-l10n-prebuilt = %version
Obsoletes:      libreoffice-libs-core-l10n-prebuilt < %version
# libs-extern
Provides:       OpenOffice_org-libs-extern-l10n-prebuilt = %version
Obsoletes:      OpenOffice_org-libs-extern-l10n-prebuilt < %version
Provides:       libreoffice-libs-extern-l10n-prebuilt = %version
Obsoletes:      libreoffice-libs-extern-l10n-prebuilt < %version
# libs-gui
Provides:       OpenOffice_org-libs-gui-l10n-prebuilt = %version
Obsoletes:      OpenOffice_org-libs-gui-l10n-prebuilt < %version
Provides:       libreoffice-libs-gui-l10n-prebuilt = %version
Obsoletes:      libreoffice-libs-gui-l10n-prebuilt < %version
# base
Provides:       OpenOffice_org-base-l10n-prebuilt = %version
Obsoletes:      OpenOffice_org-base-l10n-prebuilt < %version
Provides:       libreoffice-base-l10n-prebuilt = %version
Obsoletes:      libreoffice-base-l10n-prebuilt < %version
# calc
Provides:       OpenOffice_org-calc-l10n-prebuilt = %version
Obsoletes:      OpenOffice_org-calc-l10n-prebuilt < %version
Provides:       libreoffice-calc-l10n-prebuilt = %version
Obsoletes:      libreoffice-calc-l10n-prebuilt < %version
# impress
Provides:       OpenOffice_org-impress-l10n-prebuilt = %version
Obsoletes:      OpenOffice_org-impress-l10n-prebuilt < %version
Provides:       libreoffice-impress-l10n-prebuilt = %version
Obsoletes:      libreoffice-impress-l10n-prebuilt < %version
# writer
Provides:       OpenOffice_org-writer-l10n-prebuilt = %version
Obsoletes:      OpenOffice_org-writer-l10n-prebuilt < %version
Provides:       libreoffice-writer-l10n-prebuilt = %version
Obsoletes:      libreoffice-writer-l10n-prebuilt < %version

%description l10n-prebuilt
This package includes the prebuilt localization of LibreOffice.
It is not intended for a real use. It needs to be repacked to the real
architecture independent package.

This is only a temporary solution until we have an easier way to build
the LibreOffice localizations separately.


%prep
%if %prepare_build == 0
%setup -D -T -q -n libreoffice-bootstrap-%version
%else
%setup -q -n libreoffice-bootstrap-%version
bin/unpack-sources `pwd` \
     %{S:1}  %{S:2}  %{S:3}  %{S:4}  %{S:5} \
     %{S:6}  %{S:7}  %{S:8}  %{S:9} %{S:10} \
    %{S:11} %{S:12} %{S:13} %{S:14} %{S:15} \
    %{S:16} %{S:17} %{S:18} %{S:19}    
# 256x256 icons
tar -xjf %{S:20}
# SUSE config files
cp $RPM_SOURCE_DIR/SUSE*.conf distro-configs
# READMEs
cp $RPM_SOURCE_DIR/README* .
# extra fixes
%patch0
%patch1
%patch2
%patch3
%patch4
%patch5
%patch6
%patch7
%patch8
%patch9
%patch10
%patch11
%patch12
%if %suse_version <= 1130
# cpp/poppler-version.h is not included in older poppler packages
%patch13
%endif
%patch15
%patch19 -p1
%patch20
%patch21
%patch22
%patch26
%patch27
# PostgreSQL SDBC driver
%patch801
%patch802
%patch803
%patch804
%patch805
%patch806
%patch807
%patch808
%patch809
%patch810
# No XUL
%patch831
%patch832
%patch833
%patch834
#
%if 0%{?meego_version}
# default to MS Office 97/2000/XP file formats on MeeGo; asked by HP
%patch900
%endif
#
%if %suse_version > 1130
# fix build with gcc-4.6 on openSUSE-12.0; hack my Caolan McNamara, see http://permalink.gmane.org/gmane.comp.documentfoundation.libreoffice.devel/10987
%patch910
%endif
#
%if %suse_version > 1140
# crazy hack to avoid /usr/lib64 in RPATH and pass brp-rpath check (bnc#717262)
%patch920
%endif
#
%endif

%build
%if %prepare_build != 0
#
# Parallel build settings ...
PARALLEL_BUILD=
if test -n "%{?jobs:%jobs}" -a -e "/opt/icecream/bin/gcc" -a -e "/opt/icecream/bin/g++" ; then
  PARALLEL_BUILD="--with-gcc-speedup=icecream
                  --with-max-jobs=%jobs"
fi
# parallel build of modules; it makes sense on machines with more CPUs
if test "%build_module_in_parallel" = "1" ; then
    PARALLEL_BUILD="$PARALLEL_BUILD --with-num-cpus=`grep ^processor /proc/cpuinfo | wc -l`"
fi
if test "%build_module_in_parallel" -gt "1" ; then
    PARALLEL_BUILD="$PARALLEL_BUILD --with-num-cpus=%build_module_in_parallel"
fi
#
# Distro settings ...
%if 0%{?meego_version}
    with_distro="SUSE-11.1"
%endif
%if 0%{?suse_version} && 0%{?suse_version} <= 01110
    suse_major_ver=$((%{?suse_version} / 100))
    suse_minor_ver=$((%{?suse_version} / 10 - $suse_major_ver * 10))
    with_distro="SUSE-$suse_major_ver.$suse_minor_ver"
%endif
%if 0%{?suse_version} > 01110 && 0%{?suse_version} <= 01120
    with_distro="SUSE-11.2"
%endif
%if 0%{?suse_version} > 01120
    with_distro="SUSE"
%endif
#
# disable KDE4 on openSUSE-11.1-Evergreen but not on SLED11
%define libkde4_devel_ver %(rpm -q --queryformat '%{VERSION}' libkde4-devel)
DISABLE_KDE4=
test "%{libkde4_devel_ver}" = "4.1.3" && DISABLE_KDE4="--disable-kde4"
%endif
# make sure that JAVA_HOME is set correctly
%if 0%{?suse_version}
source /etc/profile.d/alljava.sh
%endif
%if 0%{?meego_version}
export JAVA_HOME=%{java_home}
%endif
# use RPM_OPT_FLAGS, ...
ARCH_FLAGS="`echo $RPM_OPT_FLAGS | sed -e 's/\-O[0-9s]//g' -e 's/\-fexceptions//g'` -fno-strict-aliasing"
CFLAGS="$ARCH_FLAGS"
CXXFLAGS="$ARCH_FLAGS"
export ARCH_FLAGS CFLAGS CXXFLAGS
# FIXME: genccode from the system icu is in /usr/sbin
export PATH="$PATH:/usr/sbin"
%if %prepare_build != 0
./autogen.sh $PARALLEL_BUILD \
        --with-external-tar="$RPM_SOURCE_DIR" \
	--with-arch-flags="$ARCH_FLAGS" \
	--libdir=%{_libdir} \
	--prefix=%{_prefix} \
	--mandir=%{_mandir} \
	--sysconfdir=/etc \
	--docdir=%{_docdir}/%{name} \
	--with-distro="$with_distro" \
	--without-git \
	--without-download \
	--with-lang=%lo_langs \
	--with-poor-help-localizations=%lo_poor_help_localizations \
	--with-mono-gac-root=%{_prefix}/lib \
	--with-compat-oowrappers \
%if %test_build_binfilters != 0
	--enable-binfilter \
%endif
	--with-jdk-home=$JAVA_HOME \
	--with-java-target-version=%java_target_version \
	--disable-helpcontent \
%if %lo_build_sdk == yes
	--enable-odk \
%endif
%if 0%{?suse_version} && 0%{?suse_version} <= 01030
	--with-additional-sections="PostgreSQL" \
%endif
%if 0%{?meego_version}
	--without-system-cairo \
	--with-system-icu \
	--disable-kde4 \
%endif
%if 0%{?meego_version} 
	--disable-kde \
%endif
        $DISABLE_KDE4 \
%if 0%{?suse_version} > 01130
        --disable-mono \
%endif
%if %suse_version <= 1110
	--without-junit \
%endif
        --with-system-mozilla=mozilla \
	--disable-access \
	--disable-post-install-scripts \
	--disable-strip \
	--disable-strip-solver \
	--enable-openxml \
	--disable-report-builder \
	--disable-pdfimport \
	--disable-presenter-console \
	--enable-build-noarch \
	--enable-ext-ct2n \
	--enable-ext-nlpsolver \
%if 0%{?suse_version}
	--with-system-mysql \
	--enable-ext-mysql-connector \
%endif
%if 0%{?suse_version} > 01220
	--with-system-mysql-cppconn \
%endif
%if 0%{?suse_version} > 01030 || 0%{?meego_version}
	--enable-pdfimport \
%endif
        --enable-ext-scripting-beanshell \
        --enable-ext-scripting-javascript \
        --enable-ext-scripting-python \
	--enable-minimizer --enable-presenter-console \
	--enable-wiki-publisher --enable-ogltrans --enable-report-builder \
	--enable-split-app-modules \
	--enable-split-opt-features
%endif
# hack to add icons for helpcontent that is build separately
(
    . ./*Env.Set.sh
    mkdir -p $SOLARVER/$INPATH/res/img
    perl helpcontent2/helpers/create_ilst.pl -dir=default_images/res/helpimg >$SOLARVER/$INPATH/res/img/helpimg.ilst
)
# hack to correctly bootstrap python stuff with system python, (deb#501028, i#90701)
sed -i -e "s|@INSTALLDIR@|%lo_prefix/%lo_home|" pyuno/source/module/uno.py
# FIXME: try to finish build even with the strange random build crash in officecfg
make || make || make

%install
%ifarch x86_64 ppc
%if 0%{?suse_version} && 0%{?suse_version} <= 01020
# FIXME: move this to libreoffice-build
export JAVA_HOME=/usr
%endif
%endif
#
make DESTDIR=$RPM_BUILD_ROOT distro-pack-install
################
# update desktop files
%if 0%{?suse_version}
builddir=`pwd`
cd $RPM_BUILD_ROOT%_datadir/applications
for desktop in * ; do
    # relative link is needed by %%suse_update_desktop_file
    relative_target=`readlink $desktop | sed "s|%lo_prefix|../../%_lib|"`
    # FIXME: remove the libreoffice- prefix because the old desktop files are preferred in /etc/gnome_defaults.conf
    desktop_new=`echo $desktop | sed -e "s/%lo_home-//"`
    rm $desktop
    sed -i -e "s|%_datadir/applications/$desktop|%_datadir/applications/$desktop_new|" $builddir/file-lists/*.txt
    # finally, create the right link
    ln -sf $relative_target $desktop_new
    # suse_update
    app=`echo $desktop_new | sed "s/.desktop//"`
    %suse_update_desktop_file $app
done
cd -
%endif
################
# save l10n files in l10n-prebuild package
l10n_prebuilt_list=file-lists/l10n-prebuilt.txt
mkdir -p $RPM_BUILD_ROOT/%lo_prefix/%lo_home/share/file-lists
echo "%dir %lo_prefix/%lo_home/share/file-lists" >file-lists/l10n-prebuilt.txt
for file_list in file-lists/lang_*.txt ; do
    if test "$file_list" = "file-lists/lang_en_US_list.txt" ; then
        cat $file_list >>file-lists/common_list.txt 
    else
        cat $file_list >>file-lists/l10n-prebuilt.txt
        cp $file_list $RPM_BUILD_ROOT%lo_prefix/%lo_home/share/file-lists
        echo "%lo_prefix/%lo_home/share/$file_list" >>file-lists/l10n-prebuilt.txt
    fi
done
################
# compat stuff for noarch packages
mkdir -p $RPM_BUILD_ROOT/%_datadir/%lo_home/program
mkdir -p $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir
ln -sf %lo_basis_dir $RPM_BUILD_ROOT/%_datadir/%lo_home/basis-link
install -m 755 $RPM_SOURCE_DIR/link-to-ooo-home $RPM_BUILD_ROOT%_datadir/%lo_home/
echo "%dir %_datadir/%lo_home"               >>file-lists/common_list.txt
echo "%dir %_datadir/%lo_home/program"       >>file-lists/common_list.txt
echo "%dir %_datadir/%lo_home/%lo_basis_dir" >>file-lists/common_list.txt
echo "%_datadir/%lo_home/basis-link"         >>file-lists/common_list.txt
echo "%_datadir/%lo_home/link-to-ooo-home"   >>file-lists/common_list.txt
################
# compat symlink to correctly uninstall OOo
mkdir -p $RPM_BUILD_ROOT%_datadir/ooo3
ln -sf ../libreoffice/link-to-ooo-home $RPM_BUILD_ROOT%_datadir/ooo3/link-to-ooo-home
echo "%dir %_datadir/ooo3" >>file-lists/common_list.txt
echo "%_datadir/ooo3/link-to-ooo-home" >>file-lists/common_list.txt
################
# helper script for noarch packages
# add missing directories to the file list
for dir in `find $RPM_BUILD_ROOT/%_datadir/icons/gnome -type d` ; do
    dir=`echo $dir | sed -e "s|$RPM_BUILD_ROOT||"`
    echo "%dir $dir" >>file-lists/common_list.txt
done
echo "%dir %_datadir/application-registry" >>file-lists/common_list.txt
echo "%dir %_datadir/mime-info" >>file-lists/common_list.txt
echo "%dir %_datadir/mimelnk" >>file-lists/common_list.txt
echo "%dir %_datadir/mimelnk/application" >>file-lists/common_list.txt
################
# compat symlinks for the old main icon (bnc#724087)
icon_found=
for icon in `find $RPM_BUILD_ROOT/%_datadir/icons -name libreoffice-main.png` ; do
    icon_found=1
    icon_name=$(basename $icon)
    icon_dir=$(dirname $icon | sed -e "s|^$RPM_BUILD_ROOT||")
    ln -sf $icon_name $RPM_BUILD_ROOT/$icon_dir/ooo-gulls.png
    echo "$icon_dir/ooo-gulls.png" >>file-lists/common_list.txt
done
test -z "$icon_found" && echo "ERROR: Can't find compat icon for ooo-gulls.png" && exit 1;
################
# common helpcontent files
# create symlinks to /usr/share for noarch help packages
mkdir -p $RPM_BUILD_ROOT/%lo_prefix/%lo_home/%lo_basis_dir/help
mkdir -p $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help
echo "%dir %lo_prefix/%lo_home/%lo_basis_dir/help" >>file-lists/common_list.txt
echo "%dir %_datadir/%lo_home/%lo_basis_dir/help" >>file-lists/common_list.txt
for file in idxcaption.xsl idxcontent.xsl main_transform.xsl ; do
    install -m 644 solver/*/unxlng*.pro/bin/$file $RPM_BUILD_ROOT/%lo_prefix/%lo_home/%lo_basis_dir/help
    ln -sf %lo_prefix/%lo_home/%lo_basis_dir/help/$file $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help
    echo "%lo_prefix/%lo_home/%lo_basis_dir/help/$file" >>file-lists/common_list.txt
    echo "%_datadir/%lo_home/%lo_basis_dir/help/$file" >>file-lists/common_list.txt
done
################
# branding will be in separate packages
# first check wheter the prebuilt sofficerc is still the same
if ! diff $RPM_BUILD_ROOT%lo_prefix/%lo_home/program/sofficerc $RPM_SOURCE_DIR/sofficerc-upstream ; then
    echo "Error: The file \"sofficerc\" has changed in the sources"
    echo "       Please, update the prebuilt variant in $RPM_SOURCE_DIR/sofficerc-upstream"
    exit 1;
fi
# replace files with symlinks to noarch packages
mkdir -p $RPM_BUILD_ROOT/%_datadir/%lo_home/program/shell
for file in sofficerc \
            about.png \
            intro.png \
            shell/backing_left.png \
            shell/backing_right.png \
            shell/backing_rtl_left.png \
            shell/backing_rtl_right.png \
            shell/backing_space.png ; do
    rm -f $RPM_BUILD_ROOT/%lo_prefix/%lo_home/program/$file
    ln -sf %_datadir/%lo_home/program/$file $RPM_BUILD_ROOT/%lo_prefix/%lo_home/program/$file
    # touch the target file to make brp-symlink happy; the touched files are not packaged
    # it would be possible to disable the error using NO_BRP_STALE_LINK_ERROR=yes but the check is pretty useful to catch other errors
    touch $RPM_BUILD_ROOT/%_datadir/%lo_home/program/$file
done
################
# extra background picture into the gallery
export galdir="%lo_prefix/%lo_home/%lo_basis_dir/share/gallery"
install -m 644 "$RPM_SOURCE_DIR/Draft.jpg" "$RPM_BUILD_ROOT$galdir/www-back/"
echo "$galdir/www-back/Draft.jpg" >>file-lists/common_list.txt
# make sure that the existing galleries can be modified 
chmod 644 $RPM_BUILD_ROOT$galdir/sg*.???
# LC_ALL=en_US.UTF-8 is necessary to make sure that the name "Backgrounds" is compared with the right localization 
LC_ALL=en_US.UTF-8 $RPM_BUILD_ROOT%lo_prefix/%lo_home/program/gengal -headless --name "Backgrounds" --path "$RPM_BUILD_ROOT$galdir" --destdir "$RPM_BUILD_ROOT" "$RPM_BUILD_ROOT$galdir/www-back/Draft.jpg" || exit 1;
################
# FIXME: fast hack to solve a customer issue, n#364523 
#        we need a more generic solution 
ln -sf acor_fr-FR.dat $RPM_BUILD_ROOT%lo_prefix/%lo_home/%lo_basis_dir/share/autocorr/acor_fr-CA.dat
echo "%lo_prefix/%lo_home/%lo_basis_dir/share/autocorr/acor_fr-CA.dat" >>file-lists/common_list.txt
################
# helper script to create libstlport compat symlink (bnc#458952)
%ifarch %ix86
cat << EOF > $RPM_BUILD_ROOT%lo_prefix/%lo_home/ure/bin/create-libstlport-compat-links
#!/bin/sh
# helper script to create compat link needed to run upstream extensions (bnc#458952)
if ! test -L %_libdir/libstlport_gcc.so -a -r %_libdir/libstlport_gcc.so ; then
    lib_name=\`ls /usr/lib/libstlport_gcc.so.4* 2>/dev/null | tail -n 1\`
    if test -n "\$lib_name" -a -r "\$lib_name" ; then
	lib_name=\`basename \$lib_name\`
	rm -f %_libdir/libstlport_gcc.so
	ln -sf \$lib_name %_libdir/libstlport_gcc.so
    fi
fi
EOF
chmod 755 $RPM_BUILD_ROOT%lo_prefix/%lo_home/ure/bin/create-libstlport-compat-links
echo "%lo_prefix/%lo_home/ure/bin/create-libstlport-compat-links" >>file-lists/common_list.txt
%endif
################
# helper script to update budled extensions cache
mkdir -p $RPM_BUILD_ROOT/%_prefix/sbin
cat << EOF > $RPM_BUILD_ROOT/%_prefix/sbin/unopkg-sync-bundled
#!/bin/sh

#Create the command which creates a temporary directory
INSTDIR=\`mktemp -d -t "userinstall.XXXXXX"\`
unopkg sync "-env:BUNDLED_EXTENSIONS_USER=file://%lo_prefix/%lo_home/share/prereg/bundled" "-env:UserInstallation=file://\$INSTDIR" '-env:UNO_JAVA_JFW_INSTALL_DATA=file://%lo_prefix/%lo_home/%lo_basis_dir/share/config/javasettingsunopkginstall.xml' '-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1'
find "%lo_prefix/%lo_home/share/prereg/bundled" -type f -exec chmod 644 {} \\;

rm -rf "\$INSTDIR"

exit 0
EOF
chmod 755 $RPM_BUILD_ROOT%_prefix/sbin/unopkg-sync-bundled
echo "%_prefix/sbin/unopkg-sync-bundled" >>file-lists/common_list.txt

################
# KDE4 needed to be disabled on openSUSE-11.1-Evergreen but not on SLED11-SP1
%define libkde4_devel_ver %(rpm -q --queryformat '%{VERSION}' libkde4-devel)
if test "%{libkde4_devel_ver}" = "4.1.3" ; then
    mkdir -p $RPM_BUILD_ROOT%{_docdir}/%name-kde4/
    cat << EOF > $RPM_BUILD_ROOT%{_docdir}/%name-kde4/README.txt
Dear user,

LibreOffice KDE4 support requires newer KDE4 libraries and therefore
cannot be built for openSUSE-11.1. We suggest to switch to the last
stable openSUSE release.

                                        Have a fun,
                                                Your LibreOffice team
EOF
    chmod 644 $RPM_BUILD_ROOT%{_docdir}/%name-kde4/README.txt
    echo "%doc %dir \"%{_docdir}/%name-kde4\"" >>file-lists/kde4_list.txt
    echo "%doc \"%{_docdir}/%name-kde4/README.txt\"" >>file-lists/kde4_list.txt
fi
################
# officebean subpackage 
rm -f file-lists/officebean_list.txt
for file in %lo_prefix/%lo_home/%lo_basis_dir/program/classes/officebean.jar \
            %lo_prefix/%lo_home/%lo_basis_dir/program/libofficebean.so ; do
    grep -v $file file-lists/common_list.txt >file-lists/common_list.txt.new
    mv file-lists/common_list.txt.new file-lists/common_list.txt
    echo $file >>file-lists/officebean_list.txt
done
################
# extensions
mkdir -p $RPM_BUILD_ROOT%lo_prefix/%lo_home/share/extensions
find solver -name "*.oxt" -exec cp {} $RPM_BUILD_ROOT%lo_prefix/%lo_home/share/extensions \;
# prebuilt extensions
cp $RPM_SOURCE_DIR/*-gdocs_%{gdocs_version}_modified.oxt  $RPM_BUILD_ROOT%lo_prefix/%lo_home/share/extensions/gdocs_%{gdocs_version}_modified.oxt
cp $RPM_SOURCE_DIR/numbertext-%{numbertext_version}.oxt $RPM_BUILD_ROOT%lo_prefix/%lo_home/share/extensions
# unpack the extensions
cd $RPM_BUILD_ROOT%lo_prefix/%lo_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

################
# Symlink uno.py and unohelper.py so that python can find them
mkdir -p $RPM_BUILD_ROOT%python_sitelib
ln -s %_libdir/libreoffice/basis-link/program/uno.py $RPM_BUILD_ROOT%python_sitelib/uno.py
ln -s %_libdir/libreoffice/basis-link/program/unohelper.py $RPM_BUILD_ROOT%python_sitelib/unohelper.py

%clean
rm -rf $RPM_BUILD_ROOT

%pre
# crazy hack for the ugly extensions
if test $1 -gt 1 ; then
    if test -d %{_libdir}/%lo_home/share/uno_packages/cache -a \
            -n "`find %{_libdir}/%lo_home/share/uno_packages/cache -name LanguageTool-0.9.3.oxt`" ; then
	# try to remove the LangTool extension by the older URE; it can't be
	# removed with OOo-3.1 and higher
	echo "Unregistering the LangTool extension from LibreOffice..."
	unopkg remove --shared org.openoffice.languagetool.oxt || true;
	# clear disk cache
	unopkg list --shared > /dev/null 2>&1 || true;
    fi
fi

%post
/sbin/ldconfig
/usr/bin/update-mime-database /usr/share/mime >/dev/null || true
# update GNOME icon caches
%if 0%{?suse_version} > 01130
%icon_theme_cache_post
%endif
%if 0%{?suse_version} && 0%{?suse_version} <= 01130
SuSEconfig --module gtk2 || true
%endif

%preun
test "$1" = "0" && rm -rf ./%lo_prefix/%lo_home/share/uno_packages/cache || true

%postun
/sbin/ldconfig
%_prefix/sbin/unopkg-sync-bundled || true
/usr/bin/update-mime-database /usr/share/mime >/dev/null || true
# update GNOME icon caches
%if 0%{?suse_version} > 01130
%icon_theme_cache_postun
%endif
%if 0%{?suse_version} && 0%{?suse_version} <= 01130
SuSEconfig --module gtk2 || true
%endif
#
%ifarch %ix86
if test $1 = 0 ; then
    # OOo is removed => remove the link as well if it is not created by stlport-devel package (bnc#458952)
    if test -L %_libdir/libstlport_gcc.so -a ! -r %_prefix/include/stlport/ctime ; then
	rm -f %_libdir/libstlport_gcc.so
    fi
fi
%endif

%posttrans
%_prefix/sbin/unopkg-sync-bundled || true
%ifarch %ix86
# the compat link was %%ghost in old OOo-ure packages, so it might be removed also during OOo-ure update (bnc#458952)
if test -f %lo_prefix/%lo_home/ure/bin/javaldx ; then
    %lo_prefix/%lo_home/ure/bin/create-libstlport-compat-links || true;
fi
%endif

%ifarch %ix86

%triggerin -- mysql-connector-java
%lo_prefix/%lo_home/basis-link/program/java-set-classpath /usr/share/java/mysql-connector-java.jar || true

%triggerpostun -- mysql-connector-java
%lo_prefix/%lo_home/basis-link/program/java-set-classpath /usr/share/java/mysql-connector-java.jar || true

%triggerin -- libstlport_gcc4
# create compat link needed to run upstream extensions (bnc#458952)
%lo_prefix/%lo_home/ure/bin/create-libstlport-compat-links || true;
%endif

%ifarch %ix86

%triggerpostun -- libstlport_gcc4-devel
# create compat link needed to run upstream extensions (bnc#458952)
%lo_prefix/%lo_home/ure/bin/create-libstlport-compat-links || true;
%endif

%ifarch %ix86

%triggerpostun -- libstlport_gcc4
# remove compat link needed to run upstream extensions (bnc#458952)
if test $2 = 0 ; then
    if test -L %_libdir/libstlport_gcc.so -a ! -r %_libdir/libstlport_gcc.so ; then
	rm -f %_libdir/libstlport_gcc.so
    fi
fi
exit 0
%endif

#####################

%pre filters-optional
if test $1 -gt 1 ; then
    echo "Unregistering the older LibreOffice optional filter extensions..."
    # Writer2latex extensions has been completely removed in 3.0.99.6 (bnc#529914)
    if unopkg list --shared | grep -q "org.openoffice.da.writer2latex.oxt" ; then
	unopkg remove --shared org.openoffice.da.writer2latex.oxt || true;
	# clear disk cache
	unopkg list --shared > /dev/null 2>&1 || true
    fi
fi

#####################

%pre base-drivers-postgresql
if test $1 = 2 ; then
    # unregister all extensions that were registered by LibO <= 3.2.99.3
    # the version 0.7.5 has been replaced in OOo-3.0.99.1
    unopkg remove --shared org.openoffice.legacy.postgresql-sdbc-0.7.5.zip >/dev/null 2>&1 || true;
    # the version 0.7.6 has been replaced in OOo-3.2.0.8
    unopkg remove --shared org.openoffice.legacy.postgresql-sdbc-0.7.6.zip >/dev/null 2>&1 || true;
    unopkg remove --shared org.openoffice.legacy.postgresql-sdbc-0.7.6a.zip >/dev/null 2>&1 || true;
    if unopkg list --shared | grep -q "org.openoffice.legacy.postgresql-sdbc-%postgresql_version.zip" ; then
	unopkg remove --shared org.openoffice.legacy.postgresql-sdbc-%postgresql_version.zip || true;
    fi
fi

%post base-drivers-postgresql
if test -f %lo_prefix/ooo3/share/extension/install/postgresql-sdbc-*.zip ; then
    echo
    echo "WARNING: Please ignore the following error about the extension:"
    echo "WARNING:     org.openoffice.legacy.postgresql-sdbc-0.7.x.zip"
    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

%posttrans base-drivers-postgresql
%_prefix/sbin/unopkg-sync-bundled || true

%postun base-drivers-postgresql
%_prefix/sbin/unopkg-sync-bundled || true

# base

%pre 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 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

%posttrans base-extensions
%_prefix/sbin/unopkg-sync-bundled || true

%postun base-extensions
%_prefix/sbin/unopkg-sync-bundled || true

# MySQL driver

%if 0%{?suse_version} >= 01120

%pre 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 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

%posttrans base-drivers-mysql
%_prefix/sbin/unopkg-sync-bundled || true

%postun base-drivers-mysql
%_prefix/sbin/unopkg-sync-bundled || true

%endif

# calc

%pre 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 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

%posttrans calc-extensions
%_prefix/sbin/unopkg-sync-bundled || true

%postun calc-extensions
%_prefix/sbin/unopkg-sync-bundled || true

# draw

%pre 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 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

%posttrans draw-extensions
%_prefix/sbin/unopkg-sync-bundled || true

%postun draw-extensions
%_prefix/sbin/unopkg-sync-bundled || true

# impress

%pre 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 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

%posttrans impress-extensions
%_prefix/sbin/unopkg-sync-bundled || true

%postun impress-extensions
%_prefix/sbin/unopkg-sync-bundled || true

# writer

%pre 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 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

%posttrans writer-extensions
%_prefix/sbin/unopkg-sync-bundled || true

%postun writer-extensions
%_prefix/sbin/unopkg-sync-bundled || true

# pyuno

%posttrans pyuno
%_prefix/sbin/unopkg-sync-bundled || true

%postun pyuno
%_prefix/sbin/unopkg-sync-bundled || true

# officebean

%posttrans officebean
%_prefix/sbin/unopkg-sync-bundled || true

%postun officebean
%_prefix/sbin/unopkg-sync-bundled || true

#######################
# file lists

%files -f file-lists/common_list.txt
%defattr(-,root,root) 
# common extensions
%lo_prefix/%lo_home/share/extensions/script-provider-for-javascript
# ignore helper files for brp-symlink check
%exclude %_datadir/%lo_home/program/sofficerc
%exclude %_datadir/%lo_home/program/*.png
%exclude %_datadir/%lo_home/program/shell/*.png

%files -f file-lists/base_list.txt base
%defattr(-,root,root)

%files -f file-lists/calc_list.txt calc
%defattr(-,root,root)

%files -f file-lists/draw_list.txt draw
%defattr(-,root,root)

%files -f file-lists/math_list.txt math
%defattr(-,root,root)

%files -f file-lists/impress_list.txt impress
%defattr(-,root,root)

%files -f file-lists/writer_list.txt writer
%defattr(-,root,root)

%files base-drivers-postgresql
%defattr(-,root,root)
%lo_prefix/%lo_home/share/extensions/postgresql-sdbc-*

%files -f file-lists/filters_list.txt filters-optional
%defattr(-,root,root) 

%files -f file-lists/mailmerge_list.txt mailmerge 
%defattr(-,root,root) 

%if 0%{?suse_version} <= 01130

%files -f file-lists/mono_list.txt mono
%defattr(-,root,root)
%endif

%files -f file-lists/pyuno_list.txt pyuno 
%defattr(-,root,root) 
%lo_prefix/%lo_home/share/extensions/script-provider-for-python
%python_sitelib/uno.py
%python_sitelib/unohelper.py

%files -f file-lists/testtool_list.txt testtool 
%defattr(-,root,root) 

%files -f file-lists/gnome_list.txt gnome
%defattr(-,root,root) 

%files -f file-lists/kde_list.txt kde
%defattr(-,root,root) 

%files -f file-lists/kde4_list.txt kde4
%defattr(-,root,root) 

%files -f file-lists/officebean_list.txt officebean
%defattr(-,root,root) 
%lo_prefix/%lo_home/share/extensions/script-provider-for-beanshell

%if %lo_build_sdk == yes 

%files -f file-lists/sdk_list.txt sdk 
%defattr(-,root,root) 

%files -f file-lists/sdk_doc_list.txt sdk-doc 
%defattr(-,root,root) 
%endif 

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

%if 0%{?suse_version} >= 01120

%files base-drivers-mysql
%defattr(-,root,root)
%lo_prefix/%lo_home/share/extensions/mysql-connector-ooo
%endif

%files calc-extensions
%defattr(-,root,root)
%doc README-scsolver.txt
%lo_prefix/%lo_home/share/extensions/ConvertTextToNumber
%lo_prefix/%lo_home/share/extensions/NLPSolver
%lo_prefix/%lo_home/share/extensions/numbertext-%{numbertext_version}

%files draw-extensions
%defattr(-,root,root)
%lo_prefix/%lo_home/share/extensions/pdfimport

%files impress-extensions
%defattr(-,root,root)
%lo_prefix/%lo_home/share/extensions/presentation-minimizer
%lo_prefix/%lo_home/share/extensions/presenter-screen

%files writer-extensions
%defattr(-,root,root)
%lo_prefix/%lo_home/share/extensions/gdocs_%{gdocs_version}_modified
%lo_prefix/%lo_home/share/extensions/wiki-publisher

%files -f file-lists/icon_themes_prebuilt.txt icon-themes-prebuilt 
%defattr(-,root,root) 

%files -f file-lists/l10n-prebuilt.txt l10n-prebuilt 
%defattr(-,root,root)

%changelog
openSUSE Build Service is sponsored by