File OpenColorIO.spec of Package OpenColorIO

#
# spec file for package OpenColorIO
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2015 Asterios Dramis <asterios.dramis@gmail.com>.
#
# 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/
#


%define so_ver 1

Name:           OpenColorIO
Version:        1.0.9
Release:        0
Summary:        Complete Color Management Solution Geared Towards Motion Picture Production
License:        BSD-3-Clause and GPL-2.0+
Group:          Productivity/Graphics/Other
Url:            http://opencolorio.org/
######
######
# The package contains the below non OSS licensed files (see bnc#821203)
#
# ext/Pygments-1.6/tests/examplefiles/Sorting.mod
# ext/Pygments-1.6/tests/examplefiles/test.mod
#
# so a crippled tarball is used with these files removed. Steps to reproduce:
#
# tar zxf OpenColorIO-%{version}.tar.gz
# pushd OpenColorIO-%{version}/ext/
# tar zxf Pygments-1.6.tar.gz
# rm -f Pygments-1.6.tar.gz
# rm -f Pygments-1.6/tests/examplefiles/{Sorting.mod,test.mod}
# tar zcf Pygments-1.6.tar.gz Pygments-1.6/
# rm -rf Pygments-1.6/
# popd
# tar zcf OpenColorIO-%{version}-crippled.tar.gz OpenColorIO-%{version}/
# rm -f OpenColorIO-%{version}.tar.gz
#
# NOTE: In newer OpenColorIO versions, Pygments (version 1.6) maybe updated.
# In this case check if the above files' license is changed, so no crippled tarball is needed.
#####
#####
Source0:        %{name}-%{version}-crippled.tar.gz
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  liblcms2-devel
BuildRequires:  pkg-config
BuildRequires:  python-MarkupSafe
BuildRequires:  python-devel
BuildRequires:  tinyxml-devel
# Use internal yaml-cpp until OpenColorIO is ported to yaml-cpp >= 0.5.0 currently in Factory
%if 0%{?suse_version} > 1220
#BuildRequires:  yaml-cpp-devel >= 0.3.0
%endif
Recommends:     %{name}-doc = %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
OpenColorIO (OCIO) is a complete color management solution geared towards
motion picture production with an emphasis on visual effects and computer
animation. OCIO provides a straightforward and consistent user experience
across all supporting applications while allowing for sophisticated back-end
configuration options suitable for high-end production usage. OCIO is
compatible with the Academy Color Encoding Specification (ACES) and is
LUT-format agnostic, supporting many popular formats.

%package devel
Summary:        Development Files for OpenColorIO
Group:          Development/Libraries/C and C++
Requires:       libOpenColorIO%{so_ver} = %{version}
Recommends:     %{name}-doc = %{version}

%description devel
This package provides development libraries and headers needed to build
software using OpenColorIO.

%package doc
Summary:        Documentation for OpenColorIO
Group:          Documentation/Other
BuildArch:      noarch

%description doc
This package contains documentation for OpenColorIO.

%package -n libOpenColorIO%{so_ver}
Summary:        Complete Color Management Solution Geared Towards Motion Picture Production
Group:          System/Libraries

%description -n libOpenColorIO%{so_ver}
OpenColorIO (OCIO) is a complete color management solution geared towards
motion picture production with an emphasis on visual effects and computer
animation. OCIO provides a straightforward and consistent user experience
across all supporting applications while allowing for sophisticated back-end
configuration options suitable for high-end production usage. OCIO is
compatible with the Academy Color Encoding Specification (ACES) and is
LUT-format agnostic, supporting many popular formats.

%package -n python-OpenColorIO
Summary:        Python Bindings for OpenColorIO
Group:          Development/Libraries/Python
%{py_requires}

%description -n python-OpenColorIO
This package contains python bindings for OpenColorIO.

%package -n python-OpenColorIO-devel
Summary:        Python Bindings for OpenColorIO
Group:          Development/Libraries/Python
Requires:       python-OpenColorIO = %{version}
Requires:       python-devel

%description -n python-OpenColorIO-devel
This package contains development files for python bindings for OpenColorIO.

%prep
%setup -q

# Make sure that bundled libraries are not used
rm -f ext/lcms*
rm -f ext/tinyxml*
%if 0%{?suse_version} > 1220
#rm -f ext/yaml*
%endif

%build
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}"
__libsuffix=$(echo %_lib | cut -b4-)
mkdir build
cd build
cmake \
    -DCMAKE_INSTALL_PREFIX=%{_prefix} \
    -DLIB_SUFFIX="$__libsuffix" \
    -DOCIO_BUILD_STATIC=OFF \
    -DOCIO_BUILD_DOCS=ON \
    -DOCIO_BUILD_TESTS=ON \
%ifnarch x86_64
    -DOCIO_USE_SSE=OFF \
%endif
    -DOCIO_PYGLUE_LINK=ON \
%if 0%{?suse_version} > 1220
    -DUSE_EXTERNAL_YAML=OFF \
%endif
    -DUSE_EXTERNAL_TINYXML=ON \
    -DUSE_EXTERNAL_LCMS=ON \
    ..
make %{?_smp_mflags} VERBOSE=1
cd ..

%install
%make_install -C build

# Move documentation to the right location
mkdir -p %{buildroot}%{_docdir}/%{name}
mv %{buildroot}%{_datadir}/doc/OpenColorIO/html/ %{buildroot}%{_docdir}/%{name}/

%post -n libOpenColorIO%{so_ver} -p /sbin/ldconfig

%postun -n libOpenColorIO%{so_ver} -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%doc ChangeLog LICENSE README
%exclude %{_docdir}/%{name}/html/
%{_bindir}/*
%{_datadir}/ocio/

%files devel
%defattr(-,root,root,-)
%{_includedir}/OpenColorIO/
%{_libdir}/pkgconfig/OpenColorIO.pc
%{_libdir}/*.so

%files doc
%defattr(-,root,root,-)
%{_docdir}/%{name}/html/

%files -n libOpenColorIO%{so_ver}
%defattr(-,root,root,-)
%{_libdir}/libOpenColorIO.so.%{so_ver}*

%files -n python-OpenColorIO
%defattr(-,root,root,-)
%{python_sitearch}/PyOpenColorIO.so

%files -n python-OpenColorIO-devel
%defattr(-,root,root,-)
%{_includedir}/PyOpenColorIO/

%changelog
openSUSE Build Service is sponsored by