File lensfun.spec of Package lensfun

#
# spec file for package lensfun
#
# 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:           lensfun
Version:        0.2.5
Release:        0
Summary:        A photographic lens database and a library for accessing it
License:        LGPL-3.0
Group:          System/Libraries
%define sonum   0
Url:            http://lensfun.berlios.de/
Source0:        http://download.berlios.de/lensfun/lensfun-%{version}.tar.bz2
# This patch got created via
# svn diff svn://svn.berlios.de/lensfun/tags/0.2.5/data svn://svn.berlios.de/lensfun/trunk/data > lens_database_update.diff
Patch1:         lens_database_update.diff
# PATCH-FIX-UPSTREAM lensfun-fixcrash.patch fcrozat@suse.com -- fix crash on malformed databases (from svn)
Patch2:         lensfun-fixcrash.patch
# PATCH-FIX-UPSTREAM lensfun-0.2.5-cpuid.patch fcrozat@suse.com -- fix crash on cpu detection (from svn)
Patch3:         lensfun-0.2.5-cpuid.patch
BuildRequires:  doxygen
BuildRequires:  gcc-c++
BuildRequires:  libpng-devel
BuildRequires:  python
BuildRequires:  zlib
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
Requires:       lib%{name}%{sonum} = %{version}
%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:          System/Libraries
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
%patch2 -p1
%patch3 -p1
cd data
%patch1 -p0

%build
# disable vectorizing on anything but x86(_64)
./configure -v \
%ifnarch %{ix86} x86_64
	--vectorization="" \
%endif
	--cflags="${CFLAGS:-%{optflags}}" \
	--cxxflags="${CXXFLAGS:-%{optflags}}" \
	--prefix=%{_prefix} \
	--bindir=%{_bindir} \
	--sysconfdir=%{_sysconfdir} \
	--datadir=%{_datadir}/%{name} \
	--libdir=%{_libdir} \
	--includedir=%{_includedir} \
	--libexecdir=%{_libexecdir}
# set GCC.LDFLAGS to avoid stripping and useless -debuginfo
make AUTODEP=0 GCC.LDFLAGS.release="" V=1 %{?_smp_mflags} %{name} manual

%install
make AUTODEP=0 INSTALL_PREFIX=%{?buildroot:%{buildroot}} install
mkdir -p %{buildroot}%{_docdir}
mv %{buildroot}%{_datadir}/doc/%{name}-%{version} %{buildroot}%{_docdir}/%{name}

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

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

%post   devel -p /sbin/ldconfig

%postun devel -p /sbin/ldconfig

%clean
rm -rf %{buildroot}

%files doc
%defattr(-,root,root)
%{_docdir}/%{name}

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

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

%files devel
%defattr(-,root,root)
%{_includedir}/*.h
%{_libdir}/*.so
%{_libdir}/pkgconfig/*

%changelog