File libreoffice-bootstrap.spec of Package libreoffice-bootstrap

#
# spec file for package libreoffice-bootstrap
#
# 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-bootstrap
# allow to use xulrunner191 on SLED11-SP1 (bnc#540726)
%define		use_xulrunner191	no
BuildRequires:  ImageMagick ant ant-apache-regexp 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 patch perl-Archive-Zip perl-Compress-Zlib postgresql-devel python-devel recode unixODBC-devel unzip xml-commons-apis zip
############################
# basic stuff
%if 0%{?suse_version}
BuildRequires:  db-devel krb5 openldap2-devel python-xml xorg-x11
# 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 krb5-devel openldap-devel
BuildRequires:  xorg-x11-server-devel
BuildRequires:  xorg-x11-proto-xproto
BuildRequires:  xorg-x11-utils
BuildRequires:  libjpeg-devel libxslt-devel openssl-devel pkgconfig(gl) pkgconfig(glu) pkgconfig(xau) pkgconfig(xaw7)
BuildRequires:  db4-devel krb5-devel openldap-devel
%endif
############################
# KDE3 stuff
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
BuildRequires:  kdelibs3-devel
%endif
############################
# cppunit stuff
%if 0%{?suse_version} >= 01100
BuildRequires:  libcppunit-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
############################
# mozilla stuff
%if 0%{?suse_version} > 01130 
BuildRequires:  mozilla-xulrunner192-devel
%endif
%if 0%{?suse_version} <= 01130
%if 0%{?suse_version} > 01110 || %use_xulrunner191 == yes
BuildRequires:  mozilla-xulrunner191-devel
%endif 
%endif
%if 0%{?suse_version} > 01100 && 0%{?suse_version} <= 01110 && %use_xulrunner191 != yes
BuildRequires:  mozilla-xulrunner190-devel
%endif 
%if 0%{?suse_version} > 01010 && 0%{?suse_version} <= 01100
BuildRequires:  mozilla-xulrunner181-devel
%endif
%if 0%{?suse_version} > 01000 && 0%{?suse_version} <= 01010
BuildRequires:  gecko-sdk mozilla-xulrunner
%endif
%if 0%{?meego_version}
BuildRequires:  xulrunner-devel
%endif
############################
# 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 libwpd-devel libwpg-devel libwps-devel
%endif
############################
# CODE10 features
############################
%if 0%{?suse_version} > 01000
BuildRequires:  gstreamer010-plugins-base-devel sablot-devel xalan-j2 xerces-j2 xml-commons-apis
%endif
%if 0%{?meego_version}
BuildRequires:  gst-plugins-base-devel sablot-devel xalan-j2 xerces-j2 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 ooo_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       ooo_langs		""
%else
%if %test_build_langs == 1
%define       ooo_langs		"en-US cs de hu ja"
%else
%define       ooo_langs		"en-US af ar be-BY bg br ca cs cy da de el en-GB en-ZA es et fi fr ga gl gu he hi-IN 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       ooo_poor_help_localizations "af bg be-BY 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		ooo_build_sdk 		no
%else
%if 0%{?suse_version} > 01010 || 0%{?sles_version} == 010 || 0%{?meego_version}
%define		ooo_build_sdk 		yes
%else
%define		ooo_build_sdk 		no
%endif
%endif
# java stuff
%define	      with_java		yes
%define	      use_gij		no
# 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
# we would like to support also a non-conflicting OOo2 package
%define	      ooo_bin_suffix	no
# 
%define	      ooo_build_version 3.3.1.2
%define	      ooo_piece_version 3.3.1.2
%define	      ooo_build_dir	build
%define       ooo_sourcedirname libreoffice-%ooo_piece_version
%define	      ooo_prefix	%_libdir
%define	      ooo_home		libreoffice
%define	      ooo_basis_dir	basis3.3
License:        Artistic ; BSD3c ; GPLv2+ ; LPPL .. ; LGPLv2.1+ ; LGPLv3 ; MPL .. ; MIT
Group:          Productivity/Office/Suite
Version:        3.3.1.2
Release:        1.<RELEASE2>
AutoReqProv:    on
# we use the tool "free" to detect the available memory and reduce the parallelism is needed
# too high parallelism caused troubles in the Build Service
Requires:       procps
Provides:       OpenOffice_org-bootstrap = %version
Obsoletes:      OpenOffice_org-bootstrap <= %version
Summary:        LibreOffice Build Bootstrap
Url:            http://www.documentfoundation.org/
Source0:        libreoffice-build-%ooo_build_version.tar.gz
Source1:        libreoffice-bootstrap-%ooo_piece_version.tar.bz2
# hacked soures from setup_native
Source30:       setup_native_packinfo-3.3.1.1.tar.bz2
# Hmm, rpmlint complains about devel files in non-devel package
# We would like to keep the -bootstrap package name
# So we need to disable these rpmlint checks
Source100:      %name-rpmlintrc
# jsr173_1.0_api.jar can't be built with Java-1.4 on SLED10 easily
Source150:      jsr173_1.0_api.jar
#
# patches against libreoffice-build
# Patch0:       libreoffice-build-3.3.0.1-enable-foo.diff	# example
Patch0:         libreoffice-build-3.2.99.2-extensions-hack.diff
Patch1:         libreoffice-build-3.3.1.1-setup-native.diff
Patch2:         libreoffice-build-3.3.1.1-enable-kde4-support.diff
# allow to use xulrunner191 on SLED11-SP1 (bnc#540726)
Patch500:       ooo-build-3.1.99.2-xulrunner-1.9.1.diff
# FIXME: fix the python UNO components registration on SLED10
Patch900:       piece-disable-pyuno-registration.diff
# compile sal/rtl/source with -O2 on MeeGo; File/Wizards/Letter crashed when compiled with -Os, see http://bugs.meego.com/show_bug.cgi?id=2652
Patch901:       sal-rtl-compiler-optimization-meego.diff
# slower patching to debug and hopefully fix parallel build of ct2n extension; always happened only in the Build Service (bnc#595550)
Patch902:       solenv-carefull-patching-hack.diff
# FIXME: make it configurable in integrate into git
Patch903:       officecfg-help-in-usr-share.diff
# FIXME: temporary disable mono-loader build until the dependency on comphelper is removed
Patch904:       cli_ure-disable-mono-loader.diff
# FIXME: fix EMP+ import (bnc#650049)
Patch960:       svtools-enable-emfplus.diff
Patch961:       vcl-use-canvas-bool.diff
Patch962:       drawinglayer-metadata-decomposition.diff
Patch963:       canvas-polygon-access-out-of-range.diff
#
# patches against the upstream sources, must be -p0
# Patch1000:    bug-123456-fix-foo.diff		# example
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
ExclusiveArch:  %ix86 x86_64 ppc

