#
# spec file for package oyranos
#
# Copyright (c) 2011-@OYRANOS_DEVEL_YEAR@ Kai-Uwe Behrmann <ku.b@gmx.de>
#
# 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.

Version:         @OYRANOS_VERSION_MAJOR@.@OYRANOS_VERSION_MINOR@.@OYRANOS_VERSION_MICRO@
Source:          oyranos-%{version}.tar.bz2
Release:         0
%define syscolordir     /usr/share/color
%define usercolordir    ~/.config/color
%define usercolordata   ~/.local/share/color
%define iccdirname      icc
%define cmmsubpath      @OY_CMMSUBPATH@
%define metasubpath     @OY_METASUBPATH@
%define settingsdirname settings
%define targetdirname   target
%define pixmapdir       /usr/share/pixmaps
%define icondir         /usr/share/icons
%define desktopdir      /usr/share/applications


Summary:        Color Management System
License:        BSD-3-Clause and GPL-2.0
Group:          Development/Libraries/Other

Name:           oyranos
Url:            http://www.oyranos.org
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Prefix:         %{_prefix}

Source1:        oyranos-rpmlintrc
BuildRequires:  cmake
BuildRequires:  color-filesystem
BuildRequires:  desktop-file-utils

%if 0%{?suse_version} > 0
BuildRequires:  cairo-devel
BuildRequires:  cups-devel
BuildRequires:  doxygen
BuildRequires:  fltk-devel
BuildRequires:  gcc-c++
BuildRequires:  gettext
BuildRequires:  graphviz
BuildRequires:  libjpeg-devel
BuildRequires:  liblcms-devel
BuildRequires:  liblcms2-devel
BuildRequires:  libpng-devel
BuildRequires:  libqt4-devel
BuildRequires:  libtiff-devel
BuildRequires:  libxml2-devel
BuildRequires:  netpbm
BuildRequires:  pkgconfig
BuildRequires:  xdg-utils
BuildRequires:  xorg-x11-Mesa
BuildRequires:  xorg-x11-Mesa-devel
%endif

%if 0%{?suse_version} > 910
%endif

%if 0%{?suse_version} > 1010
BuildRequires:  Mesa
BuildRequires:  Mesa-devel
BuildRequires:  doxygen
BuildRequires:  fltk-devel
BuildRequires:  gcc-c++
BuildRequires:  gettext
BuildRequires:  graphviz
BuildRequires:  libjpeg-devel
BuildRequires:  libpng-devel
BuildRequires:  netpbm
BuildRequires:  pkgconfig
BuildRequires:  update-desktop-files
BuildRequires:  xorg-x11
BuildRequires:  xorg-x11-devel
BuildRequires:  xorg-x11-fonts-devel
BuildRequires:  xorg-x11-libICE
BuildRequires:  xorg-x11-libICE-devel
BuildRequires:  xorg-x11-libSM
BuildRequires:  xorg-x11-libSM-devel
BuildRequires:  xorg-x11-libX11
BuildRequires:  xorg-x11-libX11-devel
BuildRequires:  xorg-x11-libXau
BuildRequires:  xorg-x11-libXau-devel
BuildRequires:  xorg-x11-libXdmcp
BuildRequires:  xorg-x11-libXdmcp-devel
BuildRequires:  xorg-x11-libXext
BuildRequires:  xorg-x11-libXext-devel
BuildRequires:  xorg-x11-libXfixes
BuildRequires:  xorg-x11-libXfixes-devel
BuildRequires:  xorg-x11-libXmu
BuildRequires:  xorg-x11-libXmu-devel
BuildRequires:  xorg-x11-libXp
BuildRequires:  xorg-x11-libXp-devel
BuildRequires:  xorg-x11-libXpm-devel
BuildRequires:  xorg-x11-libXprintUtil
BuildRequires:  xorg-x11-libXprintUtil-devel
BuildRequires:  xorg-x11-libXrender
BuildRequires:  xorg-x11-libXrender-devel
BuildRequires:  xorg-x11-libXt
BuildRequires:  xorg-x11-libXt-devel
BuildRequires:  xorg-x11-libXv
BuildRequires:  xorg-x11-libXv-devel
BuildRequires:  xorg-x11-libfontenc
BuildRequires:  xorg-x11-libfontenc-devel
BuildRequires:  xorg-x11-libs
BuildRequires:  xorg-x11-libxkbfile
BuildRequires:  xorg-x11-libxkbfile-devel
BuildRequires:  xorg-x11-util-devel
BuildRequires:  xorg-x11-xtrans-devel
%endif

