File cminpack.spec of Package cminpack
#
# spec file for package cminpack
#
# Copyright (c) 2023 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#
Name: cminpack
Version: 1.3.8
Release: 0
Summary: Solver for nonlinear equations and nonlinear least squares problems
License: Minpack
Group: Development/Libraries/C and C++
URL: https://devernay.free.fr/hacks/cminpack/cminpack.html
Source0: https://github.com/devernay/cminpack/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
BuildRequires: blas-devel
BuildRequires: cblas-devel
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
%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
# Install CMake config to correct directory
sed -i -e '/EXPORT CMinpackConfig/ s#share/cminpack#%{_lib}/cmake/cminpack#' CMakeLists.txt
%build
%cmake \
-DCMAKE_SKIP_INSTALL_RPATH=ON \
-DCMAKE_SKIP_RPATH=OFF \
-DBUILD_SHARED_LIBS=ON \
-DCMINPACK_LIB_INSTALL_DIR=%{_lib} \
-DCMINPACK_PRECISION="d" \
%{nil}
%cmake_build
%install
%cmake_install
# Fix generated pkgconfig file; https://github.com/devernay/cminpack/issues/55
sed -i -e '/Version:/ s/;.*//' %{buildroot}%{_libdir}/pkgconfig/%{name}.pc
%check
# Only x86_64 is able to reproduce reference results exactly
%ifarch x86_64
# tlmdifc fails due to numeric inaccuracy, https://github.com/devernay/cminpack/issues/37
%ctest --exclude-regex tlmdifc
%endif
%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.*
%license CopyrightMINPACK.txt
%files devel
%doc README.md
%doc docs/*.html docs/*.css docs/*.txt
%{_libdir}/pkgconfig/%{name}.pc
%{_libdir}/lib%{name}.so
%{_includedir}/%{name}-%{soname}
%dir %{_libdir}/cmake/cminpack
%{_libdir}/cmake/cminpack/CMinpackConfig*.cmake
%changelog