git: 7095cde0cd9d - main - science/cantera: Unbreak OCTAVE option

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Tue, 03 May 2022 02:34:44 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=7095cde0cd9d5cde379f4369b98c7090a06239a6

commit 7095cde0cd9d5cde379f4369b98c7090a06239a6
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2022-05-03 02:33:46 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2022-05-03 02:34:42 +0000

    science/cantera: Unbreak OCTAVE option
---
 science/cantera/Makefile                          |  7 +++++--
 science/cantera/files/patch-SConstruct            | 17 +++++++++++++++++
 science/cantera/files/patch-src_matlab_SConscript | 14 +++-----------
 3 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/science/cantera/Makefile b/science/cantera/Makefile
index 8afdca022e34..fecbcdeaf46b 100644
--- a/science/cantera/Makefile
+++ b/science/cantera/Makefile
@@ -42,10 +42,10 @@ OPTIONS_SUB=		yes
 
 OCTAVE_DESC=		Octave support
 OCTAVE_MAKE_ARGS=	matlab_toolbox=y matlab_path=${LOCALBASE}
-OCTAVE_CXXFLAGS=	-I${LOCALBASE}/include/octave-6.4.0/octave
+OCTAVE_CXXFLAGS=	-I${LOCALBASE}/include/octave-${OCTAVE_VERSION}/octave
 OCTAVE_LIB_DEPENDS=	liboctave.so:math/octave
 OCTAVE_SUB_FILES=	pkg-message-octave
-OCTAVE_BROKEN=		Path set for 'matlab_path' is not correct. (https://github.com/Cantera/cantera/issues/1270)
+.include "../../math/octave/Makefile.version" # for OCTAVE_VERSION
 
 PYTHON_USES=		python:3.6+
 PYTHON_USE=		PYTHON=cython
@@ -69,6 +69,9 @@ do-install:
 do-install-PYTHON-on:
 	@${STRIP_CMD} ${STAGEDIR}${PYTHON_SITELIBDIR}/cantera/_cantera.cpython-${PYTHON_VER:S/.//}.so
 
+post-patch-OCTAVE-on: # adjust Octave version in SConscript (python styled os.environ['OCTAVE_VERSION'] somehow doesn't work for this)
+	@${REINPLACE_CMD} -e "s|, 'bin', 'glnx.*')|, 'lib', 'octave', '${OCTAVE_VERSION}')|" ${WRKSRC}/src/matlab/SConscript
+
 post-install-OCTAVE-on: # adjust .mex file name
 	@${MV} \
 		${STAGEDIR}${PREFIX}/lib/cantera/matlab/toolbox/ctmethods.mexa64 \
diff --git a/science/cantera/files/patch-SConstruct b/science/cantera/files/patch-SConstruct
index 0a31558a42b2..de5294d25f39 100644
--- a/science/cantera/files/patch-SConstruct
+++ b/science/cantera/files/patch-SConstruct
@@ -25,3 +25,20 @@
  
  env["cantera_version"] = "2.6.0"
  # For use where pre-release tags are not permitted (MSI, sonames)
+@@ -1673,11 +1676,11 @@ if env["matlab_toolbox"] == "y":
+             "SUNDIALS libraries and skip building the Matlab toolbox.")
+         sys.exit(1)
+ 
+-    if not (os.path.isdir(matlab_path) and
+-            os.path.isdir(pjoin(matlab_path, "extern"))):
+-        logger.error(
+-            f"Path set for 'matlab_path' is not correct. Path was '{matlab_path}'")
+-        sys.exit(1)
++    #if not (os.path.isdir(matlab_path) and
++    #        os.path.isdir(pjoin(matlab_path, "extern"))):
++    #    logger.error(
++    #        f"Path set for 'matlab_path' is not correct. Path was '{matlab_path}'")
++    #    sys.exit(1)
+ 
+ 
+ # **********************************************
diff --git a/science/cantera/files/patch-src_matlab_SConscript b/science/cantera/files/patch-src_matlab_SConscript
index 69adee147fa9..300ee07c6df6 100644
--- a/science/cantera/files/patch-src_matlab_SConscript
+++ b/science/cantera/files/patch-src_matlab_SConscript
@@ -1,6 +1,6 @@
---- src/matlab/SConscript.orig	2021-09-17 15:33:57 UTC
+--- src/matlab/SConscript.orig	2022-05-01 15:31:54 UTC
 +++ src/matlab/SConscript
-@@ -42,13 +42,13 @@ elif localenv['OS'] == 'Darwin':
+@@ -42,7 +42,7 @@ elif localenv['OS'] == 'Darwin':
  
  elif os.name == 'posix':
      linklibs = list(env['cantera_libs'])
@@ -8,12 +8,4 @@
 +    linklibs += ['octave', 'octinterp'] + env['LIBM']
  
      if localenv['OS_BITS'] == 64:
--        matlab_libs = pjoin(localenv['matlab_path'], 'bin', 'glnxa64')
-+        matlab_libs = pjoin(localenv['matlab_path'], 'lib', 'octave', '6.4.0')
-         mexSuffix = '.mexa64'
-     else:
--        matlab_libs = pjoin(localenv['matlab_path'], 'bin', 'glnx86')
-+        matlab_libs = pjoin(localenv['matlab_path'], 'lib', 'octave', '6.4.0')
-         mexSuffix = '.mexglx'
- 
-     linkflags.extend(['-Wl,--no-undefined',
+         matlab_libs = pjoin(localenv['matlab_path'], 'bin', 'glnxa64')