%define debug 0

%define build_for_ftp 0

%define strip_bin 0
%define final 0
%define rpm_clean 1

%define desktop_file 1
%define desktop_file_utils_version 0.2.93

%define monolithic 1

%define kpovmodeler 1

%define kfract 0

%define no_scanner_archs s390 s390x

Version: 3.1
Release: 4
Name: kdegraphics
Summary: K Desktop Environment - Graphics Applications
Epoch: 7
Group: Applications/Multimedia
BuildRoot: %{_tmppath}/%{name}-buildroot
License: GPL

Source: ftp://ftp.kde.org/pub/kde/stable/%{version}/src/%{name}-%{version}.tar.bz2
Patch0: kde-libtool.patch

%if %{build_for_ftp}
ExclusiveArch: %{ix86}

%ifarch %{scanner_archs}
BuildRequires: sane-backends-devel >= 1.0.3-10
BuildRequires: gphoto2-devel

%if %{kpovmodeler}
BuildRequires: glut-devel
BuildRequires: kdelibs-devel >= %{version}
BuildRequires: zlib-devel
BuildRequires: libjpeg-devel
BuildRequires: libpng-devel
BuildRequires: libtiff-devel
BuildRequires: imlib-devel

%if %{desktop_file}
BuildRequires: desktop-file-utils >= %{desktop_file_utils_version}

Requires: kdelibs >= 6:%{version}-6
Requires: kdebase >= 6:%{version}-6

Obsoletes: kamera
Obsoletes: kcoloredit
Obsoletes: kdvi
Obsoletes: kfax
Obsoletes: kfile-pdf
Obsoletes: kfile-png
Obsoletes: kfract
Obsoletes: kghostview
Obsoletes: kiconedit
Obsoletes: kooka
Obsoletes: kpaint
Obsoletes: kruler
Obsoletes: ksnapshot
Obsoletes: kuickshow
Obsoletes: kview
Obsoletes: kviewshell
Obsoletes: libkscan

Provides: kamera
Provides: kcoloredit
Provides: kdvi
Provides: kfax
Provides: kfile-pdf
Provides: kfile-png
Provides: kfract
Provides: kghostview
Provides: kiconedit
Provides: kooka
Provides: kpaint
Provides: kruler
Provides: ksnapshot
Provides: kuickshow
Provides: kview
Provides: kviewshell
Provides: libkscan

Graphics applications for the K Desktop Environment.

  kdvi (displays TeX .dvi files)
  kfax (displays faxfiles)
  kghostview (displays postscript files)
  kcoloredit (palette editor and color chooser)
  kamera (digital camera support)
  kiconedit (icon editor)
  kpaint (a simple drawing program)
  ksnapshot (screen capture utility)
  kview (image viewer for GIF, JPEG, TIFF, etc.)
  kuickshow (quick picture viewer)
  kooka (scanner application)
  kruler (screen ruler and color measurement tool)

%package devel
Summary: Development files for kdegraphics
Requires: %{name} = %{version}-%{release}
Group: Development/Libraries

Obsoletes: kviewshell-devel
Obsoletes: libkscan-devel

Provides: kviewshell-devel
Provides: libkscan-devel

%description devel
Graphic applications for the K Desktop Environment.
This package contains header files for developing applications using kdegraphics.

%package -n kamera
Summary: Digital camera support for KDE
Group: Applications/Multimedia
Requires: gphoto2

%description -n kamera
Kamera adds support for digital cameras to KDE.
After installing kamera, you can access your digital camera just like
a filesystem from KDE applications.

%package -n kcoloredit
Summary: KDE palette editor and color chooser
Group: Applications/Multimedia
Obsoletes: kdegraphics

%description -n kcoloredit
KDE palette editor and color chooser.
kcoloredit can be used by other programs (and scripts) to pick a color or
edit a palette.

%package -n kdvi
Summary: KDE DVI (TeX output) file viewer
Group: Applications/Publishing
Obsoletes: kdegraphics

%description -n kdvi
A DVI (TeX output) file viewer for KDE.

%package -n kfax
Summary: KDE Fax viewer
Group: Applications/Communications
Obsoletes: kdegraphics

%description -n kfax
A KDE viewer for incoming faxes

%package -n kfile
Summary: KFile module for reading image file
Group: Applications/File
Obsoletes: kfile-png
Obsoletes: kfile-pdf

