File liblbfgs.spec of Package liblbfgs

#
# spec file for package liblbfgs
#
# 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/
#

%define so_ver 1

Name:           liblbfgs
Version:        1.10
Release:        0
Summary:        Limited-memory Broyden-Fletcher-Goldfarb-Shanno library
License:        MIT
Group:          Development/Libraries/C and C++
Url:            http://www.chokkan.org/software/liblbfgs/
Source0:        https://github.com/downloads/chokkan/liblbfgs/%{name}-%{version}.tar.gz
# Fix CFLAGS override, build solib with correct versioning
Patch0:         liblbfgs_build.patch
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  libtool

%package -n %{name}%{so_ver}
Summary:        Limited-memory Broyden-Fletcher-Goldfarb-Shanno library --shared library
Group:          System/Libraries

%description -n %{name}%{so_ver}
A C port of the implementation of Limited-memory
Broyden-Fletcher-Goldfarb-Shanno (L-BFGS) method written by Jorge Nocedal.

%description
A C port of the implementation of Limited-memory
Broyden-Fletcher-Goldfarb-Shanno (L-BFGS) method written by Jorge Nocedal.

%package        devel
Summary:        Development files for %{name}
Group:          Development/Libraries/C and C++
Requires:       %{name}%{so_ver} = %{version}-%{release}

%description    devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.

%prep
%setup -q
%patch0 -p1

# Needed for patch0
autoreconf -ifv

%build
export LDFLAGS="-Wl,--as-needed"
%configure --disable-static
make %{?_smp_mflags}

%install
%make_install
find %{buildroot} -type f -name "*.la" -delete -print

# Install these through %%doc
rm -rf %{buildroot}%{_datadir}/doc
rmdir %{buildroot}%{_datadir}

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

%postun -n %{name}%{so_ver} -p /sbin/ldconfig

%files -n %{name}%{so_ver}
%defattr(-,root,root)
%doc AUTHORS ChangeLog COPYING README
%{_libdir}/liblbfgs.so.*

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

%changelog