1 |
commit: e1bf0ac69752835111fef2a6700624d7ef74abc7 |
2 |
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Sep 12 20:26:23 2022 +0000 |
4 |
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Sep 12 20:31:30 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e1bf0ac6 |
7 |
|
8 |
sci-libs/nlopt: new revision with subslot dependency on sci-math/octave. |
9 |
|
10 |
With USE=octave, NLopt builds a *.oct interface using mkoctfile, and |
11 |
that requires a rebuild when Octave is upgraded. |
12 |
|
13 |
Closes: https://bugs.gentoo.org/869863 |
14 |
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org> |
15 |
|
16 |
sci-libs/nlopt/nlopt-2.7.1-r2.ebuild | 111 +++++++++++++++++++++++++++++++++++ |
17 |
1 file changed, 111 insertions(+) |
18 |
|
19 |
diff --git a/sci-libs/nlopt/nlopt-2.7.1-r2.ebuild b/sci-libs/nlopt/nlopt-2.7.1-r2.ebuild |
20 |
new file mode 100644 |
21 |
index 000000000000..b49baaa4267f |
22 |
--- /dev/null |
23 |
+++ b/sci-libs/nlopt/nlopt-2.7.1-r2.ebuild |
24 |
@@ -0,0 +1,111 @@ |
25 |
+# Copyright 1999-2022 Gentoo Authors |
26 |
+# Distributed under the terms of the GNU General Public License v2 |
27 |
+ |
28 |
+EAPI=8 |
29 |
+ |
30 |
+PYTHON_COMPAT=( python3_{8..10} ) |
31 |
+ |
32 |
+inherit python-r1 cmake fortran-2 |
33 |
+ |
34 |
+DESCRIPTION="Non-linear optimization library" |
35 |
+HOMEPAGE="https://github.com/stevengj/nlopt" |
36 |
+SRC_URI="https://github.com/stevengj/nlopt/archive/v${PV}.tar.gz -> ${P}.tar.gz" |
37 |
+ |
38 |
+LICENSE="LGPL-2.1 MIT" |
39 |
+KEYWORDS="~amd64 ~arm64 ~x86 ~amd64-linux ~x86-linux" |
40 |
+SLOT="0" |
41 |
+IUSE="cxx guile octave python test" |
42 |
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" |
43 |
+RESTRICT="!test? ( test )" |
44 |
+ |
45 |
+RDEPEND=" |
46 |
+ guile? ( dev-scheme/guile:* ) |
47 |
+ octave? ( >=sci-mathematics/octave-6:= ) |
48 |
+ python? ( |
49 |
+ ${PYTHON_DEPS} |
50 |
+ dev-python/numpy[${PYTHON_USEDEP}] |
51 |
+ ) |
52 |
+ " |
53 |
+DEPEND="${RDEPEND}" |
54 |
+BDEPEND="python? ( dev-lang/swig )" |
55 |
+ |
56 |
+src_prepare() { |
57 |
+ cmake_src_prepare |
58 |
+ |
59 |
+ use python && python_copy_sources |
60 |
+} |
61 |
+ |
62 |
+src_configure() { |
63 |
+ # MATLAB detection causes problems (as in bug 826774) if we don't |
64 |
+ # explicitly disable it. |
65 |
+ local mycmakeargs=( |
66 |
+ -DNLOPT_CXX=$(usex cxx) |
67 |
+ -DNLOPT_FORTRAN=$(usex test) |
68 |
+ -DNLOPT_GUILE=$(usex guile) |
69 |
+ -DNLOPT_OCTAVE=$(usex octave) |
70 |
+ -DNLOPT_MATLAB=OFF |
71 |
+ -DNLOPT_PYTHON=OFF |
72 |
+ -DNLOPT_SWIG=$(usex python) |
73 |
+ -DNLOPT_TESTS=$(usex test) |
74 |
+ ) |
75 |
+ |
76 |
+ cmake_src_configure |
77 |
+ |
78 |
+ if use python; then |
79 |
+ python_configure() { |
80 |
+ local mycmakeargs=( |
81 |
+ ${mycmakeargs[@]} |
82 |
+ -DNLOPT_PYTHON=ON |
83 |
+ -DINSTALL_PYTHON_DIR="$(python_get_sitedir)" |
84 |
+ ) |
85 |
+ |
86 |
+ cmake_src_configure |
87 |
+ } |
88 |
+ |
89 |
+ python_foreach_impl run_in_build_dir python_configure |
90 |
+ fi |
91 |
+} |
92 |
+ |
93 |
+src_compile() { |
94 |
+ cmake_src_compile |
95 |
+ |
96 |
+ if use python; then |
97 |
+ python_foreach_impl run_in_build_dir cmake_src_compile |
98 |
+ fi |
99 |
+} |
100 |
+ |
101 |
+src_test() { |
102 |
+ do_test() { |
103 |
+ local a f |
104 |
+ cd "${BUILD_DIR}"/test |
105 |
+ for a in {1..$(usex cxx 9 7)}; do |
106 |
+ for f in {5..9}; do |
107 |
+ ./testopt -a $a -o $f || die "algorithm $a function $f failed" |
108 |
+ done |
109 |
+ done |
110 |
+ } |
111 |
+ |
112 |
+ do_test |
113 |
+ |
114 |
+ if use python; then |
115 |
+ python_foreach_impl run_in_build_dir do_test |
116 |
+ fi |
117 |
+} |
118 |
+ |
119 |
+nlopt_install() { |
120 |
+ cmake_src_install |
121 |
+ python_optimize |
122 |
+} |
123 |
+ |
124 |
+src_install() { |
125 |
+ cmake_src_install |
126 |
+ |
127 |
+ if use python; then |
128 |
+ python_foreach_impl run_in_build_dir nlopt_install |
129 |
+ fi |
130 |
+ |
131 |
+ local r |
132 |
+ for r in */README; do |
133 |
+ newdoc ${r} README.$(dirname ${r}) |
134 |
+ done |
135 |
+} |