%description -n kfile
The KFile plugin allows all applications using KFile (e.g. Konqueror) to
view information on image files.

%package -n kfract
Summary: KDE Fractal Generator
Group: Applications/Engineering
Obsoletes: kdegraphics

%description -n kfract
A Fractal generator for KDE

%package -n kghostview
Summary: PostScript viewer for KDE
Group: Applications/Publishing
Obsoletes: kdegraphics

%description -n kghostview
A PostScript and PDF file viewer for KDE.
In addition to being a standalone viewer application, kghostview acts as
a Konqueror plugin.

%package -n kiconedit
Summary: An icon editor for creating KDE icons
Group: Applications/Multimedia
Obsoletes: kdegraphics

%description -n kiconedit
An icon editor for creating KDE icons

%package -n kooka
Summary: KDE scanner application
Group: Applications/Multimedia
Requires: libkscan = %{version}-%{release}, sane-backends

%description -n kooka
Kooka is a KDE application for previewing, cutting and receiving images
from a scanner.

%package -n kpaint
Summary: A simple paint program for KDE
Group: Applications/Multimedia
Obsoletes: kdegraphics

%description -n kpaint
A simple bitmap paint program for KDE.

%package -n kruler
Summary: A screen ruler and color measurement tool
Group: Applications/Multimedia
Obsoletes: kdegraphics

%description -n kruler
A screen ruler and color measurement tool

%package -n ksnapshot
Summary: A KDE applet for taking snapshots of the desktop
Group: Applications/Multimedia
Obsoletes: kdegraphics

%description -n ksnapshot
A KDE applet for taking screenshots.
ksnapshot allows both capturing the whole desktop and capturing just
the active window.

%package -n kuickshow
Summary: Quick picture viewer for KDE
Group: Applications/Multimedia
Obsoletes: kdegraphics

%description -n kuickshow
Kuickshow is a picture viewer for KDE. It displays the directory structure,
displaying images as thumbnails.
Clicking on an image shows the image in its normal size.

%package -n kview
Summary: KDE Image Viewer
Group: Applications/Multimedia
Obsoletes: kdegraphics

%description -n kview
KView is a KDE image viewer, supporting a wide range of graphics file formats.

%package -n kviewshell
Summary: Plugin integration for KView
Group: Applications/Multimedia
Requires: kview
Obsoletes: kdegraphics

%description -n kviewshell
KViewShell allows the kview image viewer to be embedded into other KDE

%package -n kviewshell-devel
Summary: Development files for kviewshell
Group: Development/Libraries
Requires: kviewshell
Obsoletes: kdegraphics-devel

%description -n kviewshell-devel
Development files for KViewShell.
Install kdegraphics-kviewshell-devel if you wish to develop or compile
applications using kviewshell.

%package -n libkscan
Summary: KDE library for scanner support.
Group: Applications/Multimedia
Requires: sane-backends
Obsoletes: kdegraphics

%description -n libkscan
KDE library for scanner support.

%package -n libkscan-devel
Summary: Development files for libkscan
Group: Applications/Multimedia
Requires: libkscan = %{version}-%{release}
Obsoletes: kdegraphics-devel

%description -n libkscan-devel
Development files for libkscan - install kdegraphics-libkscan-devel if
you wish to develop or compile applications using libkscan.

%package -n kmrml
Summary: MRML (Multimedia Retrieval Markup Language) client
Group: Applications/Multimedia

