File cminpack.spec of Package cminpack

#
# spec file for package cminpack
#
# Copyright (c) 2018 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:           cminpack
Version:        1.3.6
Release:        1%{?dist}
Summary:        Solver for nonlinear equations and nonlinear least squares problems
License:        Modified BSD-3-Clause
Group:          Development/Libraries/C and C++
Url:            http://devernay.free.fr/hacks/cminpack/cminpack.html
Source0:        http://devernay.free.fr/hacks/cminpack/%{name}-%{version}.tar.gz
Patch0:         %{name}-1.3.4-64bit.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  blas-devel
%if 0%{?suse_version}
BuildRequires:  cblas-devel
%endif
%if 0%{?centos_version} || 0%{?fedora_version}
BuildRequires:  atlas-devel
%endif
BuildRequires:  cmake
BuildRequires:  gcc-c++
#BuildRequires:  gcc-fortran
BuildRequires:  pkg-config
%define soname 1

%description
cminpack is an ISO C99 implementation of the FORTRAN Minpack solver package.
It is fully re-entrant and thread-safe.

%package -n lib%{name}%{soname}
Summary:        Solver for nonlinear equations and nonlinear least squares problems
Group:          System/Libraries
Provides:       cminpack

%description -n lib%{name}%{soname}
cminpack is an ISO C99 implementation of the FORTRAN Minpack solver package.
It is fully re-entrant and thread-safe.

%package devel
Summary:        Header files and libraries for cminpack
Group:          Development/Libraries/C and C++
Requires:       lib%{name}%{soname} = %{version}

%description devel
Contains the development headers and libraries needed to build a program with
cminpack.

%prep
%setup -q
#%patch0 -p1 -b .64bit
mkdir build

%build
cd build
cmake \
  -DCMAKE_C_FLAGS:STRING="%{optflags} -I/usr/include/cblas" \
  -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  -DCMAKE_SKIP_RPATH=ON \
  -DCMAKE_INSTALL_PREFIX=%{_prefix} \
  -DBUILD_SHARED_LIBS=ON \
  -DSHARED_LIBS=ON \
  -DBLAS_LIBRARIES="cblas -lblas" \
%if "%{_lib}" == "lib64"
  -DLIB_SUFFIX=64 \
%endif
  %{_builddir}/%{name}-%{version}
make %{?_smp_mflags}

%install
cd build
%make_install DESTDIR=%{buildroot}

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

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

%files -n lib%{name}%{soname}
%{_libdir}/lib%{name}.so.*
%if 0%{?suse_version} >= 1500
%license CopyrightMINPACK.txt
%else
%doc CopyrightMINPACK.txt
%endif
%doc readme.txt

%files devel
%doc doc/*.html doc/*.txt
%{_libdir}/pkgconfig/%{name}.pc
%{_libdir}/lib%{name}.so
%{_includedir}/%{name}-%{soname}
%dir %{_datadir}/cmake/CMinpack
%{_datadir}/cmake/CMinpack/CMinpackConfig.cmake

%changelog
openSUSE Build Service is sponsored by