commit:     0fad1730e56262ffe836aaeeafeed0e6780c175a
Author:     Fabio Rossi <rossi.f <AT> inwind <DOT> it>
AuthorDate: Sun Jan 24 17:11:03 2021 +0000
Commit:     Andrew Ammerlaan <andrewammerlaan <AT> riseup <DOT> net>
CommitDate: Sun Jan 24 20:47:42 2021 +0000
URL:        https://gitweb.gentoo.org/proj/sci.git/commit/?id=0fad1730

sci-mathematics/scilab: re-add previous version 5.5.2

As latest version 6.1.0 requires more work (missing deps in portage),
re-add the old one. Ebuild is not mergeable yet.

Signed-off-by: Fabio Rossi <rossi.f <AT> inwind.it>
Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> riseup.net>

 .../files/scilab-5.5.2-accessviolation.patch       |  21 ++
 .../scilab/files/scilab-5.5.2-batik-1.9.patch      | 104 +++++++
 .../scilab/files/scilab-5.5.2-bug15449.patch       |  11 +
 .../scilab-5.5.2-fix-random-runtime-failure.patch  |  12 +
 .../scilab/files/scilab-5.5.2-followlinks.patch    |  11 +
 .../scilab/files/scilab-5.5.2-fop-2.0.patch        |  38 +++
 .../scilab/files/scilab-5.5.2-fortran-gcc8.patch   |  57 ++++
 .../scilab/files/scilab-5.5.2-freehep.patch        |  12 +
 .../scilab/files/scilab-5.5.2-gluegen.patch        |  11 +
 .../scilab/files/scilab-5.5.2-hdf5-1.8.10.patch    | 278 +++++++++++++++++++
 .../scilab/files/scilab-5.5.2-java-heap.patch      |  11 +
 .../scilab/files/scilab-5.5.2-libxml-icu64.patch   |  16 ++
 .../scilab/files/scilab-5.5.2-missinglib.patch     |  11 +
 .../scilab/files/scilab-5.5.2-ocaml-4.0.4.patch    |  12 +
 .../scilab-5.5.2-xmlgraphics-common-2.0.patch      |  91 +++++++
 sci-mathematics/scilab/scilab-5.5.2.ebuild         | 300 +++++++++++++++++++++
 16 files changed, 996 insertions(+)

