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/
#


%define so_ver 1

Name:           openjpeg
Version:        1.5.1
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-UPSTREAM openjpeg-1.5.1-cmake_libdir.patch asterios.dramis@gmail.com -- Fix libopenjpeg.pc symlink (taken from Fedora)
Patch0:         openjpeg-1.5.1-cmake_libdir.patch
# PATCH-FIX-OPENSUSE openjpeg-1.5.1-soname.patch asterios.dramis@gmail.com -- Revert soname bump compared to 1.5.0 release (for now, remove patch in 2.0 release) (taken from Fedora)
# See "http://code.google.com/p/openjpeg/source/browse/tags/version.1.5.1/CMakeLists.txt". The change was introduced in 1.5.1 but soname can remain the same between 1.5.0 and 1.5.1 versions.
Patch1:         openjpeg-1.5.1-soname.patch
BuildRequires:  cmake
BuildRequires:  doxygen
%if 0%{?suse_version}
BuildRequires:  fdupes
%endif
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:       libopenjpeg%{so_ver} = %{version}

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

%package -n libopenjpeg%{so_ver}
Summary:        An open-source JPEG 2000 codec
Group:          System/Libraries

%description -n libopenjpeg%{so_ver}
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

# 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_LIB_DIR:PATH=%{_lib} \
 -DOPENJPEG_INSTALL_DOC_DIR=%{_docdir}/%{name} \
 -DBUILD_SHARED_LIBS=ON \
 -DCMAKE_BUILD_TYPE=release \
 -DBUILD_DOC=ON \
 -DBUILD_THIRDPARTY=OFF ..
make %{?_smp_mflags} VERBOSE=1
cd ..

%install
%make_install -C build

# Install devel docs manually in order to fix rpmlint warning "files-duplicate"
cp -a build/doc/html/ %{buildroot}%{_docdir}/%{name}-devel/

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

# Fix of Fedora build
%if 0%{?fedora_version}
  rm -f %{buildroot}%{_docdir}/openjpeg/{CHANGES,LICENSE}
%endif

%if 0%{?suse_version}
%fdupes -s %{buildroot}
%endif

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

%postun -n libopenjpeg%{so_ver} -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 %{_docdir}/%{name}-devel/
%{_includedir}/openjpeg-1.5/
%{_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 libopenjpeg%{so_ver}
%defattr(-,root,root,-)
%{_libdir}/libopenjpeg.so.%{version}
%{_libdir}/libopenjpeg.so.%{so_ver}*

%changelog
openSUSE Build Service is sponsored by