1 |
commit: 386771016f5534e7a99133e0e13eb4b6e001461a |
2 |
Author: band-a-prend <torokhov-s-a <AT> yandex <DOT> ru> |
3 |
AuthorDate: Wed Aug 14 03:02:03 2019 +0000 |
4 |
Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Sep 6 03:04:00 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=38677101 |
7 |
|
8 |
sci-libs/cantera: revision bump (r2) with fix python installation path |
9 |
|
10 |
Fix python installation path using 'libdirname' env variable. |
11 |
This patch is backport of upstream patch [1]. |
12 |
|
13 |
[1] https://github.com/Cantera/cantera/pull/674 |
14 |
|
15 |
This patch is backport of upstream patch [1] but with removing of |
16 |
'setIterator' function instead of it's deprecation. |
17 |
|
18 |
[1] https://github.com/Cantera/cantera/pull/672 |
19 |
|
20 |
Closes: https://github.com/gentoo/gentoo/pull/12701 |
21 |
Signed-off-by: Sergey Torokhov <torokhov_s_a <AT> mail.ru> |
22 |
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org> |
23 |
|
24 |
sci-libs/cantera/cantera-2.4.0-r2.ebuild | 126 ++++++++++++++ |
25 |
.../files/cantera_2.4.0_env_python_install.patch | 17 ++ |
26 |
.../cantera/files/cantera_2.4.0_sundials4.patch | 190 +++++++++++++++++++++ |
27 |
3 files changed, 333 insertions(+) |
28 |
|
29 |
diff --git a/sci-libs/cantera/cantera-2.4.0-r2.ebuild b/sci-libs/cantera/cantera-2.4.0-r2.ebuild |
30 |
new file mode 100644 |
31 |
index 00000000000..2d69f8d348c |
32 |
--- /dev/null |
33 |
+++ b/sci-libs/cantera/cantera-2.4.0-r2.ebuild |
34 |
@@ -0,0 +1,126 @@ |
35 |
+# Copyright 1999-2019 Gentoo Authors |
36 |
+# Distributed under the terms of the GNU General Public License v2 |
37 |
+ |
38 |
+EAPI=7 |
39 |
+ |
40 |
+PYTHON_COMPAT=( python3_{5,6,7} ) |
41 |
+ |
42 |
+FORTRAN_NEEDED=fortran |
43 |
+FORTRAN_STANDARD=90 |
44 |
+ |
45 |
+inherit desktop fortran-2 python-single-r1 scons-utils toolchain-funcs |
46 |
+ |
47 |
+DESCRIPTION="Object-oriented tool suite for chemical kinetics, thermodynamics, and transport" |
48 |
+HOMEPAGE="https://www.cantera.org" |
49 |
+SRC_URI="https://github.com/Cantera/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" |
50 |
+ |
51 |
+LICENSE="BSD" |
52 |
+SLOT="0" |
53 |
+KEYWORDS="~amd64 ~x86" |
54 |
+IUSE="+cti fortran pch +python test" |
55 |
+ |
56 |
+REQUIRED_USE=" |
57 |
+ python? ( cti ) |
58 |
+ ${PYTHON_REQUIRED_USE} |
59 |
+ " |
60 |
+ |
61 |
+RDEPEND=" |
62 |
+ ${PYTHON_DEPS} |
63 |
+ python? ( |
64 |
+ dev-python/numpy[${PYTHON_USEDEP}] |
65 |
+ ) |
66 |
+ <sci-libs/sundials-5.0.0:0= |
67 |
+" |
68 |
+ |
69 |
+DEPEND=" |
70 |
+ ${RDEPEND} |
71 |
+ dev-cpp/eigen:3 |
72 |
+ dev-libs/boost |
73 |
+ dev-libs/libfmt |
74 |
+ python? ( |
75 |
+ dev-python/cython[${PYTHON_USEDEP}] |
76 |
+ ) |
77 |
+ test? ( |
78 |
+ >=dev-cpp/gtest-1.8.0 |
79 |
+ ) |
80 |
+" |
81 |
+ |
82 |
+PATCHES=( |
83 |
+ "${FILESDIR}/${PN}_${PV}_env.patch" |
84 |
+ "${FILESDIR}/${PN}_${PV}_env_python_install.patch" |
85 |
+ "${FILESDIR}/${PN}_${PV}_sundials4.patch" |
86 |
+ ) |
87 |
+ |
88 |
+pkg_setup() { |
89 |
+ fortran-2_pkg_setup |
90 |
+ python-single-r1_pkg_setup |
91 |
+} |
92 |
+ |
93 |
+## Full list of configuration options of Cantera is presented here: |
94 |
+## http://cantera.org/docs/sphinx/html/compiling/config-options.html |
95 |
+ |
96 |
+src_configure() { |
97 |
+ scons_vars=( |
98 |
+ CC="$(tc-getCC)" |
99 |
+ CXX="$(tc-getCXX)" |
100 |
+ cc_flags="${CXXFLAGS}" |
101 |
+ cxx_flags="-std=c++11" |
102 |
+ debug="no" |
103 |
+ FORTRAN="$(tc-getFC)" |
104 |
+ FORTRANFLAGS="${CXXFLAGS}" |
105 |
+ optimize_flags="-Wno-inline" |
106 |
+ renamed_shared_libraries="no" |
107 |
+ use_pch=$(usex pch) |
108 |
+## In some cases other order can break the detection of right location of Boost: ## |
109 |
+ system_fmt="y" |
110 |
+ system_sundials="y" |
111 |
+ system_eigen="y" |
112 |
+ env_vars="all" |
113 |
+ extra_inc_dirs="/usr/include/eigen3" |
114 |
+ ) |
115 |
+ use test || scons_vars+=( googletest="none" ) |
116 |
+ |
117 |
+ scons_targets=( |
118 |
+ f90_interface=$(usex fortran y n) |
119 |
+ python2_package="none" |
120 |
+ ) |
121 |
+ |
122 |
+ if use cti ; then |
123 |
+ local scons_python=$(usex python full minimal) |
124 |
+ scons_targets+=( python3_package="${scons_python}" python3_cmd="${EPYTHON}" ) |
125 |
+ else |
126 |
+ scons_targets+=( python3_package="none" ) |
127 |
+ fi |
128 |
+} |
129 |
+ |
130 |
+src_compile() { |
131 |
+ escons build "${scons_vars[@]}" "${scons_targets[@]}" prefix="/usr" |
132 |
+} |
133 |
+ |
134 |
+src_test() { |
135 |
+ escons test |
136 |
+} |
137 |
+ |
138 |
+src_install() { |
139 |
+ escons install stage_dir="${D}" libdirname="$(get_libdir)" |
140 |
+ if ! use cti ; then |
141 |
+ rm -r "${D}/usr/share/man" || die "Can't remove man files." |
142 |
+ else |
143 |
+ # Run the byte-compile of modules |
144 |
+ python_optimize "${D}/$(python_get_sitedir)/${PN}" |
145 |
+ fi |
146 |
+} |
147 |
+ |
148 |
+pkg_postinst() { |
149 |
+ if use cti && ! use python ; then |
150 |
+ elog "Cantera was build without 'python' use-flag therefore the CTI tool 'ck2cti'" |
151 |
+ elog "will convert Chemkin files to Cantera format without verification of kinetic mechanism." |
152 |
+ fi |
153 |
+ |
154 |
+ local post_msg=$(usex fortran "and Fortran " "") |
155 |
+ elog "C++ ${post_msg}samples are installed to '/usr/share/${PN}/samples/' directory." |
156 |
+ |
157 |
+ if use python ; then |
158 |
+ elog "Python examples are installed to '$(python_get_sitedir)/${PN}/examples/' directories." |
159 |
+ fi |
160 |
+} |
161 |
|
162 |
diff --git a/sci-libs/cantera/files/cantera_2.4.0_env_python_install.patch b/sci-libs/cantera/files/cantera_2.4.0_env_python_install.patch |
163 |
new file mode 100644 |
164 |
index 00000000000..2e01fed1fa9 |
165 |
--- /dev/null |
166 |
+++ b/sci-libs/cantera/files/cantera_2.4.0_env_python_install.patch |
167 |
@@ -0,0 +1,17 @@ |
168 |
+diff -Nur old/interfaces/cython/SConscript new/interfaces/cython/SConscript |
169 |
+--- old/interfaces/cython/SConscript 2018-08-24 16:24:45.000000000 +0300 |
170 |
++++ new/interfaces/cython/SConscript 2019-08-14 04:28:41.000000000 +0300 |
171 |
+@@ -83,10 +83,10 @@ |
172 |
+ extra = '' |
173 |
+ elif localenv['OS'] == 'Darwin': |
174 |
+ extra = localenv.subst(' --prefix=${python%s_prefix}' % major) |
175 |
+- elif localenv['libdirname'] == 'lib64': |
176 |
+- # 64-bit RHEL / Fedora |
177 |
++ elif localenv['libdirname'] != 'lib': |
178 |
++ # 64-bit RHEL / Fedora etc. or e.g. x32 Gentoo profile |
179 |
+ extra = localenv.subst( |
180 |
+- ' --prefix=${python%s_prefix} --install-lib=${python%s_prefix}/lib64/python%s.%s/site-packages' % (major, major, major, minor)) |
181 |
++ ' --prefix=${python%s_prefix} --install-lib=${python%s_prefix}/${libdirname}/python%s.%s/site-packages' % (major, major, major, minor)) |
182 |
+ else: |
183 |
+ extra = '--user' |
184 |
+ localenv.AppendENVPath( |
185 |
|
186 |
diff --git a/sci-libs/cantera/files/cantera_2.4.0_sundials4.patch b/sci-libs/cantera/files/cantera_2.4.0_sundials4.patch |
187 |
new file mode 100644 |
188 |
index 00000000000..c745f6b6f7f |
189 |
--- /dev/null |
190 |
+++ b/sci-libs/cantera/files/cantera_2.4.0_sundials4.patch |
191 |
@@ -0,0 +1,190 @@ |
192 |
+diff -Nur old/SConstruct new/SConstruct |
193 |
+--- old/SConstruct 2019-08-14 04:12:50.000000000 +0300 |
194 |
++++ new/SConstruct 2019-08-14 04:38:55.000000000 +0300 |
195 |
+@@ -1013,23 +1013,29 @@ |
196 |
+ |
197 |
+ import SCons.Conftest, SCons.SConf |
198 |
+ context = SCons.SConf.CheckContext(conf) |
199 |
+-ret = SCons.Conftest.CheckLib(context, |
200 |
+- ['sundials_cvodes'], |
201 |
+- header='#include "cvodes/cvodes.h"', |
202 |
+- language='C++', |
203 |
+- call='CVodeCreate(CV_BDF, CV_NEWTON);', |
204 |
+- autoadd=False, |
205 |
+- extra_libs=env['blas_lapack_libs']) |
206 |
+-if ret: |
207 |
++ |
208 |
++# Check initially for Sundials<=3.2 and then for Sundials>=4.0 |
209 |
++for cvode_call in ['CVodeCreate(CV_BDF, CV_NEWTON);','CVodeCreate(CV_BDF);']: |
210 |
++ ret = SCons.Conftest.CheckLib(context, |
211 |
++ ['sundials_cvodes'], |
212 |
++ header='#include "cvodes/cvodes.h"', |
213 |
++ language='C++', |
214 |
++ call=cvode_call, |
215 |
++ autoadd=False, |
216 |
++ extra_libs=env['blas_lapack_libs']) |
217 |
+ # CheckLib returns False to indicate success |
218 |
++ if not ret: |
219 |
++ if env['system_sundials'] == 'default': |
220 |
++ env['system_sundials'] = 'y' |
221 |
++ break |
222 |
++ |
223 |
++# Execute if the cycle ends without 'break' |
224 |
++else: |
225 |
+ if env['system_sundials'] == 'default': |
226 |
+ env['system_sundials'] = 'n' |
227 |
+ elif env['system_sundials'] == 'y': |
228 |
+ config_error('Expected system installation of Sundials, but it could ' |
229 |
+ 'not be found.') |
230 |
+-elif env['system_sundials'] == 'default': |
231 |
+- env['system_sundials'] = 'y' |
232 |
+- |
233 |
+ |
234 |
+ # Checkout Sundials submodule if needed |
235 |
+ if (env['system_sundials'] == 'n' and |
236 |
+@@ -1066,7 +1072,7 @@ |
237 |
+ |
238 |
+ # Ignore the minor version, e.g. 2.4.x -> 2.4 |
239 |
+ env['sundials_version'] = '.'.join(sundials_version.split('.')[:2]) |
240 |
+- if env['sundials_version'] not in ('2.4','2.5','2.6','2.7','3.0','3.1','3.2'): |
241 |
++ if env['sundials_version'] not in ('2.4','2.5','2.6','2.7','3.0','3.1','3.2','4.0','4.1'): |
242 |
+ print("""ERROR: Sundials version %r is not supported.""" % env['sundials_version']) |
243 |
+ sys.exit(1) |
244 |
+ print("""INFO: Using system installation of Sundials version %s.""" % sundials_version) |
245 |
+diff -Nur old/include/cantera/numerics/CVodesIntegrator.h new/include/cantera/numerics/CVodesIntegrator.h |
246 |
+--- old/include/cantera/numerics/CVodesIntegrator.h 2018-08-24 16:24:45.000000000 +0300 |
247 |
++++ new/include/cantera/numerics/CVodesIntegrator.h 2019-08-14 04:39:50.000000000 +0300 |
248 |
+@@ -49,7 +49,6 @@ |
249 |
+ m_maxord = n; |
250 |
+ } |
251 |
+ virtual void setMethod(MethodType t); |
252 |
+- virtual void setIterator(IterType t); |
253 |
+ virtual void setMaxStepSize(double hmax); |
254 |
+ virtual void setMinStepSize(double hmin); |
255 |
+ virtual void setMaxSteps(int nmax); |
256 |
+diff -Nur old/include/cantera/numerics/Integrator.h new/include/cantera/numerics/Integrator.h |
257 |
+--- old/include/cantera/numerics/Integrator.h 2018-08-24 16:24:45.000000000 +0300 |
258 |
++++ new/include/cantera/numerics/Integrator.h 2019-08-14 04:44:27.000000000 +0300 |
259 |
+@@ -34,17 +34,6 @@ |
260 |
+ Adams_Method //! Adams |
261 |
+ }; |
262 |
+ |
263 |
+-//! Specifies the method used for iteration. |
264 |
+-/*! |
265 |
+- * Not all methods are supported by all integrators. |
266 |
+- */ |
267 |
+-enum IterType { |
268 |
+- //! Newton Iteration |
269 |
+- Newton_Iter, |
270 |
+- //! Functional Iteration |
271 |
+- Functional_Iter |
272 |
+-}; |
273 |
+- |
274 |
+ //! Abstract base class for ODE system integrators. |
275 |
+ /*! |
276 |
+ * @ingroup odeGroup |
277 |
+@@ -163,11 +152,6 @@ |
278 |
+ warn("setMethodType"); |
279 |
+ } |
280 |
+ |
281 |
+- //! Set the linear iterator. |
282 |
+- virtual void setIterator(IterType t) { |
283 |
+- warn("setInterator"); |
284 |
+- } |
285 |
+- |
286 |
+ //! Set the maximum step size |
287 |
+ virtual void setMaxStepSize(double hmax) { |
288 |
+ warn("setMaxStepSize"); |
289 |
+diff -Nur old/src/kinetics/ImplicitSurfChem.cpp new/src/kinetics/ImplicitSurfChem.cpp |
290 |
+--- old/src/kinetics/ImplicitSurfChem.cpp 2018-08-24 16:24:45.000000000 +0300 |
291 |
++++ new/src/kinetics/ImplicitSurfChem.cpp 2019-08-14 04:45:57.000000000 +0300 |
292 |
+@@ -79,7 +79,6 @@ |
293 |
+ // numerically, and use a Newton linear iterator |
294 |
+ m_integ->setMethod(BDF_Method); |
295 |
+ m_integ->setProblemType(DENSE + NOJAC); |
296 |
+- m_integ->setIterator(Newton_Iter); |
297 |
+ m_work.resize(ntmax); |
298 |
+ } |
299 |
+ |
300 |
+diff -Nur old/src/numerics/CVodesIntegrator.cpp new/src/numerics/CVodesIntegrator.cpp |
301 |
+--- old/src/numerics/CVodesIntegrator.cpp 2018-08-24 16:24:45.000000000 +0300 |
302 |
++++ new/src/numerics/CVodesIntegrator.cpp 2019-08-14 04:49:02.000000000 +0300 |
303 |
+@@ -88,7 +88,6 @@ |
304 |
+ m_type(DENSE+NOJAC), |
305 |
+ m_itol(CV_SS), |
306 |
+ m_method(CV_BDF), |
307 |
+- m_iter(CV_NEWTON), |
308 |
+ m_maxord(0), |
309 |
+ m_reltol(1.e-9), |
310 |
+ m_abstols(1.e-15), |
311 |
+@@ -218,17 +217,6 @@ |
312 |
+ } |
313 |
+ } |
314 |
+ |
315 |
+-void CVodesIntegrator::setIterator(IterType t) |
316 |
+-{ |
317 |
+- if (t == Newton_Iter) { |
318 |
+- m_iter = CV_NEWTON; |
319 |
+- } else if (t == Functional_Iter) { |
320 |
+- m_iter = CV_FUNCTIONAL; |
321 |
+- } else { |
322 |
+- throw CanteraError("CVodesIntegrator::setIterator", "unknown iterator"); |
323 |
+- } |
324 |
+-} |
325 |
+- |
326 |
+ void CVodesIntegrator::sensInit(double t0, FuncEval& func) |
327 |
+ { |
328 |
+ m_np = func.nparams(); |
329 |
+@@ -284,7 +272,11 @@ |
330 |
+ //! Specify the method and the iteration type. Cantera Defaults: |
331 |
+ //! CV_BDF - Use BDF methods |
332 |
+ //! CV_NEWTON - use Newton's method |
333 |
+- m_cvode_mem = CVodeCreate(m_method, m_iter); |
334 |
++ #if CT_SUNDIALS_VERSION < 40 |
335 |
++ m_cvode_mem = CVodeCreate(m_method, CV_NEWTON); |
336 |
++ #else |
337 |
++ m_cvode_mem = CVodeCreate(m_method); |
338 |
++ #endif |
339 |
+ if (!m_cvode_mem) { |
340 |
+ throw CanteraError("CVodesIntegrator::initialize", |
341 |
+ "CVodeCreate failed."); |
342 |
+@@ -394,7 +386,11 @@ |
343 |
+ #if CT_SUNDIALS_VERSION >= 30 |
344 |
+ SUNLinSolFree((SUNLinearSolver) m_linsol); |
345 |
+ SUNMatDestroy((SUNMatrix) m_linsol_matrix); |
346 |
+- m_linsol_matrix = SUNBandMatrix(N, nu, nl, nu+nl); |
347 |
++ #if CT_SUNDIALS_VERSION < 40 |
348 |
++ m_linsol_matrix = SUNBandMatrix(N, nu, nl, nu+nl); |
349 |
++ #else |
350 |
++ m_linsol_matrix = SUNBandMatrix(N, nu, nl); |
351 |
++ #endif |
352 |
+ #if CT_SUNDIALS_USE_LAPACK |
353 |
+ m_linsol = SUNLapackBand(m_y, (SUNMatrix) m_linsol_matrix); |
354 |
+ #else |
355 |
+diff -Nur old/src/numerics/IDA_Solver.cpp new/src/numerics/IDA_Solver.cpp |
356 |
+--- old/src/numerics/IDA_Solver.cpp 2018-08-24 16:24:45.000000000 +0300 |
357 |
++++ new/src/numerics/IDA_Solver.cpp 2019-08-14 04:51:01.000000000 +0300 |
358 |
+@@ -442,7 +442,11 @@ |
359 |
+ #if CT_SUNDIALS_VERSION >= 30 |
360 |
+ SUNLinSolFree((SUNLinearSolver) m_linsol); |
361 |
+ SUNMatDestroy((SUNMatrix) m_linsol_matrix); |
362 |
+- m_linsol_matrix = SUNBandMatrix(N, nu, nl, nu+nl); |
363 |
++ #if CT_SUNDIALS_VERSION < 40 |
364 |
++ m_linsol_matrix = SUNBandMatrix(N, nu, nl, nu+nl); |
365 |
++ #else |
366 |
++ m_linsol_matrix = SUNBandMatrix(N, nu, nl); |
367 |
++ #endif |
368 |
+ #if CT_SUNDIALS_USE_LAPACK |
369 |
+ m_linsol = SUNLapackBand(m_y, (SUNMatrix) m_linsol_matrix); |
370 |
+ #else |
371 |
+diff -Nur old/src/zeroD/ReactorNet.cpp new/src/zeroD/ReactorNet.cpp |
372 |
+--- old/src/zeroD/ReactorNet.cpp 2018-08-24 16:24:45.000000000 +0300 |
373 |
++++ new/src/zeroD/ReactorNet.cpp 2019-08-14 04:51:35.000000000 +0300 |
374 |
+@@ -28,7 +28,6 @@ |
375 |
+ // numerically, and use a Newton linear iterator |
376 |
+ m_integ->setMethod(BDF_Method); |
377 |
+ m_integ->setProblemType(DENSE + NOJAC); |
378 |
+- m_integ->setIterator(Newton_Iter); |
379 |
+ } |
380 |
+ |
381 |
+ void ReactorNet::setInitialTime(double time) |