Hello community, here is the log from the commit of package nlopt for openSUSE:Factory checked in at 2016-01-16 11:57:04 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/nlopt (Old) and /work/SRC/openSUSE:Factory/.nlopt.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "nlopt" Changes: -------- --- /work/SRC/openSUSE:Factory/nlopt/nlopt.changes 2015-06-02 10:09:22.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.nlopt.new/nlopt.changes 2016-01-16 11:57:07.000000000 +0100 @@ -1,0 +2,6 @@ +Tue Nov 17 16:33:16 UTC 2015 - dmitry_r@opensuse.org + +- Fix compatibility with Octave 4.0 + * nlopt-octave-4.0.patch + +------------------------------------------------------------------- New: ---- nlopt-octave-4.0.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ nlopt.spec ++++++ --- /var/tmp/diff_new_pack.vGqxsU/_old 2016-01-16 11:57:08.000000000 +0100 +++ /var/tmp/diff_new_pack.vGqxsU/_new 2016-01-16 11:57:08.000000000 +0100 @@ -28,10 +28,12 @@ Patch1: nlopt-2.3-pkgconfig.patch # PATCH-FIX-UPSTREAM pythondir.patch Patch2: pythondir.patch +# PATCH-FIX-UPSTREAM nlopt-octave-4.0.patch -- https://github.com/stevengj/nlopt/issues/33 +Patch3: nlopt-octave-4.0.patch BuildRequires: fdupes BuildRequires: gcc-c++ BuildRequires: hdf5-devel -# BuildRequires: octave-devel +BuildRequires: octave-devel BuildRequires: pkgconfig BuildRequires: python-numpy-devel BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -45,8 +47,6 @@ %package -n lib%{name}0 Summary: A library for nonlinear optimization Group: System/Libraries -# FIXME temporary, octave-nlopt_optimize is inconsistent with octave 4.0 -Obsoletes: octave-nlopt_optimize %description -n lib%{name}0 NLopt is a free/open-source library for nonlinear optimization, @@ -76,23 +76,24 @@ This package contains Python interface to NLopt library. -# %%package -n octave-nlopt_optimize -# Summary: Octave interface to nonlinear optimization libray -# Group: Productivity/Scientific/Math -# Requires: octave -# -# %%description -n octave-nlopt_optimize -# NLopt is a free/open-source library for nonlinear optimization, -# providing a common interface for a number of different free -# optimization routines available online as well as original -# implementations of various other algorithms. -# -# This package contains Octave interface to NLopt library. +%package -n octave-nlopt_optimize +Summary: Octave interface to nonlinear optimization libray +Group: Productivity/Scientific/Math +Requires: octave-cli + +%description -n octave-nlopt_optimize +NLopt is a free/open-source library for nonlinear optimization, +providing a common interface for a number of different free +optimization routines available online as well as original +implementations of various other algorithms. + +This package contains Octave interface to NLopt library. %prep %setup -q %patch1 %patch2 -p1 +%patch3 -p1 %build %configure --enable-shared \ @@ -125,13 +126,13 @@ %doc COPYING %{python_sitearch}/* -# %%files -n octave-nlopt_optimize -# %%defattr(-,root,root,-) -# %%doc COPYING -# %%dir %%{_libdir}/octave/*/site -# %%dir %%{_libdir}/octave/*/site/oct -# %%dir %%{_libdir}/octave/*/site/oct/* -# %%{_libdir}/octave/*/site/oct/*/*.oct -# %%{_datadir}/octave/*/site/m/* +%files -n octave-nlopt_optimize +%defattr(-,root,root,-) +%doc COPYING +%dir %{_libdir}/octave/*/site +%dir %{_libdir}/octave/*/site/oct +%dir %{_libdir}/octave/*/site/oct/* +%{_libdir}/octave/*/site/oct/*/*.oct +%{_datadir}/octave/*/site/m/* %changelog ++++++ nlopt-octave-4.0.patch ++++++ diff --git a/octave/nlopt_optimize-oct.cc b/octave/nlopt_optimize-oct.cc index 4e08421..819db4e 100644 --- a/octave/nlopt_optimize-oct.cc +++ b/octave/nlopt_optimize-oct.cc @@ -29,7 +29,12 @@ #include "nlopt.h" #include "nlopt_optimize_usage.h" -static int struct_val_default(Octave_map &m, const std::string& k, +#include <octave/version.h> +#if OCTAVE_MAJOR_VERSION < 3 || (OCTAVE_MAJOR_VERSION == 3 && OCTAVE_MINOR_VERSION < 8) +# define octave_map Octave_map +#endif + +static int struct_val_default(octave_map &m, const std::string& k, int dflt) { if (m.contains(k)) { @@ -39,7 +44,7 @@ static int struct_val_default(Octave_map &m, const std::string& k, return dflt; } -static double struct_val_default(Octave_map &m, const std::string& k, +static double struct_val_default(octave_map &m, const std::string& k, double dflt) { if (m.contains(k)) { @@ -49,7 +54,7 @@ static double struct_val_default(Octave_map &m, const std::string& k, return dflt; } -static Matrix struct_val_default(Octave_map &m, const std::string& k, +static Matrix struct_val_default(octave_map &m, const std::string& k, Matrix &dflt) { if (m.contains(k)) { @@ -140,7 +145,7 @@ static double user_function1(unsigned n, const double *x, #define CHECK1(cond, msg) if (!(cond)) { fprintf(stderr, msg "\n\n"); nlopt_destroy(opt); nlopt_destroy(local_opt); return NULL; } -nlopt_opt make_opt(Octave_map &opts, int n) +nlopt_opt make_opt(octave_map &opts, int n) { nlopt_opt opt = NULL, local_opt = NULL; @@ -195,7 +200,7 @@ nlopt_opt make_opt(Octave_map &opts, int n) CHECK1(opts.contents("local_optimizer").length() == 1 && (opts.contents("local_optimizer"))(0).is_map(), "opt.local_optimizer must be a structure"); - Octave_map local_opts = (opts.contents("local_optimizer"))(0).map_value(); + octave_map local_opts = (opts.contents("local_optimizer"))(0).map_value(); CHECK1((local_opt = make_opt(local_opts, n)), "error initializing local optimizer"); nlopt_set_local_optimizer(opt, local_opt); @@ -216,7 +221,7 @@ DEFUN_DLD(nlopt_optimize, args, nargout, NLOPT_OPTIMIZE_USAGE) CHECK(args.length() == 2 && nargout <= 3, "wrong number of args"); CHECK(args(0).is_map(), "opt must be structure") - Octave_map opts = args(0).map_value(); + octave_map opts = args(0).map_value(); CHECK(args(1).is_real_matrix() || args(1).is_real_scalar(), "x must be real vector");