File OpenImageIO.spec of Package OpenImageIO

#
# spec file for package OpenImageIO
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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_7
Name:           OpenImageIO
Version:        1.7.0dev
Release:        0
Summary:        Library for Reading and Writing Images
License:        BSD-3-Clause
Group:          Productivity/Graphics/Other
Url:            http://www.openimageio.org/
#DL-URL: https://github.com/OpenImageIO/oiio/archive/Release-%%{version}/OpenImageIO-%%{version}.tar.gz
Source0:        oiio-Release-%{version}.tar.bz2
Patch0:         oiio-clusterfit-boundscheck.patch
Patch1:         oiio-detectplatform-others.patch
Patch2:         oiio_gcc6_missleading_indentation.patch
# NOTE: Please don't uncomment a build requirement unless you have submitted the package to factory and it exists
#BuildRequires:  Field3D-devel
BuildRequires:  OpenColorIO-devel
BuildRequires:  boost-devel
BuildRequires:  cmake
BuildRequires:  doxygen
BuildRequires:  fdupes
BuildRequires:  freetype2-devel
BuildRequires:  giflib-devel
BuildRequires:  glew-devel
BuildRequires:  hdf5-devel
BuildRequires:  libjpeg-devel
BuildRequires:  libopenssl-devel
BuildRequires:  libpng-devel
BuildRequires:  libqt4-devel
BuildRequires:  libraw-devel
BuildRequires:  libtiff-devel
BuildRequires:  libwebp-devel
BuildRequires:  opencv-devel
BuildRequires:  openjpeg-devel
BuildRequires:  openjpeg2-devel
BuildRequires:  pugixml-devel
BuildRequires:  python-devel
# NOTE: txt2man is needed for the man pages but not in factory.
BuildRequires:  txt2man
BuildRequires:  zlib-devel
BuildRequires:  pkgconfig(gl)
BuildRequires:  pkgconfig(glu)
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} > 1220
BuildRequires:  ilmbase-devel
%else
BuildRequires:  libilmbase-devel
%endif
%if 0%{?suse_version} > 1220
BuildRequires:  openexr-devel
%else
BuildRequires:  OpenEXR-devel
%endif

%description
OpenImageIO is a library for reading and writing images, and a bunch of related
classes, utilities, and applications. There is a particular emphasis on formats
and functionality used in professional, large-scale animation and visual
effects work for film. OpenImageIO is used extensively in animation and VFX
studios all over the world, and is also incorporated into several commercial
products.

%package devel
Summary:        Development Files for OpenImageIO
Group:          Development/Libraries/C and C++
Requires:       libOpenImageIO%{so_ver} = %{version}
Requires:       libOpenImageIO_Util%{so_ver} = %{version}

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

%package -n libOpenImageIO%{so_ver}
Summary:        Library for Reading and Writing Images
Group:          System/Libraries

%description -n libOpenImageIO%{so_ver}
OpenImageIO is a library for reading and writing images, and a bunch of related
classes, utilities, and applications. There is a particular emphasis on formats
and functionality used in professional, large-scale animation and visual
effects work for film. OpenImageIO is used extensively in animation and VFX
studios all over the world, and is also incorporated into several commercial
products.

%package -n libOpenImageIO_Util%{so_ver}
Summary:        Library for Reading and Writing Images
Group:          System/Libraries

%description -n libOpenImageIO_Util%{so_ver}
OpenImageIO is a library for reading and writing images, and a bunch of related
classes, utilities, and applications. There is a particular emphasis on formats
and functionality used in professional, large-scale animation and visual
effects work for film. OpenImageIO is used extensively in animation and VFX
studios all over the world, and is also incorporated into several commercial
products.

%package -n python-OpenImageIO
Summary:        Python Bindings for OpenImageIO
Group:          Development/Libraries/Python
%py_requires

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

%prep
%setup -q -n oiio-Release-%{version}
%patch0
%patch1
%patch2 -p1

# Make sure that bundled libraries are not used
rm -f src/include/pugiconfig.hpp \
      src/include/pugixml.hpp
rm -rf src/include/tbb/

%build
# This is for build debugging purposed
export OIIOINC=`echo $PWD`
%define pwd $OIIOINC
%define oiioinclude %{pwd}/src/include
echo %{pwd}
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}"
mkdir -p build
cd build
cmake \
%ifarch ppc
    -DNOTHREADS=ON \
%endif
    -DCMAKE_INSTALL_PREFIX=%{_prefix} \
    -DLIB_INSTALL_DIR=%{_libdir} \
    -DPYLIB_INSTALL_DIR=%{python_sitearch} \
    -DINSTALL_DOCS:BOOL=ON \
    -DDOC_INSTALL_DIR=%{_docdir}/%{name} \
    -DINSTALL_FONTS:BOOL=ON \
    -DBUILDSTATIC:BOOL=OFF \
    -DLINKSTATIC:BOOL=OFF \
    -DUSE_EXTERNAL_PUGIXML:BOOL=ON \
    -DUSE_FFMPEG:BOOL=OFF \
    -DUSE_OPENSSL:BOOL=ON \
    -DCMAKE_SKIP_RPATH:BOOL=ON \
    -DUSE_OPENCV:BOOL=OFF \
        ..
make %{?_smp_mflags} VERBOSE=1 || \
make -j1 VERBOSE=1
cd ..
make %{?_smp_mflags} doxygen

%install
%make_install -C build

# Move devel documentation to the right location
mkdir -p %{buildroot}%{_docdir}/%{name}-devel
mv %{buildroot}%{_docdir}/%{name}/openimageio.pdf %{buildroot}%{_docdir}/%{name}-devel/
%if 1 == 0
# Install additional devel documentation
cp -a src/doc/doxygen/html/ %{buildroot}%{_docdir}/%{name}-devel/
%endif

%fdupes -s %{buildroot}

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

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

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

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

%files
%defattr(-,root,root,-)
%doc CHANGES CREDITS LICENSE README.rst
%{_bindir}/*
%dir %{_datadir}/fonts/oiio
%{_datadir}/fonts/oiio/DroidSans-Bold.ttf
%{_datadir}/fonts/oiio/DroidSans.ttf
%{_datadir}/fonts/oiio/DroidSansMono.ttf
%{_datadir}/fonts/oiio/DroidSerif-Bold.ttf
%{_datadir}/fonts/oiio/DroidSerif-BoldItalic.ttf
%{_datadir}/fonts/oiio/DroidSerif-Italic.ttf
%{_datadir}/fonts/oiio/DroidSerif.ttf
%if 1 == 1
%{_mandir}/man1/*.1%{ext_man}
%endif

%files devel
%defattr(-,root,root,-)
%doc %{_docdir}/%{name}-devel/
%{_includedir}/OpenImageIO/
%{_libdir}/*.so

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

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

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

%changelog
openSUSE Build Service is sponsored by