File openjpeg.spec of Package openjpeg

#
# spec file for package openjpeg
#
# Copyright (c) 2012 SUSE LINUX Products 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/
#


Name:           openjpeg
Version:        1.5.0
Release:        0
Summary:        An open-source JPEG 2000 codec
License:        BSD-2-Clause
Group:          Productivity/Graphics/Other
Url:            http://www.openjpeg.org/
Source0:        http://openjpeg.googlecode.com/files/%{name}-%{version}.tar.gz
Source1:        baselibs.conf
# PATCH-FIX-OPENSUSE openjpeg-1.5.0-cmake_Config.patch rh#669425 asterios.dramis@gmail.com -- Fix OpenJPEGConfig.cmake (taken from Fedora)
Patch0:         openjpeg-1.5.0-cmake_Config.patch
# PATCH-FIX-OPENSUSE openjpeg-1.5.0-cmake_header_symlink.patch asterios.dramis@gmail.com -- Fix cmake create_symlink usage for header file (taken from Fedora)
Patch1:         openjpeg-1.5.0-cmake_header_symlink.patch
# PATCH-FIX-OPENSUSE openjpeg-1.5.0-cmake_libdir.patch asterios.dramis@gmail.com -- Fix installation directories (taken from Fedora)
Patch2:         openjpeg-1.5.0-cmake_libdir.patch
# PATCH-FIX-UPSTREAM openjpeg-1.5.0-pkgconfig_includedir.patch asterios.dramis@gmail.com -- Fix includedir in pkgconfig file (taken from Fedora)
Patch3:         openjpeg-1.5.0-pkgconfig_includedir.patch
# PATCH-FIX-UPSTREAM heap_corruption_fix.patch CVE-2009-5030 bnc#757260 asterios.dramis@gmail.com -- Fix heap corruption when processing certain Gray16 TIFF images (http://code.google.com/p/openjpeg/source/detail?r=1703)
Patch4:         heap_corruption_fix.patch
# PATCH-FIX-UPSTREAM heap_buffer_overflow_fix.patch CVE-2012-3358 bnc#770649 asterios.dramis@gmail.com -- Fix heap-based buffer overflow when processing JPEG2000 images (http://code.google.com/p/openjpeg/source/detail?r=1727)
Patch5:         heap_buffer_overflow_fix.patch
BuildRequires:  cmake
BuildRequires:  doxygen
BuildRequires:  liblcms2-devel
BuildRequires:  libpng-devel
BuildRequires:  libtiff-devel
BuildRequires:  zlib-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
OpenJPEG library is an open-source JPEG 2000 codec written in C. It has been
developed in order to promote the use of JPEG 2000, the new still-image
compression standard from the Joint Photographic Experts Group (JPEG).

%package devel
Summary:        Development files for the OpenJPEG library
Group:          Development/Libraries/C and C++
Requires:       libopenjpeg1 = %{version}

%description devel
This package contains header files and libraries needed for developing programs
using the OpenJPEG library.

%package -n libopenjpeg1
Summary:        An open-source JPEG 2000 codec
Group:          System/Libraries

%description -n libopenjpeg1
OpenJPEG library is an open-source JPEG 2000 codec written in C. It has been
developed in order to promote the use of JPEG 2000, the new still-image
compression standard from the Joint Photographic Experts Group (JPEG).

%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1

# Remove build time references so build-compare can do its work
sed -i "s/HTML_TIMESTAMP         = YES/HTML_TIMESTAMP         = NO/g" doc/Doxyfile.dox.cmake.in

%build
mkdir build
cd build
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}"
cmake \
 -DCMAKE_INSTALL_PREFIX=%{_prefix} \
 -DOPENJPEG_INSTALL_BIN_DIR=%{_bindir} \
 -DOPENJPEG_INSTALL_LIB_DIR=%{_libdir} \
 -DOPENJPEG_INSTALL_DATA_DIR=%{_datadir} \
 -DOPENJPEG_INSTALL_INCLUDE_DIR=%{_includedir} \
 -DOPENJPEG_INSTALL_DOC_DIR=%{_docdir}/%{name} \
 -DBUILD_SHARED_LIBS=ON \
 -DBUILD_DOC=ON \
 -DBUILD_THIRDPARTY=OFF ..
make %{?_smp_mflags} VERBOSE=1
cd ..

%install
cd build
%make_install
cd ..

# Compatibility symlink
ln -s openjpeg-1.5 %{buildroot}%{_includedir}/openjpeg

%post -n libopenjpeg1 -p /sbin/ldconfig

%postun -n libopenjpeg1 -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%doc AUTHORS CHANGES LICENSE NEWS README THANKS
%{_bindir}/image_to_j2k
%{_bindir}/j2k_dump
%{_bindir}/j2k_to_image
%{_mandir}/man1/image_to_j2k.1%{ext_man}
%{_mandir}/man1/j2k_dump.1%{ext_man}
%{_mandir}/man1/j2k_to_image.1%{ext_man}

%files devel
%defattr(-,root,root,-)
%doc build/doc/html/
%{_includedir}/openjpeg-1.5/
%{_includedir}/openjpeg/
%{_includedir}/openjpeg.h
%{_libdir}/pkgconfig/libopenjpeg.pc
%{_libdir}/pkgconfig/libopenjpeg1.pc
%{_libdir}/openjpeg-1.5/
%{_libdir}/libopenjpeg.so
%{_mandir}/man3/libopenjpeg.3%{ext_man}

%files -n libopenjpeg1
%defattr(-,root,root,-)
%{_libdir}/libopenjpeg.so.1*

%changelog