Blob Blame History Raw
# The octave_pkg_install macro assumes a package that is only octave code, not
# an addon like in this package.  We define our own version of the macro here
# to operate only on the correct directory.
%global my_octave_pkg_install \
mkdir -p %{buildroot}%{octprefix} \
mkdir -p %{buildroot}%{octarchprefix} \
%octave_cmd pkg("prefix","%{buildroot}%{octprefix}","%{buildroot}%{octarchprefix}");pkg("global_list",fullfile("%{buildroot}%{octshareprefix}","octave_packages"));pkg("install","-nodeps","-verbose",glob("%{_builddir}/%{buildsubdir}/examples/matlab/%{octpkg}-%{version}-*.tar.gz"){1,1});unlink(pkg("global_list")); \
if [ -e %{buildroot}%{octpkgdir}/packinfo/on_uninstall.m ] \
then \
  mv %{buildroot}%{octpkgdir}/packinfo/on_uninstall.m %{buildroot}%{octpkgdir}/packinfo/on_uninstall.m.orig \
fi \
echo "function on_uninstall (desc)" > %{buildroot}%{octpkgdir}/packinfo/on_uninstall.m \
echo "  error ('Can not uninstall %s installed by the redhat package manager',;" >> %{buildroot}%{octpkgdir}/packinfo/on_uninstall.m \
echo "endfunction" >> %{buildroot}%{octpkgdir}/packinfo/on_uninstall.m \
if [ -e %{_builddir}/%{buildsubdir}/examples/matlab/%{octpkg}-%{version}/*.metainfo.xml ] \
then \
  echo "Found .metainfo.xml appdata file" \
  mkdir -p %{buildroot}/%{_metainfodir} \
  cp -p %{_builddir}/%{buildsubdir}/examples/matlab/%{octpkg}-%{version}/*.metainfo.xml %{buildroot}/%{_metainfodir}/ \
  appstreamcli validate --no-net %{buildroot}/%{_metainfodir}/*.metainfo.xml \
else \
  echo "Did not find a .metainfo.xml appdata file" \
fi \

Name:           mpsolve
Version:        3.2.1
Release:        16%{?dist}
Summary:        Multiprecision polynomial solver

License:        GPL-3.0-or-later
# Fix mutex and condvar leaks
Patch0:         %{name}-mutex-leak.patch
# Fix to work with autoconf 2.70+
Patch1:         %{name}-autoconf-2.70.patch
# Fix coefficient leaks
Patch2:         %{name}-coefficient-leak.patch
# Updates for octave 6.x
Patch3:         %{name}-octave.patch
# Fix LTO warnings about mismatched types
Patch4:         %{name}-lto.patch
# Fix configure tests with Modern C
# See
Patch5:         %{name}-modern-c.patch

BuildRequires:  bison
BuildRequires:  doxygen-latex
BuildRequires:  flex
BuildRequires:  gcc-c++
BuildRequires:  gcc-gfortran
BuildRequires:  gmp-devel
BuildRequires:  ImageMagick
BuildRequires:  libtool
BuildRequires:  make
BuildRequires:  pkgconfig(check)
BuildRequires:  pkgconfig(gtk+-3.0)
BuildRequires:  pkgconfig(mpfr)
BuildRequires:  pkgconfig(octave)
BuildRequires:  pkgconfig(Qt5)
BuildRequires:  pkgconfig(Qt5Qml)
BuildRequires:  python3-devel
BuildRequires:  tex(dvips)

Requires:       %{name}-libs%{?_isa} = %{version}-%{release}

%global _desc %{expand:
MPSolve stands for Multiprecision Polynomial SOLVEr.  It aims to provide
an easy to use universal blackbox for solving polynomials and secular

Its features include:
- Arbitrary precision approximation.
- Guaranteed inclusion radii for the results.
- Exploiting of polynomial structures: it can take advantage of sparsity
  as well as coefficients in a particular domain (i.e. integers or
- It can be specialized for specific classes of polynomials.  As an
  example, the roots of the Mandelbrot polynomial of degree 2,097,151
  were computed in about 10 days on a dual Xeon server.}

%description %_desc

This package contains command-line interfaces to %{name}.

%package        libs
Summary:        Multiprecision polynomial solver library

%description    libs %_desc

%package        doc
Summary:        Developer documentation for %{name}
BuildArch:      noarch

%description    doc %_desc

This package contains developer documentation for %{name}.

%package        devel
Summary:        Headers and library links for %{name}
Requires:       %{name}-libs%{?_isa} = %{version}-%{release}
Requires:       gmp-devel%{?_isa}

%description    devel
This package contains header and library links for developing
applications that use %{name}.

%package     -n xmpsolve
Summary:        Qt GUI for mpsolve
Requires:       %{name}-libs%{?_isa} = %{version}-%{release}
Requires:       hicolor-icon-theme
Requires:       shared-mime-info%{?_isa}

%description -n xmpsolve %_desc

This package contains a Qt-based graphical interface to mpsolve.

%package     -n python3-mpsolve
Summary:        Python 3 interface to mpsolve
BuildArch:      noarch
Requires:       %{name}-libs = %{version}-%{release}

%description -n python3-mpsolve %_desc

This package contains a python 3 interface to mpsolve.

%global octpkg  %{name}

%package     -n octave-mpsolve
Summary:        Octave interface to mpsolve
Requires:       %{name}-libs%{?_isa} = %{version}-%{release}
Requires:       octave(api) = %{?octave_api}%{!?octave_api:0}
Requires(post): octave
Requires(postun): octave

%description -n octave-mpsolve %_desc

This package contains an octave interface to mpsolve.

%autosetup -n MPSolve-%{version} -p1

# Fix the version number in the octave interface
sed -i 's/3\.1\.7/%{version}/' examples/octave/DESCRIPTION
cp -p examples/octave/DESCRIPTION examples/matlab

# Octave wants the COPYING file
cp -p COPYING examples/matlab

# We do not need both HTML and PDF documentation
sed -i '/GENERATE_LATEX/s/YES/NO/' doc/

# Doxygen wants the CSS file up one level
cp -p doc/doxygen/doxygen.css doc

# Invoke python3, not python
sed -i 's,%{_bindir}/env python,%{python3},' examples/python/tests/*.py

# Do not force use of -fomit-frame-pointer
sed -i '/-fomit-frame-pointer/d'

# Generate the configure script
autoreconf -fi .

%configure --disable-static --disable-debug --enable-qml-ui LIBS=-lpthread

# Get rid of undesirable hardcoded rpaths; workaround libtool reordering
# -Wl,--as-needed after all the libraries.
sed -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \
    -e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' \
    -e 's|CC="\(.*g..\)"|CC="\1 -Wl,--as-needed"|' \
    -i libtool

# Work around


# Build the octave package the Fedora way
cd examples/matlab
mkdir -p MPSolve-%{version}/src
mkoctfile -I../../include -c -o mps_interp.o mps_interp.c
mkoctfile -I../../include -c -o mps_kostlan.o mps_kostlan.c
mkoctfile -I../../include -c -o mps_option_parser.o mps_option_parser.c
mkoctfile -I../../include -c -o mps_roots_double.o mps_roots_double.c
mkoctfile -I../../include -c -o mps_roots_string.o mps_roots_string.c
mkoctfile -o MPSolve-%{version}/src/mps_interp.oct -L../../src/libmps/.libs mps_interp.o -lmps -lmpfr
mkoctfile -o MPSolve-%{version}/src/mps_kostlan.oct -L../../src/libmps/.libs mps_kostlan.o -lmps
mkoctfile -o MPSolve-%{version}/src/mps_option_parser.oct -L../../src/libmps/.libs mps_option_parser.o -lmps
mkoctfile -o MPSolve-%{version}/src/mps_roots_double.oct -L../../src/libmps/.libs mps_roots_double.o -lmps
mkoctfile -o MPSolve-%{version}/src/mps_roots_string.oct -L../../src/libmps/.libs mps_roots_string.o -lmps
cp -p *.m MPSolve-%{version}/src
cp -p COPYING DESCRIPTION MPSolve-%{version}
tar cf mpsolve-%{version}-any-none.tar MPSolve-%{version}
gzip -9v mpsolve-%{version}-any-none.tar
cd -


# We do not want the libtool files
rm -f %{buildroot}%{_libdir}/*.la

# Move the icon
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/192x192/apps
mv %{buildroot}%{_datadir}/icons/xmpsolve.png \

# Generate more icon sizes
for sz in 16 22 24 32 36 48 64 72 96 128 256; do
  mkdir -p %{buildroot}%{_datadir}/icons/hicolor/${sz}x${sz}/apps
  convert src/xmpsolve/xmpsolve.png -resize ${sz}x${sz} \

# Install the octave package the Fedora way

make check

%post        -n octave-mpsolve
%octave_cmd pkg rebuild

%preun       -n octave-mpsolve

%postun      -n octave-mpsolve
%octave_cmd pkg rebuild


%files          libs
%license COPYING

%files          doc
%doc doc/html/*
%license COPYING

%files          devel
%doc ChangeLog

%files       -n xmpsolve

%files       -n python3-mpsolve

%files       -n octave-mpsolve
%dir %{octpkgdir}/
%doc %{octpkgdir}/doc-cache

* Sun Apr 09 2023 Orion Poplawski <> - 3.2.1-16
- Rebuild for octave 8.1.0

* Thu Jan 19 2023 Fedora Release Engineering <> - 3.2.1-15
- Rebuilt for

* Mon Nov 28 2022 Jerry James <> - 3.2.1-14
- Add modern-c patch
- Convert License tag to SPDX

* Thu Jul 21 2022 Fedora Release Engineering <> - 3.2.1-13
- Rebuilt for

* Mon Jun 13 2022 Python Maint <> - 3.2.1-12
- Rebuilt for Python 3.11

* Wed Jun 01 2022 Orion Poplawski <> - 3.2.1-11
- Rebuild for octave 7.1

* Tue May 24 2022 Jerry James <> - 3.2.1-10
- Fix FTBFS with octave 7.1 (rhbz#2083937)
- Add -coefficient-leak patch to plug another memory leak

* Thu Jan 20 2022 Fedora Release Engineering <> - 3.2.1-9
- Rebuilt for

* Tue Aug 17 2021 Jerry James <> - 3.2.1-8
- Rebuild for octave 6.3.0
- Add -octave and -lto patches to fix build issues

* Thu Jul 22 2021 Fedora Release Engineering <> - 3.2.1-7
- Rebuilt for

* Fri Jun 04 2021 Python Maint <> - 3.2.1-6
- Rebuilt for Python 3.10

* Thu Mar 25 2021 Jerry James <> - 3.2.1-5
- Add -autoconf-2.70 patch (bz 1943108)
- Add -mutex-leak patch
- Upstream suggests building the matlab interface with octave in preference to
  the unmaintained octave interface

* Tue Jan 26 2021 Fedora Release Engineering <> - 3.2.1-4
- Rebuilt for

* Sat Aug 01 2020 Fedora Release Engineering <> - 3.2.1-3
- Second attempt - Rebuilt for

* Tue Jul 28 2020 Fedora Release Engineering <> - 3.2.1-2
- Rebuilt for

* Fri Jun 12 2020 Jerry James <> - 3.2.1-1
- Version 3.2.1
- The formerly missing files are now included in the tarball

* Thu Jun 11 2020 Jerry James <> - 3.2.0-1
- Version 3.2.0
- Drop upstreamed patches: -strict-aliasing and -mpq-canonicalize

* Wed May 27 2020 Jerry James <> - 3.1.8-1
- Initial RPM