File lensfun.spec of Package lensfun

#
# spec file for package lensfun
#
# Copyright (c) 2015 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/
#


Name:           lensfun
%define sonum   0
Version:        0.3.1
Release:        0
Summary:        A photographic lens database and a library for accessing it
License:        LGPL-3.0
Group:          Development/Libraries/C and C++
Url:            http://lensfun.sourceforge.net/
Source:         http://downloads.sf.net/lensfun/lensfun-%version.tar.gz
# This patch got created via
# svn diff svn://svn.berlios.de/lensfun/tags/0.2.6/data svn://svn.berlios.de/lensfun/trunk/data > lens_database_update.diff
#Patch1:         lens_database_update.diff
BuildRequires:  cmake
BuildRequires:  doxygen
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  libpng-devel
BuildRequires:  pkg-config
BuildRequires:  python3
BuildRequires:  python3-docutils
BuildRequires:  zlib-devel
BuildRequires:  pkgconfig(glib-2.0)
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
The goal of the lensfun library is to provide a open source database
of photographic lenses and their characteristics. In the past there
was a effort in this direction (see http://www.epaperpress.com/ptlens/),
but then author decided to take the commercial route and the database
froze at the last public stage. This database was used as the basement
on which lensfun database grew, thanks to PTLens author which gave his
permission for this, while the code was totally rewritten from scratch
(and the database was converted to a totally new, XML-based format).

The lensfun library not only provides a way to read the database and
search for specific things in it, but also provides a set of algorithms
for correcting images based on detailed knowledge of lens properties
and calibration data. Right now lensfun is designed to correct distortion,
transversal (also known as lateral) chromatic aberrations, vignetting
and colour contribution index of the lens.

%package data
Summary:        Data files for %{name}/%{name}-devel
Group:          System/Libraries
%if %suse_version > 1130
BuildArch:      noarch
%endif

%description data
The goal of the lensfun library is to provide a open source database
of photographic lenses and their characteristics. In the past there
was a effort in this direction (see http://www.epaperpress.com/ptlens/),
but then author decided to take the commercial route and the database
froze at the last public stage. This database was used as the basement
on which lensfun database grew, thanks to PTLens author which gave his
permission for this, while the code was totally rewritten from scratch
(and the database was converted to a totally new, XML-based format).

The lensfun library not only provides a way to read the database and
search for specific things in it, but also provides a set of algorithms
for correcting images based on detailed knowledge of lens properties
and calibration data. Right now lensfun is designed to correct distortion,
transversal (also known as lateral) chromatic aberrations, vignetting
and colour contribution index of the lens.

%package -n lib%{name}%{sonum}
Summary:        Library files for %{name}/%{name}-devel
Group:          System/Libraries
Requires:       %{name}-data
Provides:       %{name} = %{version}
Obsoletes:      %{name} < %{version}

%description -n lib%{name}%{sonum}
Library files needed by the use the %{name} library/database.

%package doc
Summary:        Documentation for %{name}
Group:          Documentation/HTML
Requires:       %{name}-data

%description doc
Documentation and manual files for the %{name} library/database.

%package devel
Summary:        Header and library definition files for %{name}
Group:          Development/Libraries/C and C++
Requires:       %{name}-data = %{version}
Requires:       lib%{name}%{sonum} = %{version}
Recommends:     %{name}-doc = %{version}

%description devel
Header and library definition files for developing applications
that use the %{name} library/database.

%prep
%setup -q
cd data
#%patch1 -p0

%build
echo 'HTML_TIMESTAMP=NO' >> docs/doxyfile.in.cmake
# We can count on having SSE2 on x86_64
# On i%86 it is not save. We could have the sse lib in sse subdirectory in addition though.
# In any case this must be independent of the build host.
mkdir cmake_build
cd cmake_build
cmake ..                        \
    -DBUILD_STATIC=OFF          \
    -DBUILD_TESTS=ON            \
    -DBUILD_DOC=on              \
    -DBUILD_FOR_SSE=off         \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DDOCDIR=%{_defaultdocdir}/%name \
%if %{_lib} == lib64
    -DLIB_SUFFIX=64 \
%endif
%ifarch x86_64
    -DBUILD_FOR_SSE2=on
%else
    -DBUILD_FOR_SSE2=off
%endif
make %{?_smp_mflags} lensfun doc

%install
cd cmake_build
make AUTODEP=0 DESTDIR=%{?buildroot:%{buildroot}} install
# fix man path
mv %{buildroot}/usr/man %{buildroot}%{_mandir}
# drop test cases, we should run them here instead
rm -rf %{buildroot}/usr/share/lensfun/tests

%fdupes %{buildroot}

%post   -n lib%{name}%{sonum} -p /sbin/ldconfig

%postun -n lib%{name}%{sonum} -p /sbin/ldconfig

%files doc
%defattr(-,root,root)
%doc README
%doc docs/adobe-lens-profile.txt
%doc docs/cc-by-sa-3.0.txt
%doc docs/gpl-3.0.txt
%doc docs/lgpl-3.0.txt
%doc docs/mounts.txt
%doc %{_defaultdocdir}/%name

%files data
%defattr(-,root,root)
%{_datadir}/%{name}/

%files -n lib%{name}%{sonum}
%defattr(-,root,root)
%{_libdir}/*.so.*

%files devel
%defattr(-,root,root)
%{_includedir}/lensfun
%{_libdir}/*.so
%{_libdir}/pkgconfig/lensfun.pc
%{_bindir}/g-lensfun-update-data
%{_bindir}/lensfun-add-adapter
%{_bindir}/lensfun-update-data
%{_mandir}/man?/g-lensfun-update-data.*
%{_mandir}/man?/lensfun-add-adapter.*
%{_mandir}/man?/lensfun-update-data.*

%changelog