%if 0%{?suse_version} > 1130
BuildRequires:  libexiv2-devel
BuildRequires:  libraw-devel
BuildRequires:  libraw-devel-static
BuildRequires:  libyajl-devel
%endif

%if 0%{?suse_version} > 1200
BuildRequires:  libltdl-devel
%endif

%if 0%{?suse_version} > 1210
BuildRequires:  Mesa-libGLU-devel
%endif

%if 0%{?suse_version} > 1310
BuildRequires:  libXpm-tools
%else
BuildRequires:  xorg-x11-libXpm
BuildRequires:  xorg-x11-proto-devel
%endif

%if 0%{?mandriva_version} > 0
BuildRequires:  Mesa
BuildRequires:  cairo-devel
BuildRequires:  cups-devel
BuildRequires:  doxygen
BuildRequires:  fltk
BuildRequires:  fltk-devel
BuildRequires:  gcc-c++
BuildRequires:  gettext
BuildRequires:  graphviz
BuildRequires:  lcms-devel
BuildRequires:  libXcm-devel >= 0.5.1
BuildRequires:  libjpeg
BuildRequires:  libjpeg-devel
BuildRequires:  libpng-devel
BuildRequires:  libqt4-devel
BuildRequires:  libtiff-devel
BuildRequires:  libtool-devel
BuildRequires:  libxinerama-devel
BuildRequires:  libxml2-devel
BuildRequires:  libxrandr-devel
BuildRequires:  mesagl-devel
BuildRequires:  netpbm
BuildRequires:  pkgconfig
BuildRequires:  xdg-utils
BuildRequires:  xorg-x11
%endif

%if 0%{?fedora_version} > 0 && 0%{?rhel_version} < 600
BuildRequires:  LibRaw-devel
BuildRequires:  Mesa
BuildRequires:  Mesa-devel
BuildRequires:  cairo-devel
BuildRequires:  cups-devel
BuildRequires:  doxygen
BuildRequires:  exiv2-devel
BuildRequires:  fltk
BuildRequires:  fltk-devel
BuildRequires:  fltk-fluid
BuildRequires:  gcc-c++
BuildRequires:  gettext
BuildRequires:  graphviz
BuildRequires:  libXcm-devel >= 0.5.1
BuildRequires:  libXmu-devel
BuildRequires:  libXxf86vm-devel
BuildRequires:  libjpeg
BuildRequires:  libjpeg-devel
BuildRequires:  liblcms-devel
BuildRequires:  liblcms2-devel
BuildRequires:  libpng-devel
BuildRequires:  libqt4-devel
BuildRequires:  libtiff-devel
BuildRequires:  libtool
BuildRequires:  libtool-ltdl-devel
BuildRequires:  libxml2-devel
BuildRequires:  netpbm
BuildRequires:  pkgconfig
BuildRequires:  xdg-utils
BuildRequires:  xorg-x11-Mesa-devel
BuildRequires:  xorg-x11-devel
BuildRequires:  yajl-devel
%endif

