File CharLS.spec of Package CharLS
#
# spec file for package CharLS
#
# 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: CharLS
Version: 1.0
Release: 0
Summary: A JPEG-LS library
License: BSD-3-Clause
Group: System/Libraries
Url: http://charls.codeplex.com/
Source0: %{name}-source-%{version}.zip
# PATCH-FIX-OPENSUSE charls_add_cmake_install_target.patch asterios.dramis@gmail.com -- Add a cmake install target for CharLS header files
Patch0: charls_add_cmake_install_target.patch
# PATCH-FIX-OPENSUSE charls_add_sharedlib_soname.patch asterios.dramis@gmail.com -- Add soname to generated shared lib and install libCharLS.so
Patch1: charls_add_sharedlib_soname.patch
# PATCH-FIX-OPENSUSE charls_fix_tests.patch asterios.dramis@gmail.com -- Fix tests
Patch2: charls_fix_tests.patch
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: unzip
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
An optimized implementation of the JPEG-LS standard for lossless and
near-lossless image compression. JPEG-LS is a low-complexity standard that
matches JPEG 2000 compression ratios. In terms of speed, CharLS outperforms
open source and commercial JPEG LS implementations.
%package devel
Summary: Libraries and headers for CharLS
Group: Development/Libraries/C and C++
Requires: libCharLS1 = %{version}
%description devel
This package contains libraries and headers for CharLS.
%package -n libCharLS1
Summary: A JPEG-LS library
Group: System/Libraries
%description -n libCharLS1
An optimized implementation of the JPEG-LS standard for lossless and
near-lossless image compression. JPEG-LS is a low-complexity standard that
matches JPEG 2000 compression ratios. In terms of speed, CharLS outperforms
open source and commercial JPEG LS implementations.
%prep
%setup -c -q
# Fix wrong end of line encoding
perl -i -pe 's/\r\n/\n/gs' *.h
perl -i -pe 's/\r\n/\n/gs' *.c*
perl -i -pe 's/\r\n/\n/gs' *.txt
%patch0 -p1
%patch1 -p1
%patch2 -p1
%build
mkdir build
cd build
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}"
cmake \
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
-DBUILD_SHARED_LIBS=ON \
-Dcharls_BUILD_SHARED_LIBS=ON \
%if "%{_lib}" == "lib64"
-DLIB_SUFFIX=64 \
%endif
--DBUILD_TESTING=ON \
-DCMAKE_BUILD_TYPE=release ..
make %{?_smp_mflags} VERBOSE=1
cd ..
%install
cd build
make DESTDIR=%{buildroot} install
cd ..
%check
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.
ctest .
%post -n libCharLS1 -p /sbin/ldconfig
%postun -n libCharLS1 -p /sbin/ldconfig
%files devel
%defattr(-,root,root,-)
%doc License.txt
%{_includedir}/CharLS/
%{_libdir}/*.so
%files -n libCharLS1
%defattr(-,root,root,-)
%{_libdir}/libCharLS.so.1*
%changelog