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.4
Release:        0
License:        BSD-2-Clause
Summary:        An open-source JPEG 2000 codec
Url:            http://www.openjpeg.org/
Group:          Productivity/Graphics/Other
# http://code.google.com/p/openjpeg/downloads/detail?name=openjpeg_v1_4_sources_r697.tgz
Source0:        %{name}_v1_4_sources_r697-crippled.tar.bz2
Source1:        %{name}_v1_4_sources_r697-crippled.txt
# PATCH-FIX-OPENSUSE openjpeg-1.4-OpenJPEGConfig.patch rh#669425 asterios.dramis@gmail.com -- Fix OpenJPEGConfig.cmake (taken from Fedora)
Patch0:         openjpeg-1.4-OpenJPEGConfig.patch
# PATCH-FIX-UPSTREAM openjpeg-1.4-cmake_symlink_fix.patch asterios.dramis@gmail.com -- Fix cmake create_symlink usage for header file (taken from Fedora)
Patch1:         openjpeg-1.4-cmake_symlink_fix.patch
# PATCH-FIX-UPSTREAM fix_no_undefined.patch rh#467661 asterios.dramis@gmail.com -- Fix libopenjpeg undefined references (taken from upstream)
Patch2:         fix_no_undefined.patch
# PATCH-FIX-UPSTREAM fix_soversion.patch asterios.dramis@gmail.com -- Fix so version to 1 instead of 1.4 (taken from upstream)
Patch3:         fix_soversion.patch
# PATCH-FIX-UPSTREAM install_pkgconfig_file.patch asterios.dramis@gmail.com -- Fix cmake to install pkgconfig file(s) (taken from upstream)
Patch4:         install_pkgconfig_file.patch
BuildRequires:  cmake
BuildRequires:  libpng-devel
BuildRequires:  libtiff-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 -n %{name}_v1_4_sources_r697
%patch0 -p1
%patch1 -p1
%patch2
%patch3
%patch4
# Make sure we use system libraries
rm -rf libs/

%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} ..
make %{?_smp_mflags} VERBOSE=1
cd ..

%install
cd build
make install DESTDIR=%{?buildroot}
cd ..

# Compatibility symlink
ln -s openjpeg-1.4 %{buildroot}%{_includedir}/openjpeg
rm -f %{buildroot}/usr/share/doc/openjpeg/CHANGES %{buildroot}/usr/share/doc/openjpeg/LICENSE

%post -n libopenjpeg1 -p /sbin/ldconfig

%postun -n libopenjpeg1 -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%doc CHANGES LICENSE README
%{_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,-)
%{_includedir}/openjpeg-1.4/
%{_includedir}/openjpeg/
%{_includedir}/openjpeg.h
%{_libdir}/pkgconfig/libopenjpeg.pc
%{_libdir}/pkgconfig/libopenjpeg1.pc
%{_libdir}/openjpeg-1.4/
%{_libdir}/libopenjpeg.so
%{_mandir}/man3/libopenjpeg.3%{ext_man}

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

%changelog
openSUSE Build Service is sponsored by