%description
This packages provides the basic tools and framework for building
LibreOffice using separate source packages.



%prep
%if %prepare_build == 0
%setup -D -T -q -n libreoffice-build-%ooo_build_version
%else
%setup -q -n libreoffice-build-%ooo_build_version
#
# apply patches against libreoffice-build
# %patch0	# example
%patch0
%patch1
%patch2
install -m 644 %{S:1} %{S:30} src/
%if 0%{?suse_version} == 01010
install -m 644 %{S:150} src/
%endif
%if %use_xulrunner191 == yes
# allow to use xulrunner191 on SLED11-SP1 (bnc#540726)
%patch500
%endif
%if 0%{?suse_version} == 01010
# temporary disable registration of python components on SLED10
cp %{P:900} patches/hotfixes
%endif
%if 0%{?meego_version}
# compile sal/rtl/source with -O2 on MeeGo; File/Wizards/Letter crashed when compiled with -Os, see http://bugs.meego.com/show_bug.cgi?id=2652
cp %{P:901} patches/hotfixes
%endif
cp %{P:902} patches/hotfixes
cp %{P:903} patches/hotfixes
cp %{P:904} patches/hotfixes
# EMF+ stuff
cp %{P:960} patches/hotfixes
cp %{P:961} patches/hotfixes
cp %{P:962} patches/hotfixes
cp %{P:963} patches/hotfixes
%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
#
# run autoreconf to make sure that everything works correctly on current system
# also the autoconf stuff might have been patched
autoreconf -fi
%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, ...
export ARCH_FLAGS="`echo $RPM_OPT_FLAGS | sed -e 's/\-O[0-9s]//g' -e 's/\-fexceptions//g'` -fno-strict-aliasing"
# FIXME: genccode from the system icu is in /usr/sbin
export PATH="$PATH:/usr/sbin"
%if %prepare_build != 0
./configure $PARALLEL_BUILD \
	--with-arch-flags="$ARCH_FLAGS" \
	--with-split \
	--with-piece=bootstrap \
	--libdir=%{_libdir} \
	--prefix=%{_prefix} \
	--mandir=%{_mandir} \
	--sysconfdir=/etc \
	--with-docdir=%{_docdir}/%{name} \
	--with-binsuffix=%ooo_bin_suffix \
	--with-installed-ooo-dirname=%ooo_home \
	--with-distro="$with_distro" \
