# We keep track manually of the library version
%global liblongver 0.0.0
%global libshortver 0
Name: cmpfit
Version: 1.2
Release: 8%{?dist}
Summary: A MINPACK-1 Least Squares Fitting Library in C
License: BSD
URL: http://cow.physics.wisc.edu/~craigm/idl/cmpfit.html
Source0: http://cow.physics.wisc.edu/~craigm/idl/down/%{name}-%{version}.zip
# patches generated using the updated sources at fityk project
# original author emailed updated package to fityk developer (Marcin Wojdyr)
# sources can be seen here - https://github.com/wojdyr/fityk/tree/master/fityk/cmpfit
Patch0: header_file.patch
Patch1: source_file.patch
%description
CMPFIT uses the Levenberg-Marquardt technique to solve the least-squares
problem. In its typical use, CMPFIT will be used to fit a user-supplied
function (the "model") to user-supplied data points (the "data") by adjusting
a set of parameters. CMPFIT is based upon MINPACK-1 (LMDIF.F) by More' and
collaborators.
%package devel
Summary: Headers for developing programs that will use %{name}
Group: Development/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
These are the header files and libraries needed to develop a %{name}
application.
%prep
%setup -q
%patch0
%patch1
%build
# Manual build, makefile only does static library
gcc %{optflags} -fpic -c -o mpfit.o mpfit.c
gcc -shared -Wl,-soname,libmpfit.so.%{libshortver} -o libmpfit.so.%{liblongver} mpfit.o -lm
%install
mkdir -p %{buildroot}/%{_includedir}
mkdir -p %{buildroot}/%{_libdir}
cp mpfit.h %{buildroot}/%{_includedir}
cp libmpfit.so.%{liblongver} %{buildroot}/%{_libdir}
pushd %{buildroot}/%{_libdir}
ln -s libmpfit.so.%{liblongver} libmpfit.so.%{libshortver}
ln -s libmpfit.so.%{liblongver} libmpfit.so
popd
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%doc README DISCLAIMER
%{_libdir}/libmpfit.so.%{liblongver}
%{_libdir}/libmpfit.so.%{libshortver}
%files devel
%{_includedir}/mpfit.h
%{_libdir}/libmpfit.so
%changelog
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.2-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.2-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Fri Jun 06 2014 Mukundan Ragavan <nonamedotc@fedoraproject.org> - 1.2-5
- Reverted patch
* Thu Jun 05 2014 Mukundan Ragavan <nonamedotc@fedoraproject.org> - 1.2-4
- Correct patch added
* Thu Jun 05 2014 Mukundan Ragavan <nonamedotc@fedoraproject.org> - 1.2-3
- Updating package to version available from fityk github repo
- update obtained via email from original author of mpfit by fityk devel
- Added patch from Marcin Wojdyr (fityk github repo)
* Fri Mar 07 2014 Sergio Pascual <sergiopr at fedoraproject.org> - 1.2-2
- Add license in DISCLAIMER
- Update requires in cmpfit-devel
* Fri Aug 16 2013 Sergio Pascual <sergiopr at fedoraproject.org> - 1.2-1
- Initial spec