%if 0%{?centos_version} >= 600
BuildRequires:  Mesa
BuildRequires:  Mesa-devel
BuildRequires:  cairo-devel
BuildRequires:  cups-devel
BuildRequires:  doxygen
BuildRequires:  exiv2-devel
BuildRequires:  gcc-c++
BuildRequires:  gettext
BuildRequires:  graphviz
BuildRequires:  libXcm-devel >= 0.5.1
BuildRequires:  libXmu-devel
BuildRequires:  libXxf86vm-devel
BuildRequires:  libjpeg
BuildRequires:  libjpeg-devel
BuildRequires:  liblcms-devel
BuildRequires:  liblcms2-devel
BuildRequires:  libpng-devel
BuildRequires:  libqt4-devel
BuildRequires:  libtiff-devel
BuildRequires:  libtool
BuildRequires:  libtool-ltdl-devel
BuildRequires:  libtool-ltdl
BuildRequires:  libxml2-devel
BuildRequires:  netpbm
BuildRequires:  pkgconfig
BuildRequires:  xdg-utils
BuildRequires:  xorg-x11-Mesa-devel
BuildRequires:  xorg-x11-devel
BuildRequires:  yajl-devel
%endif

%if 0%{?rhel_version} >= 600
BuildRequires:  Mesa
BuildRequires:  Mesa-devel
BuildRequires:  cairo-devel
BuildRequires:  cups-devel
BuildRequires:  doxygen
BuildRequires:  gcc-c++
BuildRequires:  gettext
BuildRequires:  libXcm-devel >= 0.5.1
BuildRequires:  libXmu-devel
BuildRequires:  libXxf86vm-devel
BuildRequires:  libjpeg
BuildRequires:  libjpeg-devel
BuildRequires:  liblcms2-devel
BuildRequires:  libpng-devel
BuildRequires:  libqt4-devel
BuildRequires:  libtiff-devel
BuildRequires:  libtool
BuildRequires:  libxml2-devel
BuildRequires:  libyajl2-devel
BuildRequires:  netpbm
BuildRequires:  pkgconfig
BuildRequires:  xdg-utils
BuildRequires:  xorg-x11-Mesa-devel
BuildRequires:  xorg-x11-devel
%endif


%package      -n lib%{name}0
Summary:        Color Management System Libraries
Group:          Development/Libraries/Other
# assume users want the device modules
Requires:       lib%{name}0-cups = %{version}
%if 0%{?suse_version} > 1130 || 0%{?fedora_version} > 0
Requires:       lib%{name}0-lraw = %{version}
%endif
Requires:       lib%{name}0-monitor = %{version}
# we need rgb, lab, xyz gray and cmyk profiles
# the proper names: sRGB.icc, XYZ.icc, Lab.icc are in the OpenICC-data package
Requires:       icc-profiles

%package      -n lib%{name}-devel
Summary:        Headers, Configuration and static Libs + Documentation
Group:          Development/Libraries/Other
Requires:       lib%{name}0 = %{version}
Requires:       libxml2-devel
%if 0%{?suse_version} > 1130
Requires:       libyajl-devel
%endif

%package      -n lib%{name}-alpha-devel
Summary:        Alpha and Pre Alpha Headers
Group:          Development/Libraries/Other
Requires:       lib%{name}-devel = %{version}

%package      -n lib%{name}-alpha-devel-doc
Summary:        Alpha and Pre Alpha Documentation
Group:          Development/Libraries/Other
Requires:       lib%{name}-alpha-devel = %{version}

%package      -n lib%{name}0-monitor
Summary:        Oyranos Monitor dependent Libraries
Group:          Development/Libraries/Other
Requires:       libXcm0 >= 0.5.2
Requires:       xcalib

%package      monitor
Summary:        Oyranos Monitor Tools
Group:          Development/Libraries/Other
Requires:       lib%{name}0-monitor >= %{version}

%package      profile-graph
Summary:        Profile 2D graph tool
Group:          Development/Libraries/Other

%package      -n lib%{name}0-cups
Summary:        CUPS device support
Group:          Development/Libraries/Other
Requires:       cups

%if 0%{?suse_version} > 1130 || 0%{?fedora_version} > 0
%package      -n lib%{name}0-lraw
Summary:        LibRaw device support
Group:          Development/Libraries/Other
%endif

%package      ui-fltk
Summary:        Example Configuration Panel + Image Viewer
Group:          System/GUI/Other
Requires:       fltk

%package      qcmsevents
Summary:        Xorg Color management Event observer applet
Group:          System/Monitoring

%description
Oyranos is a color management system.
Features:
o configuration for cross application color agreement 
o plugable and selectable modules (known as CMM's)
o pixel conversions
o profile handling
o named colors
o device profile assignment


Authors:
--------
    Oyranos     Kai-Uwe Behrmann <www.behrmann.name>
    CUPS        Joe Simon <jsimon184@yahoo.com>
    lraw, oyRE, grantlee code generator
                Yiannis Belias <yiannisbe@gmail.com>

used components and libraries with divergine FOSS licenses:
    md5         L. Peter Deutsch
    libXNVCtrl  Nvidia
    FLMM        Matthias Melcher
    lookup3     Bob Jenkins


%description -n lib%{name}0
Oyranos is usable to store default profiles and paths and
query for profiles in that paths.
An internal device profile API allowes configuring of a 
profile in X.
The documentation in html format is included.
The object oriented Oyranos API's provide advanced access to
ICC profiles, allow for filtering profile lists and provide
a CMM independent color conversion API. Single color lookups 
are supported.
These API's are to be considered for changing very frequently.

%description -n lib%{name}-devel
Header files, libraries and documentation for development.
Oyranos is usable to store default profiles and paths and
query for profiles in that paths.
The documentation in html format is included.

%description -n lib%{name}-alpha-devel
Header files and libraries for development.
The object oriented Oyranos API's provide advanced access to
ICC profiles, allow for filtering profile lists and provide
a CMM independent color conversion API. Single color lookups 
are supported.
These API's are to be considered for changing very frequently.

%description -n lib%{name}-alpha-devel-doc
Documentation for development.
These API's are to be considered for changing very frequently.

%description  monitor
The monitor profile configuration tool.

%description  -n lib%{name}0-monitor
The monitor support libraries of the
Oyranos color management system.

%description  profile-graph
The grapher renders a simple gamut 
hull of a ICC profile in 2D.

%description  -n lib%{name}0-cups
CUPS device support for the
Oyranos color management system.

%if 0%{?suse_version} > 1130 || 0%{?fedora_version} > 0
%description  -n lib%{name}0-lraw
LibRaw device support for the
Oyranos color management system.
%endif

%description  ui-fltk
A example configuration GUI and a image viewer.
Oyranos is a color management system.

%description  qcmsevents
the applet shows if a color server is running through a icon in 
the system tray.

%prep
%setup -q

%build
%configure --enable-debug
%{__make} VERBOSE=1 %{_smp_mflags} || make

%install
%make_install
rm -fr %{buildroot}/%{_datadir}/doc/%{name}
cp -av src/tools/qcmsevents/qcmsevents-applet.desktop .
cp -av extras/%{name}-profile-install.desktop .
cp -av src/examples/image_display/%{name}-image-display.desktop .
echo 'X-SuSE-translate=true' >> qcmsevents-applet.desktop
echo 'X-SuSE-translate=true' >> %{name}-profile-install.desktop
echo 'X-SuSE-translate=true' >> %{name}-image-display.desktop
desktop-file-install --dir=%{buildroot}/%{desktopdir} qcmsevents-applet.desktop
desktop-file-install --dir=%{buildroot}/%{desktopdir} %{name}-profile-install.desktop
desktop-file-install --dir=%{buildroot}/%{desktopdir} %{name}-image-display.desktop
%find_lang %{name}       # generate a special file list

%post -n lib%{name}0 -p /sbin/ldconfig

%postun -n lib%{name}0 -p /sbin/ldconfig

%files -f %{name}.lang
%defattr(-, root, root)
%doc AUTHORS.md COPYING.md ChangeLog.md README.md
%{_bindir}/%{name}-icc
%{_bindir}/%{name}-policy
%{_bindir}/%{name}-profile
%{_bindir}/%{name}-profiles
%{_bindir}/%{name}-profile-install
%{_bindir}/%{name}-xforms
%{_bindir}/%{name}-xforms-modules
%{_mandir}/man1/%{name}-policy*
%{_mandir}/man1/%{name}-profile.1*
%{_mandir}/man1/%{name}-profiles.1*
%{_mandir}/man1/%{name}-profile-install.1*
%{_mandir}/man1/%{name}-xforms.1*
%{_mandir}/man1/%{name}-xforms-modules.1*
%{pixmapdir}/oyranos_logo.*
%{pixmapdir}/lcms_logo2.png
%dir %{syscolordir}/%{settingsdirname}
%{syscolordir}/%{settingsdirname}/*.policy.xml
%{desktopdir}/%{name}-profile-install.desktop

%files -n lib%{name}0
%defattr(-, root, root)
%doc AUTHORS.md COPYING.md ChangeLog.md README.md
%{_libdir}/libOyranosCore.so.*
%{_libdir}/libOyranosObject.so.*
%{_libdir}/libOyranosModules.so.*
%{_libdir}/libOyranosConfig.so.*
%{_libdir}/libOyranos.so.*
%dir %{_libdir}/color/
%dir %{_libdir}/%{cmmsubpath}/
%dir %{_libdir}/%{metasubpath}/
%{_libdir}/%{cmmsubpath}/lib%{name}_lcm*
%{_libdir}/%{cmmsubpath}/lib%{name}_oyra_cmm_module*
%{_libdir}/%{cmmsubpath}/lib%{name}_oicc_cmm_module*
%{_libdir}/%{cmmsubpath}/lib%{name}_oJPG_cmm_module*
%{_libdir}/%{cmmsubpath}/lib%{name}_oPNG_cmm_module*
%{_libdir}/%{metasubpath}/lib%{name}_oyIM_cmm_module*

%files -n lib%{name}-devel
%defattr(-, root, root)
%doc AUTHORS.md COPYING.md ChangeLog.md README.md
%{_bindir}/%{name}-config
%{_libdir}/libOyranosCore.so
%{_libdir}/libOyranosObject.so
%{_libdir}/libOyranosModules.so
%{_libdir}/libOyranosConfig.so
%{_libdir}/libOyranos.so
%dir %{_includedir}/%{name}
%{_includedir}/%{name}/icc34.h
%{_includedir}/%{name}/oy*.h
%{_libdir}/pkgconfig/*
%dir %{_libdir}/cmake/oyranos
%{_libdir}/cmake/oyranos/*.cmake
%{_libdir}/lib%{name}_core-static.a
%{_libdir}/lib%{name}_object-static.a
%{_libdir}/lib%{name}_modules-static.a
%{_libdir}/lib%{name}_config-static.a
%{_libdir}/lib%{name}-static.a
%{_mandir}/man3/%{name}-config.3*
%{_mandir}/man3/%{name}.*
%doc doc/html

%files -n lib%{name}-alpha-devel
%defattr(-, root, root)
%doc AUTHORS.md COPYING.md ChangeLog.md README.md
%dir %{_includedir}/%{name}/alpha
%{_includedir}/%{name}/alpha/%{name}_alpha.h

%files -n lib%{name}-alpha-devel-doc
%defattr(-, root, root)
%doc doc/doc_alpha/html

%files monitor
%defattr(-, root, root)
%doc AUTHORS.md COPYING.md ChangeLog.md README.md
%{_bindir}/%{name}-monitor
%{_bindir}/%{name}-monitor-daemon
%{_mandir}/man1/%{name}-monitor.1*
%{_mandir}/man1/%{name}-monitor-daemon.1*
/etc/xdg/autostart/%{name}-monitor-setup.desktop

%files -n lib%{name}0-monitor
%defattr(-, root, root)
%doc AUTHORS.md COPYING.md ChangeLog.md README.md
%dir %{_libdir}/color/
%dir %{_libdir}/%{cmmsubpath}/
%{_libdir}/%{cmmsubpath}/lib%{name}_oyX1_cmm_module*
%{_libdir}/%{cmmsubpath}/lib%{name}_oydi_cmm_module*

%files -n lib%{name}0-cups
%defattr(-, root, root)
%doc AUTHORS.md COPYING.md ChangeLog.md README.md
%dir %{_libdir}/color/
%dir %{_libdir}/%{cmmsubpath}/
%{_libdir}/%{cmmsubpath}/lib%{name}_CUPS_cmm_module*

%if 0%{?suse_version} > 1130 || 0%{?fedora_version} > 0
%files -n lib%{name}0-lraw
%defattr(-, root, root)
%doc AUTHORS.md COPYING.md ChangeLog.md README.md
%dir %{_libdir}/color/
%dir %{_libdir}/%{cmmsubpath}/
%{_libdir}/%{cmmsubpath}/lib%{name}_lraw_cmm_module*
%{_libdir}/%{cmmsubpath}/lib%{name}_oyRE_cmm_module*
%endif

%files ui-fltk
%defattr(-, root, root)
%doc AUTHORS.md COPYING.md ChangeLog.md README.md
%{_bindir}/%{name}-config-fl*
%{_bindir}/%{name}-image-display
%{_bindir}/%{name}-xforms-fltk
%{_mandir}/man1/%{name}-config-fltk.1*
%{_mandir}/man1/%{name}-image-display.1*
%{_mandir}/man1/%{name}-xforms-fltk.1*
%{desktopdir}/%{name}-image-display.desktop

%files qcmsevents
%defattr(-, root, root)
%doc AUTHORS.md COPYING.md ChangeLog.md README.md
%{_bindir}/qcmsevents
%{_mandir}/man1/qcmsevents.1*
%{pixmapdir}/qcmsevents.*
%{desktopdir}/qcmsevents-applet.desktop

%files profile-graph
%defattr(-, root, root)
%doc AUTHORS.md COPYING.md ChangeLog.md README.md
%{_bindir}/%{name}-profile-graph
%{_mandir}/man1/%{name}-profile-graph.1*

%changelog
* Thu Feb 20 2014 Kai-Uwe Behrmann
- add liboyranos-lraw

* Thu Dec 13 2012 Kai-Uwe Behrmann
- add BuildRequires:  cmake
- install FindOyranos.cmake
- remove monitor-nvidia
- comment out oforms stuff
- rename static libraries by prefixing
- remove non needed smp build flags

* Fri Nov 16 2012 - Kai-Uwe Behrmann
- add oyranos-icc

* Thu Jun 14 2012 - Kai-Uwe Behrmann
- add oyranos-profile-graph

* Sat Oct 29 2011 - Kai-Uwe Behrmann
- add oyranos-monitor-daemon

* Fri Jul 01 2011 - Kai-Uwe Behrmann
- add liboyranos_modules

* Wed Jun 01 2011 - Kai-Uwe Behrmann
- rename module packages from liboyranos-xxx to oyranos-libs-xxx
- remove comments with macros 

* Sun Feb 13 2011 - Kai-Uwe Behrmann
- split liboyranos_object from liboyranos

* Mon Jan 03 2011 - Kai-Uwe Behrmann
- split liboyranos_core from liboyranos

* Mon Jan 03 2011 - Kai-Uwe Behrmann
- add forms and forms-fltk

* Tue Nov 16 2010 - Kai-Uwe Behrmann
- add oyranos_types.h

* Mon Aug 30 2010 - Kai-Uwe Behrmann
- add SANE

* Fri Oct 16 2009 - Kai-Uwe Behrmann
- add oyranos-forms-fltk-devel

* Sun Aug 02 2009 - Kai-Uwe Behrmann
- add oicc module
- add CUPS module from Joe Simon and create new RPM from it

* Wed Apr 15 2009 - Kai-Uwe Behrmann
- add oydi module

* Thu Oct 02 2008 - Kai-Uwe Behrmann
- split display into monitor and monitor-nvidia
- rename panel to ui-fltk

* Fri Jan 25 2008 - Kai-Uwe Behrmann
- remove old kdb and cmm registration stuff

* Sat Sep 16 2006 - Kai-Uwe Behrmann
- set default policy if no settings are found

* Sat May 28 2005 - Kai-Uwe Behrmann
- packaging

* Thu Apr 21 2005 - Kai-Uwe Behrmann
- first release