%if 0%{?suse_version} && 0%{?suse_version} <= 01030
	--with-intro-bitmaps="%{S:140} %{S:142}" \
	--with-about-bitmaps="%{S:141} %{S:143}" \
%endif
	--with-source-version=%ooo_piece_version \
	--without-git \
	--without-download \
	--with-lang=%ooo_langs \
	--with-poor-help-localizations=%ooo_poor_help_localizations \
	--with-mono-gac-root=%{_prefix}/lib \
	--with-compat-oowrappers \
%if %test_build_binfilters != 0
	--enable-binfilter \
%endif
%if %with_java == no
	--with-java=no \
	--with-jdk-home="" \
%else
%if %use_gij == yes
	--with-java=gij \
	--with-jdk-home=/usr \
%else
	--with-java=java \
	--with-jdk-home=$JAVA_HOME \
	--with-java-target-version=%java_target_version \
%endif
%endif
%if %ooo_build_sdk == yes
	--enable-odk \
%endif
%if 0%{?suse_version} && 0%{?suse_version} <= 01030
	--with-additional-sections="PostgreSQL" \
%endif
%if 0%{?meego_version}
	--with-system-icu \
	--disable-kde4 \
%endif
%if 0%{?meego_version} || %suse_version > 1110
	--disable-kde \
%endif
%if 0%{?suse_version} > 01130
        --disable-mono \
%endif
%if %suse_version <= 1110
	--without-junit \
%endif
	--disable-access \
	--disable-post-install-scripts \
	--disable-strip \
	--disable-strip-solver \
	--enable-openxml \
	--disable-report-builder \
	--disable-pdfimport \
	--disable-presenter-console \
	--enable-build-noarch \
	--with-ct2n \
	--with-numbertext \
%if 0%{?suse_version}
	--with-system-mysql \
	--enable-mysql-connector \
%endif
%if 0%{?suse_version} > 01210
	--with-system-mysql-cppconn \
%endif
%if 0%{?suse_version} > 01030 || 0%{?meego_version}
	--enable-pdfimport \
%endif
	--enable-minimizer --enable-presenter-console \
	--enable-wiki-publisher --enable-ogltrans --enable-report-builder \
	--enable-split-app-modules \
	--enable-split-opt-features
%endif
# 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 install

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%dir %ooo_prefix/%ooo_home
%dir %ooo_prefix/%ooo_home/solver
%dir %ooo_prefix/%ooo_home/solenv
%dir %ooo_prefix/%ooo_home/build
%ooo_prefix/%ooo_home/solver/*
%ooo_prefix/%ooo_home/solenv/*
%ooo_prefix/%ooo_home/build/*
# noarch-related stuff
%dir %_datadir/%ooo_home
%dir %_datadir/%ooo_home/build
%_datadir/%ooo_home/build/*

%changelog
openSUSE Build Service is sponsored by