%define enable_fltk_fluid 1
%if 0%{?rhel} && 0%{?rhel} >= 8
  %define enable_fltk_fluid 0
%endif

%define enable_qt4 1
%if 0%{?rhel} && 0%{?rhel} >= 8
  %define enable_qt4 0
%endif

Name:           oyranos
Version:        0.9.5
Release:        29.2%{?dist}
Summary:        A Colour Management System (CMS) on operating system level
Group:          Applications/Multimedia
License:        GPLv2+ and BSD
URL:            http://www.oyranos.org
Source0:        http://downloads.sourceforge.net/oyranos/oyranos-%{version}.tar.bz2
# Snapshot temporary URL.
# Source0:        oyranos-%%{version}git.tgz
BuildRequires:  gcc gcc-c++
BuildRequires:  boost-devel
BuildRequires:  cairo-devel
BuildRequires:  cmake
BuildRequires:  color-filesystem
BuildRequires:  cups-devel
BuildRequires:  desktop-file-utils
BuildRequires:  doxygen
BuildRequires:  exiv2-devel
BuildRequires:  fltk-devel
%if 0%{?enable_fltk_fluid}
BuildRequires:  fltk-fluid
%endif
BuildRequires:  freetype-devel
BuildRequires:  gettext
BuildRequires:  graphviz
BuildRequires:  imake
BuildRequires:  lcms-devel
BuildRequires:  lcms2-devel
BuildRequires:  libjpeg-devel
BuildRequires:  libpng-devel
BuildRequires:  LibRaw-devel
BuildRequires:  libstdc++-devel
BuildRequires:  libtiff-devel
BuildRequires:  libX11-devel
BuildRequires:  libXcm-devel
BuildRequires:  libXext-devel
BuildRequires:  libXfixes-devel
BuildRequires:  libXinerama-devel
BuildRequires:  libxml2-devel
BuildRequires:  libXrandr-devel
BuildRequires:  libxslt-devel
BuildRequires:  libXxf86vm-devel
BuildRequires:  OpenEXR-devel
%if 0%{?enable_qt4}
BuildRequires:  qt4-devel
%endif
BuildRequires:  sane-backends-devel
BuildRequires:  yajl-devel
#BuildRequires:  mesa-libGL-devel
#BuildRequires:  mesa-libGLU-devel
Requires:       color-filesystem
Requires:       %{name}-libs%{?_isa} = %{version}-%{release}
Requires:       icc-profiles-openicc
Requires:       icc-profiles-basiccolor-printing2009

Provides:       bundled(elektra)

%description
The Color Management System (CMS) Oyranos is intended to coordinate device
specific information (ICC colour profiles) and configure their system wide
settings. Target is a predictable path for applications and users to match
colors across devices and across platforms. 

Oyranos is intended as a OS level CMS.

%package        libs
Summary:        Shared libraries for %{name}

%description    libs
This package contains shared libraries of %{name}.

%package        devel
Summary:        Development files for %{name}
Requires:       %{name}-libs%{?_isa} = %{version}-%{release}
# -doc deprecation introducted in F-11
Obsoletes:      %{name}-doc < 0.1.9-2
Requires:       libX11-devel%{?_isa}
Requires:       libXinerama-devel%{?_isa}

%description    devel
This package contains libraries and header files for
developing applications that use %{name}.

%prep
%setup -q

# Remove bundled yaji sources
%{__rm} -rf yajl/

%build
# https://bugs.gentoo.org/671996
# Built target oyranos-profile-graph
# In file included from /home/scx/rpmbuild/BUILD/oyranos-0.9.5/src/examples/image_display/image_display.cpp:38:0:
# /home/scx/rpmbuild/BUILD/oyranos-0.9.5/src/examples/image_display/Oy_Fl_Shader_Box.h: In member function 'void Oy_Fl_Shader_Box::print_log(GLhandleARB)':
# /home/scx/rpmbuild/BUILD/oyranos-0.9.5/src/examples/image_display/Oy_Fl_Shader_Box.h:66:72: error: 'glGetObjectParameterivARB' was not declared in this scope
#      glGetObjectParameterivARB (obj, GL_OBJECT_INFO_LOG_LENGTH_ARB, &len);
export CFLAGS="%{optflags} -DGL_GLEXT_PROTOTYPES"
export CXXFLAGS="%{optflags} -DGL_GLEXT_PROTOTYPES"

%configure --enable-debug \
           --disable-static \
           --with-fltk-config \
           --syscolordir=%{_colordir}
