sci-libs/cantera: 2.4.0-r1. Enable build with sci-libs/sundials-3.2.x
authorband-a-prend <torokhov-s-a@yandex.ru>
Fri, 21 Jun 2019 22:15:41 +0000 (01:15 +0300)
committerMichał Górny <mgorny@gentoo.org>
Fri, 19 Jul 2019 16:44:53 +0000 (18:44 +0200)
This patch moves early applied 'sed' patches from src_prepare() to external
patch-file and allows to build Cantera 2.4.0 with sci-libs/sundials-3.2.x
since this version of Sundials is compatible with Sundials 3.1
and doesn't require to rebuild Cantera after it's upgrade from Sundials 3.1
to Sundials 3.2.

It was tested that Cantera successfuly build with Sundials-3.2.1
(that not in portage tree yet) and internal tests passed after "ebuild compile"
with Sundials 3.1.2 and "ebuild test" phase after intallation
of the Sundials 3.2.1 into system.

Note that Cantera 2.4.0 isn't compatible with Sundials 4.y branch
so there is a restriction for RDEPEND sci-libs/sundials-4.0.0

Signed-off-by: Sergey Torokhov <torokhov_s_a@mail.ru>
Signed-off-by: Michał Górny <mgorny@gentoo.org>
sci-libs/cantera/cantera-2.4.0-r1.ebuild
sci-libs/cantera/files/cantera_2.4.0_env.patch [new file with mode: 0644]

index 235d20b70bfea70c8c85769f2d56c5f0fadc7f7b..707f5670106b4088d9e0a5abda490c7d8b679d25 100644 (file)
@@ -29,7 +29,7 @@ RDEPEND="
        python? (
                dev-python/numpy[${PYTHON_USEDEP}]
        )
-       <sci-libs/sundials-3.2.0:0=
+       <sci-libs/sundials-4.0.0:0=
 "
 
 DEPEND="
@@ -45,21 +45,16 @@ DEPEND="
        )
 "
 
-PATCHES=( "${FILESDIR}/${PN}_${PV}_libdirname_variable.patch" )
+PATCHES=(
+       "${FILESDIR}/${PN}_${PV}_libdirname_variable.patch"
+       "${FILESDIR}/${PN}_${PV}_env.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
 
diff --git a/sci-libs/cantera/files/cantera_2.4.0_env.patch b/sci-libs/cantera/files/cantera_2.4.0_env.patch
new file mode 100644 (file)
index 0000000..1be40df
--- /dev/null
@@ -0,0 +1,33 @@
+diff -Nur old/cantera-2.4.0/SConstruct new/cantera-2.4.0/SConstruct
+--- old/SConstruct     2018-08-24 16:24:45.000000000 +0300
++++ new/SConstruct     2019-06-22 00:18:41.000000000 +0300
+@@ -189,7 +189,7 @@
+     toolchain = ['default']
+ env = Environment(tools=toolchain+['textfile', 'subst', 'recursiveInstall', 'wix', 'gch'],
+-                  ENV={'PATH': os.environ['PATH']},
++                  ENV={'PATH': os.environ['PATH'], 'CCACHE_DIR': os.environ.get('CCACHE_DIR','')},
+                   toolchain=toolchain,
+                   **extraEnvArgs)
+@@ -1061,7 +1061,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'):
++    if env['sundials_version'] not in ('2.4','2.5','2.6','2.7','3.0','3.1','3.2'):
+         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/cantera-2.4.0/test_problems/SConscript new/cantera-2.4.0/test_problems/SConscript
+--- old/test_problems/SConscript       2018-08-24 16:24:45.000000000 +0300
++++ new/test_problems/SConscript       2019-06-22 00:13:29.000000000 +0300
+@@ -282,7 +282,7 @@
+ CompileAndTest('VPsilane_test', 'VPsilane_test', 'VPsilane_test', 'output_blessed.txt')
+ CompileAndTest('clib', 'clib_test', 'clib_test', 'output_blessed.txt',
+-               extensions=['^clib_test.c'], libs=['cantera_shared'])
++               extensions=['^clib_test.c'])
+ # Force explicitly-named tests to run even if SCons thinks they're up to date
+ for command in COMMAND_LINE_TARGETS: