%define sourcedir stable/koffice-%{version}/src

Name: koffice
URL: http://koffice.kde.org/
Summary: Integrated office suite for KDE
Summary(ja): KDE 向け統合オフィススイート
Version: 1.6.3
Release: 2%{?_dist_release}
Epoch: 1
Source: ftp://ftp.kde.org/pub/kde/{sourcedir}/%{name}-%{version}.tar.bz2
Source1: %{name}-l10n-ja-%{version}.tar.bz2
Patch0: koffice-xpdf-CVE-2007-3387.diff
Patch1: koffice-1.6.3-xpdf2-CVE-2007-4352-5392-5393.diff
Group: Applications/Productivity
Obsoletes: killustrator kivio
License: GPL

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: qt-devel >= 3.3.2, kdelibs-devel >= 3.3, arts-devel >= 1:1.3
BuildRequires: aspell-devel >= 0.50.2, wv2-devel >= 0.1.8
BuildRequires: libjpeg-devel libmng-devel libtiff-devel zlib-devel
BuildRequires: libxml2-devel libxslt-devel freetype2-devel libart_lgpl-devel
BuildRequires: jasper-devel doxygen ImageMagick-devel pkgconfig
BuildRequires: libpng-devel libgsf-devel lcms-devel libexif-devel
BuildRequires: MySQL-devel postgresql-devel
#if %{?_dist_release} 
#BuildConflicts: ruby-devel
#else
BuildRequires: libpqxx-devel libtool-ltdl-devel ruby-devel
#endif
Requires: qt >= 3.3.2, kdelibs >= 3.3, arts >= 1:1.3
Requires: freetype2 libjpeg libtiff libmng libpng
Requires: zlib audiofile libxml2 libxslt
Requires: libart_lgpl aspell wv2
Prereq: ldconfig kdelibs

%description
KOffice is a collection of office applications linked together by a common
basis. This common basis assures that all office application can work
together. You can, for instance, insert a spreadsheet in your thesis without
leaving your document. Editing the spreadsheet happens _inside_ your thesis.

The applications currently included in KOffice are:
- KWord (Professional text editing) 
- KSpread (Professional number cruncher/spreadsheet)
- KPresenter (Professional presentation program)
- KChart (Graphing of your abstract data)
- Karbon (Vector graphics tool)
- Kugar (Database report creation)
- Kivio (Flowcharting program)
- Kexi (a database management tool)
- KOffice Workspace (A combination of all of the above)

%prep
%setup -q -n %{name}-%{version}
%patch0 -p0 -b .CVE-2007-3387
%patch1 -p0 -b .xpdf

%build
#only for beta
#make -f Makefile.cvs

unset QTDIR || : ; . /etc/profile.d/qt.sh
export KDEDIR=%{_prefix}

#CFLAGS="-D_GNU_SOURCE $RPM_OPT_FLAGS" \
#CXXFLAGS="-D_GNU_SOURCE $RPM_OPT_FLAGS -DNO_DEBUG -DNDEBUG -fno-check-new" \
#./configure --prefix=%{_prefix} \
#    --with-qt-libraries=$QTDIR/lib \
#    --disable-final \
#    --disable-pie \
#    --includedir=%{_includedir}/kde \
#    --disable-rpath
./configure --prefix=%{_prefix} \
  --includedir=%{_includedir}/kde \
  --with-qt-libraries=$QTDIR/lib \
  --disable-rpath --disable-dependency-tracking \
  --enable-new-ldflags \
  --disable-debug --disable-warnings \
  --with-pic --enable-shared --disable-static \
  --with-extra-libs=%{_libdir} \
  --with-pgsqllibdir=%{_libdir} --with-pgsqlincdir=%{_includedir} \
  --with-pqxxlibdir=%{_libdir} --with-pqxxincdir=%{_includedir} \
  --disable-final

make %{?_smp_mflags}

tar xjf %{SOURCE1}
cd %{name}-l10n-ja-%{version}
./configure --prefix=%{_prefix}
make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT
make RUN_KAPPFINDER=no DESTDIR=$RPM_BUILD_ROOT install

# Drop -x
chmod -x $RPM_BUILD_ROOT%{_datadir}/apps/kexi/kross/python/kexiapp/*
chmod -x $RPM_BUILD_ROOT%{_datadir}/apps/kexi/scripts/copycenter/*
chmod -x $RPM_BUILD_ROOT%{_datadir}/apps/kexi/scripts/exportxhtml/*
chmod -x $RPM_BUILD_ROOT%{_datadir}/apps/kexi/scripts/importxhtml/*
chmod -x $RPM_BUILD_ROOT%{_datadir}/apps/kexi/scripts/projectdocumentor/*
chmod -x $RPM_BUILD_ROOT%{_datadir}/apps/krita/scripts/changecs/*
chmod -x $RPM_BUILD_ROOT%{_datadir}/apps/krita/scripts/filterstest/*
chmod -x $RPM_BUILD_ROOT%{_datadir}/apps/krita/scripts/invertpython/*
chmod -x $RPM_BUILD_ROOT%{_datadir}/apps/krita/scripts/invertruby/*
chmod -x $RPM_BUILD_ROOT%{_datadir}/apps/krita/scripts/randompaint/*
chmod -x $RPM_BUILD_ROOT%{_datadir}/apps/krita/scripts/reshapehisto/*
chmod -x $RPM_BUILD_ROOT%{_datadir}/apps/krita/scripts/torturefilters/*
chmod -x $RPM_BUILD_ROOT%{_datadir}/apps/krita/scripts/torturepainting/*
chmod -x $RPM_BUILD_ROOT%{_datadir}/apps/kross/python/*.py
chmod -x $RPM_BUILD_ROOT%{_datadir}/apps/kross/python/RestrictedPython/*.py
chmod -x $RPM_BUILD_ROOT%{_datadir}/apps/kspread/scripts/exporthtml/*
chmod -x $RPM_BUILD_ROOT%{_datadir}/apps/kspread/scripts/scripteditor/*

# Replace absolute symlinks with relative ones
pushd $RPM_BUILD_ROOT%{_prefix}/share/doc/HTML/en
for i in *; do
    if [ -d $i -a -L $i/common ]; then
	rm -f $RPM_BUILD_ROOT%{_prefix}/share/doc/HTML/en/$i/common
	ln -s ../common $RPM_BUILD_ROOT%{_prefix}/share/doc/HTML/en/$i
    fi
done
popd

cd %{name}-l10n-ja-%{version}
make DESTDIR=$RPM_BUILD_ROOT install

%clean
rm -rf $RPM_BUILD_ROOT

%post
/sbin/ldconfig
kbuildsycoca &>/dev/null || :

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc AUTHORS COPYING INSTALL README
%doc %{_datadir}/doc/HTML/en/*
%{_bindir}/*
%{_includedir}/kde/*
%{_libdir}/*
%{_datadir}/applications
%{_datadir}/applnk
%{_datadir}/apps
%config %{_datadir}/config
%{_datadir}/config.kcfg
%{_datadir}/icons
%{_datadir}/locale/ja/LC_MESSAGES/*
%{_datadir}/mimelnk
%{_datadir}/services
%{_datadir}/servicetypes
%{_datadir}/templates

%changelog
* Fri May 22 2009 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.6.3-2
- added libtiff(-devel) to dependency.
- rebuilt with MySQL-5.1.34.

* Sat May  9 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.6.3-1
- applied new versioning policy
- spec in UTF-8

* Mon Nov 12 2007 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.6.3-0vl6
- rebuild for VineSeed

* Mon Nov 12 2007 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.6.3-0vl5
- add Patch1 (CVE-2007-4352, 5392, 5393)

* Thu Aug  2 2007 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.6.3-0vl4
- add Patch0 (CVE-2007-3387)

* Sat Jul 28 2007 NAKAMURA Kenta <kenta@vinelinux.org> 1.6.3-0vl3
- added --with-qt-libraries configure option

* Thu Jun 28 2007 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.6.3-0vl2
- rebuild for VineSeed

* Wed Jun 27 2007 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.6.3-0vl1
- new upstream release

* Tue Oct 10 2006 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.6.0-0vl1
- new upstream release

* Mon Sep 11 2006 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.5.91-0vl1
- new upstream release

* Mon Jul 10 2006 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.5.2-0vl2
- rebuild for VineSeed

* Mon Jul 10 2006 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.5.2-0vl1
- new upstream release
- drop obsolete patches

* Mon May 22 2006 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.5.1-0vl2
- rebuild for VineSeed

* Mon May 22 2006 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.5.1-0vl1
- new upstream release
- drop obsolete patches
- add BuildPrereq: libexif-devel
- add --disable-final to configure option
- add Patch0 and Patch1

* Tue Apr 25 2006 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.5.0-0vl3
- build with ruby-1.8.4-0vl1 on VineSeed
- add Buildprereq: ruby-devel for VineSeed

* Thu Apr  6 2006 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.5.0-0vl2
- rebuild for VineSeed

* Thu Apr  6 2006 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.5.0-0vl1
- new upstream release
- drop Patch1

* Fri Mar 24 2006 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.5.0-0vl0.rc1
- new upstream release
- drop Patch0
- add --disable-pie and --includedir=%%{_includedir}/kde to configure option
- add BuildConflicts: ruby-devel
- add Patch1
- update %%files

* Sun Mar 12 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.4.2-0vl4
- rebuild with libgsf-1.14.0-0vl1
- add Japanese summary

* Thu Jan  5 2006 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.4.2-0vl3
- add Patch0 (CAN-2005-3193)

* Thu Nov 17 2005 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.4.2-0vl2
- rebuild with libgsf-1.13.3-0vl1 and python-2.4.2-0vl4

* Tue Oct 18 2005 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.4.2-0vl1
- new upstream release
- remove all patches
- add SOURCE1 from snapshot

* Mon Sep 26 2005 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.4.1-0vl2
- add Patch0 - Patch8 to build with qt-3.3.5
- add BuildPrereq: libtool-ltdl-devel

* Thu Jul 21 2005 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.4.1-0vl1
- new upstream release

* Thu Jul  7 2005 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.4.0a-0vl1
- new upstream release
- remove i18n files
- add BuildPrereq: automake17
- add --disable-rpath to configure option

* Tue Apr 26 2005 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.3.91-0vl1
- new upstream release
- remove all patches
- add BuildPrereq: lcms-devel MySQL-devel postgresql-devel libpqxx-devel
- change Group to Applications/Productivity
- update Summary and description

* Mon Mar 21 2005 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.3.5-0vl8
- rebuild with KDE-3.4.0 (VineSeed)

* Mon Mar 21 2005 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.3.5-0vl7
- rebuild with KDE-3.4.0 (Vine3.1)
- clean up changelog to use (double-percent) everywhere

* Sat Jan 22 2005 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.3.5-0vl6
- rebuild for VineSeed

* Fri Jan 21 2005 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.3.5-0vl5
- add Patch1 (CAN-2005-0064)

* Fri Jan  7 2005 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.3.5-0vl4
- rebuild for VineSeed

* Fri Jan  7 2005 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.3.5-0vl3
- add patch0 (http://www.koffice.org/security/2004_xpdf_integer_overflow_2.php)

* Sun Jan  2 2005 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.3.5-0vl2
- rebuild for VineSeed

* Sun Jan  2 2005 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.3.5-0vl1
- new upstream release
- remove about ia64
- remove patch0

* Sun Oct 31 2004 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.3.4-0vl1
- source upgrade
- add Patch0 (security patch)

* Thu Aug 12 2004 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.3.2-0vl1
- source upgrade
- remove lines about vine26 
- add BuildPrereq: libgsf-devel

* Thu May  6 2004 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.3.1-0vl1
- source upgrade

* Sat May  1 2004 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.3-0vl3
- rebuild with kde-3.2.2

* Wed Mar 17 2004 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.3-0vl2
- rebuild with kde-3.2.1

* Wed Jan 21 2004 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.3-0vl1
- source upgrade

* Mon Dec 29 2003 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.2.95-0vl1
- source upgrade
- add BuildPrereq: jasper-devel doxygen ImageMagick-devel pkgconfig

* Mon Sep 29 2003 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.2.93-0vl1
- source upgrade

* Sat Sep 20 2003 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.2.92-0vl2
- rebuild with kdelibs-3.1.4 and gcc-3.2.3

* Fri Aug 15 2003 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.2.92-0vl1
- source upgrade
- BuildPrereq: wv2-devel >= 0.1.8 and add Requires: wv2

* Mon Jul 21 2003 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.2.91-0vl1
- source upgrade
- built with libpng >= 1.2.5 when %%{vine26} is set to 0 (ie VineSeedPlus)
- change spec to build with gcc295
- remove patch
- add BuildPrereq: aspell-devel >= 0.50.2 and Requires: aspell
- add BuildPrereq: wv2-devel

* Mon May 19 2003 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.2.1-0vl4
- rebuild with kdelibs-3.1.2

* Thu Apr  4 2003 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.2.1-0vl3
- rebuild with kdelibs-3.1.1

* Sat Feb  8 2003 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.2.1-0vl2
- add patch

* Fri Feb  7 2003 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.2.1-0vl1
- source upgrade
- change spec to build both VineSeed and Vine2.5/2.6

* Wed Oct 16 2002 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.2-0vl3
- objprelink2 support only ix86 (add %%ifarch %%{ix86} ... )

* Wed Oct  9 2002 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.2-0vl2
- rebuild with qt-3.0.5-0vl1
- BuildPrereq: autoconf253

* Mon Sep 23 2002 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.2-0vl1
- source upgrade
- no file conflicts from other package (maybe)
- add BuildPrereq: objprelink2 instead of objprelink (obsolete) 
- add BuildPrereq: libart_lgpl-devel and Requires: libart_lgpl
- add %%doc section

* Fri Jul  5 2002 AKIYAMA Kazuhito <akiyama@karen.servepics.com> 1.1.1-1vl3
- add koffice-i18n-ja-1.1.1

* Thu May  2 2002 AKIYAMA Kazuhito <akiyama@karen.servepics.com> 1.1.1-1vl2
- source upgrade to 1.1.1
- delete some .desktop files (they conflict files from kdelibs)

* Sun Mar 31 2002 AKIYAMA Kazuhito <akiyama@karen.servepics.com> 1.1.1-1vl1
- merged with rawhide 1.1-0.cvs20010725.1
- source update to cvs-20020329
- add BuildPrereq: autoconf252 automake15
- add Epoch:1
- There is Vine's previous changes, hacked for Vine 
 -- Wed Dec 5 2001 AKIYAMA Kazuhito <akiyama@karen.servepics.com> 1.1-6vl1
  - Delete Epoch
  - Change BuildRequires and Requires
  - Build for VineSeed

* Wed Jul 25 2001 Bernhard Rosenkraenzer <bero@redhat.com> 1.1-0.cvs20010725.1
- Increase Epoch

* Tue Jul 24 2001 Bernhard Rosenkraenzer <bero@redhat.com> 1.1-0.cvs20010724.1
- Don't build kivio on ia64 ATM (compiler bug)

* Tue Feb 20 2001 Than Ngo <than@redhat.com>
- update 2.1
- fix dangling symlinks

* Fri Feb  2 2001 Bernhard Rosenkraenzer <bero@redhat.com>
- Add ldconfig in %%post and %%postun, replace absolute symlinks
  with relative symlinks (#24878)

* Mon Jan 22 2001 Bernhard Rosenkraenzer <bero@redhat.com>
- Update

* Thu Jan 11 2001 Bernhard Rosenkraenzer <bero@redhat.com>
- Update
- Don't build on sparc and ia64 (Bug #23809)

* Sun Dec  3 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- 2.0.1

* Fri Nov  3 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- Update to KDE_2_0_BRANCH

* Mon Oct 16 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- 2.0 final

* Tue Oct  3 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- 2.0

* Mon Oct  2 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- new CVS
- fix compilation

* Thu Aug 24 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- kill dupes from kdelibs

* Thu Aug 24 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- 1.93

* Sun Aug  6 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- update (fixed compilation with gcc 2.96 in CVS)
- work around compiler bugs on alpha

* Fri Aug  4 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- new snapshot
- move to /usr/lib/kde2

* Thu Jul 27 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- rebuild

* Tue Jul 25 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- new snapshot

* Sun Jul 23 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- new snapshot, new Qt

* Thu Jul 13 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- Don't hardcode Qt version
- obsolete killustrator (powertools 6.x)
- SMPify

* Tue Jul 11 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- use gcc 2.96
- new snapshot

* Mon Jul  3 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- use kernelcc
- new snapshot

* Tue Jun 20 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- new snapshot
- ExcludeArch ia64

* Sat Mar 18 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- new snapshot
- move it to /usr, where it belongs

* Sat Oct 23 1999 Bernhard Rosenkraenzer <bero@redhat.de>
- Initial RPM
