commit:     b7177d1c59ecb2b173ae8222ccaff546d67c97db
Author:     band-a-prend <torokhov-s-a <AT> yandex <DOT> ru>
AuthorDate: Sat Sep 29 20:29:26 2018 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Nov 28 10:30:09 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b7177d1c

sci-libs/cantera: New package

This commit add new package 'sci-libs/cantera' of version 2.4.0
(cantera-2.4.0.ebuild):

Description:
Cantera is an open-source suite of object-oriented software tools
for problems involving chemical kinetics, thermodynamics,
and/or transport processes.

Homepage and documentation: http://cantera.org
GitHub page: https://github.com/Cantera/cantera

Closes: https://bugs.gentoo.org/200425

Signed-off-by: Sergey Torokhov <torokhov_s_a <AT> mail.ru>
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 sci-libs/cantera/Manifest                          |   1 +
 sci-libs/cantera/cantera-2.4.0.ebuild              | 129 +++++++++++++++++++++
 .../files/cantera_2.4.0_libdirname_variable.patch  |  28 +++++
 sci-libs/cantera/metadata.xml                      |  22 ++++
 4 files changed, 180 insertions(+)

diff --git a/sci-libs/cantera/Manifest b/sci-libs/cantera/Manifest
new file mode 100644
index 00000000000..a4660bf3bfd
--- /dev/null
+++ b/sci-libs/cantera/Manifest
@@ -0,0 +1 @@
+DIST cantera-2.4.0.tar.gz 2321316 BLAKE2B 
40750e3864afa3d35817e6f5777a6ac235261e9d134ef749966dbd738a2af5efec2882e6dcc719851f88656b41469e2159d3bff3df32f6abdf57db3b0a2afcae
 SHA512 
8bb0fee34fa5bc9ec78e6f21a100eaa77bdd966bd0b7f0fa27d452e4f122c69e61648beef847178490f5c5d56267a96f6081cac9ccd03cea153c32814e0e84e9

diff --git a/sci-libs/cantera/cantera-2.4.0.ebuild 
b/sci-libs/cantera/cantera-2.4.0.ebuild
new file mode 100644
index 00000000000..3b43b50033f
--- /dev/null
+++ b/sci-libs/cantera/cantera-2.4.0.ebuild
@@ -0,0 +1,129 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python3_{4,5,6} )
+
+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="http://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="
+       cti? ( ${PYTHON_REQUIRED_USE} )
+       python? ( cti )
+       ${PYTHON_REQUIRED_USE}
+       "
+
+RDEPEND="
+       python? (
+               dev-python/numpy[${PYTHON_USEDEP}]
+       )
+       sci-libs/sundials:0=
+"
+
+DEPEND="
+       ${RDEPEND}
+       dev-cpp/eigen
+       dev-libs/boost
+       dev-libs/libfmt
+       python? (
+               dev-python/cython[${PYTHON_USEDEP}]
+       )
+       test? (
+               >=dev-cpp/gtest-1.8.0
+       )
+"
+
+PATCHES=( "${FILESDIR}/${PN}_${PV}_libdirname_variable.patch" )
+
+pkg_setup() {
+       fortran-2_pkg_setup
+       python-single-r1_pkg_setup
+}
+
+src_prepare() {
+       default
+       # patch to work 'scons test' properly in case of set up 
'renamed_shared_libraries="no"' option
+       sed -i "s/, libs=\['cantera_shared'\]//" 
"${S}"/test_problems/SConscript || die "failed to modify 
'test_problems/SConscript'"
+       # patch env to pass CCACHE_DIR variable
+       sed -i "s/ENV={'PATH': os.environ\['PATH'\]}/ENV={'PATH': 
os.environ\['PATH'\], 'CCACHE_DIR': os.environ.get('CCACHE_DIR','')}/" 
"${S}"/SConstruct || die "failed to modify 'SConstruct'"
+}
+
+## 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}"
+               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_libdirname_variable.patch 
b/sci-libs/cantera/files/cantera_2.4.0_libdirname_variable.patch
new file mode 100644
index 00000000000..a16f5670b55
--- /dev/null
+++ b/sci-libs/cantera/files/cantera_2.4.0_libdirname_variable.patch
@@ -0,0 +1,28 @@
+diff -Naur old/SConstruct new/SConstruct
+--- old/SConstruct     2018-08-24 16:24:45.000000000 +0300
++++ new/SConstruct     2018-11-05 03:07:07.000000000 +0300
+@@ -327,6 +327,10 @@
+         'prefix',
+         'Set this to the directory where Cantera should be installed.',
+         defaults.prefix, PathVariable.PathAccept),
++    PathVariable(
++        'libdirname',
++        'Set this to the directory where Cantera libraries should be 
installed.',
++        '', PathVariable.PathAccept),
+     EnumVariable(
+         'python_package',
+         """If you plan to work in Python, then you need the ``full`` Cantera 
Python
+@@ -1465,10 +1469,9 @@
+ # *** Set additional configuration variables ***
+ # **********************************************
+ 
+-# Some distributions (e.g. Fedora/RHEL) use 'lib64' instead of 'lib' on 
64-bit systems
+-if any(name.startswith('/usr/lib64/python') for name in sys.path):
+-    env['libdirname'] = 'lib64'
+-else:
++# Some distributions use 'lib64' (e.g. Fedora/RHEL) or something else instead 
of 'lib' on 64-bit systems.
++# If user didn't set 'libdirname' configuration variable set it to default 
value 'lib'
++if not env['libdirname']:
+     env['libdirname'] = 'lib'
+ 
+ # On Debian-based systems, need to special-case installation to

diff --git a/sci-libs/cantera/metadata.xml b/sci-libs/cantera/metadata.xml
new file mode 100644
index 00000000000..a57df7829d2
--- /dev/null
+++ b/sci-libs/cantera/metadata.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+  <maintainer type="person">
+    <email>[email protected]</email>
+    <name>Sergey Torokhov</name>
+  </maintainer>
+  <maintainer type="project">
+    <email>[email protected]</email>
+    <name>Proxy Maintainers</name>
+  </maintainer>
+  <longdescription>
+    Cantera is an open-source suite of object-oriented software tools
+    for problems involving chemical kinetics, thermodynamics, and/or transport 
processes.
+  </longdescription>
+  <use>
+    <flag name="cti">Install CTI tools (ck2cti, ctml_writer) for conversion of 
Chemkin files to Cantera format</flag>
+  </use>
+  <upstream>
+    <remote-id type="github">cantera</remote-id>
+  </upstream>
+</pkgmetadata>

Reply via email to