%description -n kmrml
This package contains an MRML (Multimedia Retrieval Markup Language, http://www.mrml.net/) client
for Konqueror.

%package -n kpovmodeler
Summary: Model editor for the PovRay raytracer
Group: Applications/Multimedia

%description -n kpovmodeler
This package contains a model editor for the PovRay raytracer.

%setup -q
%patch0 -p1 -b .libtool

# Workaround for legacy auto* tools
[ -x /usr/bin/autoconf-2.5? ] && ln -s /usr/bin/autoconf-2.5? autoconf
[ -x /usr/bin/autoheader-2.5? ] && ln -s /usr/bin/autoheader-2.5? autoheader
[ -x /usr/bin/aclocal-1.5 ] && ln -s /usr/bin/aclocal-1.5 aclocal
[ -x /usr/bin/automake-1.5 ] && ln -s /usr/bin/automake-1.5 automake
export PATH=`pwd`:$PATH
# End workaround

test -f Makefile.cvs && make -f Makefile.cvs

export PATH=`pwd`:$PATH
export CXXFLAGS="$RPM_OPT_FLAGS -fno-use-cxa-atexit"
export KDEDIR=%{_prefix}
unset QTDIR || : ; . /etc/profile.d/qt.sh

%configure \
   --with-qt-libraries=$QTDIR/lib \
   --enable-final \
   --includedir=/usr/include/kde \
   --with-xinerama \
%ifnarch %{no_scanner_archs}
   --with-kamera \

make %{?smp_mflags}



pushd $RPM_BUILD_ROOT/usr/share/doc/HTML/en
for i in *; do
   if [ -d $i -a -L $i/common ]; then
      rm -f $i/common
      ln -sf ../common $i

# move desktop files back
pushd $RPM_BUILD_ROOT%{_datadir}/applnk
for i in `find . -name "More"`; do
   if /bin/ls $i/*.desktop >& /dev/null ; then
      pushd $i
      for j in *.desktop ; do
         grep "Hidden=true" $j >& /dev/null || mv -f $j ..

%if ! %{kpovmodeler}
rm -rf $RPM_BUILD_ROOT%{_docdir}/HTML/en/kpovmodeler

%if %{desktop_file}
mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications

desktop-file-install --vendor kde \
   --dir $RPM_BUILD_ROOT%{_datadir}/applications \
   --delete-original \
   --add-category "Application;Graphics;X-Red-Hat-Base" \
   --copy-generic-name-to-name \
   $RPM_BUILD_ROOT%{_datadir}/applnk/Graphics/kcoloredit.desktop \
   $RPM_BUILD_ROOT%{_datadir}/applnk/Graphics/kdvi.desktop \

desktop-file-install --vendor kde \
   --dir $RPM_BUILD_ROOT%{_datadir}/applications \
   --delete-original \
   --add-category "Application;Graphics;X-Red-Hat-Base" \
   --copy-generic-name-to-name \
   --add-only-show-in KDE \

desktop-file-install --vendor kde \
   --dir $RPM_BUILD_ROOT%{_datadir}/applications \
   --delete-original \
   --add-category "Application;Graphics;X-Red-Hat-Extra" \

desktop-file-install --vendor kde \
   --dir $RPM_BUILD_ROOT%{_datadir}/applications \
   --delete-original \
   --add-category "Application;Graphics;X-Red-Hat-Extra" \
   --copy-generic-name-to-name \
   $RPM_BUILD_ROOT%{_datadir}/applnk/Graphics/kghostview.desktop \
   $RPM_BUILD_ROOT%{_datadir}/applnk/Graphics/kiconedit.desktop \
   $RPM_BUILD_ROOT%{_datadir}/applnk/Graphics/kpaint.desktop \
   $RPM_BUILD_ROOT%{_datadir}/applnk/Graphics/kruler.desktop \
   $RPM_BUILD_ROOT%{_datadir}/applnk/Graphics/kview.desktop \
%if "%{kpovmodeler}" == "1"
   $RPM_BUILD_ROOT%{_datadir}/applnk/Graphics/kpovmodeler.desktop \
%ifnarch %{no_scanner_archs}
   $RPM_BUILD_ROOT%{_datadir}/applnk/Graphics/kooka.desktop \

for i in Accessibility Components FileBrowsing Information LookNFeel Network \
   Peripherals Personalization PowerControl Sound WebBrowsing Security \
   Desktop LookNFeel/Desktop LookNFeel/Themes LookNFeel/Windows System; do
   case $i in
      Accessibility) catagory="X-KDE-Accessibility";;
      FileBrowsing) catagory="X-KDE-FileBrowsing";;
      Databases) catagory="X-KDE-Database";;
      Desktop) catagory="X-KDE-Desktop";;
      Help) catagory="X-KDE-Help";;
      Information) catagory="X-KDE-Information";;
      LookNFeel) catagory="X-KDE-LookNFeel";;
      LookNFeel/Desktop) catagory="X-KDE-LookNFeel-Desktop";;
      LookNFeel/Themes) catagory="X-KDE-LookNFeel-Theme";;
      LookNFeel/Windows) catagory="X-KDE-LookNFeel-Window";;
      Network) catagory="X-KDE-Network";;
      Peripherals) catagory="X-KDE-Peripherals";;
      Personalization) catagory="X-KDE-Personalization";;
      Components) catagory="X-KDE-Components";;
      Security) catagory="X-KDE-Security";;
      PowerControl) catagory="X-KDE-PowerControl";;
      Sound) catagory="X-KDE-Sound";;
      System) catagory="X-KDE-System";;
      WebBrowsing) catagory="X-KDE-WebBrowsing";;
   if /bin/ls $RPM_BUILD_ROOT%{_datadir}/applnk/Settings/$i/*.desktop >& /dev/null ; then
     desktop-file-install --vendor kde \
       --dir $RPM_BUILD_ROOT%{_datadir}/applications \
       --delete-original \
       --add-category "$catagory" \
       --add-only-show-in KDE \

%ifnarch %{no_scanner_archs}
mkdir -p $RPM_BUILD_ROOT%{_datadir}/apps/kcontrol/applnk
mv $RPM_BUILD_ROOT%{_datadir}/applnk/Settings \

rm -rfv $RPM_BUILD_ROOT%{_datadir}/applnk


%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%doc %{_docdir}/HTML/en/*
%ifnarch %{no_scanner_archs}
%if %{desktop_file}

%files devel

* Mon Feb 24 2003 Elliot Lee <sopwith@redhat.com>
- debuginfo rebuild

* Fri Feb 21 2003 Than Ngo <than@redhat.com> 3.1-3
- get rid of gcc path from dependency_libs

* Wed Feb 19 2003 Elliot Lee <sopwith@redhat.com>
- BuildRequires: glut-devel if kpovmodeler

* Tue Jan 28 2003 Than Ngo <than@redhat.com> 3.1-1
- 3.1 release
- remove excludearch ia64
- remove some unneeded macros

* Wed Jan 22 2003 Tim Powers <timp@redhat.com>
- rebuilt

* Mon Jan 13 2003 Thomas Woerner <twoerner@redhat.com> 3.1-0.3
- rc6
- exclude ia64

* Thu Nov 28 2002 Than Ngo <than@redhat.com> 3.1-0.2
- fix desktop file issues
- get rid of su packages

* Sun Nov 24 2002 Than Ngo <than@redhat.com> 3.1-0.1
- update to 3.1 rc4

* Sun Nov 10 2002 Than Ngo <than@redhat.com> 3.0.5-1
- update to 3.0.5

* Tue Oct 15 2002 Than Ngo <than@redhat.com> 3.0.4-1
- 3.0.4

* Sun Aug 25 2002 Florian La Roche <Florian.LaRoche@redhat.de>
- compile on mainframe

* Wed Aug 14 2002 Florian La Roche <Florian.LaRoche@redhat.de>
- change spec file to work for more archs

* Mon Aug 12 2002 Than Ngo <than@redhat.com> 3.0.3-1
- 3.0.3
- build using gcc-3.2-0.3

* Fri Aug  9 2002 Than Ngo <than@redhat.com> 3.0.2-4
- desktop files issues (bug #71018)

* Tue Jul 23 2002 Tim Powers <timp@redhat.com> 3.0.2-3
- build using gcc-3.2-0.1

* Sat Jul 20 2002 Than Ngo <than@redhat.com> 3.0.2-2
- fix desktop files issue

* Tue Jul 09 2002 Than Ngo <than@redhat.com> 3.0.2-1
- 3.0.2
- use desktop-file-install

* Fri Jun 21 2002 Tim Powers <timp@redhat.com>
- automated rebuild

* Sun May 26 2002 Tim Powers <timp@redhat.com>
- automated rebuild

* Tue May 14 2002 Bernhard Rosenkraenzer <bero@redhat.com> 3.0.1-1
- 3.0.1

* Tue Apr 16 2002 Bernhard Rosenkraenzer <bero@redhat.com> 3.0.0-5
- rename libraries

* Mon Apr  8 2002 Bernhard Rosenkraenzer <bero@redhat.com> 3.0.0-4
- Fix libkviewpart.* duplication (kview and kviewshell, #62749)
- Shut up rpmlint

* Fri Mar 29 2002 Bernhard Rosenkraenzer <bero@redhat.com> 3.0.0-3
- Obsolete the old monolithic package
- Fix build with gcc 3.1

* Thu Mar 28 2002 Than Ngo <than@redhat.com> 3.0.0-2
- fix deps problem

* Wed Mar 27 2002 Bernhard Rosenkraenzer <bero@redhat.com> 3.0.0-1
- 3.0.0 final

* Thu Mar 21 2002 Bernhard Rosenkraenzer <bero@redhat.com> 3.0.0-0.cvs20020321.1
- Add docs for kooka and kuickshow and kfile PostScript plugin

* Wed Mar  6 2002 Bernhard Rosenkraenzer <bero@redhat.com> 3.0.0-0.cvs20020306.1
- Update
- Rename subpackages
- Don't build kamera on alpha

* Wed Dec 26 2001 Bernhard Rosenkraenzer <bero@redhat.com> 3.0.0-0.cvs20011226.1
- Update
- Reorganize package

* Thu Jul 26 2001 Bernhard Rosenkraenzer <bero@redhat.com> 2.2-0.cvs20010726.1
- The -devel package has kscan-related files -n only. Since kscan isn't built
  on s390/s390x, don't build the devel package there.

* Tue Jul 24 2001 Bernhard Rosenkraenzer <bero@redhat.com> 2.2-0.cvs20010724.1
- Add more build dependencies (#48970)
- Remove ia64 workarounds, no longer needed
- Update

* Mon Jul 23 2001 Bernhard Rosenkraenzer <bero@redhat.com> 2.2-0.cvs20010723.1
- Restore -devel package, got lost during the update
- Fix build on s390/s390x
- Update

* Sun Jul 22 2001 Bernhard Rosenkraenzer <bero@redhat.com> 2.2-0.cvs20010722.2
- Make symlinks relative
- Update

* Wed Feb 21 2001 Bernhard Rosenkraenzer <bero@redhat.com>
- 2.1-respin

* Tue Feb 20 2001 Bernhard Rosenkraenzer <bero@redhat.com>
- 2.1

* Fri Feb 16 2001 Than Ngo <than@redhat.com>
- fix to build against glibc

* Tue Feb  6 2001 Bernhard Rosenkraenzer <bero@redhat.com>
- Get rid of libkdefakes.so.0 dependency

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

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

* Wed Dec 20 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- Update
- Stop excluding ia64

* Wed Nov 15 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- Update to HEAD

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

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

* Thu Aug 24 2000 Than Ngo <than@redhat.com>
- update to kdegraphics-1.93

* Sun Aug 20 2000 Than Ngo <than@redhat.com>
- add missing kdegraphic2 package

* Mon Aug  7 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- new version

* Tue Jul 25 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- new snapshot
- work around compiler bug by disabling kcoloredit for now, FIXME

* Fri Jul 21 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- new snapshot
- SMPify build

* Sun Jul 16 2000 Than Ngo <than@redhat.de>
- use gcc 2.96
- new snapshot
- fix docdir

* Fri Jun 23 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- Add Epoch - for some reason, rpm thinks 1.1.2 > 1.92.20000623.

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

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

* Sun Oct 24 1999 Bernhard Rosenkraenzer <bero@redhat.de>
- Fix compilation

* Fri Oct 22 1999 Bernhard Rosenkraenzer <bero@redhat.de>
- 2.0 CVS

* Fri Sep 24 1999 Preston Brown <pbrown@redhat.com>
- mark doc files as such

* Wed Sep 08 1999 Preston Brown <pbrown@redhat.com>
- upgraded to 1.1.2 release

* Fri Jun 11 1999 Preston Brown <pbrown@redhat.com>
- snapshot, includes kde 1.1.1 + fixes

* Mon Apr 19 1999 Preston Brown <pbrown@redhat.com>
- last snapshot before release

* Mon Apr 12 1999 Preston Brown <pbrown@redhat.com>
- latest stable snapshot

* Wed Feb 24 1999 Preston Brown <pbrown@redhat.com>
- Injected new description and group.

* Mon Feb 08 1999 Preston Brown <pbrown@redhat.com>
- upgraded to KDE 1.1 final.

* Sat Feb 06 1999 Preston Brown <pbrown@redhat.com>
- updates to new libstdc++ and rpm standards.

* Wed Jan 06 1999 Preston Brown <pbrown@redhat.com>
- re-merged in updates from Duncan Haldane