Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-libs/cantera/files/, sci-libs/cantera/
Date: Wed, 28 Nov 2018 10:52:51
Message-Id: 1543401009.b7177d1c59ecb2b173ae8222ccaff546d67c97db.mgorny@gentoo
1 commit: b7177d1c59ecb2b173ae8222ccaff546d67c97db
2 Author: band-a-prend <torokhov-s-a <AT> yandex <DOT> ru>
3 AuthorDate: Sat Sep 29 20:29:26 2018 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Wed Nov 28 10:30:09 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b7177d1c
7
8 sci-libs/cantera: New package
9
10 This commit add new package 'sci-libs/cantera' of version 2.4.0
11 (cantera-2.4.0.ebuild):
12
13 Description:
14 Cantera is an open-source suite of object-oriented software tools
15 for problems involving chemical kinetics, thermodynamics,
16 and/or transport processes.
17
18 Homepage and documentation: http://cantera.org
19 GitHub page: https://github.com/Cantera/cantera
20
21 Closes: https://bugs.gentoo.org/200425
22
23 Signed-off-by: Sergey Torokhov <torokhov_s_a <AT> mail.ru>
24 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
25
26 sci-libs/cantera/Manifest | 1 +
27 sci-libs/cantera/cantera-2.4.0.ebuild | 129 +++++++++++++++++++++
28 .../files/cantera_2.4.0_libdirname_variable.patch | 28 +++++
29 sci-libs/cantera/metadata.xml | 22 ++++
30 4 files changed, 180 insertions(+)
31
32 diff --git a/sci-libs/cantera/Manifest b/sci-libs/cantera/Manifest
33 new file mode 100644
34 index 00000000000..a4660bf3bfd
35 --- /dev/null
36 +++ b/sci-libs/cantera/Manifest
37 @@ -0,0 +1 @@
38 +DIST cantera-2.4.0.tar.gz 2321316 BLAKE2B 40750e3864afa3d35817e6f5777a6ac235261e9d134ef749966dbd738a2af5efec2882e6dcc719851f88656b41469e2159d3bff3df32f6abdf57db3b0a2afcae SHA512 8bb0fee34fa5bc9ec78e6f21a100eaa77bdd966bd0b7f0fa27d452e4f122c69e61648beef847178490f5c5d56267a96f6081cac9ccd03cea153c32814e0e84e9
39
40 diff --git a/sci-libs/cantera/cantera-2.4.0.ebuild b/sci-libs/cantera/cantera-2.4.0.ebuild
41 new file mode 100644
42 index 00000000000..3b43b50033f
43 --- /dev/null
44 +++ b/sci-libs/cantera/cantera-2.4.0.ebuild
45 @@ -0,0 +1,129 @@
46 +# Copyright 1999-2018 Gentoo Foundation
47 +# Distributed under the terms of the GNU General Public License v2
48 +
49 +EAPI=6
50 +
51 +PYTHON_COMPAT=( python3_{4,5,6} )
52 +
53 +FORTRAN_NEEDED=fortran
54 +FORTRAN_STANDARD=90
55 +
56 +inherit desktop fortran-2 python-single-r1 scons-utils toolchain-funcs
57 +
58 +DESCRIPTION="Object-oriented tool suite for chemical kinetics, thermodynamics, and transport"
59 +HOMEPAGE="http://www.cantera.org"
60 +SRC_URI="https://github.com/Cantera/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
61 +
62 +LICENSE="BSD"
63 +SLOT="0"
64 +KEYWORDS="~amd64 ~x86"
65 +IUSE="+cti fortran pch +python test"
66 +
67 +REQUIRED_USE="
68 + cti? ( ${PYTHON_REQUIRED_USE} )
69 + python? ( cti )
70 + ${PYTHON_REQUIRED_USE}
71 + "
72 +
73 +RDEPEND="
74 + python? (
75 + dev-python/numpy[${PYTHON_USEDEP}]
76 + )
77 + sci-libs/sundials:0=
78 +"
79 +
80 +DEPEND="
81 + ${RDEPEND}
82 + dev-cpp/eigen
83 + dev-libs/boost
84 + dev-libs/libfmt
85 + python? (
86 + dev-python/cython[${PYTHON_USEDEP}]
87 + )
88 + test? (
89 + >=dev-cpp/gtest-1.8.0
90 + )
91 +"
92 +
93 +PATCHES=( "${FILESDIR}/${PN}_${PV}_libdirname_variable.patch" )
94 +
95 +pkg_setup() {
96 + fortran-2_pkg_setup
97 + python-single-r1_pkg_setup
98 +}
99 +
100 +src_prepare() {
101 + default
102 + # patch to work 'scons test' properly in case of set up 'renamed_shared_libraries="no"' option
103 + sed -i "s/, libs=\['cantera_shared'\]//" "${S}"/test_problems/SConscript || die "failed to modify 'test_problems/SConscript'"
104 + # patch env to pass CCACHE_DIR variable
105 + 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'"
106 +}
107 +
108 +## Full list of configuration options of Cantera is presented here:
109 +## http://cantera.org/docs/sphinx/html/compiling/config-options.html
110 +
111 +src_configure() {
112 + scons_vars=(
113 + CC="$(tc-getCC)"
114 + CXX="$(tc-getCXX)"
115 + cc_flags="${CXXFLAGS}"
116 + cxx_flags="-std=c++11"
117 + debug="no"
118 + FORTRAN="$(tc-getFC)"
119 + FORTRANFLAGS="${CXXFLAGS}"
120 + renamed_shared_libraries="no"
121 + use_pch=$(usex pch)
122 +## In some cases other order can break the detection of right location of Boost: ##
123 + system_fmt="y"
124 + system_sundials="y"
125 + system_eigen="y"
126 + env_vars="all"
127 + extra_inc_dirs="/usr/include/eigen3"
128 + )
129 + use test || scons_vars+=( googletest="none" )
130 +
131 + scons_targets=(
132 + f90_interface=$(usex fortran y n)
133 + python2_package="none"
134 + )
135 +
136 + if use cti ; then
137 + local scons_python=$(usex python full minimal)
138 + scons_targets+=( python3_package="${scons_python}" python3_cmd="${EPYTHON}" )
139 + else
140 + scons_targets+=( python3_package="none" )
141 + fi
142 +}
143 +
144 +src_compile() {
145 + escons build "${scons_vars[@]}" "${scons_targets[@]}" prefix="/usr"
146 +}
147 +
148 +src_test() {
149 + escons test
150 +}
151 +
152 +src_install() {
153 + escons install stage_dir="${D%/}" libdirname="$(get_libdir)"
154 + if ! use cti ; then
155 + rm -r "${D%/}/usr/share/man" || die "Can't remove man files."
156 + else
157 + # Run the byte-compile of modules
158 + python_optimize "${D%/}/$(python_get_sitedir)/${PN}"
159 + fi
160 +}
161 +
162 +pkg_postinst() {
163 + if use cti && ! use python ; then
164 + elog "Cantera was build without 'python' use-flag therefore the CTI tool 'ck2cti'"
165 + elog "will convert Chemkin files to Cantera format without verification of kinetic mechanism."
166 + fi
167 +
168 + local post_msg=$(usex fortran "and Fortran " "")
169 + elog "C++ ${post_msg}samples are installed to '/usr/share/${PN}/samples/' directory."
170 +
171 + if use python ; then
172 + elog "Python examples are installed to '$(python_get_sitedir)/${PN}/examples/' directories."
173 + fi
174 +}
175
176 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
177 new file mode 100644
178 index 00000000000..a16f5670b55
179 --- /dev/null
180 +++ b/sci-libs/cantera/files/cantera_2.4.0_libdirname_variable.patch
181 @@ -0,0 +1,28 @@
182 +diff -Naur old/SConstruct new/SConstruct
183 +--- old/SConstruct 2018-08-24 16:24:45.000000000 +0300
184 ++++ new/SConstruct 2018-11-05 03:07:07.000000000 +0300
185 +@@ -327,6 +327,10 @@
186 + 'prefix',
187 + 'Set this to the directory where Cantera should be installed.',
188 + defaults.prefix, PathVariable.PathAccept),
189 ++ PathVariable(
190 ++ 'libdirname',
191 ++ 'Set this to the directory where Cantera libraries should be installed.',
192 ++ '', PathVariable.PathAccept),
193 + EnumVariable(
194 + 'python_package',
195 + """If you plan to work in Python, then you need the ``full`` Cantera Python
196 +@@ -1465,10 +1469,9 @@
197 + # *** Set additional configuration variables ***
198 + # **********************************************
199 +
200 +-# Some distributions (e.g. Fedora/RHEL) use 'lib64' instead of 'lib' on 64-bit systems
201 +-if any(name.startswith('/usr/lib64/python') for name in sys.path):
202 +- env['libdirname'] = 'lib64'
203 +-else:
204 ++# Some distributions use 'lib64' (e.g. Fedora/RHEL) or something else instead of 'lib' on 64-bit systems.
205 ++# If user didn't set 'libdirname' configuration variable set it to default value 'lib'
206 ++if not env['libdirname']:
207 + env['libdirname'] = 'lib'
208 +
209 + # On Debian-based systems, need to special-case installation to
210
211 diff --git a/sci-libs/cantera/metadata.xml b/sci-libs/cantera/metadata.xml
212 new file mode 100644
213 index 00000000000..a57df7829d2
214 --- /dev/null
215 +++ b/sci-libs/cantera/metadata.xml
216 @@ -0,0 +1,22 @@
217 +<?xml version="1.0" encoding="UTF-8"?>
218 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
219 +<pkgmetadata>
220 + <maintainer type="person">
221 + <email>torokhov_s_a@××××.ru</email>
222 + <name>Sergey Torokhov</name>
223 + </maintainer>
224 + <maintainer type="project">
225 + <email>proxy-maint@g.o</email>
226 + <name>Proxy Maintainers</name>
227 + </maintainer>
228 + <longdescription>
229 + Cantera is an open-source suite of object-oriented software tools
230 + for problems involving chemical kinetics, thermodynamics, and/or transport processes.
231 + </longdescription>
232 + <use>
233 + <flag name="cti">Install CTI tools (ck2cti, ctml_writer) for conversion of Chemkin files to Cantera format</flag>
234 + </use>
235 + <upstream>
236 + <remote-id type="github">cantera</remote-id>
237 + </upstream>
238 +</pkgmetadata>