summaryrefslogtreecommitdiff
path: root/sci-libs/nlopt
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /sci-libs/nlopt
reinit the tree, so we can have metadata
Diffstat (limited to 'sci-libs/nlopt')
-rw-r--r--sci-libs/nlopt/Manifest9
-rw-r--r--sci-libs/nlopt/files/nlopt-2.3-as-needed.patch23
-rw-r--r--sci-libs/nlopt/files/nlopt-2.3-pkgconfig.patch10
-rw-r--r--sci-libs/nlopt/files/nlopt-2.4.2-fix-dynamic-underlinking.patch62
-rw-r--r--sci-libs/nlopt/files/nlopt-2.4.2-octave-4-map.patch49
-rw-r--r--sci-libs/nlopt/metadata.xml24
-rw-r--r--sci-libs/nlopt/nlopt-2.4.2-r1.ebuild115
7 files changed, 292 insertions, 0 deletions
diff --git a/sci-libs/nlopt/Manifest b/sci-libs/nlopt/Manifest
new file mode 100644
index 000000000000..4a940fa89b36
--- /dev/null
+++ b/sci-libs/nlopt/Manifest
@@ -0,0 +1,9 @@
+AUX nlopt-2.3-as-needed.patch 1062 SHA256 fdd21b03d1a667b0be4b1ce5b516d9c28ea2b5e116252f2f6fd2fbf0530395f2 SHA512 755e04b0e9d2ab5b1256c14015980b051716756777b910a9273a0dced4108e19a8f3030c1d03c6d96561a7edb3e883fdbc2822e1d6c1b74fa2794c336612cc47 WHIRLPOOL 88d7d978eafb5dc9c2de25e26e515d7ce1eed194da39f4b35f8c61c3588cfca49affc3d31ba0b0f7d25188a80310c8f45b9da3237f415df5a7a38f0e73abed4f
+AUX nlopt-2.3-pkgconfig.patch 318 SHA256 d7f9eb5f7912b4722e4f5514f27682ed3e20104076c2dc03d693aef449e4283a SHA512 923b20e177a842643b1022d68168978d5fb35e987c6781d8b0b368a6c707f4b42a4141c4ca7cf33cd7067a39147ae87220adeaaa545a8731bb6a5d2f3d11a5bc WHIRLPOOL 4f9fc1ee7800b48fec6c2f2d41dddee39ea371ea31e08f0b57faffe4bfffa370390d2d20e03bd96aec4e5c57d3a6d57897992557895d4be149fa83bc095cb6f8
+AUX nlopt-2.4.2-fix-dynamic-underlinking.patch 2522 SHA256 725e5f0dc4a1c6963860171af56ec915a059dff02f619d404d8367d864dbacb8 SHA512 bdb07b216ffb68b68cb3f03076336234c558db3953c48b02511883bf9fb12f5915c04950a2e3222577c7af4fb1e288a165af2e8adf211fc853e747c98a65cd19 WHIRLPOOL 051dd3abd6e29b0932a3aca9a8d50d99e5f188d7de82ada856e30aab3fcaaf914821b35b94d0cdd130b95884c2a267f0e4990a67256e969b67547af9868e5497
+AUX nlopt-2.4.2-octave-4-map.patch 1858 SHA256 3be25fff014a9157ae0824c908479e23d23eb382aa21b29fc57b34bdfa9205e7 SHA512 00c45fe04fdc1acf4ccbb77aaf39feab0cb2b811b45edf791db7e87aa9e965c23b6131400eebd68335be8dcb86f346c01892e718f739f07dc0853b3dd9ea5ad4 WHIRLPOOL f45b2ebfab0591fe9fcecd19d17d705f4a47214b7d73a1181cc19236a1086b93ca90e2e897df8678f21af8e451e4456d9ce2f770bdea1c55043be1b135410c9c
+DIST nlopt-2.4.2.tar.gz 2361992 SHA256 8099633de9d71cbc06cd435da993eb424bbcdbded8f803cdaa9fb8c6e09c8e89 SHA512 136aacc00a69f77e8a7ce5dc26a5f3f027bc8c01b97aa1f43919462e0a412154eabfb01be258e082dffe61f9b554bb2bfbb550a7b82c7c77c7b22874a64a9703 WHIRLPOOL ec07f402cc1868f05adf1f261aa2e50901448e965ccdee3d249e1447ad0abdff354caf1bafbf0700a25896f9fcee509c916fd5e7bdd768514a55bf6fff40784d
+EBUILD nlopt-2.4.2-r1.ebuild 2640 SHA256 4e03c7b2128df6fc829758bef1989e337ad4830c088a37b9cba28063ba688d2b SHA512 c8255cebd138aa4a3236f09b6d27f97781353dccb065652d64130973643dd97866d61cdc8f12c7465f5df0b63fc579864afb71ecff06ebdd31aa991de4ee1745 WHIRLPOOL 31ad319f7ee7c1a051738ad20569c6abc94334dab109f385aca39ee79eafa9a9f4152943dc1317c9ebb8a7646ca5b86405a411ff4322c8dc8cec9d75ec12b953
+MISC ChangeLog 3086 SHA256 0ac60e67c5ef3d848d01003e0a0a1eb0b0cb3666b147d1420efe9a3352f6faaf SHA512 8653458187153580beb70f0ca35bf2c6cfe833f0ee7bb4fbefda7bc51055d39280820268e865a82a4735f0b32fa99269935a07b8eaca60d1639257a910b5e004 WHIRLPOOL f430d06d6c4caa28c824d1b9ffba671e4fba326a22700167ce49d63df6e15778c81b123fd8249d2704656534dc701816b4b9096d53139dd0d16de0ab388f7fcc
+MISC ChangeLog-2015 3975 SHA256 c2f0c1e857d519df0d27299fb733252a7aafd218c0727f3bc0efd48cc0356f0e SHA512 cd64130435c8f3ad5bf25983125fb7b843e02ab499b156ce8ffb93cc03a1d23146fa65ab01ef643add3924d1be18cf21788a122d16502e17df0a010df6cb0e7b WHIRLPOOL 18da175a8ff6dae1e90c49f8da27fc5d229603b85c732e4c258b14b2f4ed1d76990fc4729736c2a2b0b97dade0308e27031fb647fe856a99983e318399f11a72
+MISC metadata.xml 1095 SHA256 44a69ac8e3f0af0869f79d77a9d21dfd4d7f895714fcc1582d590b0f6dfdb25d SHA512 74a37bc3e6fa74d0f96c3390fadf16e76caf904f43cf9ac0496f70e3e3bc458727e58d9fc65c39a81302b081575e530c27be3812488df20fab42aff5494437f7 WHIRLPOOL ca2f2b21a46fd5607bd7ef7579e54194651b90b8f3ce39f82c1516da153ec43ee6076e4bfde404c176d21a62ae0e75da8c4ac8f320256baaaf6bdcf4bfcbfdc8
diff --git a/sci-libs/nlopt/files/nlopt-2.3-as-needed.patch b/sci-libs/nlopt/files/nlopt-2.3-as-needed.patch
new file mode 100644
index 000000000000..928ec174b771
--- /dev/null
+++ b/sci-libs/nlopt/files/nlopt-2.3-as-needed.patch
@@ -0,0 +1,23 @@
+diff -Nur nlopt-2.3.orig/Makefile.am nlopt-2.3/Makefile.am
+--- nlopt-2.3.orig/Makefile.am 2012-08-03 02:07:09.000000000 +0100
++++ nlopt-2.3/Makefile.am 2012-08-03 02:13:13.000000000 +0100
+@@ -25,6 +25,7 @@
+
+ if WITH_CXX
+ libnlopt@NLOPT_SUFFIX@_la_LDFLAGS = -version-info @SHARED_VERSION_INFO@
++libnlopt@NLOPT_SUFFIX@_la_LIBADD += -lstdc++
+ else
+ libnlopt@NLOPT_SUFFIX@_la_LDFLAGS = -no-undefined -version-info @SHARED_VERSION_INFO@
+ endif
+diff -Nur nlopt-2.3.orig/swig/Makefile.am nlopt-2.3/swig/Makefile.am
+--- nlopt-2.3.orig/swig/Makefile.am 2012-08-03 02:07:09.000000000 +0100
++++ nlopt-2.3/swig/Makefile.am 2012-08-03 03:04:30.000000000 +0100
+@@ -9,7 +9,7 @@
+ # Guile wrapper
+
+ libnlopt@NLOPT_SUFFIX@_guile_la_SOURCES = nlopt-guile.cpp
+-libnlopt@NLOPT_SUFFIX@_guile_la_LIBADD = ../libnlopt@NLOPT_SUFFIX@.la
++libnlopt@NLOPT_SUFFIX@_guile_la_LIBADD = ../libnlopt@NLOPT_SUFFIX@.la @GUILE_LIBS@
+ libnlopt@NLOPT_SUFFIX@_guile_la_LDFLAGS = -version-info @SHARED_VERSION_INFO@
+ libnlopt@NLOPT_SUFFIX@_guile_la_CPPFLAGS = $(GUILE_CPPFLAGS) -I$(top_builddir)/api
+
diff --git a/sci-libs/nlopt/files/nlopt-2.3-pkgconfig.patch b/sci-libs/nlopt/files/nlopt-2.3-pkgconfig.patch
new file mode 100644
index 000000000000..8a072b15e2e2
--- /dev/null
+++ b/sci-libs/nlopt/files/nlopt-2.3-pkgconfig.patch
@@ -0,0 +1,10 @@
+--- nlopt.pc.in.orig 2012-08-03 01:41:30.000000000 +0100
++++ nlopt.pc.in 2012-08-03 01:42:29.000000000 +0100
+@@ -6,5 +6,6 @@
+ Name: NLopt
+ Description: nonlinear optimization libary
+ Version: @VERSION@
+-Libs: -L${libdir} -lnlopt -lm
++Libs: -L${libdir} -lnlopt@NLOPT_SUFFIX@
++Libs.private: -lm
+ Cflags: -I${includedir}
diff --git a/sci-libs/nlopt/files/nlopt-2.4.2-fix-dynamic-underlinking.patch b/sci-libs/nlopt/files/nlopt-2.4.2-fix-dynamic-underlinking.patch
new file mode 100644
index 000000000000..beb9dd4de815
--- /dev/null
+++ b/sci-libs/nlopt/files/nlopt-2.4.2-fix-dynamic-underlinking.patch
@@ -0,0 +1,62 @@
+Fix underlinking issues, caused by missing -lpython27 and -lpthread
+
+--- nlopt-2.4.2/configure.ac
++++ nlopt-2.4.2/configure.ac
+@@ -161,33 +161,17 @@
+ dnl Python:
+ AM_PATH_PYTHON([],[have_python=yes],[have_python=no])
+ if test $have_python = yes; then
+- AC_ARG_VAR([PYTHON_CONFIG], [python-config program])
+- AC_PATH_PROGS([PYTHON_CONFIG], [python$PYTHON_VERSION-config python-config],
+- [unknown], [`dirname $PYTHON`:$PATH])
+- AC_MSG_CHECKING([for Python include flags])
+- if test "x$PYTHON_CONFIG" = "xunknown"; then
+- pinc=-I`echo "import distutils.sysconfig; print (distutils.sysconfig.get_python_inc())" | $PYTHON - 2>/dev/null`
+- test "x$pinc" = "x-I" && pinc=""
+- else
+- pinc=`$PYTHON_CONFIG --includes 2>/dev/null`
+- fi
+- AC_MSG_RESULT([${pinc:-unknown}])
+- PYTHON_INCLUDES="$pinc"
+- save_CPPFLAGS=$CPPFLAGS
+- CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
+- AC_CHECK_HEADER([Python.h], [], [AC_MSG_WARN([disabling Python wrappers])
+- have_python=no])
+- if test $have_python = yes; then
++ PKG_CHECK_MODULES([PYTHON], [python-2.7])
++ CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
++
+ AC_MSG_CHECKING([for Numpy include directory])
+ pinc=`echo "import numpy; print (numpy.get_include())" | $PYTHON - 2>/dev/null`
+ AC_MSG_RESULT([${pinc:-unknown}])
+- test -n "$pinc" && PYTHON_INCLUDES="$PYTHON_INCLUDES -I$pinc"
++ test -n "$pinc" && PYTHON_INCLUDES="$PYTHON_CFLAGS -I$pinc"
+ CPPFLAGS="$save_CPPFLAGS $PYTHON_INCLUDES"
+ AC_CHECK_HEADER([numpy/arrayobject.h],[],[
+ AC_MSG_WARN([disabling Python wrappers])
+ have_python=no],[#include <Python.h>])
+- fi
+- CPPFLAGS=$save_CPPFLAGS
+ fi
+
+ fi # with_python
+--- nlopt-2.4.2/swig/Makefile.am
++++ nlopt-2.4.2/swig/Makefile.am
+@@ -9,7 +9,7 @@
+ # Guile wrapper
+
+ libnlopt@NLOPT_SUFFIX@_guile_la_SOURCES = nlopt-guile.cpp
+-libnlopt@NLOPT_SUFFIX@_guile_la_LIBADD = ../libnlopt@NLOPT_SUFFIX@.la @GUILE_LIBS@
++libnlopt@NLOPT_SUFFIX@_guile_la_LIBADD = -lpthread ../libnlopt@NLOPT_SUFFIX@.la @GUILE_LIBS@
+ libnlopt@NLOPT_SUFFIX@_guile_la_LDFLAGS = -version-info @SHARED_VERSION_INFO@
+ libnlopt@NLOPT_SUFFIX@_guile_la_CPPFLAGS = $(GUILE_CPPFLAGS) -I$(top_srcdir)/api
+
+@@ -23,7 +23,7 @@
+ # Python wrapper
+
+ _nlopt_la_SOURCES = nlopt-python.cpp
+-_nlopt_la_LIBADD = ../libnlopt@NLOPT_SUFFIX@.la
++_nlopt_la_LIBADD = ../libnlopt@NLOPT_SUFFIX@.la @PYTHON_LIBS@
+ _nlopt_la_LDFLAGS = -module -version-info @SHARED_VERSION_INFO@
+ _nlopt_la_CPPFLAGS = $(PYTHON_INCLUDES) -I$(top_srcdir)/api
+
diff --git a/sci-libs/nlopt/files/nlopt-2.4.2-octave-4-map.patch b/sci-libs/nlopt/files/nlopt-2.4.2-octave-4-map.patch
new file mode 100644
index 000000000000..c82d99497e67
--- /dev/null
+++ b/sci-libs/nlopt/files/nlopt-2.4.2-octave-4-map.patch
@@ -0,0 +1,49 @@
+Fix issues caused by Octave-4 renaming Octave_map to octave_map
+See also
+https://bugs.gentoo.org/show_bug.cgi?id=569996
+https://github.com/stevengj/nlopt/commit/5326ab410c978f9d8c3cae7e4917f55c10ef2c2e?diff=unified
+
+--- nlopt-2.4.2_old/octave/nlopt_optimize-oct.cc 2014-05-20 20:35:58.000000000 +0200
++++ nlopt-2.4.2/octave/nlopt_optimize-oct.cc 2016-01-09 16:10:53.358491776 +0100
+@@ -30,5 +30,5 @@
+ #include "nlopt_optimize_usage.h"
+
+-static int struct_val_default(Octave_map &m, const std::string& k,
++static int struct_val_default(octave_map &m, const std::string& k,
+ int dflt)
+ {
+@@ -40,5 +40,5 @@
+ }
+
+-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)
+ {
+@@ -50,5 +50,5 @@
+ }
+
+-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)
+ {
+@@ -141,5 +141,5 @@
+ #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;
+@@ -196,5 +196,5 @@
+ && (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");
+@@ -217,5 +217,5 @@
+
+ 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(),
diff --git a/sci-libs/nlopt/metadata.xml b/sci-libs/nlopt/metadata.xml
new file mode 100644
index 000000000000..35f045929ff6
--- /dev/null
+++ b/sci-libs/nlopt/metadata.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>sci@gentoo.org</email>
+ <name>Gentoo Science Project</name>
+ </maintainer>
+ <longdescription lang="en">
+ NLopt is a 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. Its features include:
+ * Callable from variety of languages (C, C++, Fortran, Python, Octave)
+ * A common interface for many different algorithms—try a different
+ algorithm just by changing one parameter.
+ * Both global and local optimization algorithms.
+ * Both derivative-free and gradient-based optimization algorithms.
+ * Algorithms for unconstrained optimization, bound-constrained
+ optimization, and general nonlinear inequality constraints.
+</longdescription>
+ <use>
+ <flag name="octave">Add plugin for <pkg>sci-mathematics/octave</pkg></flag>
+ </use>
+</pkgmetadata>
diff --git a/sci-libs/nlopt/nlopt-2.4.2-r1.ebuild b/sci-libs/nlopt/nlopt-2.4.2-r1.ebuild
new file mode 100644
index 000000000000..8562dd322d07
--- /dev/null
+++ b/sci-libs/nlopt/nlopt-2.4.2-r1.ebuild
@@ -0,0 +1,115 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 )
+AUTOTOOLS_AUTORECONF=1
+
+inherit python-r1 autotools-utils
+
+DESCRIPTION="Non-linear optimization library"
+HOMEPAGE="http://ab-initio.mit.edu/nlopt/"
+SRC_URI="${HOMEPAGE}/${P}.tar.gz"
+
+LICENSE="LGPL-2.1 MIT"
+KEYWORDS="amd64 x86 ~amd64-linux ~x86-linux"
+SLOT="0"
+IUSE="cxx guile octave python static-libs"
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+DEPEND="
+ guile? ( dev-scheme/guile:* )
+ octave? ( sci-mathematics/octave )
+ python? (
+ ${PYTHON_DEPS}
+ dev-python/numpy[${PYTHON_USEDEP}]
+ )"
+RDEPEND="${DEPEND}"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-2.3-pkgconfig.patch
+ "${FILESDIR}"/${PN}-2.3-as-needed.patch
+ "${FILESDIR}"/${P}-fix-dynamic-underlinking.patch
+)
+
+src_prepare() {
+ # fix #569996 due to renaming of Octave_map class
+ has_version ">=sci-mathematics/octave-4.0" && \
+ epatch "${FILESDIR}/${P}-octave-4-map.patch"
+ autotools-utils_src_prepare
+ use cxx && BUILD_CXX="${S}_cxx"
+ use python && python_copy_sources
+}
+
+src_configure() {
+ local myeconfargs=(
+ $(use_with octave)
+ )
+ if use octave; then
+ export OCT_INSTALL_DIR="$(octave-config -p LOCALOCTFILEDIR)"
+ export M_INSTALL_DIR="$(octave-config -p LOCALFCNFILEDIR)"
+ else
+ export MKOCTFILE=None
+ fi
+
+ myeconfargs+=(
+ $(use_with guile)
+ )
+
+ if use python; then
+ python_foreach_impl run_in_build_dir autotools-utils_src_configure
+ else
+ autotools-utils_src_configure
+ fi
+
+ if use cxx; then
+ myeconfargs+=( --with-cxx --without-octave --without-python )
+ BUILD_DIR="${BUILD_CXX}" autotools-utils_src_configure
+ fi
+}
+
+src_compile() {
+ if use python; then
+ python_foreach_impl run_in_build_dir autotools-utils_src_compile
+ else
+ autotools-utils_src_compile
+ fi
+ use cxx && BUILD_DIR="${BUILD_CXX}" autotools-utils_src_compile
+ #-C "${BUILD_DIR}_cxx"
+}
+
+src_test() {
+ do_test() {
+ local a f
+ cd "${BUILD_DIR}"/test
+ for a in {1..7}; do
+ for f in {5..9}; do
+ ./testopt -a $a -o $f || die "algorithm $a function $f failed"
+ done
+ done
+ }
+ if use python; then
+ python_foreach_impl run_in_build_dir do_test
+ else
+ do_test
+ fi
+ cd "${BUILD_CXX}"/test
+ for a in {1..9}; do
+ for f in {5..9}; do
+ ./testopt -a $a -o $f || die "algorithm $a function $f failed"
+ done
+ done
+}
+
+src_install() {
+ # build cxx first so the c lib overwrites the pc file
+ use cxx && BUILD_DIR="${BUILD_CXX}" autotools-utils_src_install
+ if use python; then
+ python_foreach_impl run_in_build_dir autotools-utils_src_install
+ else
+ autotools-utils_src_install
+ fi
+ local r
+ for r in */README; do newdoc ${r} README.$(dirname ${r}); done
+}