%{make_build}
%{__make} docu %{?_smp_mflags}

%install
%{make_install}

# Remove unneeded files
find %{buildroot} -name '*.*a' -delete -print
%{__rm} -rf %{buildroot}%{_datadir}/doc/oyranos

# Multilib tweaks
touch -r ChangeLog %{buildroot}%{_bindir}/%{name}-config
touch -r ChangeLog doc/html/*
touch -r ChangeLog %{buildroot}%{_includedir}/%{name}/oyranos_version.h

%if ! 0%{?enable_qt4}
%{__rm} -rf %{buildroot}%{_mandir}/man1/qcmsevents.1* ||:
%endif

%find_lang %{name}

%check
desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop

%post libs -p /sbin/ldconfig

%postun libs -p /sbin/ldconfig

%files -f %{name}.lang
%doc AUTHORS BUGS ChangeLog README
%license COPYING
%exclude %{_sysconfdir}/xdg/autostart/oyranos-monitor-setup.desktop
%if 0%{?enable_fltk_fluid}
%{_bindir}/%{name}-config-fltk
%endif
%{_bindir}/%{name}-icc
%{_bindir}/%{name}-monitor
%{_bindir}/%{name}-monitor-daemon
%{_bindir}/%{name}-policy
%{_bindir}/%{name}-profile
%{_bindir}/%{name}-profile-graph
%{_bindir}/%{name}-profile-install
%{_bindir}/%{name}-profiles
%{_bindir}/%{name}-xforms-modules
%if 0%{?enable_qt4}
%{_bindir}/qcmsevents
%endif
%{_datadir}/applications/oyranos-profile-install.desktop
%if 0%{?enable_qt4}
%{_datadir}/applications/qcmsevents-applet.desktop
%endif
%{_mandir}/man1/%{name}-policy.1*
%{_mandir}/man1/%{name}-profile*.1*
%{_mandir}/man1/%{name}-xforms-modules.1*
%{_mandir}/man1/%{name}-config-fltk.1*
%{_mandir}/man1/%{name}-monitor*.1*
%if 0%{?enable_qt4}
%{_mandir}/man1/qcmsevents.1*
%endif
%{_datadir}/color/settings/*.policy.xml
%{_datadir}/pixmaps/lcms_logo2.png
%{_datadir}/pixmaps/oyranos_logo.png
%if 0%{?enable_qt4}
%{_datadir}/pixmaps/qcmsevents.svg
%endif

%files libs
%{_libdir}/*.so.*
%{_libdir}/color/
%{_libdir}/oyranos/

%files devel
%doc doc/html/*
%{_bindir}/%{name}-config
%{_mandir}/man3/%{name}.*
%{_mandir}/man3/%{name}-config.*
%{_includedir}/%{name}/
%{_libdir}/*.so
%{_libdir}/pkgconfig/%{name}*.pc

%changelog
* Tue Oct 22 2019 Tomasz Tomasik <scx.mail@gmail.com> - 0.9.5-29.2
- Disable qt4 for EL8

* Tue Oct 22 2019 Tomasz Tomasik <scx.mail@gmail.com> - 0.9.5-29.1
- Rebuilt for EL

* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.5-29
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.5-28
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Thu Jul 19 2018 Adam Williamson <awilliam@redhat.com> - 0.9.5-27
- Rebuild for new libraw

* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.5-26
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.5-25
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.5-24
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.5-23
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Tue May 02 2017 Rex Dieter <rdieter@fedoraproject.org> - 0.9.5-22
- rebuild (exiv2)

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.5-21
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Fri Jan 27 2017 Jonathan Wakely <jwakely@redhat.com> - 0.9.5-20
- Rebuilt for Boost 1.63

* Tue Dec 27 2016 Jon Ciesla <limburgher@gmail.com> - 0.9.5-19
- Rebuild for new LibRaw.

* Wed Jun 15 2016 Pete Walter <pwalter@fedoraproject.org> - 0.9.5-18
- Build with bundled elektra

* Tue Jun 14 2016 Pete Walter <pwalter@fedoraproject.org> - 0.9.5-17
- Rebuild for unretirement

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.5-16
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Fri Jan 15 2016 Jonathan Wakely <jwakely@redhat.com> - 0.9.5-15
- Rebuilt for Boost 1.60

* Thu Sep 03 2015 Jonathan Wakely <jwakely@redhat.com> - 0.9.5-14
- Rebuilt for Boost 1.59

* Thu Aug 20 2015 Jon Ciesla <limburgher@gmail.com> - 0.9.5-13
- Commented macro, fixed doc path.
- Rebuild for new LibRaw.

* Wed Jul 29 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.5-12
- Rebuilt for https://fedoraproject.org/wiki/Changes/F23Boost159

* Wed Jul 22 2015 David Tardon <dtardon@redhat.com> - 0.9.5-11
- rebuild for Boost 1.58

* Wed Jun 24 2015 Rex Dieter <rdieter@fedoraproject.org> - 0.9.5-10
- rebuild (exiv2)

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.5-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Sat May 02 2015 Kalev Lember <kalevlember@gmail.com> - 0.9.5-8
- Rebuilt for GCC 5 C++11 ABI change

* Wed Feb 18 2015 Rex Dieter <rdieter@fedoraproject.org> 0.9.5-7
- rebuild (fltk,gcc5)

* Tue Jan 27 2015 Petr Machata <pmachata@redhat.com> - 0.9.5-6
- Rebuild for boost 1.57.0

* Tue Nov 25 2014 Rex Dieter <rdieter@fedoraproject.org> 0.9.5-5
- rebuild (openexr)

* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.5-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Thu May 22 2014 Petr Machata <pmachata@redhat.com> - 0.9.5-2
- Rebuild for boost 1.55.0

* Sat Mar 08 2014 Christopher Meng <rpm@cicku.me> - 0.9.5-1
- Update to 0.9.5
- Remove redundant lines in %%files section.

* Tue Feb 18 2014 Jaromir Capik <jcapik@redhat.com> - 0.9.5-0.1.20140123git
- Workaround for broken pkg-config & oyranos-config (#1057030, #1066424)

* Thu Jan 23 2014 Christopher Meng <rpm@cicku.me> - 0.9.5-0.0.20140123git
- Update to 0.9.5 snapshoted from VCS repo for Kolor.
- Add missing BRs(qt4/cairo).

* Tue Jan 21 2014 Jon Ciesla <limburgher@gmail.com> - 0.4.0-16
- Rebuild for new LibRaw.

* Mon Jan 20 2014 Rex Dieter <rdieter@fedoraproject.org> 0.4.0-15
- rebuild (elektra)

* Tue Dec 03 2013 Rex Dieter <rdieter@fedoraproject.org> - 0.4.0-14
- rebuild (exiv2)

* Wed Nov 27 2013 Rex Dieter <rdieter@fedoraproject.org> 0.4.0-13
- rebuild (openexr)

* Sun Sep 15 2013 Bruno Wolff III <bruno@wolff.to> - 0.4.0-12
- Fix test for libXcm

* Sat Sep 14 2013 Bruno Wolff III <bruno@wolff.to> - 0.4.0-11
- Rebuild for libraw soname bump

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.0-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Tue Jul 30 2013 Petr Machata <pmachata@redhat.com> - 0.4.0-9
- Rebuild for boost 1.54.0

* Fri May 31 2013 Jon Ciesla <limburgher@gmail.com> - 0.4.0-8
- Rebuild for new LibRaw.

* Sun Mar 10 2013 Rex Dieter <rdieter@fedoraproject.org> - 0.4.0-7
- rebuild (OpenEXR)

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Wed Oct 03 2012 Nicolas Chauvet <kwizart@gmail.com> - 0.4.0-5
- Add missing BR

* Tue Oct 02 2012 Nicolas Chauvet <kwizart@gmail.com> - 0.4.0-4
- Add Requires icc-profiles-basiccolor-printing2009

* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Wed May 02 2012 Rex Dieter <rdieter@fedoraproject.org> - 0.4.0-2
- rebuild (exiv2)

* Sun Apr 08 2012 Nicolas Chauvet <kwizart@gmail.com> - 0.4.0-1
- Update to 0.4.0

* Wed Jan 11 2012 Nicolas Chauvet <kwizart@gmail.com> - 0.3.2-3
- Add Requires icc-profiles-openicc
- Enable lcms2 support
- Build with system yajl

* Tue Dec 06 2011 Adam Jackson <ajax@redhat.com> - 0.3.2-2
- Rebuild for new libpng

* Sun Nov 20 2011 Nicolas Chauvet <kwizart@gmail.com> - 0.3.2-1
- Update to 0.3.2

* Fri Oct 14 2011 Rex Dieter <rdieter@fedoraproject.org> - 0.3.1-2
- rebuild (exiv2)

* Tue Jul 26 2011 Nicolas Chauvet <kwizart@gmail.com> - 0.3.1-1
- Update to 0.3.1

* Fri May 27 2011 Nicolas Chauvet <kwizart@gmail.com> - 0.2.0-5
- Rebuild for new fltk

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Fri Jan 07 2011 Nicolas Chauvet <kwizart@gmail.com> - 0.2.0-2
- Update to 0.2.0
- Exclude autostart desktop file for now
- Disable lcms2 for now

* Sun Nov 07 2010 Nicolas Chauvet <kwizart@gmail.com> - 0.1.12-2
- Update to 0.1.12
- Back to upstream tarball usage
  (ICC profiles are redistributed elsewhere)
- Fix pkg-config file.

* Sun Aug 22 2010 Nicolas Chauvet <kwizart@gmail.com> - 0.1.10-1
- Update to 0.1.10
- Fix description

* Wed Jun 23 2010 Dan Horák <dan[at]danny.cz> - 0.1.9-5
- fixed FTBFS #564777 and #599809

* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.1.9-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Tue Mar 10 2009 kwizart < kwizart at gmail.com > - 0.1.9-3
- Fix wrong %%post requires

* Mon Mar  9 2009 kwizart < kwizart at gmail.com > - 0.1.9-2
- Remove unused patch
- Merge -doc in -devel
- Add missing BR libtiff-devel

* Thu Mar  5 2009 kwizart < kwizart at gmail.com > - 0.1.9-1
- Update to 0.1.9

* Sun Sep 28 2008 kwizart < kwizart at gmail.com > - 0.1.7-12
- Fix patch fuzz

* Thu Mar  6 2008 kwizart < kwizart at gmail.com > - 0.1.7-11
- Make oyranos-config a wrapper for pkgconfig

* Tue Mar  4 2008 kwizart < kwizart at gmail.com > - 0.1.7-10
- Comment out %%post with %%if 0
- Add BR graphviz
- Upate Doxygen before generation (-u) 
  (set CLASS_GRAPH and COLLABORATION_GRAPH to NO )
- Remove Requires color-filesystem for -devel
- Rename man1 to man3 within man pages.

* Sat Mar  1 2008 kwizart < kwizart at gmail.com > - 0.1.7-9
- Drop monitor-nvidia (will be bundled in the main package)
- Comment out the oyranos default policy until some profiles
  are available within the repository.
- Reenable oyranos-config with tweaks for multilibs
  (will be properly fixed later with pkgconfig)
- Add Requirement needed by oyranos_moni.pc
- Add README-Fedora-ICC_PROFILES

* Wed Feb 20 2008 kwizart < kwizart at gmail.com > - 0.1.7-8
- Uses color-filesystem BR and macros
- Split the doc
- Split monitor-nvidia from the main package and use alternatives
- Fix wrong file encoding not-utf8 ChangeLog
- Tweak oyranos_version.h
- Remove oyranos-config (we should use pkgconfig instead)
- Repackage the sources.

* Thu Aug 16 2007 kwizart < kwizart at gmail.com > - 0.1.7-7
- Move oyranos-config to -devel
- Add Requires elektra-devel for oyranos-devel
- Use ldconfig for -libs only
- Fix .pc files

* Thu Aug 16 2007 kwizart < kwizart at gmail.com > - 0.1.7-6
- Move man3 to -devel
- Remove .a and .la after install step
- Drop the elektra keys registration for now:
  http://www.libelektra.org/Best_Practices_When_Creating_Keys
  User will have to register them by himself

* Tue Jul 10 2007 kwizart < kwizart at gmail.com > - 0.1.7-5
- Directory ownership for %%{_datadir}/color/settings
- Drop unused macros

* Sun Jun 17 2007 kwizart < kwizart at gmail.com > - 0.1.7-4
- Uses patches to fix things
- Removed unused macros
- Removed patented icc profiles

* Mon May 14 2007 kwizart < kwizart at gmail.com > - 0.1.7-3
- Fixed remaining rpaths

* Sat May 12 2007 kwizart < kwizart at gmail.com > - 0.1.7-2
- Disabled internal elektra.
- Exclude oyranos-config.
- Include Various Licenses files.

* Tue Apr 10 2007 kwizart < kwizart at gmail.com > - 0.1.7-1
- Update to final 0.1.7

* Sun Apr  1 2007 kwizart < kwizart at gmail.com > - 0.1.7-0.1.rc8
- Initial Fedora release

* 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