public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Joonas Niilola" <juippis@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-libs/cantera/files/, sci-libs/cantera/
Date: Fri,  6 Sep 2019 03:04:10 +0000 (UTC)	[thread overview]
Message-ID: <1567739040.386771016f5534e7a99133e0e13eb4b6e001461a.juippis@gentoo> (raw)

commit:     386771016f5534e7a99133e0e13eb4b6e001461a
Author:     band-a-prend <torokhov-s-a <AT> yandex <DOT> ru>
AuthorDate: Wed Aug 14 03:02:03 2019 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Fri Sep  6 03:04:00 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=38677101

sci-libs/cantera: revision bump (r2) with fix python installation path

Fix python installation path using 'libdirname' env variable.
This patch is backport of upstream patch [1].

[1] https://github.com/Cantera/cantera/pull/674

This patch is backport of upstream patch [1] but with removing of
'setIterator' function instead of it's deprecation.

[1] https://github.com/Cantera/cantera/pull/672

Closes: https://github.com/gentoo/gentoo/pull/12701
Signed-off-by: Sergey Torokhov <torokhov_s_a <AT> mail.ru>
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 sci-libs/cantera/cantera-2.4.0-r2.ebuild           | 126 ++++++++++++++
 .../files/cantera_2.4.0_env_python_install.patch   |  17 ++
 .../cantera/files/cantera_2.4.0_sundials4.patch    | 190 +++++++++++++++++++++
 3 files changed, 333 insertions(+)

