summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Orlitzky <mjo@gentoo.org>2022-09-12 16:26:23 -0400
committerMichael Orlitzky <mjo@gentoo.org>2022-09-12 16:31:30 -0400
commite1bf0ac69752835111fef2a6700624d7ef74abc7 (patch)
tree0bdb385a89660c149f8102190ece06b2911d8aa8 /sci-libs
parentsci-libs/nlopt: drop 2.6.2-r1, 2.7.1 (diff)
downloadgentoo-e1bf0ac69752835111fef2a6700624d7ef74abc7.tar.gz
gentoo-e1bf0ac69752835111fef2a6700624d7ef74abc7.tar.bz2
gentoo-e1bf0ac69752835111fef2a6700624d7ef74abc7.zip
sci-libs/nlopt: new revision with subslot dependency on sci-math/octave.
With USE=octave, NLopt builds a *.oct interface using mkoctfile, and that requires a rebuild when Octave is upgraded. Closes: https://bugs.gentoo.org/869863 Signed-off-by: Michael Orlitzky <mjo@gentoo.org>
Diffstat (limited to 'sci-libs')
-rw-r--r--sci-libs/nlopt/nlopt-2.7.1-r2.ebuild111
1 files changed, 111 insertions, 0 deletions
diff --git a/sci-libs/nlopt/nlopt-2.7.1-r2.ebuild b/sci-libs/nlopt/nlopt-2.7.1-r2.ebuild
new file mode 100644
index 000000000000..b49baaa4267f
--- /dev/null
+++ b/sci-libs/nlopt/nlopt-2.7.1-r2.ebuild
@@ -0,0 +1,111 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{8..10} )
+
+inherit python-r1 cmake fortran-2
+
+DESCRIPTION="Non-linear optimization library"
+HOMEPAGE="https://github.com/stevengj/nlopt"
+SRC_URI="https://github.com/stevengj/nlopt/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="LGPL-2.1 MIT"
+KEYWORDS="~amd64 ~arm64 ~x86 ~amd64-linux ~x86-linux"
+SLOT="0"
+IUSE="cxx guile octave python test"
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+ guile? ( dev-scheme/guile:* )
+ octave? ( >=sci-mathematics/octave-6:= )
+ python? (
+ ${PYTHON_DEPS}
+ dev-python/numpy[${PYTHON_USEDEP}]
+ )
+ "
+DEPEND="${RDEPEND}"
+BDEPEND="python? ( dev-lang/swig )"
+
+src_prepare() {
+ cmake_src_prepare
+
+ use python && python_copy_sources
+}
+
+src_configure() {
+ # MATLAB detection causes problems (as in bug 826774) if we don't
+ # explicitly disable it.
+ local mycmakeargs=(
+ -DNLOPT_CXX=$(usex cxx)
+ -DNLOPT_FORTRAN=$(usex test)
+ -DNLOPT_GUILE=$(usex guile)
+ -DNLOPT_OCTAVE=$(usex octave)
+ -DNLOPT_MATLAB=OFF
+ -DNLOPT_PYTHON=OFF
+ -DNLOPT_SWIG=$(usex python)
+ -DNLOPT_TESTS=$(usex test)
+ )
+
+ cmake_src_configure
+
+ if use python; then
+ python_configure() {
+ local mycmakeargs=(
+ ${mycmakeargs[@]}
+ -DNLOPT_PYTHON=ON
+ -DINSTALL_PYTHON_DIR="$(python_get_sitedir)"
+ )
+
+ cmake_src_configure
+ }
+
+ python_foreach_impl run_in_build_dir python_configure
+ fi
+}
+
+src_compile() {
+ cmake_src_compile
+
+ if use python; then
+ python_foreach_impl run_in_build_dir cmake_src_compile
+ fi
+}
+
+src_test() {
+ do_test() {
+ local a f
+ cd "${BUILD_DIR}"/test
+ for a in {1..$(usex cxx 9 7)}; do
+ for f in {5..9}; do
+ ./testopt -a $a -o $f || die "algorithm $a function $f failed"
+ done
+ done
+ }
+
+ do_test
+
+ if use python; then
+ python_foreach_impl run_in_build_dir do_test
+ fi
+}
+
+nlopt_install() {
+ cmake_src_install
+ python_optimize
+}
+
+src_install() {
+ cmake_src_install
+
+ if use python; then
+ python_foreach_impl run_in_build_dir nlopt_install
+ fi
+
+ local r
+ for r in */README; do
+ newdoc ${r} README.$(dirname ${r})
+ done
+}