diff --git a/sci-mathematics/scilab/files/scilab-5.5.2-accessviolation.patch 
b/sci-mathematics/scilab/files/scilab-5.5.2-accessviolation.patch
new file mode 100644
index 000000000..a7e5c6d5f
--- /dev/null
+++ b/sci-mathematics/scilab/files/scilab-5.5.2-accessviolation.patch
@@ -0,0 +1,21 @@
+diff -urN scilab-5.5.0-orig/bin/scilab scilab-5.5.0/bin/scilab
+--- a/bin/scilab       2014-07-12 15:24:17.105686656 -0400
++++ b/bin/scilab       2014-07-12 15:25:29.307725409 -0400
+@@ -647,17 +647,6 @@
+ GTK_MODULES=$(echo $GTK_MODULES | sed s/gnomebreakpad//g)
+ export GTK_MODULES
+ 
+-# libEGL may be partially supported by the closed-source NVIDIA driver.
+-# Until they release an EGL driver, we force the egl_glx driver.
+-# http://bugzilla.scilab.org/show_bug.cgi?id=12940
+-if test -x /usr/bin/glxinfo; then
+-    NVIDIA_GLX_VENDOR=$(/usr/bin/glxinfo |grep "NVIDIA Corporation")
+-    if test ! -z "$NVIDIA_GLX_VENDOR"; then
+-        EGL_DRIVER=egl_glx
+-        export EGL_DRIVER
+-    fi
+-fi
+-
+ if test $SCIVERBOSE -ne 0; then
+     echo "SCI : $SCI"
+     echo "SCIBIN : $SCIBIN"

diff --git a/sci-mathematics/scilab/files/scilab-5.5.2-batik-1.9.patch 
b/sci-mathematics/scilab/files/scilab-5.5.2-batik-1.9.patch
new file mode 100644
index 000000000..ce0cebbf3
--- /dev/null
+++ b/sci-mathematics/scilab/files/scilab-5.5.2-batik-1.9.patch
@@ -0,0 +1,104 @@
+Updates Scilab to build against (and require) Batik >=1.9, this has been
+adapted from Gentoo-Bug-URL: https://github.com/gentoo-science/sci/pull/456
+
+--- a/configure
++++ b/configure
+@@ -16600,8 +16600,8 @@ $as_echo "$as_me: WARNING: Could not find or use the 
Java package/jar batik used
+                 fi
+ 
+ 
+-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking minimal version (1.7) 
of batik" >&5
+-$as_echo_n "checking minimal version (1.7) of batik... " >&6; }
++    { $as_echo "$as_me:${as_lineno-$LINENO}: checking minimal version (1.9) 
of batik" >&5
++$as_echo_n "checking minimal version (1.9) of batik... " >&6; }
+    saved_ac_java_classpath=$ac_java_classpath
+    export ac_java_classpath="$BATIK:$ac_java_classpath"
+    if test "x" == "x"; then
+@@ -16614,7 +16614,7 @@ import org.apache.batik.Version;
+ 
+ public class conftest {
+     public static void main(String[] argv) {
+-        String minVersion="1.7";
++        String minVersion="1.9";
+ 
+                             System.out.println(Version.getVersion());
+                                   if (compare(minVersion, 
Version.getVersion()) > 0) {
+@@ -16663,7 +16663,7 @@ EOF
+                    STDOUT=`cat conftest.java.output`
+                 fi
+                 echo "configure: CLASSPATH was $CLASSPATH" >&5
+-                  as_fn_error $? "Wrong version of batik. Expected at least 
1.7. Found $STDOUT" "$LINENO" 5
++                  as_fn_error $? "Wrong version of batik. Expected at least 
1.9. Found $STDOUT" "$LINENO" 5
+                             fi
+         fi
+         if test -f conftest.java.output; then
+@@ -16673,7 +16673,7 @@ EOF
+         echo "configure: failed program was:" >&5
+         cat conftest.java >&5
+         echo "configure: CLASSPATH was $CLASSPATH" >&5
+-          as_fn_error $? "Wrong version of batik. Expected at least 1.7. 
Found $STDOUT" "$LINENO" 5
++          as_fn_error $? "Wrong version of batik. Expected at least 1.9. 
Found $STDOUT" "$LINENO" 5
+             fi
+ 
+    else
+@@ -16686,7 +16686,7 @@ import org.apache.batik.Version;
+ 
+ public class conftest {
+     public static void main(String[] argv) {
+-        String minVersion="1.7";
++        String minVersion="1.9";
+ 
+                             System.out.println(Version.getVersion());
+                                   if (compare(minVersion, 
Version.getVersion()) != 0) {
+@@ -16735,7 +16735,7 @@ EOF
+                    STDOUT=`cat conftest.java.output`
+                 fi
+                 echo "configure: CLASSPATH was $CLASSPATH" >&5
+-                  as_fn_error $? "Wrong version of batik. Expected exact 
version 1.7. Found $STDOUT" "$LINENO" 5
++                  as_fn_error $? "Wrong version of batik. Expected exact 
version 1.9. Found $STDOUT" "$LINENO" 5
+                             fi
+         fi
+         if test -f conftest.java.output; then
+@@ -16745,7 +16745,7 @@ EOF
+         echo "configure: failed program was:" >&5
+         cat conftest.java >&5
+         echo "configure: CLASSPATH was $CLASSPATH" >&5
+-          as_fn_error $? "Wrong version of batik. Expected exact version 1.7. 
Found $STDOUT" "$LINENO" 5
++          as_fn_error $? "Wrong version of batik. Expected exact version 1.9. 
Found $STDOUT" "$LINENO" 5
+             fi
+ 
+     fi
+--- a/configure.ac
++++ b/configure.ac
+@@ -1038,7 +1038,7 @@ interface for JOGL2 - or libGL (OpenGL library) are 
installed and if the version
+                    BATIK=$PACKAGE_JAR_FILE
+                 fi
+                 AC_SUBST(BATIK)
+-                AC_JAVA_CHECK_VERSION_PACKAGE([batik],[import 
org.apache.batik.Version;],$BATIK,[1.7],[Version.getVersion()])
++                AC_JAVA_CHECK_VERSION_PACKAGE([batik],[import 
org.apache.batik.Version;],$BATIK,[1.9],[Version.getVersion()])
+ 
+                 # Commons I/O library
+                 
AC_JAVA_CHECK_PACKAGE([commons-io],[org.apache.commons.io.output.CountingOutputStream],[Commons
 I/O library])
+--- 
a/modules/graph/src/java/org/scilab/modules/graph/utils/ScilabGraphUtils.java
++++ 
b/modules/graph/src/java/org/scilab/modules/graph/utils/ScilabGraphUtils.java
+@@ -28,7 +28,7 @@ import org.apache.batik.bridge.DocumentLoader;
+ import org.apache.batik.bridge.GVTBuilder;
+ import org.apache.batik.bridge.UserAgent;
+ import org.apache.batik.bridge.UserAgentAdapter;
+-import org.apache.batik.dom.svg.SAXSVGDocumentFactory;
++import org.apache.batik.anim.dom.SAXSVGDocumentFactory;
+ import org.apache.batik.gvt.GraphicsNode;
+ import org.apache.batik.util.XMLResourceDescriptor;
+ import org.scilab.forge.jlatexmath.ParseException;
+--- ./modules/xcos/src/java/org/scilab/modules/xcos/Xcos.java  2021-01-24 
16:26:14.686473112 +0100
++++ ./modules/xcos/src/java/org/scilab/modules/xcos/Xcos.java.new      
2021-01-24 16:34:25.486426923 +0100
+@@ -100,7 +100,7 @@
+      * Dependencies version
+      */
+     private static final List<String> MXGRAPH_VERSIONS = null;
+-    private static final List<String> BATIK_VERSIONS = Arrays.asList("1.7", 
"1.8pre", "1.8");
++    private static final List<String> BATIK_VERSIONS = Arrays.asList("1.7", 
"1.8pre", "1.8", "1.9");
+ 
+     private static final String UNABLE_TO_LOAD_JGRAPHX = 
Messages.gettext("Unable to load the jgraphx library.\nExpecting version %s ; 
Getting version %s .");
+     private static final String UNABLE_TO_LOAD_BATIK = 
Messages.gettext("Unable to load the Batik library. \nExpecting version %s ; 
Getting version %s .");
+

diff --git a/sci-mathematics/scilab/files/scilab-5.5.2-bug15449.patch 
b/sci-mathematics/scilab/files/scilab-5.5.2-bug15449.patch
new file mode 100644
index 000000000..6e58dd540
--- /dev/null
+++ b/sci-mathematics/scilab/files/scilab-5.5.2-bug15449.patch
@@ -0,0 +1,11 @@
+--- ./modules/xcos/sci_gateway/cpp/sci_xcosPalLoad.cpp 2015-03-31 
11:31:43.000000000 +0200
++++ ./modules/xcos/sci_gateway/cpp/sci_xcosPalLoad.cpp.new     2021-01-10 
15:47:49.011858918 +0100
+@@ -54,7 +54,7 @@
+     {
+         // FIXME #7266 workaround
+         // check category emptyness
+-        if (category == NULL || (lenCategory == 1 && *category == '\0'))
++        if (category == NULL || (lenCategory == 1 && **category == 0))
+         {
+             Palette::loadPal(getScilabJavaVM(), name);
+         }

diff --git 
a/sci-mathematics/scilab/files/scilab-5.5.2-fix-random-runtime-failure.patch 
b/sci-mathematics/scilab/files/scilab-5.5.2-fix-random-runtime-failure.patch
new file mode 100644
index 000000000..da7b6e485
--- /dev/null
+++ b/sci-mathematics/scilab/files/scilab-5.5.2-fix-random-runtime-failure.patch
@@ -0,0 +1,12 @@
+diff -urN scilab-orig/modules/api_scilab/src/cpp/api_double.cpp 
scilab/modules/api_scilab/src/cpp/api_double.cpp
+--- a/modules/api_scilab/src/cpp/api_double.cpp        2012-08-06 
23:26:31.342617365 -0400
++++ b/modules/api_scilab/src/cpp/api_double.cpp        2012-08-06 
23:27:34.838621420 -0400
+@@ -497,7 +497,7 @@
+ /*--------------------------------------------------------------------------*/
+ int createScalarDouble(void* _pvCtx, int _iVar, double _dblReal)
+ {
+-    return createCommonScalarDouble(_pvCtx, _iVar, 0, _dblReal, NULL);
++    return createCommonScalarDouble(_pvCtx, _iVar, 0, _dblReal, 0);
+ }
+ /*--------------------------------------------------------------------------*/
+ int createScalarComplexDouble(void* _pvCtx, int _iVar, double _dblReal, 
double _dblImg)

diff --git a/sci-mathematics/scilab/files/scilab-5.5.2-followlinks.patch 
b/sci-mathematics/scilab/files/scilab-5.5.2-followlinks.patch
new file mode 100644
index 000000000..a3f60bee7
--- /dev/null
+++ b/sci-mathematics/scilab/files/scilab-5.5.2-followlinks.patch
@@ -0,0 +1,11 @@
+--- a/m4/java.m4       2014-02-11 23:43:03.030430258 -0500
++++ b/m4/java.m4       2014-02-11 23:43:54.008428766 -0500
+@@ -839,7 +839,7 @@
+       for jar in "$jardir/$1.jar" "$jardir/lib$1.jar" 
"$jardir/lib$1-java.jar" "$jardir/$1*.jar"; do
+ 
+ # TODO check the behaviour when spaces
+-        jars_resolved=`ls $jar 2>/dev/null`
++        jars_resolved=$(realpath $(ls $jar 2>/dev/null) 2>/dev/null)
+         for jar_resolved in $jars_resolved; do # If several jars matches
+           if test -e "$jar_resolved"; then
+             export ac_java_classpath="$jar_resolved:$ac_java_classpath"

diff --git a/sci-mathematics/scilab/files/scilab-5.5.2-fop-2.0.patch 
b/sci-mathematics/scilab/files/scilab-5.5.2-fop-2.0.patch
new file mode 100644
index 000000000..18bdaac1d
--- /dev/null
+++ b/sci-mathematics/scilab/files/scilab-5.5.2-fop-2.0.patch
@@ -0,0 +1,38 @@
+From: Bryan Gardiner <[email protected]>
+Project-Bug-URL: https://bugzilla.scilab.org/show_bug.cgi?id=14009
+Gentoo-Bug-URL: https://github.com/gentoo-science/sci/pull/456
+
+Updates Scilab to build against FOP >=2.0.  This is not tested, as I'm not sure
+of a test case, and it's awaiting upstream review.
+
+--- a/modules/helptools/src/java/org/scilab/modules/helptools/FopConverter.java
++++ b/modules/helptools/src/java/org/scilab/modules/helptools/FopConverter.java
+@@ -43,10 +43,10 @@ public class FopConverter extends ContainerConverter {
+         String fileName = outputDirectory + "/" + baseName + "." + 
format.name().toLowerCase();
+ 
+         try {
+-            FopFactory fopFactory = FopFactory.newInstance();
++            FopFactory fopFactory =
++                FopFactory.newInstance(new File(System.getenv("SCI") + 
"/modules/helptools/etc/fopconf.xml"));
+             fopFactory.addElementMapping(new JLaTeXMathElementMapping());
+             fopFactory.getXMLHandlerRegistry().addXMLHandler(new 
JLaTeXMathXMLHandler());
+-            fopFactory.setUserConfig(new File(System.getenv("SCI") + 
"/modules/helptools/etc/fopconf.xml"));
+ 
+             // Step 3: Construct fop with desired output format
+             OutputStream out = new BufferedOutputStream(new 
FileOutputStream(fileName));
+--- 
a/modules/scinotes/src/java/org/scilab/modules/scinotes/utils/CodeExporter.java
++++ 
b/modules/scinotes/src/java/org/scilab/modules/scinotes/utils/CodeExporter.java
+@@ -114,11 +114,11 @@ public class CodeExporter extends FOCodeConverter {
+      * @param format the page format
+      */
+     public void convert(String code, int[] lineNumberArray, String fileName, 
String type, String title, PageFormat format) {
+-        FopFactory fopFactory = FopFactory.newInstance();
+         OutputStream out = null;
+ 
+         try {
+-            fopFactory.setUserConfig(new File(ScilabConstants.SCI + 
"/modules/helptools/etc/fopconf.xml"));
++            FopFactory fopFactory =
++                FopFactory.newInstance(new File(ScilabConstants.SCI + 
"/modules/helptools/etc/fopconf.xml"));
+             FOUserAgent userAgent = fopFactory.newFOUserAgent();
+             userAgent.setProducer(CREATOR);
+             userAgent.setTitle(title);

diff --git a/sci-mathematics/scilab/files/scilab-5.5.2-fortran-gcc8.patch 
b/sci-mathematics/scilab/files/scilab-5.5.2-fortran-gcc8.patch
new file mode 100644
index 000000000..31dcf52e7
--- /dev/null
+++ b/sci-mathematics/scilab/files/scilab-5.5.2-fortran-gcc8.patch
@@ -0,0 +1,57 @@
+From f49b185c678c07526ef59c1531d41575f9266bdc Mon Sep 17 00:00:00 2001
+From: =?utf8?q?Cl=C3=A9ment=20DAVID?= <[email protected]>
+Date: Mon, 26 Feb 2018 23:43:14 +0100
+Subject: [PATCH] Fortran: fix errors with gfortran 8
+
+Change-Id: Ib890c6ea2dcba2f70d3c22dc86bbe38e4f22b061
+--- a/modules/differential_equations/src/fortran/ddaskr.f
++++ b/modules/differential_equations/src/fortran/ddaskr.f
+@@ -1409,6 +1409,7 @@ C
+       DIMENSION RWORK(LRW),IWORK(LIW)
+       DIMENSION RTOL(*),ATOL(*)
+       DIMENSION RPAR(*),IPAR(*)
++      DIMENSION JROOT(NRT)
+       CHARACTER MSG*80
+       EXTERNAL  RES, JAC, PSOL, RT, DDASID, DDASIK, DNEDD, DNEDK
+ C
+@@ -2530,7 +2531,8 @@ C Pointers into RWORK:
+       DOUBLE PRECISION TN, TOUT, Y, YP, PHI, PSI, R0, R1, RX, UROUND,
+      *  RWORK, RPAR
+       DIMENSION Y(*), YP(*), PHI(NEQ,*), PSI(*),
+-     *          R0(*), R1(*), RX(*), JROOT(*), RWORK(*), IWORK(*)
++     *          R0(*), R1(*), RX(*), JROOT(NRT), RWORK(*), IWORK(*),
++     *          RPAR(*), IPAR(*)
+       INTEGER I, JFLAG
+       DOUBLE PRECISION H
+       DOUBLE PRECISION HMINR, T1, TEMP1, TEMP2, X, ZERO
+--- a/modules/differential_equations/src/fortran/ddasrt.f
++++ b/modules/differential_equations/src/fortran/ddasrt.f
+@@ -870,6 +870,7 @@ C
+       DIMENSION RWORK(*),IWORK(*)
+       DIMENSION RTOL(*),ATOL(*)
+       DIMENSION RPAR(*),IPAR(*)
++      DIMENSION JROOT(NG)
+       CHARACTER MSG*80
+ C
+ C     SET POINTERS INTO IWORK
+@@ -1594,7 +1595,8 @@ C
+       DOUBLE PRECISION TN, TOUT, Y, YP, PHI, PSI, G0, G1, GX, UROUND,
+      *  RWORK, RPAR
+       DIMENSION  Y(*), YP(*), PHI(NEQ,*), PSI(*),
+-     1  G0(*), G1(*), GX(*), JROOT(*), RWORK(*), IWORK(*)
++     1  G0(*), G1(*), GX(*), JROOT(NG), RWORK(*), IWORK(*), RPAR(*),
++     1  IPAR(*)
+       INTEGER I, JFLAG
+       DOUBLE PRECISION H
+       DOUBLE PRECISION HMING, T1, TEMP1, TEMP2, X
+--- a/modules/differential_equations/src/fortran/twodq.f
++++ b/modules/differential_equations/src/fortran/twodq.f
+@@ -900,7 +900,7 @@ C
+       END
+ 
+       subroutine tridv(node,node1,node2,coef,rank)
+-      double precision node(10),node1(10),node2(10),coef
++      double precision node(9),node1(9),node2(9),coef
+       integer rank
+       double precision s(3),coef1,temp
+       integer t(3)

diff --git a/sci-mathematics/scilab/files/scilab-5.5.2-freehep.patch 
b/sci-mathematics/scilab/files/scilab-5.5.2-freehep.patch
new file mode 100644
index 000000000..46825cb29
--- /dev/null
+++ b/sci-mathematics/scilab/files/scilab-5.5.2-freehep.patch
@@ -0,0 +1,12 @@
+diff -uNr scilab-5.5.2-orig/configure.ac scilab-5.5.2/configure.ac
+--- a/configure.ac     2016-06-05 12:30:06.582735449 -0400
++++ b/configure.ac     2016-06-05 12:31:29.706708157 -0400
+@@ -1024,7 +1024,7 @@
+                     AC_SUBST(FREEHEP_IO)
+ 
+                     # Freehep Util
+-                    
AC_JAVA_CHECK_PACKAGE([freehep-util],[org.freehep.util.StringUtilities],[Freehep
 Util])
++                    
AC_JAVA_CHECK_PACKAGE([freehep-graphicsbase],[org.freehep.graphicsbase.util.UserProperties],[Freehep
 Util])
+                     FREEHEP_UTIL=$PACKAGE_JAR_FILE
+                     AC_SUBST(FREEHEP_UTIL)
+                 fi

diff --git a/sci-mathematics/scilab/files/scilab-5.5.2-gluegen.patch 
b/sci-mathematics/scilab/files/scilab-5.5.2-gluegen.patch
new file mode 100644
index 000000000..d75c31e9a
--- /dev/null
+++ b/sci-mathematics/scilab/files/scilab-5.5.2-gluegen.patch
@@ -0,0 +1,11 @@
+--- a/modules/gui/src/java/org/scilab/modules/gui/SwingView.java       
2014-03-24 22:38:00.928934500 -0400
++++ b/modules/gui/src/java/org/scilab/modules/gui/SwingView.java       
2014-03-24 22:37:33.947567043 -0400
+@@ -157,7 +157,7 @@
+ 
+     static {
+         try {
+-            System.loadLibrary("gluegen2-rt");
++            System.loadLibrary("gluegen-rt");
+         } catch (Exception e) {
+             System.err.println(e);
+         }

diff --git a/sci-mathematics/scilab/files/scilab-5.5.2-hdf5-1.8.10.patch 
b/sci-mathematics/scilab/files/scilab-5.5.2-hdf5-1.8.10.patch
new file mode 100644
index 000000000..07e497939
--- /dev/null
+++ b/sci-mathematics/scilab/files/scilab-5.5.2-hdf5-1.8.10.patch
@@ -0,0 +1,278 @@
+--- scilab-6.0.0.orig/modules/hdf5/src/cpp/H5ReferenceData.cpp 2017-02-14 
12:40:34.000000000 +0100
++++ scilab-6.0.0/modules/hdf5/src/cpp/H5ReferenceData.cpp      2017-02-15 
20:08:00.761619371 +0100
+@@ -42,7 +42,11 @@
+     for (int i = 0; i < totalSize; i++)
+     {
+         void * ref = &(((void **)cdata)[i]);
+-        hid_t obj = H5Rdereference(file, datasetReference ? 
H5R_DATASET_REGION : H5R_OBJECT, ref);
++        hid_t obj = H5Rdereference(file,
++    #if H5_VERSION_GE(1,10,0)
++                                   H5P_DATASET_ACCESS_DEFAULT,
++    #endif
++                                   datasetReference ? H5R_DATASET_REGION : 
H5R_OBJECT, ref);
+         H5O_info_t info;
+         H5Oget_info(obj, &info);
+         H5Oclose(obj);
+@@ -84,7 +88,11 @@
+ 
+     file = getFile().getH5Id();
+     ref = &(((void **)cdata)[0]);
+-    obj = H5Rdereference(file, datasetReference ? H5R_DATASET_REGION : 
H5R_OBJECT, ref);
++    obj = H5Rdereference(file,
++#if H5_VERSION_GE(1,10,0)
++                         H5P_DATASET_ACCESS_DEFAULT,
++#endif
++                         datasetReference ? H5R_DATASET_REGION : H5R_OBJECT, 
ref);
+     if (obj < 0)
+     {
+         throw H5Exception(__LINE__, __FILE__, _("Cannot open object at the 
given position."));
+@@ -126,7 +134,11 @@
+     for (int i = 0; i < totalSize; i++)
+     {
+         void * ref = &(((void **)cdata)[i]);
+-        hid_t obj = H5Rdereference(file, datasetReference ? 
H5R_DATASET_REGION : H5R_OBJECT, ref);
++        hid_t obj = H5Rdereference(file,
++    #if H5_VERSION_GE(1,10,0)
++                                   H5P_DATASET_ACCESS_DEFAULT,
++    #endif
++                                   datasetReference ? H5R_DATASET_REGION : 
H5R_OBJECT, ref);
+         objs[i] = &H5Object::getObject(getParent(), obj);
+     }
+ 
+@@ -181,7 +193,11 @@
+     char * cdata = static_cast<char *>(data) + offset + pos * (stride ? 
stride : dataSize);
+     void ** ref = &(((void **)cdata)[0]);
+     hid_t file = getFile().getH5Id();
+-    hid_t obj = H5Rdereference(file, datasetReference ? H5R_DATASET_REGION : 
H5R_OBJECT, ref);
++    hid_t obj = H5Rdereference(file,
++#if H5_VERSION_GE(1,10,0)
++                               H5P_DATASET_ACCESS_DEFAULT,
++#endif
++                               datasetReference ? H5R_DATASET_REGION : 
H5R_OBJECT, ref);
+     if (obj < 0)
+     {
+         os << "NULL";
+--- scilab-6.0.0.orig/modules/hdf5/src/c/h5_readDataFromFile_v1.c      
2017-02-14 12:40:34.000000000 +0100
++++ scilab-6.0.0/modules/hdf5/src/c/h5_readDataFromFile_v1.c   2017-02-15 
20:08:00.758286029 +0100
+@@ -474,7 +474,11 @@
+         }
+ 
+         //Open the referenced object, get its name and type.
+-        obj = H5Rdereference(_iDatasetId, H5R_OBJECT, &Ref);
++        obj = H5Rdereference(_iDatasetId,
++    #if H5_VERSION_GE(1,10,0)
++                             H5P_DATASET_ACCESS_DEFAULT,
++    #endif
++                             H5R_OBJECT, &Ref);
+         readDouble_v1(obj, _iRows, _iCols, _pdblData);
+     }
+ 
+@@ -501,14 +505,22 @@
+     }
+ 
+     //Open the referenced object, get its name and type.
+-    obj = H5Rdereference(_iDatasetId, H5R_OBJECT, &pRef[0]);
++    obj = H5Rdereference(_iDatasetId,
++#if H5_VERSION_GE(1,10,0)
++                         H5P_DATASET_ACCESS_DEFAULT,
++#endif
++                         H5R_OBJECT, &pRef[0]);
+     status = readDouble_v1(obj, _iRows, _iCols, _pdblReal);
+     if (status < 0)
+     {
+         return -1;
+     }
+ 
+-    obj = H5Rdereference(_iDatasetId, H5R_OBJECT, &pRef[1]);
++    obj = H5Rdereference(_iDatasetId,
++#if H5_VERSION_GE(1,10,0)
++                         H5P_DATASET_ACCESS_DEFAULT,
++#endif
++                         H5R_OBJECT, &pRef[1]);
+     status = readDouble_v1(obj, _iRows, _iCols, _pdblImg);
+     if (status < 0)
+     {
+@@ -834,7 +846,11 @@
+         /*
+         * Open the referenced object, get its name and type.
+         */
+-        obj = H5Rdereference(_iDatasetId, H5R_OBJECT, &pData[i]);
++        obj = H5Rdereference(_iDatasetId,
++    #if H5_VERSION_GE(1,10,0)
++                             H5P_DATASET_ACCESS_DEFAULT,
++    #endif
++                             H5R_OBJECT, &pData[i]);
+         if (_iComplex)
+         {
+             status = readComplexPoly_v1(obj, &_piNbCoef[i], &_pdblReal[i], 
&_pdblImg[i]);
+@@ -1069,7 +1085,11 @@
+     }
+ 
+     //read Row data
+-    obj = H5Rdereference(_iDatasetId, H5R_OBJECT, &pRef[0]);
++    obj = H5Rdereference(_iDatasetId,
++#if H5_VERSION_GE(1,10,0)
++                         H5P_DATASET_ACCESS_DEFAULT,
++#endif
++                         H5R_OBJECT, &pRef[0]);
+     status = readInteger32Matrix_v1(obj, 1, _iRows, _piNbItemRow);
+     if (status < 0)
+     {
+@@ -1077,7 +1097,11 @@
+     }
+ 
+     //read cols data
+-    obj = H5Rdereference(_iDatasetId, H5R_OBJECT, &pRef[1]);
++    obj = H5Rdereference(_iDatasetId,
++#if H5_VERSION_GE(1,10,0)
++                         H5P_DATASET_ACCESS_DEFAULT,
++#endif
++                         H5R_OBJECT, &pRef[1]);
+     status = readInteger32Matrix_v1(obj, 1, _iNbItem, _piColPos);
+     if (status < 0)
+     {
+@@ -1085,7 +1109,11 @@
+     }
+ 
+     //read sparse data
+-    obj = H5Rdereference(_iDatasetId, H5R_OBJECT, &pRef[2]);
++    obj = H5Rdereference(_iDatasetId,
++#if H5_VERSION_GE(1,10,0)
++                         H5P_DATASET_ACCESS_DEFAULT,
++#endif
++                         H5R_OBJECT, &pRef[2]);
+ 
+     if (_iComplex)
+     {
+@@ -1131,7 +1159,11 @@
+     }
+ 
+     //read Row data
+-    obj = H5Rdereference(_iDatasetId, H5R_OBJECT, &pRef[0]);
++    obj = H5Rdereference(_iDatasetId,
++#if H5_VERSION_GE(1,10,0)
++                         H5P_DATASET_ACCESS_DEFAULT,
++#endif
++                         H5R_OBJECT, &pRef[0]);
+     status = readInteger32Matrix_v1(obj, 1, _iRows, _piNbItemRow);
+     if (status < 0)
+     {
+@@ -1139,7 +1171,11 @@
+     }
+ 
+     //read cols data
+-    obj = H5Rdereference(_iDatasetId, H5R_OBJECT, &pRef[1]);
++    obj = H5Rdereference(_iDatasetId,
++#if H5_VERSION_GE(1,10,0)
++                         H5P_DATASET_ACCESS_DEFAULT,
++#endif
++                         H5R_OBJECT, &pRef[1]);
+     status = readInteger32Matrix_v1(obj, 1, _iNbItem, _piColPos);
+     if (status < 0)
+     {
+@@ -1234,7 +1270,11 @@
+ {
+     hobj_ref_t poRef = ((hobj_ref_t *) _piItemRef)[_iItemPos];
+ 
+-    *_piItemDataset = H5Rdereference(_iDatasetId, H5R_OBJECT, &poRef);
++    *_piItemDataset = H5Rdereference(_iDatasetId,
++#if H5_VERSION_GE(1,10,0)
++                                     H5P_DATASET_ACCESS_DEFAULT,
++#endif
++                                     H5R_OBJECT, &poRef);
+ 
+     if (*_piItemDataset == 0)
+     {
+--- scilab-6.0.0.orig/modules/hdf5/src/c/h5_readDataFromFile.c 2017-02-14 
12:40:34.000000000 +0100
++++ scilab-6.0.0/modules/hdf5/src/c/h5_readDataFromFile.c      2017-02-15 
20:08:00.758286029 +0100
+@@ -742,7 +742,11 @@
+         /*
+          * Open the referenced object, get its name and type.
+          */
+-        obj = H5Rdereference(_iDatasetId, H5R_OBJECT, &pData[i]);
++        obj = H5Rdereference(_iDatasetId,
++    #if H5_VERSION_GE(1,10,0)
++                             H5P_DATASET_ACCESS_DEFAULT,
++    #endif
++                             H5R_OBJECT, &pData[i]);
+         if (_iComplex)
+         {
+             status = readComplexPoly(obj, &_piNbCoef[i], &_pdblReal[i], 
&_pdblImg[i]);
+@@ -976,7 +980,11 @@
+     }
+ 
+     //read Row data
+-    obj = H5Rdereference(_iDatasetId, H5R_OBJECT, &pRef[0]);
++    obj = H5Rdereference(_iDatasetId,
++#if H5_VERSION_GE(1,10,0)
++                         H5P_DATASET_ACCESS_DEFAULT,
++#endif
++                         H5R_OBJECT, &pRef[0]);
+     status = readInteger32Matrix(obj, _piNbItemRow);
+     if (status < 0)
+     {
+@@ -984,7 +992,11 @@
+     }
+ 
+     //read cols data
+-    obj = H5Rdereference(_iDatasetId, H5R_OBJECT, &pRef[1]);
++    obj = H5Rdereference(_iDatasetId,
++#if H5_VERSION_GE(1,10,0)
++                         H5P_DATASET_ACCESS_DEFAULT,
++#endif
++                         H5R_OBJECT, &pRef[1]);
+     status = readInteger32Matrix(obj, _piColPos);
+     if (status < 0)
+     {
+@@ -992,7 +1004,11 @@
+     }
+ 
+     //read sparse data
+-    obj = H5Rdereference(_iDatasetId, H5R_OBJECT, &pRef[2]);
++    obj = H5Rdereference(_iDatasetId,
++#if H5_VERSION_GE(1,10,0)
++                         H5P_DATASET_ACCESS_DEFAULT,
++#endif
++                         H5R_OBJECT, &pRef[2]);
+ 
+     if (_iComplex)
+     {
+@@ -1043,7 +1059,11 @@
+     }
+ 
+     //read Row data
+-    obj = H5Rdereference(_iDatasetId, H5R_OBJECT, &pRef[0]);
++    obj = H5Rdereference(_iDatasetId,
++#if H5_VERSION_GE(1,10,0)
++                         H5P_DATASET_ACCESS_DEFAULT,
++#endif
++                         H5R_OBJECT, &pRef[0]);
+     status = readInteger32Matrix(obj, _piNbItemRow);
+     if (status < 0)
+     {
+@@ -1053,7 +1073,11 @@
+     if (_iNbItem != 0)
+     {
+         //read cols data
+-        obj = H5Rdereference(_iDatasetId, H5R_OBJECT, &pRef[1]);
++        obj = H5Rdereference(_iDatasetId,
++    #if H5_VERSION_GE(1,10,0)
++                             H5P_DATASET_ACCESS_DEFAULT,
++    #endif
++                             H5R_OBJECT, &pRef[1]);
+         status = readInteger32Matrix(obj, _piColPos);
+         if (status < 0)
+         {
+@@ -1154,7 +1178,11 @@
+ {
+     hobj_ref_t poRef = ((hobj_ref_t *) _piItemRef)[_iItemPos];
+ 
+-    *_piItemDataset = H5Rdereference(_iDatasetId, H5R_OBJECT, &poRef);
++    *_piItemDataset = H5Rdereference(_iDatasetId,
++#if H5_VERSION_GE(1,10,0)
++                                     H5P_DATASET_ACCESS_DEFAULT,
++#endif
++                                     H5R_OBJECT, &poRef);
+ 
+     if (*_piItemDataset == 0)
+     {

diff --git a/sci-mathematics/scilab/files/scilab-5.5.2-java-heap.patch 
b/sci-mathematics/scilab/files/scilab-5.5.2-java-heap.patch
new file mode 100644
index 000000000..ca17e52a6
--- /dev/null
+++ b/sci-mathematics/scilab/files/scilab-5.5.2-java-heap.patch
@@ -0,0 +1,11 @@
+--- a/etc/jvm_options.xml      2014-02-12 00:05:34.323390688 -0500
++++ b/etc/jvm_options.xml      2014-02-12 00:05:53.977390112 -0500
+@@ -22,7 +22,7 @@
+     <!-- ENABLE Just In Time java compiler -->
+     <option value="-Djava.compiler=JIT"/>
+     <!-- Set Java Heap space to 256mb -->
+-    <option value="-Xmx256m"/>
++    <option value="-Xmx512m"/>
+     <!-- Avoid jvm to handle sigint (& other signals)  -->
+     <option value="-Xrs"/>
+     

diff --git a/sci-mathematics/scilab/files/scilab-5.5.2-libxml-icu64.patch 
b/sci-mathematics/scilab/files/scilab-5.5.2-libxml-icu64.patch
new file mode 100644
index 000000000..1dc4fd079
--- /dev/null
+++ b/sci-mathematics/scilab/files/scilab-5.5.2-libxml-icu64.patch
@@ -0,0 +1,16 @@
+--- ./modules/xml/src/cpp/XMLDocument.hxx      2015-03-31 11:31:45.000000000 
+0200
++++ ./modules/xml/src/cpp/XMLDocument.hxx.new  2021-01-10 15:18:51.172022465 
+0100
+@@ -20,13 +20,10 @@
+ 
+ #include "dynlib_xml_scilab.h"
+ 
+-extern "C"
+-{
+ #include "xml.h"
+ #ifndef XML_XPATH_CHECKNS
+ #define XML_XPATH_CHECKNS
+ #endif
+-}
+ 
+ #include "XMLObject.hxx"
+ 

diff --git a/sci-mathematics/scilab/files/scilab-5.5.2-missinglib.patch 
b/sci-mathematics/scilab/files/scilab-5.5.2-missinglib.patch
new file mode 100644
index 000000000..25b281820
--- /dev/null
+++ b/sci-mathematics/scilab/files/scilab-5.5.2-missinglib.patch
@@ -0,0 +1,11 @@
+diff -urN scilab-5.5.1-orig/Makefile.am scilab-5.5.1/Makefile.am
+--- a/Makefile.am      2014-10-09 18:22:21.994610695 -0400
++++ b/Makefile.am      2014-10-09 18:24:28.208333575 -0400
+@@ -74,6 +74,7 @@
+ if NEED_JAVA
+ scilab_bin_LDADD += \
+                       $(top_builddir)/modules/console/libsciconsole.la \
++                      
$(top_builddir)/modules/console/libsciconsole-minimal.la \
+                       $(top_builddir)/modules/jvm/libscijvm.la \
+                       $(top_builddir)/modules/commons/libscicommons.la
+ else

diff --git a/sci-mathematics/scilab/files/scilab-5.5.2-ocaml-4.0.4.patch 
b/sci-mathematics/scilab/files/scilab-5.5.2-ocaml-4.0.4.patch
new file mode 100644
index 000000000..dc8941ff0
--- /dev/null
+++ b/sci-mathematics/scilab/files/scilab-5.5.2-ocaml-4.0.4.patch
@@ -0,0 +1,12 @@
+--- ./modules/scicos/src/modelica_compiler/optimization.ml.orig        
2018-05-16 19:42:49.168681800 +0200
++++ ./modules/scicos/src/modelica_compiler/optimization.ml     2018-05-16 
19:44:53.999181477 +0200
+@@ -163,7 +163,8 @@
+     let m, e = frexp f in
+     let sm = string_of_float m in
+     let s = String.make 16 '0' in
+-    String.blit sm 2 s 0 (String.length sm - 2);
++    let sss = Bytes.make 16 '0' in
++    String.blit sm 2 sss 0 (String.length sm - 2);
+     let e' = Num.power_num (Num.Int 2) (Num.num_of_int e) in
+     Num.div_num (Num.mult_num (Num.num_of_string s) e') scaling_factor
+   in

diff --git 
a/sci-mathematics/scilab/files/scilab-5.5.2-xmlgraphics-common-2.0.patch 
b/sci-mathematics/scilab/files/scilab-5.5.2-xmlgraphics-common-2.0.patch
new file mode 100644
index 000000000..4d90f30c7
--- /dev/null
+++ b/sci-mathematics/scilab/files/scilab-5.5.2-xmlgraphics-common-2.0.patch
@@ -0,0 +1,91 @@
+From: Bryan Gardiner <[email protected]>
+Project-Bug-URL: https://bugzilla.scilab.org/show_bug.cgi?id=13724
+Gentoo-Bug-URL: https://github.com/gentoo-science/sci/pull/456
+
+Updates Scilab 5.5.2 to build against xmlgraphics-common >=2.0.  This is not
+tested, as I'm not sure of a test case, and a similar patch (where the
+super.processShape calls are passed cached=true) is already awaiting upstream
+review.
+
+--- 
a/modules/graphic_export/src/java/org/scilab/modules/graphic_export/Export.java
++++ 
b/modules/graphic_export/src/java/org/scilab/modules/graphic_export/Export.java
+@@ -857,7 +857,7 @@ public class Export {
+                     }
+ 
+                     @Override
+-                    public int processShape(Shape s) throws IOException {
++                    public int processShape(Shape s, boolean cached) throws 
IOException {
+                         if (s instanceof Ellipse2D.Double) {
+                             Ellipse2D.Double ell = (Ellipse2D.Double) s;
+                             if (ell.height == ell.width) {
+@@ -880,10 +880,10 @@ public class Export {
+                                     
buffer.append("[").append(gen.formatDouble(coords[0])).append(" 
").append(gen.formatDouble(coords[1]));
+                                     it.next();
+                                 } else {
+-                                    return super.processShape(s);
++                                    return super.processShape(s, cached);
+                                 }
+                             } else {
+-                                return super.processShape(s);
++                                return super.processShape(s, cached);
+                             }
+ 
+                             for (; !it.isDone(); it.next()) {
+@@ -891,7 +891,7 @@ public class Export {
+                                 if (type == PathIterator.SEG_LINETO) {
+                                     buffer.append(" 
").append(gen.formatDouble(coords[0])).append(" 
").append(gen.formatDouble(coords[1]));
+                                 } else {
+-                                    return super.processShape(s);
++                                    return super.processShape(s, cached);
+                                 }
+                             }
+                             buffer.append("] DP");
+@@ -899,7 +899,7 @@ public class Export {
+                             return PathIterator.WIND_NON_ZERO;
+                         }
+ 
+-                        return super.processShape(s);
++                        return super.processShape(s, cached);
+                     }
+                 };
+                 g2d.setGraphicContext(new GraphicContext());
+@@ -1029,7 +1029,7 @@ public class Export {
+                     }
+ 
+                     @Override
+-                    public int processShape(Shape s) throws IOException {
++                    public int processShape(Shape s, boolean cached) throws 
IOException {
+                         if (s instanceof Ellipse2D.Double) {
+                             Ellipse2D.Double ell = (Ellipse2D.Double) s;
+                             if (ell.height == ell.width) {
+@@ -1052,10 +1052,10 @@ public class Export {
+                                     
buffer.append("[").append(gen.formatDouble(coords[0])).append(" 
").append(gen.formatDouble(coords[1]));
+                                     it.next();
+                                 } else {
+-                                    return super.processShape(s);
++                                    return super.processShape(s, cached);
+                                 }
+                             } else {
+-                                return super.processShape(s);
++                                return super.processShape(s, cached);
+                             }
+ 
+                             for (; !it.isDone(); it.next()) {
+@@ -1063,7 +1063,7 @@ public class Export {
+                                 if (type == PathIterator.SEG_LINETO) {
+                                     buffer.append(" 
").append(gen.formatDouble(coords[0])).append(" 
").append(gen.formatDouble(coords[1]));
+                                 } else {
+-                                    return super.processShape(s);
++                                    return super.processShape(s, cached);
+                                 }
+                             }
+                             buffer.append("] DP");
+@@ -1071,7 +1071,7 @@ public class Export {
+                             return PathIterator.WIND_NON_ZERO;
+                         }
+ 
+-                        return super.processShape(s);
++                        return super.processShape(s, cached);
+                     }
+ 
+                 };

diff --git a/sci-mathematics/scilab/scilab-5.5.2.ebuild 
b/sci-mathematics/scilab/scilab-5.5.2.ebuild
new file mode 100644
index 000000000..684a3df8b
--- /dev/null
+++ b/sci-mathematics/scilab/scilab-5.5.2.ebuild
@@ -0,0 +1,300 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+JAVA_PKG_OPT_USE="gui"
+VIRTUALX_REQUIRED="manual"
+
+inherit autotools bash-completion-r1 check-reqs eutils flag-o-matic \
+       fortran-2 java-pkg-opt-2 pax-utils toolchain-funcs virtualx xdg-utils
+
+DESCRIPTION="Scientific software package for numerical computations"
+HOMEPAGE="http://www.scilab.org/";
+SRC_URI="http://www.scilab.org/download/${PV}/${P}-src.tar.gz
+       
https://raw.githubusercontent.com/gentoo/sci/4c2a07c4629c61395a998633ccfcb34d72569529/sci-mathematics/scilab/files/${P}-bug15107.patch";
+
+LICENSE="CeCILL-2.1"
+SLOT="0"
+KEYWORDS=""
+IUSE="bash-completion debug doc emf fftw +gui +matio mpi nls openmp
+       static-libs test tk +umfpack +xcos"
+REQUIRED_USE="xcos? ( gui ) doc? ( gui )"
+
+RESTRICT="test"
+
+IUSE_L10N="fr zh zh ru ca de es pt ja it uk pl cs"
+L10N_DOC="fr pt ja ru"
+
+map_lang() {
+       local lang=${1/_/-}
+       case $1 in
+               # Retain the following, which have a specific subtag
+               de_*|en_*|pt_*|zh_*) ;;
+               # Consider all other xx_XX as duplicates of the generic xx tag
+               *_*) lang=${1%%_*} ;;
+       esac
+       echo ${lang}
+}
+
+prev_l=
+for l in ${IUSE_L10N}; do
+       l=$(map_lang ${l})
+       [[ ${l} != "${prev_l}" ]] && IUSE+=" l10n_${l}"
+       prev_l=${l}
+done
+unset l prev_l
+
+CDEPEND="
+       dev-libs/libpcre
+       dev-libs/libxml2:2
+       sci-libs/hdf5[mpi=]
+       >=sci-libs/arpack-3
+       sys-devel/gettext
+       sys-libs/ncurses:0=
+       sys-libs/readline:0=
+       virtual/lapack
+       emf? (
+               dev-java/freehep-graphicsio:0
+               dev-java/freehep-graphicsio-emf:0
+               dev-java/freehep-graphics2d:0
+               dev-java/freehep-io:0
+               dev-java/freehep-graphicsbase:0
+       )
+       fftw? ( sci-libs/fftw:3.0 )
+       gui? (
+               dev-java/avalon-framework:4.2
+               >=dev-java/batik-1.9:1.9
+               dev-java/commons-io:1
+               dev-java/commons-logging:0
+               >=dev-java/flexdock-1.2.4:0
+               >=dev-java/fop-2.0:0
+               ~dev-java/gluegen-2.2.4:2.2
+               dev-java/javahelp:0
+               dev-java/jeuclid-core:0
+               dev-java/jgoodies-looks:2.6
+               >=dev-java/jlatexmath-1.0.3:1
+               >=dev-java/jlatexmath-fop-1.0.3:1
+               ~dev-java/jogl-2.2.4:2.2
+               >=dev-java/jrosetta-1.0.4:0
+               dev-java/skinlf:0
+               dev-java/xmlgraphics-commons:2
+               virtual/opengl
+               xcos? ( dev-java/jgraphx:0 )
+               )
+       matio? ( >=sci-libs/matio-1.5 )
+       tk? ( dev-lang/tk:0= )
+       umfpack? ( sci-libs/umfpack )"
+
+RDEPEND="${CDEPEND}
+       gui? ( >=virtual/jre-1.5 )"
+
+DEPEND="${CDEPEND}
+       virtual/pkgconfig
+       debug? ( dev-util/lcov )
+       gui? (
+               >=virtual/jdk-1.6
+               doc? ( app-text/docbook-xsl-stylesheets
+                       dev-java/xml-commons-external:1.4
+                       dev-java/saxon:9 )
+               xcos? (
+                       >=dev-lang/ocaml-4.06
+                       dev-ml/num
+               )
+       )
+       test? (
+               dev-java/junit:4
+               gui? ( ${VIRTUALX_DEPEND} ) )"
+
+DOCS=( "ACKNOWLEDGEMENTS" "README_Unix" "Readme_Visual.txt" )
+
+PATCHES=(
+       "${FILESDIR}/${P}-followlinks.patch"
+       "${FILESDIR}/${P}-gluegen.patch"
+       "${FILESDIR}/${P}-fix-random-runtime-failure.patch"
+       "${FILESDIR}/${P}-accessviolation.patch"
+       "${FILESDIR}/${P}-missinglib.patch"
+       "${FILESDIR}/${P}-batik-1.9.patch"
+       "${FILESDIR}/${P}-fop-2.0.patch"
+       "${FILESDIR}/${P}-xmlgraphics-common-2.0.patch"
+       "${FILESDIR}/${P}-freehep.patch"
+       "${FILESDIR}/${P}-fortran-gcc8.patch" # 
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=232958
+       "${FILESDIR}/${P}-libxml-icu64.patch" # similar to 
https://bugzilla.scilab.org/show_bug.cgi?id=16588
+       "${FILESDIR}/${P}-hdf5-1.8.10.patch" # adapted from 
https://github.com/bartoszek/scilab
+       "${DISTDIR}/${P}-bug15107.patch" # 
http://bugzilla.scilab.org/show_bug.cgi?id=15107
+       "${FILESDIR}/${P}-bug15449.patch" # 
http://bugzilla.scilab.org/show_bug.cgi?id=15449
+       "${FILESDIR}/${P}-ocaml-4.0.4.patch" # 
https://github.com/bartoszek/scilab
+)
+
+pkg_pretend() {
+       use doc && CHECKREQS_MEMORY="512M" check-reqs_pkg_pretend
+}
+
+pkg_setup() {
+       if use openmp; then
+               if [[ $(tc-getCC) == *gcc* ]] && ! tc-has-openmp; then
+                       ewarn "You are using a gcc without OpenMP capabilities"
+                       die "Need an OpenMP capable compiler"
+               fi
+               FORTRAN_NEED_OPENMP=1
+       fi
+       FORTRAN_STANDARD="77 90"
+       fortran-2_pkg_setup
+       #bug 8053
+       unset F77
+       java-pkg-opt-2_pkg_setup
+
+       ALL_L10N="en_US"
+       ALL_L10N_DOC="en_US"
+       for l in ${IUSE_L10N}; do
+               use l10n_${l} && ALL_L10N="${ALL_L10N} ${l}"
+       done
+       for l in ${L10N_DOC}; do
+               use l10n_${l} && ALL_L10N_DOC="${ALL_L10N_DOC} ${l}"
+       done
+       export ALL_L10N ALL_L10N_DOC
+}
+
+src_prepare() {
+       default
+
+       # works for me on x86, but users are having
+       # trouble without see #282 on github
+       append-ldflags $(no-as-needed)
+
+       # increases java heap to 512M when building docs (sync with cheqreqs 
above)
+       use doc && eapply "${FILESDIR}/${P}-java-heap.patch"
+
+       # use the L10N variable that we set
+       sed -i -e "/^ALL_LINGUAS=/d" -e "/^ALL_LINGUAS_DOC=/d" -i configure.ac 
||die
+
+       # make sure the DOCBOOK_ROOT variable is set
+       sed -i -e "s/xsl-stylesheets-\*/xsl-stylesheets/g" bin/scilab* || die
+
+       # remove self closing <br /> (error our with javadoc8)
+       # already upstream commit 2103082c
+       find . -name '*.java' -exec sed -i "s|<br />|<BR>|" {} \; ||die
+
+       #add specific gentoo java directories
+       if use gui; then
+               sed -i -e "s|/usr/lib/jogl2|/usr/lib/jogl-2.2|" \
+                       -e "s|/usr/lib64/jogl2|/usr/lib64/jogl-2.2|" 
configure.ac || die
+               sed -i -e "s|/usr/lib/gluegen2|/usr/lib/gluegen-2.2|" \
+                       -e "s|/usr/lib64/gluegen2|/usr/lib64/gluegen-2.2|" \
+                       -e 
"s|AC_CHECK_LIB(\[gluegen2-rt|AC_CHECK_LIB([gluegen-rt|" \
+                       configure.ac || die
+
+               sed -i -e "s/jogl2/jogl-2.2/" -e "s/gluegen2/gluegen-2.2/" \
+                       etc/librarypath.xml || die
+       fi
+
+       mkdir jar || die
+       pushd jar >/dev/null
+       if use gui; then
+               java-pkg_jar-from jlatexmath-1,flexdock,skinlf
+               java-pkg_jar-from jgoodies-looks-2.6,jrosetta
+               java-pkg_jar-from avalon-framework-4.2,jeuclid-core
+               java-pkg_jar-from xmlgraphics-commons-2,commons-io-1
+               java-pkg_jar-from jogl-2.2 jogl-all.jar jogl2.jar
+               java-pkg_jar-from gluegen-2.2 gluegen-rt.jar gluegen2-rt.jar
+               java-pkg_jar-from fop fop.jar
+               java-pkg_jar-from javahelp jhall.jar
+               java-pkg_jar-from jlatexmath-fop-1
+               use xcos &&     java-pkg_jar-from jgraphx
+               if use doc; then
+                       java-pkg_jar-from --build-only batik-1.9 batik-all.jar
+                       java-pkg_jar-from --build-only saxon-9 saxon.jar 
saxon9he.jar
+                       java-pkg_jar-from --build-only xml-commons-external-1.4 
xml-apis-ext.jar
+               fi
+       fi
+       if use emf; then
+               java-pkg_jar-from freehep-graphicsio-emf,freehep-graphics2d
+               java-pkg_jar-from 
freehep-graphicsio,freehep-io,freehep-graphicsbase
+       fi
+       if use test; then
+               java-pkg_jar-from junit-4 junit.jar junit4.jar
+               java-pkg_jar-from ant-junit
+       fi
+       popd
+
+       java-pkg-opt-2_src_prepare
+       eautoconf
+}
+
+src_configure() {
+       if use gui; then
+               export JAVA_HOME="$(java-config -O)"
+       else
+               unset JAVAC
+       fi
+
+       export BLAS_LIBS="$($(tc-getPKG_CONFIG) --libs blas)"
+       export LAPACK_LIBS="$($(tc-getPKG_CONFIG) --libs lapack)"
+       export F77_LDFLAGS="${LDFLAGS}"
+
+       econf \
+               --enable-relocatable \
+               --disable-rpath \
+               
--with-docbook="${EPREFIX}/usr/share/sgml/docbook/xsl-stylesheets" \
+               --disable-static-system-lib \
+               $(use_enable debug) \
+               $(use_enable debug code-coverage) \
+               $(use_enable debug debug-C) \
+               $(use_enable debug debug-CXX) \
+               $(use_enable debug debug-fortran) \
+               $(use_enable debug debug-java) \
+               $(use_enable debug debug-linker) \
+               $(use_enable doc build-help) \
+               $(use_enable nls) \
+               $(use_enable nls build-localization) \
+               $(use_enable static-libs static) \
+               $(use_enable test compilation-tests) \
+               $(use_with emf) \
+               $(use_with fftw) \
+               $(use_with gui) \
+               $(use_with gui javasci) \
+               $(use_with matio) \
+               $(use_with openmp) \
+               $(use_with tk) \
+               $(use_with umfpack) \
+               $(use_with xcos) \
+               $(use_with xcos modelica) \
+               $(use_with mpi)
+}
+
+src_compile() {
+       addpredict /proc/mtrr
+       default
+       pax-mark m .libs/scilab-bin
+       use doc && emake doc
+}
+
+src_test() {
+       if use gui; then
+               Xemake check
+       else
+               emake check
+       fi
+}
+
+src_install() {
+       default
+       prune_libtool_files --all
+       rm -rf "${D}"/usr/share/scilab/modules/*/tests ||die
+       use bash-completion && newbashcomp 
"${FILESDIR}"/"${PN}".bash_completion "${PN}"
+       echo "SEARCH_DIRS_MASK=${EPREFIX}/usr/$(get_libdir)/scilab" \
+               > 50-"${PN}"
+       insinto /etc/revdep-rebuild && doins "50-${PN}"
+}
+
+pkg_postinst() {
+       xdg_mimeinfo_database_update
+       einfo "If you are using the NVIDIA binary drivers, and run into 
graphics"
+       einfo "crashes, you may try to run scilab as follows:"
+       einfo "EGL_DRIVER=egl_glx scilab"
+       einfo "See upstream http://bugzilla.scilab.org/show_bug.cgi?id=12940";
+}
+
+pkg_postrm() {
+       xdg_mimeinfo_database_update
+}

Reply via email to