diff --git a/sci-libs/cantera/cantera-2.4.0-r2.ebuild b/sci-libs/cantera/cantera-2.4.0-r2.ebuild
new file mode 100644
index 00000000000..2d69f8d348c
--- /dev/null
+++ b/sci-libs/cantera/cantera-2.4.0-r2.ebuild
@@ -0,0 +1,126 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{5,6,7} )
+
+FORTRAN_NEEDED=fortran
+FORTRAN_STANDARD=90
+
+inherit desktop fortran-2 python-single-r1 scons-utils toolchain-funcs
+
+DESCRIPTION="Object-oriented tool suite for chemical kinetics, thermodynamics, and transport"
+HOMEPAGE="https://www.cantera.org"
+SRC_URI="https://github.com/Cantera/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="+cti fortran pch +python test"
+
+REQUIRED_USE="
+	python? ( cti )
+	${PYTHON_REQUIRED_USE}
+	"
+
+RDEPEND="
+	${PYTHON_DEPS}
+	python? (
+		dev-python/numpy[${PYTHON_USEDEP}]
+	)
+	<sci-libs/sundials-5.0.0:0=
+"
+
+DEPEND="
+	${RDEPEND}
+	dev-cpp/eigen:3
+	dev-libs/boost
+	dev-libs/libfmt
+	python? (
+		dev-python/cython[${PYTHON_USEDEP}]
+	)
+	test? (
+		>=dev-cpp/gtest-1.8.0
+	)
+"
+
+PATCHES=(
+	"${FILESDIR}/${PN}_${PV}_env.patch"
+	"${FILESDIR}/${PN}_${PV}_env_python_install.patch"
+	"${FILESDIR}/${PN}_${PV}_sundials4.patch"
+	)
+
+pkg_setup() {
+	fortran-2_pkg_setup
+	python-single-r1_pkg_setup
+}
+
+## Full list of configuration options of Cantera is presented here:
+## http://cantera.org/docs/sphinx/html/compiling/config-options.html
+
+src_configure() {
+	scons_vars=(
+		CC="$(tc-getCC)"
+		CXX="$(tc-getCXX)"
+		cc_flags="${CXXFLAGS}"
+		cxx_flags="-std=c++11"
+		debug="no"
+		FORTRAN="$(tc-getFC)"
+		FORTRANFLAGS="${CXXFLAGS}"
+		optimize_flags="-Wno-inline"
+		renamed_shared_libraries="no"
+		use_pch=$(usex pch)
+## In some cases other order can break the detection of right location of Boost: ##
+		system_fmt="y"
+		system_sundials="y"
+		system_eigen="y"
+		env_vars="all"
+		extra_inc_dirs="/usr/include/eigen3"
+	)
+	use test || scons_vars+=( googletest="none" )
+
+	scons_targets=(
+		f90_interface=$(usex fortran y n)
+		python2_package="none"
+	)
+
+	if use cti ; then
+		local scons_python=$(usex python full minimal)
+		scons_targets+=( python3_package="${scons_python}" python3_cmd="${EPYTHON}" )
+	else
+		scons_targets+=( python3_package="none" )
+	fi
+}
+
+src_compile() {
+	escons build "${scons_vars[@]}" "${scons_targets[@]}" prefix="/usr"
+}
+
+src_test() {
+	escons test
+}
+
+src_install() {
+	escons install stage_dir="${D}" libdirname="$(get_libdir)"
+	if ! use cti ; then
+		rm -r "${D}/usr/share/man" || die "Can't remove man files."
+	else
+		# Run the byte-compile of modules
+		python_optimize "${D}/$(python_get_sitedir)/${PN}"
+	fi
+}
+
+pkg_postinst() {
+	if use cti && ! use python ; then
+		elog "Cantera was build without 'python' use-flag therefore the CTI tool 'ck2cti'"
+		elog "will convert Chemkin files to Cantera format without verification of kinetic mechanism."
+	fi
+
+	local post_msg=$(usex fortran "and Fortran " "")
+	elog "C++ ${post_msg}samples are installed to '/usr/share/${PN}/samples/' directory."
+
+	if use python ; then
+		elog "Python examples are installed to '$(python_get_sitedir)/${PN}/examples/' directories."
+	fi
+}

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
new file mode 100644
index 00000000000..2e01fed1fa9
--- /dev/null
+++ b/sci-libs/cantera/files/cantera_2.4.0_env_python_install.patch
@@ -0,0 +1,17 @@
+diff -Nur old/interfaces/cython/SConscript new/interfaces/cython/SConscript
+--- old/interfaces/cython/SConscript	2018-08-24 16:24:45.000000000 +0300
++++ new/interfaces/cython/SConscript	2019-08-14 04:28:41.000000000 +0300
+@@ -83,10 +83,10 @@
+             extra = ''
+         elif localenv['OS'] == 'Darwin':
+             extra = localenv.subst(' --prefix=${python%s_prefix}' % major)
+-        elif localenv['libdirname'] == 'lib64':
+-            # 64-bit RHEL / Fedora
++        elif localenv['libdirname'] != 'lib':
++            # 64-bit RHEL / Fedora etc. or e.g. x32 Gentoo profile
+             extra = localenv.subst(
+-                ' --prefix=${python%s_prefix} --install-lib=${python%s_prefix}/lib64/python%s.%s/site-packages' % (major, major, major, minor))
++                ' --prefix=${python%s_prefix} --install-lib=${python%s_prefix}/${libdirname}/python%s.%s/site-packages' % (major, major, major, minor))
+         else:
+             extra = '--user'
+             localenv.AppendENVPath(

diff --git a/sci-libs/cantera/files/cantera_2.4.0_sundials4.patch b/sci-libs/cantera/files/cantera_2.4.0_sundials4.patch
new file mode 100644
index 00000000000..c745f6b6f7f
--- /dev/null
+++ b/sci-libs/cantera/files/cantera_2.4.0_sundials4.patch
@@ -0,0 +1,190 @@
+diff -Nur old/SConstruct new/SConstruct
+--- old/SConstruct	2019-08-14 04:12:50.000000000 +0300
++++ new/SConstruct	2019-08-14 04:38:55.000000000 +0300
+@@ -1013,23 +1013,29 @@
+ 
+ import SCons.Conftest, SCons.SConf
+ context = SCons.SConf.CheckContext(conf)
+-ret = SCons.Conftest.CheckLib(context,
+-                              ['sundials_cvodes'],
+-                              header='#include "cvodes/cvodes.h"',
+-                              language='C++',
+-                              call='CVodeCreate(CV_BDF, CV_NEWTON);',
+-                              autoadd=False,
+-                              extra_libs=env['blas_lapack_libs'])
+-if ret:
++
++# Check initially for Sundials<=3.2 and then for Sundials>=4.0
++for cvode_call in ['CVodeCreate(CV_BDF, CV_NEWTON);','CVodeCreate(CV_BDF);']:
++    ret = SCons.Conftest.CheckLib(context,
++                                  ['sundials_cvodes'],
++                                  header='#include "cvodes/cvodes.h"',
++                                  language='C++',
++                                  call=cvode_call,
++                                  autoadd=False,
++                                  extra_libs=env['blas_lapack_libs'])
+     # CheckLib returns False to indicate success
++    if not ret:
++        if env['system_sundials'] == 'default':
++            env['system_sundials'] = 'y'
++        break
++
++# Execute if the cycle ends without 'break'
++else:
+     if env['system_sundials'] == 'default':
+         env['system_sundials'] = 'n'
+     elif env['system_sundials'] == 'y':
+         config_error('Expected system installation of Sundials, but it could '
+                      'not be found.')
+-elif env['system_sundials'] == 'default':
+-    env['system_sundials'] = 'y'
+-
+ 
+ # Checkout Sundials submodule if needed
+ if (env['system_sundials'] == 'n' and
+@@ -1066,7 +1072,7 @@
+ 
+     # Ignore the minor version, e.g. 2.4.x -> 2.4
+     env['sundials_version'] = '.'.join(sundials_version.split('.')[:2])
+-    if env['sundials_version'] not in ('2.4','2.5','2.6','2.7','3.0','3.1','3.2'):
++    if env['sundials_version'] not in ('2.4','2.5','2.6','2.7','3.0','3.1','3.2','4.0','4.1'):
+         print("""ERROR: Sundials version %r is not supported.""" % env['sundials_version'])
+         sys.exit(1)
+     print("""INFO: Using system installation of Sundials version %s.""" % sundials_version)
+diff -Nur old/include/cantera/numerics/CVodesIntegrator.h new/include/cantera/numerics/CVodesIntegrator.h
+--- old/include/cantera/numerics/CVodesIntegrator.h	2018-08-24 16:24:45.000000000 +0300
++++ new/include/cantera/numerics/CVodesIntegrator.h	2019-08-14 04:39:50.000000000 +0300
+@@ -49,7 +49,6 @@
+         m_maxord = n;
+     }
+     virtual void setMethod(MethodType t);
+-    virtual void setIterator(IterType t);
+     virtual void setMaxStepSize(double hmax);
+     virtual void setMinStepSize(double hmin);
+     virtual void setMaxSteps(int nmax);
+diff -Nur old/include/cantera/numerics/Integrator.h new/include/cantera/numerics/Integrator.h
+--- old/include/cantera/numerics/Integrator.h	2018-08-24 16:24:45.000000000 +0300
++++ new/include/cantera/numerics/Integrator.h	2019-08-14 04:44:27.000000000 +0300
+@@ -34,17 +34,6 @@
+     Adams_Method //! Adams
+ };
+ 
+-//! Specifies the method used for iteration.
+-/*!
+- * Not all methods are supported by all integrators.
+- */
+-enum IterType {
+-    //!  Newton Iteration
+-    Newton_Iter,
+-    //! Functional Iteration
+-    Functional_Iter
+-};
+-
+ //!  Abstract base class for ODE system integrators.
+ /*!
+  *  @ingroup odeGroup
+@@ -163,11 +152,6 @@
+         warn("setMethodType");
+     }
+ 
+-    //! Set the linear iterator.
+-    virtual void setIterator(IterType t) {
+-        warn("setInterator");
+-    }
+-
+     //! Set the maximum step size
+     virtual void setMaxStepSize(double hmax) {
+         warn("setMaxStepSize");
+diff -Nur old/src/kinetics/ImplicitSurfChem.cpp new/src/kinetics/ImplicitSurfChem.cpp
+--- old/src/kinetics/ImplicitSurfChem.cpp	2018-08-24 16:24:45.000000000 +0300
++++ new/src/kinetics/ImplicitSurfChem.cpp	2019-08-14 04:45:57.000000000 +0300
+@@ -79,7 +79,6 @@
+     // numerically, and use a Newton linear iterator
+     m_integ->setMethod(BDF_Method);
+     m_integ->setProblemType(DENSE + NOJAC);
+-    m_integ->setIterator(Newton_Iter);
+     m_work.resize(ntmax);
+ }
+ 
+diff -Nur old/src/numerics/CVodesIntegrator.cpp new/src/numerics/CVodesIntegrator.cpp
+--- old/src/numerics/CVodesIntegrator.cpp	2018-08-24 16:24:45.000000000 +0300
++++ new/src/numerics/CVodesIntegrator.cpp	2019-08-14 04:49:02.000000000 +0300
+@@ -88,7 +88,6 @@
+     m_type(DENSE+NOJAC),
+     m_itol(CV_SS),
+     m_method(CV_BDF),
+-    m_iter(CV_NEWTON),
+     m_maxord(0),
+     m_reltol(1.e-9),
+     m_abstols(1.e-15),
+@@ -218,17 +217,6 @@
+     }
+ }
+ 
+-void CVodesIntegrator::setIterator(IterType t)
+-{
+-    if (t == Newton_Iter) {
+-        m_iter = CV_NEWTON;
+-    } else if (t == Functional_Iter) {
+-        m_iter = CV_FUNCTIONAL;
+-    } else {
+-        throw CanteraError("CVodesIntegrator::setIterator", "unknown iterator");
+-    }
+-}
+-
+ void CVodesIntegrator::sensInit(double t0, FuncEval& func)
+ {
+     m_np = func.nparams();
+@@ -284,7 +272,11 @@
+     //! Specify the method and the iteration type. Cantera Defaults:
+     //!        CV_BDF  - Use BDF methods
+     //!        CV_NEWTON - use Newton's method
+-    m_cvode_mem = CVodeCreate(m_method, m_iter);
++    #if CT_SUNDIALS_VERSION < 40
++        m_cvode_mem = CVodeCreate(m_method, CV_NEWTON);
++    #else
++        m_cvode_mem = CVodeCreate(m_method);
++    #endif
+     if (!m_cvode_mem) {
+         throw CanteraError("CVodesIntegrator::initialize",
+                            "CVodeCreate failed.");
+@@ -394,7 +386,11 @@
+         #if CT_SUNDIALS_VERSION >= 30
+             SUNLinSolFree((SUNLinearSolver) m_linsol);
+             SUNMatDestroy((SUNMatrix) m_linsol_matrix);
+-            m_linsol_matrix = SUNBandMatrix(N, nu, nl, nu+nl);
++            #if CT_SUNDIALS_VERSION < 40
++                m_linsol_matrix = SUNBandMatrix(N, nu, nl, nu+nl);
++            #else
++                m_linsol_matrix = SUNBandMatrix(N, nu, nl);
++            #endif
+             #if CT_SUNDIALS_USE_LAPACK
+                 m_linsol = SUNLapackBand(m_y, (SUNMatrix) m_linsol_matrix);
+             #else
+diff -Nur old/src/numerics/IDA_Solver.cpp new/src/numerics/IDA_Solver.cpp
+--- old/src/numerics/IDA_Solver.cpp	2018-08-24 16:24:45.000000000 +0300
++++ new/src/numerics/IDA_Solver.cpp	2019-08-14 04:51:01.000000000 +0300
+@@ -442,7 +442,11 @@
+         #if CT_SUNDIALS_VERSION >= 30
+             SUNLinSolFree((SUNLinearSolver) m_linsol);
+             SUNMatDestroy((SUNMatrix) m_linsol_matrix);
+-            m_linsol_matrix = SUNBandMatrix(N, nu, nl, nu+nl);
++            #if CT_SUNDIALS_VERSION < 40
++                m_linsol_matrix = SUNBandMatrix(N, nu, nl, nu+nl);
++            #else
++                m_linsol_matrix = SUNBandMatrix(N, nu, nl);
++            #endif
+             #if CT_SUNDIALS_USE_LAPACK
+                 m_linsol = SUNLapackBand(m_y, (SUNMatrix) m_linsol_matrix);
+             #else
+diff -Nur old/src/zeroD/ReactorNet.cpp new/src/zeroD/ReactorNet.cpp
+--- old/src/zeroD/ReactorNet.cpp	2018-08-24 16:24:45.000000000 +0300
++++ new/src/zeroD/ReactorNet.cpp	2019-08-14 04:51:35.000000000 +0300
+@@ -28,7 +28,6 @@
+     // numerically, and use a Newton linear iterator
+     m_integ->setMethod(BDF_Method);
+     m_integ->setProblemType(DENSE + NOJAC);
+-    m_integ->setIterator(Newton_Iter);
+ }
+ 
+ void ReactorNet::setInitialTime(double time)


             reply	other threads:[~2019-09-06  3:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-06  3:04 Joonas Niilola [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-03-10  2:54 [gentoo-commits] repo/gentoo:master commit in: sci-libs/cantera/files/, sci-libs/cantera/ Sam James
2024-02-08  9:18 Joonas Niilola
2023-10-27  2:34 Sam James
2023-01-30 10:35 Andrew Ammerlaan
2022-05-13 20:04 Sam James
2020-05-05 16:54 Matthias Maier
2019-07-30 15:25 Matthias Maier
2019-07-19 16:45 Michał Górny
2018-11-28 10:52 Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1567739040.386771016f5534e7a99133e0e13eb4b6e001461a.juippis@gentoo \
    --to=juippis@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox