all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#66201] [PATCH 0/2] Update scilab and remove suitesparse-3.
@ 2023-09-25 21:00 David Elsing
  2023-09-25 21:13 ` [bug#66201] [PATCH 1/2] gnu: scilab: Update to 2023.1.0 David Elsing
  2023-09-25 21:13 ` [bug#66201] [PATCH 2/2] gnu: Remove suitesparse-3 David Elsing
  0 siblings, 2 replies; 4+ messages in thread
From: David Elsing @ 2023-09-25 21:00 UTC (permalink / raw)
  To: 66201; +Cc: David Elsing

There are a lot of autogenerated files, so the snippet became rather
large. As the Java parts depend on some libraries not packaged in Guix
(such as jogl or saxon), I kept them disabled.

David Elsing (2):
  gnu: scilab: Update to 2023.1.0.
  gnu: Remove suitesparse-3.

 gnu/packages/maths.scm                        | 345 +++++++++---------
 .../patches/scilab-hdf5-1.8-api.patch         |  71 ++++
 2 files changed, 236 insertions(+), 180 deletions(-)
 create mode 100644 gnu/packages/patches/scilab-hdf5-1.8-api.patch

-- 
2.41.0





^ permalink raw reply	[flat|nested] 4+ messages in thread

* [bug#66201] [PATCH 1/2] gnu: scilab: Update to 2023.1.0.
  2023-09-25 21:00 [bug#66201] [PATCH 0/2] Update scilab and remove suitesparse-3 David Elsing
@ 2023-09-25 21:13 ` David Elsing
  2023-10-04 15:00   ` bug#66201: " Efraim Flashner
  2023-09-25 21:13 ` [bug#66201] [PATCH 2/2] gnu: Remove suitesparse-3 David Elsing
  1 sibling, 1 reply; 4+ messages in thread
From: David Elsing @ 2023-09-25 21:13 UTC (permalink / raw)
  To: 66201; +Cc: David Elsing

* gnu/packages/maths.scm (scilab): Update to 2023.1.0.
[source] Use git-fetch.
<modules>: Add (guix build utils) and (ice-9 ftw).
<patches>: Add patch for hdf5 >= 1.10.
<snippet>: Move contents of the "scilab" directory to its parents. Remove
the other files and autogenerated files.
[native-inputs]: Add autoconf, autoconf-archive, automake, bison, eigen, flex,
libtool, ocaml and ocaml-findlib.
[inputs]: Add ocaml-num, replace hdf5-1.8 by hdf5-1.14 and suitesparse-3 by
suitesparse.
[arguments]: Remove quasiquote. Add --enable-build-parser,
--with-eigen-include=..., OCAMLC=... and OCAMLOPT=... to #:configure-flags.
<#:phases>: Add fix-ocaml-num, remove-desktop-files,
bootstrap-dynamic_link-scripts and build-parsers phases. Remove fixes for
compilation and linker errors from the pre-build phase.
[home-page]: Update URL.
[description]: Add two spaces between sentences.
[license]: Update to gpl2 and bsd-3.
---
 gnu/packages/maths.scm                        | 256 +++++++++++-------
 .../patches/scilab-hdf5-1.8-api.patch         |  71 +++++
 2 files changed, 236 insertions(+), 91 deletions(-)
 create mode 100644 gnu/packages/patches/scilab-hdf5-1.8-api.patch

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 62d4adfbd1..ff50a99599 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -61,6 +61,7 @@
 ;;; Copyright © 2022 Roman Scherer <roman.scherer@burningswell.com>
 ;;; Copyright © 2023 Jake Leporte <jakeleporte@outlook.com>
 ;;; Copyright © 2023 Camilo Q.S. (Distopico) <distopico@riseup.net>
+;;; Copyright © 2023 David Elsing <david.elsing@posteo.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -8422,112 +8423,185 @@ (define-public optizelle
 (define-public scilab
   (package
     (name "scilab")
-    (version "5.5.2")
+    (version "2023.1.0")
     (source
      (origin
-       (method url-fetch)
-       (uri
-        (string-append "https://www.scilab.org/download/"
-                       version "/scilab-" version "-src.tar.gz"))
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://gitlab.com/scilab/scilab")
+             (commit version)))
+       (file-name (git-file-name name version))
        (sha256
-        (base32 "0phg9pn24yw98hbh475ik84dnikf1225b2knh7qbhdbdx6fm2d57"))))
+        (base32
+         "0hbqsnc67b4f8zc690kl79bwhjaasykjlmqbln8iymnjcn3l5ypd"))
+       (modules '((guix build utils)
+                  (ice-9 ftw)))
+       (patches (search-patches "scilab-hdf5-1.8-api.patch"))
+       (snippet
+        #~(begin
+            (for-each
+             (lambda (file)
+               (unless (member file '("." ".." "scilab"))
+                 (delete-file-recursively file)))
+             (scandir "."))
+            (for-each
+             (lambda (file)
+               (unless (member file '("." ".."))
+                 (rename-file (string-append "scilab/" file) file)))
+             (scandir "scilab"))
+            (delete-file-recursively "scilab")
+            (delete-file "aclocal.m4")
+            (for-each
+             delete-file
+             (find-files "." "^Makefile\\.in$"))
+            (delete-file-recursively "config")
+            (delete-file "configure")
+            (delete-file-recursively "libs/GetWindowsVersion")
+            (delete-file "m4/ax_cxx_compile_stdcxx.m4")
+            (delete-file "m4/lib-ld.m4")
+            (delete-file "m4/libtool.m4")
+            (delete-file "m4/ltoptions.m4")
+            (delete-file "m4/ltsugar.m4")
+            (delete-file "m4/ltversion.m4")
+            (delete-file "m4/lt~obsolete.m4")
+            (delete-file "m4/pkg.m4")
+            (for-each
+             (lambda (file)
+               (delete-file
+                (string-append "modules/dynamic_link/src/scripts/" file)))
+             '("aclocal.m4"
+               "configure"
+               "compile"
+               "config.guess"
+               "config.sub"
+               "ltmain.sh"
+               "depcomp"
+               "install-sh"
+               "missing"))
+            (delete-file-recursively "modules/dynamic_link/src/scripts/m4")
+            (delete-file "modules/ast/src/cpp/parse/scanscilab.cpp")
+            (delete-file "modules/ast/src/cpp/parse/bison/parsescilab.output")
+            (delete-file "modules/ast/includes/parse/parsescilab.hxx")
+            (delete-file "modules/ast/src/cpp/parse/parsescilab.cpp")))))
     (build-system gnu-build-system)
-    (native-inputs (list pkg-config gfortran))
-    (inputs (list libxml2
-                  `(,pcre "bin")
+    (native-inputs
+     (list autoconf
+           autoconf-archive
+           automake
+           bison
+           eigen
+           flex
+           gfortran
+           libtool
+           ocaml
+           ocaml-findlib
+           pkg-config))
+    (inputs (list `(,pcre "bin")
                   `(,pcre "out")
-                  readline
-                  hdf5-1.8
-                  curl
-                  openblas
-                  lapack
+                  libxml2
                   arpack-ng
+                  curl
                   fftw
                   gettext-minimal
-                  suitesparse-3
-                  tcl
-                  tk
+                  hdf5-1.14
+                  lapack
                   libx11
-                  matio))
+                  matio
+                  ocaml-num
+                  openblas
+                  readline
+                  suitesparse
+                  tcl
+                  tk))
     (arguments
-     `(#:tests? #f
-       #:configure-flags
-       ,#~(list
-           "--enable-relocatable"
-           "--disable-static-system-lib"
-           ;; Disable all java code.
-           "--without-gui"
-           "--without-javasci"
-           "--disable-build-help"
-           "--with-external-scirenderer"
-           ;; Tcl and Tk library locations.
-           (string-append "--with-tcl-include="
-                          (string-drop-right
-                           (search-input-file %build-inputs "include/tcl.h")
-                           (string-length "/tcl.h")))
-           (string-append "--with-tcl-library="
-                          (string-drop-right
-                           (search-input-directory %build-inputs "lib/tcl8")
-                           (string-length "/tcl8")))
-           (string-append "--with-tk-include="
-                          (string-drop-right
-                           (search-input-file %build-inputs "include/tk.h")
-                           (string-length "/tk.h")))
-           (string-append "--with-tk-library="
-                          (string-drop-right
-                           (search-input-directory %build-inputs "lib/tk8.6")
-                           (string-length "/tk8.6")))
-           ;; There are some 2018-fortran errors that are ignored
-           ;; with this fortran compiler flag.
-           "FFLAGS=-fallow-argument-mismatch")
-       #:phases
-       ,#~(modify-phases %standard-phases
-            (add-before 'build 'pre-build
-              (lambda _
-                ;; Fix scilab script.
-                (substitute* "bin/scilab"
-                  (("\\/bin\\/ls")
-                   (which "ls")))
-                ;; Fix core.start.
-                (substitute* "modules/core/etc/core.start"
-                  (("'SCI/modules")
-                   "SCI+'/modules"))
-                ;; Fix fortran compilation error.
-                (substitute*
-                    "modules/differential_equations/src/fortran/twodq.f"
-                  (("node\\(10\\),node1\\(10\\),node2\\(10\\),coef")
-                   "node(9),node1(9),node2(9),coef"))
-                ;; Fix C compilation errors.
-                ;; remove &
-                (substitute* "modules/hdf5/src/c/h5_readDataFromFile_v1.c"
-                  (("(H5Rdereference\\(_iDatasetId, H5R_OBJECT, )&(.*)\\);$"
-                    all common ref)
-                   (string-append common ref)))
-                ;; fix multiple definitions
-                (substitute* "modules/tclsci/src/c/TCL_Command.h"
-                  (("^__thread")
-                   "extern __thread"))
-                (substitute* "modules/tclsci/src/c/InitTclTk.c"
-                  (("BOOL TK_Started = FALSE;" all)
-                   (string-append all "\n"
-                                  "__threadId TclThread;" "\n"
-                                  "__threadSignal InterpReady;" "\n"
-                                  "__threadSignalLock InterpReadyLock;"
-                                  "\n")))
-                ;; Fix CPP compilation errors.
-                (substitute* "modules/output_stream/src/cpp/diary_manager.cpp"
-                  (("if \\(array_size > 0\\)")
-                   "if (*array_size > 0)"))
-                ;; Set SCIHOME to /tmp before macros compilation.
-                (setenv "SCIHOME" "/tmp"))))))
-    (home-page "https://scilab.org")
+     (list
+      ;; The tests require java code.
+      #:tests? #f
+      #:configure-flags
+      #~(list
+         "--enable-relocatable"
+         "--disable-static-system-lib"
+         "--enable-build-parser"
+         ;; Disable all java code.
+         "--without-gui"
+         "--without-javasci"
+         "--disable-build-help"
+         "--with-external-scirenderer"
+         ;; Tcl and Tk library locations.
+         (string-append "--with-tcl-include="
+                        (string-drop-right
+                         (search-input-file %build-inputs "include/tcl.h")
+                         (string-length "/tcl.h")))
+         (string-append "--with-tcl-library="
+                        (string-drop-right
+                         (search-input-directory %build-inputs "lib/tcl8")
+                         (string-length "/tcl8")))
+         (string-append "--with-tk-include="
+                        (string-drop-right
+                         (search-input-file %build-inputs "include/tk.h")
+                         (string-length "/tk.h")))
+         (string-append "--with-tk-library="
+                        (string-drop-right
+                         (search-input-directory %build-inputs "lib/tk8.6")
+                         (string-length "/tk8.6")))
+         (string-append "--with-eigen-include="
+                        #$(this-package-native-input "eigen")
+                        "/include/eigen3")
+         ;; Find and link to the OCaml Num package
+         "OCAMLC=ocamlfind ocamlc -package num"
+         "OCAMLOPT=ocamlfind ocamlopt -package num -linkpkg"
+         ;; There are some 2018-fortran errors that are ignored
+         ;; with this fortran compiler flag.
+         "FFLAGS=-fallow-argument-mismatch")
+      #:phases
+      #~(modify-phases %standard-phases
+          ;; The Num library is specified with the OCAMLC and
+          ;; OCAMLOPT variables above.
+          (add-after 'unpack 'fix-ocaml-num
+            (lambda _
+              (substitute*
+                  '("modules/scicos/Makefile.modelica.am"
+                    "modules/scicos/src/translator/makefile.mak"
+                    "modules/scicos/src/modelica_compiler/makefile.mak")
+                (("nums\\.cmx?a") ""))))
+          ;; Install only scilab-cli.desktop
+          (add-after 'unpack 'remove-desktop-files
+            (lambda _
+              (substitute* "desktop/Makefile.am"
+                (("desktop_DATA =")
+                 "desktop_DATA = scilab-cli.desktop\nDUMMY ="))))
+          ;; These generated files are assumed to be present during
+          ;; the build.
+          (add-after 'bootstrap 'bootstrap-dynamic_link-scripts
+            (lambda _
+              (with-directory-excursion "modules/dynamic_link/src/scripts"
+                (invoke "autoreconf" "-i"))))
+          (add-before 'build 'pre-build
+            (lambda _
+              ;; Fix scilab script.
+              (substitute* "bin/scilab"
+                (("\\/bin\\/ls")
+                 (which "ls")))
+              ;; Fix core.start.
+              (substitute* "modules/core/etc/core.start"
+                (("'SCI/modules")
+                 "SCI+'/modules"))
+              ;; Set SCIHOME to /tmp before macros compilation.
+              (setenv "SCIHOME" "/tmp")))
+          ;; Prevent race condition
+          (add-after 'pre-build 'build-parsers
+            (lambda _
+              (with-directory-excursion "modules/ast"
+                (invoke "make" "src/cpp/parse/parsescilab.cpp"
+                        "src/cpp/parse/scanscilab.cpp")))))))
+    (home-page "https://www.scilab.org/")
     (synopsis "Software for engineers and scientists")
     (description "This package provides the non-graphical version of the Scilab
-software for engineers and scientists. Scilab is used for signal processing,
+software for engineers and scientists.  Scilab is used for signal processing,
 statistical analysis, image enhancement, fluid dynamics simulations, numerical
 optimization, and modeling, simulation of explicit and implicit dynamical
 systems and symbolic manipulations.")
-    (license license:cecill)))                    ;CeCILL v2.1
+    (license (list license:gpl2 license:bsd-3))))
 
 (define-public ruy
   (let ((commit "caa244343de289f913c505100e6a463d46c174de")
diff --git a/gnu/packages/patches/scilab-hdf5-1.8-api.patch b/gnu/packages/patches/scilab-hdf5-1.8-api.patch
new file mode 100644
index 0000000000..8b453e4720
--- /dev/null
+++ b/gnu/packages/patches/scilab-hdf5-1.8-api.patch
@@ -0,0 +1,71 @@
+This patch fixes the compilation with hdf5 version >= 1.10. Adapted from
+https://aur.archlinux.org/cgit/aur.git/plain/hdf5_18_api.patch?h=scilab-git.
+
+diff -ur a/scilab/modules/hdf5/includes/HDF5Objects.h b/scilab/modules/hdf5/includes/HDF5Objects.h
+--- a/scilab/modules/hdf5/includes/HDF5Objects.h
++++ b/scilab/modules/hdf5/includes/HDF5Objects.h
+@@ -16,14 +16,12 @@
+ #ifndef __HDF5OBJECTS_H__
+ #define __HDF5OBJECTS_H__
+ 
+-#define H5_NO_DEPRECATED_SYMBOLS
+ #undef H5_USE_16_API
++#define H5_USE_18_API
+ 
+-#define H5Eset_auto_vers 2
+ #include <hdf5.h>
+ #include <hdf5_hl.h>
+ 
+-#undef H5_NO_DEPRECATED_SYMBOLS
+ 
+ //#define __HDF5OBJECTS_DEBUG__
+ //#define __HDF5ERROR_PRINT__
+diff -ur a/scilab/modules/hdf5/Makefile.am b/scilab/modules/hdf5/Makefile.am
+--- a/scilab/modules/hdf5/Makefile.am
++++ b/scilab/modules/hdf5/Makefile.am
+@@ -104,8 +104,7 @@
+     -DH5Gopen_vers=2 \
+     -DH5Tget_array_dims_vers=2 \
+     -DH5Acreate_vers=2 \
+-    -DH5Rdereference_vers=2 \
+-    -DNO_DEPRECATED_SYMBOLS
++    -DH5Rdereference_vers=2
+ 
+ 
+ libscihdf5_la_CPPFLAGS = \
+diff -ur a/scilab/modules/hdf5/sci_gateway/cpp/sci_hdf5_listvar_v3.cpp b/scilab/modules/hdf5/sci_gateway/cpp/sci_hdf5_listvar_v3.cpp
+--- a/scilab/modules/hdf5/sci_gateway/cpp/sci_hdf5_listvar_v3.cpp
++++ b/scilab/modules/hdf5/sci_gateway/cpp/sci_hdf5_listvar_v3.cpp
+@@ -13,6 +13,8 @@
+ *
+ */
+ 
++#define H5_USE_18_API
++
+ #include <vector>
+ #include "function.hxx"
+ #include "string.hxx"
+diff -ur a/scilab/modules/hdf5/src/c/h5_readDataFromFile.c b/scilab/modules/hdf5/src/c/h5_readDataFromFile.c
+--- a/scilab/modules/hdf5/src/c/h5_readDataFromFile.c
++++ b/scilab/modules/hdf5/src/c/h5_readDataFromFile.c
+@@ -13,7 +13,7 @@
+ *
+ */
+ 
+-#define H5_NO_DEPRECATED_SYMBOLS
++#define H5_USE_18_API
+ 
+ #ifndef _MSC_VER
+ #include <sys/time.h>
+diff -ur a/scilab/modules/hdf5/src/c/h5_readDataFromFile_v1.c b/scilab/modules/hdf5/src/c/h5_readDataFromFile_v1.c
+--- a/scilab/modules/hdf5/src/c/h5_readDataFromFile_v1.c
++++ b/scilab/modules/hdf5/src/c/h5_readDataFromFile_v1.c
+@@ -13,7 +13,7 @@
+ *
+ */
+ 
+-#define H5_NO_DEPRECATED_SYMBOLS
++#define H5_USE_18_API
+ 
+ #ifndef _MSC_VER
+ #include <sys/time.h>
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [bug#66201] [PATCH 2/2] gnu: Remove suitesparse-3.
  2023-09-25 21:00 [bug#66201] [PATCH 0/2] Update scilab and remove suitesparse-3 David Elsing
  2023-09-25 21:13 ` [bug#66201] [PATCH 1/2] gnu: scilab: Update to 2023.1.0 David Elsing
@ 2023-09-25 21:13 ` David Elsing
  1 sibling, 0 replies; 4+ messages in thread
From: David Elsing @ 2023-09-25 21:13 UTC (permalink / raw)
  To: 66201; +Cc: David Elsing

* gnu/packages/maths.scm (suitesparse-3): Delete variable.
---
 gnu/packages/maths.scm | 89 ------------------------------------------
 1 file changed, 89 deletions(-)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index ff50a99599..b2446f23c9 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -4965,95 +4965,6 @@ (define-public suitesparse
     ;;  GPUQREngine, RBio, SuiteSparse_GPURuntime, SuiteSparseQR, UMFPACK
     (license (list license:gpl2+ license:lgpl2.1+))))
 
-
-;; This outdated version is used to build the scilab package.
-(define-public suitesparse-3
-  (package
-    (inherit suitesparse)
-    (name "suitesparse")
-    (version "3.1.0")
-    (source
-     (origin
-       (method git-fetch)
-       (uri (git-reference
-             (url "https://github.com/DrTimothyAldenDavis/SuiteSparse")
-             (commit (string-append "v" version))))
-       (file-name (git-file-name name version))
-       (sha256
-        (base32 "0wxk755nzps0c9la24zqknqkzjp6rcj5q9jhd973mff1pqja3clz"))))
-    (build-system gnu-build-system)
-    (arguments
-     `(#:tests? #f  ;no "check" target
-       #:make-flags
-       ,#~(list
-           (string-append "CC=gcc")
-           "AR=gcc -shared -o"
-           "RANLIB=touch"
-           "CFLAGS=-O3 -fPIC -I../Include"
-           "TBB=-ltbb"
-
-           ;; Disable metis@4 (nonfree) support.
-           "CHOLMOD_CONFIG=-DNPARTITION"
-           "METIS="
-           "METIS_PATH="
-
-           ;; The default is to link against netlib lapack.  Use OpenBLAS
-           ;; instead.
-           "BLAS=-lopenblas" "LAPACK=-lopenblas"
-
-           (string-append "INSTALL_LIB="
-                          (assoc-ref %outputs "out") "/lib")
-           (string-append "INSTALL_INCLUDE="
-                          (assoc-ref %outputs "out") "/include")
-           "library")
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'correct-build-configuration
-           (lambda _
-             ;; Invert build order: CHOLMOD before KLU.
-             (substitute* "Makefile"
-               (("\t\\( cd CHOLMOD ; \\$\\(MAKE\\) \\)\n$")
-                "")
-               (("\\( cd KLU ; \\$\\(MAKE\\) \\)")
-                (string-append "( cd CHOLMOD ; $(MAKE) )\n\t"
-                               "( cd KLU ; $(MAKE) )")))
-             ;; Build shared libraries.
-             (substitute* (find-files "." "akefile$")
-               (("lib([a-z]+)\\.a" all libname)
-                (string-append "lib" libname ".so")))
-             ;; Delete broken KLU Demo step.
-             (substitute* "KLU/Makefile"
-               (("\\( cd Demo ; \\$\\(MAKE\\) \\)")
-                ""))))
-         (replace 'install
-           (lambda _
-             ;; Install libraries.
-             (for-each
-              (lambda (x)
-                (install-file
-                 x
-                 (string-append (assoc-ref %outputs "out") "/lib")))
-              (find-files "." "\\.so$"))
-             ;; Install header files.
-             (for-each
-              (lambda (x)
-                (install-file
-                 x
-                 (string-append (assoc-ref %outputs "out") "/include")))
-              (find-files "." "\\.h$"))))
-         ,@(if (target-riscv64?)
-               ;; GraphBLAS FTBFS on riscv64-linux
-               `((add-after 'unpack 'skip-graphblas
-                   (lambda _
-                     (substitute* "Makefile"
-                       ((".*cd GraphBLAS.*") "")
-                       (("metisinstall gbinstall moninstall")
-                        "moninstall")))))
-               '())
-         (delete 'configure))))         ;no configure script
-    (inputs
-     (list tbb openblas gmp mpfr))))
-
 (define-public atlas
   (package
     (name "atlas")
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#66201: [PATCH 1/2] gnu: scilab: Update to 2023.1.0.
  2023-09-25 21:13 ` [bug#66201] [PATCH 1/2] gnu: scilab: Update to 2023.1.0 David Elsing
@ 2023-10-04 15:00   ` Efraim Flashner
  0 siblings, 0 replies; 4+ messages in thread
From: Efraim Flashner @ 2023-10-04 15:00 UTC (permalink / raw)
  To: David Elsing; +Cc: 66201-done

[-- Attachment #1: Type: text/plain, Size: 18310 bytes --]

Thanks. Patch pushed, with a couple of comments below:

On Mon, Sep 25, 2023 at 09:13:12PM +0000, David Elsing wrote:
> * gnu/packages/maths.scm (scilab): Update to 2023.1.0.
> [source] Use git-fetch.
> <modules>: Add (guix build utils) and (ice-9 ftw).
> <patches>: Add patch for hdf5 >= 1.10.
> <snippet>: Move contents of the "scilab" directory to its parents. Remove
> the other files and autogenerated files.
> [native-inputs]: Add autoconf, autoconf-archive, automake, bison, eigen, flex,
> libtool, ocaml and ocaml-findlib.
> [inputs]: Add ocaml-num, replace hdf5-1.8 by hdf5-1.14 and suitesparse-3 by
> suitesparse.
> [arguments]: Remove quasiquote. Add --enable-build-parser,
> --with-eigen-include=..., OCAMLC=... and OCAMLOPT=... to #:configure-flags.
> <#:phases>: Add fix-ocaml-num, remove-desktop-files,
> bootstrap-dynamic_link-scripts and build-parsers phases. Remove fixes for
> compilation and linker errors from the pre-build phase.
> [home-page]: Update URL.
> [description]: Add two spaces between sentences.
> [license]: Update to gpl2 and bsd-3.
> ---
>  gnu/packages/maths.scm                        | 256 +++++++++++-------
>  .../patches/scilab-hdf5-1.8-api.patch         |  71 +++++
>  2 files changed, 236 insertions(+), 91 deletions(-)
>  create mode 100644 gnu/packages/patches/scilab-hdf5-1.8-api.patch
> 
> diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
> index 62d4adfbd1..ff50a99599 100644
> --- a/gnu/packages/maths.scm
> +++ b/gnu/packages/maths.scm
> @@ -61,6 +61,7 @@
>  ;;; Copyright © 2022 Roman Scherer <roman.scherer@burningswell.com>
>  ;;; Copyright © 2023 Jake Leporte <jakeleporte@outlook.com>
>  ;;; Copyright © 2023 Camilo Q.S. (Distopico) <distopico@riseup.net>
> +;;; Copyright © 2023 David Elsing <david.elsing@posteo.net>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -8422,112 +8423,185 @@ (define-public optizelle
>  (define-public scilab
>    (package
>      (name "scilab")
> -    (version "5.5.2")
> +    (version "2023.1.0")
>      (source
>       (origin
> -       (method url-fetch)
> -       (uri
> -        (string-append "https://www.scilab.org/download/"
> -                       version "/scilab-" version "-src.tar.gz"))
> +       (method git-fetch)
> +       (uri (git-reference
> +             (url "https://gitlab.com/scilab/scilab")
> +             (commit version)))
> +       (file-name (git-file-name name version))
>         (sha256
> -        (base32 "0phg9pn24yw98hbh475ik84dnikf1225b2knh7qbhdbdx6fm2d57"))))
> +        (base32
> +         "0hbqsnc67b4f8zc690kl79bwhjaasykjlmqbln8iymnjcn3l5ypd"))
> +       (modules '((guix build utils)
> +                  (ice-9 ftw)))
> +       (patches (search-patches "scilab-hdf5-1.8-api.patch"))
> +       (snippet

Wow, that is a big snippet. I added some comments and grouped up some
repetitive commands with a for-each.

> +        #~(begin
> +            (for-each
> +             (lambda (file)
> +               (unless (member file '("." ".." "scilab"))
> +                 (delete-file-recursively file)))
> +             (scandir "."))
> +            (for-each
> +             (lambda (file)
> +               (unless (member file '("." ".."))
> +                 (rename-file (string-append "scilab/" file) file)))
> +             (scandir "scilab"))
> +            (delete-file-recursively "scilab")
> +            (delete-file "aclocal.m4")
> +            (for-each
> +             delete-file
> +             (find-files "." "^Makefile\\.in$"))
> +            (delete-file-recursively "config")
> +            (delete-file "configure")
> +            (delete-file-recursively "libs/GetWindowsVersion")
> +            (delete-file "m4/ax_cxx_compile_stdcxx.m4")
> +            (delete-file "m4/lib-ld.m4")
> +            (delete-file "m4/libtool.m4")
> +            (delete-file "m4/ltoptions.m4")
> +            (delete-file "m4/ltsugar.m4")
> +            (delete-file "m4/ltversion.m4")
> +            (delete-file "m4/lt~obsolete.m4")
> +            (delete-file "m4/pkg.m4")
> +            (for-each
> +             (lambda (file)
> +               (delete-file
> +                (string-append "modules/dynamic_link/src/scripts/" file)))
> +             '("aclocal.m4"
> +               "configure"
> +               "compile"
> +               "config.guess"
> +               "config.sub"
> +               "ltmain.sh"
> +               "depcomp"
> +               "install-sh"
> +               "missing"))
> +            (delete-file-recursively "modules/dynamic_link/src/scripts/m4")
> +            (delete-file "modules/ast/src/cpp/parse/scanscilab.cpp")
> +            (delete-file "modules/ast/src/cpp/parse/bison/parsescilab.output")
> +            (delete-file "modules/ast/includes/parse/parsescilab.hxx")
> +            (delete-file "modules/ast/src/cpp/parse/parsescilab.cpp")))))
>      (build-system gnu-build-system)
> -    (native-inputs (list pkg-config gfortran))
> -    (inputs (list libxml2
> -                  `(,pcre "bin")
> +    (native-inputs
> +     (list autoconf
> +           autoconf-archive
> +           automake
> +           bison
> +           eigen
> +           flex
> +           gfortran
> +           libtool
> +           ocaml
> +           ocaml-findlib
> +           pkg-config))
> +    (inputs (list `(,pcre "bin")
>                    `(,pcre "out")
> -                  readline
> -                  hdf5-1.8
> -                  curl
> -                  openblas
> -                  lapack
> +                  libxml2
>                    arpack-ng
> +                  curl
>                    fftw
>                    gettext-minimal
> -                  suitesparse-3
> -                  tcl
> -                  tk
> +                  hdf5-1.14
> +                  lapack
>                    libx11
> -                  matio))
> +                  matio
> +                  ocaml-num
> +                  openblas
> +                  readline
> +                  suitesparse
> +                  tcl
> +                  tk))
>      (arguments
> -     `(#:tests? #f
> -       #:configure-flags
> -       ,#~(list
> -           "--enable-relocatable"
> -           "--disable-static-system-lib"
> -           ;; Disable all java code.
> -           "--without-gui"
> -           "--without-javasci"
> -           "--disable-build-help"
> -           "--with-external-scirenderer"
> -           ;; Tcl and Tk library locations.
> -           (string-append "--with-tcl-include="
> -                          (string-drop-right
> -                           (search-input-file %build-inputs "include/tcl.h")
> -                           (string-length "/tcl.h")))
> -           (string-append "--with-tcl-library="
> -                          (string-drop-right
> -                           (search-input-directory %build-inputs "lib/tcl8")
> -                           (string-length "/tcl8")))
> -           (string-append "--with-tk-include="
> -                          (string-drop-right
> -                           (search-input-file %build-inputs "include/tk.h")
> -                           (string-length "/tk.h")))
> -           (string-append "--with-tk-library="
> -                          (string-drop-right
> -                           (search-input-directory %build-inputs "lib/tk8.6")
> -                           (string-length "/tk8.6")))
> -           ;; There are some 2018-fortran errors that are ignored
> -           ;; with this fortran compiler flag.
> -           "FFLAGS=-fallow-argument-mismatch")
> -       #:phases
> -       ,#~(modify-phases %standard-phases
> -            (add-before 'build 'pre-build
> -              (lambda _
> -                ;; Fix scilab script.
> -                (substitute* "bin/scilab"
> -                  (("\\/bin\\/ls")
> -                   (which "ls")))
> -                ;; Fix core.start.
> -                (substitute* "modules/core/etc/core.start"
> -                  (("'SCI/modules")
> -                   "SCI+'/modules"))
> -                ;; Fix fortran compilation error.
> -                (substitute*
> -                    "modules/differential_equations/src/fortran/twodq.f"
> -                  (("node\\(10\\),node1\\(10\\),node2\\(10\\),coef")
> -                   "node(9),node1(9),node2(9),coef"))
> -                ;; Fix C compilation errors.
> -                ;; remove &
> -                (substitute* "modules/hdf5/src/c/h5_readDataFromFile_v1.c"
> -                  (("(H5Rdereference\\(_iDatasetId, H5R_OBJECT, )&(.*)\\);$"
> -                    all common ref)
> -                   (string-append common ref)))
> -                ;; fix multiple definitions
> -                (substitute* "modules/tclsci/src/c/TCL_Command.h"
> -                  (("^__thread")
> -                   "extern __thread"))
> -                (substitute* "modules/tclsci/src/c/InitTclTk.c"
> -                  (("BOOL TK_Started = FALSE;" all)
> -                   (string-append all "\n"
> -                                  "__threadId TclThread;" "\n"
> -                                  "__threadSignal InterpReady;" "\n"
> -                                  "__threadSignalLock InterpReadyLock;"
> -                                  "\n")))
> -                ;; Fix CPP compilation errors.
> -                (substitute* "modules/output_stream/src/cpp/diary_manager.cpp"
> -                  (("if \\(array_size > 0\\)")
> -                   "if (*array_size > 0)"))
> -                ;; Set SCIHOME to /tmp before macros compilation.
> -                (setenv "SCIHOME" "/tmp"))))))
> -    (home-page "https://scilab.org")
> +     (list
> +      ;; The tests require java code.
> +      #:tests? #f
> +      #:configure-flags
> +      #~(list
> +         "--enable-relocatable"
> +         "--disable-static-system-lib"
> +         "--enable-build-parser"
> +         ;; Disable all java code.
> +         "--without-gui"
> +         "--without-javasci"
> +         "--disable-build-help"
> +         "--with-external-scirenderer"
> +         ;; Tcl and Tk library locations.
> +         (string-append "--with-tcl-include="

Here I've used dirname, so the following 3 lines become:

(dirname
  (search-input-file %build-inputs "include/tcl.h"))

> +                        (string-drop-right
> +                         (search-input-file %build-inputs "include/tcl.h")
> +                         (string-length "/tcl.h")))
> +         (string-append "--with-tcl-library="
> +                        (string-drop-right
> +                         (search-input-directory %build-inputs "lib/tcl8")
> +                         (string-length "/tcl8")))
> +         (string-append "--with-tk-include="
> +                        (string-drop-right
> +                         (search-input-file %build-inputs "include/tk.h")
> +                         (string-length "/tk.h")))
> +         (string-append "--with-tk-library="
> +                        (string-drop-right
> +                         (search-input-directory %build-inputs "lib/tk8.6")
> +                         (string-length "/tk8.6")))
> +         (string-append "--with-eigen-include="

While I was at it I changed this one to also use search-input-directory,
so we can replace eigen if desired (--with-input=eigen=my-eigen) and
still keep the flag working.

> +                        #$(this-package-native-input "eigen")
> +                        "/include/eigen3")
> +         ;; Find and link to the OCaml Num package
> +         "OCAMLC=ocamlfind ocamlc -package num"
> +         "OCAMLOPT=ocamlfind ocamlopt -package num -linkpkg"
> +         ;; There are some 2018-fortran errors that are ignored
> +         ;; with this fortran compiler flag.
> +         "FFLAGS=-fallow-argument-mismatch")
> +      #:phases
> +      #~(modify-phases %standard-phases
> +          ;; The Num library is specified with the OCAMLC and
> +          ;; OCAMLOPT variables above.
> +          (add-after 'unpack 'fix-ocaml-num
> +            (lambda _
> +              (substitute*
> +                  '("modules/scicos/Makefile.modelica.am"
> +                    "modules/scicos/src/translator/makefile.mak"
> +                    "modules/scicos/src/modelica_compiler/makefile.mak")
> +                (("nums\\.cmx?a") ""))))
> +          ;; Install only scilab-cli.desktop
> +          (add-after 'unpack 'remove-desktop-files
> +            (lambda _
> +              (substitute* "desktop/Makefile.am"
> +                (("desktop_DATA =")
> +                 "desktop_DATA = scilab-cli.desktop\nDUMMY ="))))
> +          ;; These generated files are assumed to be present during
> +          ;; the build.
> +          (add-after 'bootstrap 'bootstrap-dynamic_link-scripts
> +            (lambda _
> +              (with-directory-excursion "modules/dynamic_link/src/scripts"

I changed the invoke line to:
((assoc-ref %standard-phases 'bootstrap))

> +                (invoke "autoreconf" "-i"))))
> +          (add-before 'build 'pre-build
> +            (lambda _
> +              ;; Fix scilab script.
> +              (substitute* "bin/scilab"
> +                (("\\/bin\\/ls")
> +                 (which "ls")))

I'm not sure if scilab can be cross-compiled, but we want to use
search-input instead of (which "ls"), so we get the one for the correct
architecture.

> +              ;; Fix core.start.
> +              (substitute* "modules/core/etc/core.start"
> +                (("'SCI/modules")
> +                 "SCI+'/modules"))
> +              ;; Set SCIHOME to /tmp before macros compilation.
> +              (setenv "SCIHOME" "/tmp")))
> +          ;; Prevent race condition
> +          (add-after 'pre-build 'build-parsers
> +            (lambda _
> +              (with-directory-excursion "modules/ast"
> +                (invoke "make" "src/cpp/parse/parsescilab.cpp"
> +                        "src/cpp/parse/scanscilab.cpp")))))))

In order to keep the make-flags (if there are any) this becomes:
(lambda* (#:key (make-flags #~'()) #:allow-other-keys)
  (with-directory-excursion "modules/ast"
    (apply invoke "make"
           "src/cpp/parse/parsescilab.cpp"
           "src/cpp/parse/scanscilab.cpp"
           make-flags)))))))

> +    (home-page "https://www.scilab.org/")
>      (synopsis "Software for engineers and scientists")
>      (description "This package provides the non-graphical version of the Scilab
> -software for engineers and scientists. Scilab is used for signal processing,
> +software for engineers and scientists.  Scilab is used for signal processing,
>  statistical analysis, image enhancement, fluid dynamics simulations, numerical
>  optimization, and modeling, simulation of explicit and implicit dynamical
>  systems and symbolic manipulations.")
> -    (license license:cecill)))                    ;CeCILL v2.1
> +    (license (list license:gpl2 license:bsd-3))))
>  
>  (define-public ruy
>    (let ((commit "caa244343de289f913c505100e6a463d46c174de")
> diff --git a/gnu/packages/patches/scilab-hdf5-1.8-api.patch b/gnu/packages/patches/scilab-hdf5-1.8-api.patch
> new file mode 100644
> index 0000000000..8b453e4720
> --- /dev/null
> +++ b/gnu/packages/patches/scilab-hdf5-1.8-api.patch
> @@ -0,0 +1,71 @@
> +This patch fixes the compilation with hdf5 version >= 1.10. Adapted from
> +https://aur.archlinux.org/cgit/aur.git/plain/hdf5_18_api.patch?h=scilab-git.
> +
> +diff -ur a/scilab/modules/hdf5/includes/HDF5Objects.h b/scilab/modules/hdf5/includes/HDF5Objects.h
> +--- a/scilab/modules/hdf5/includes/HDF5Objects.h
> ++++ b/scilab/modules/hdf5/includes/HDF5Objects.h
> +@@ -16,14 +16,12 @@
> + #ifndef __HDF5OBJECTS_H__
> + #define __HDF5OBJECTS_H__
> + 
> +-#define H5_NO_DEPRECATED_SYMBOLS
> + #undef H5_USE_16_API
> ++#define H5_USE_18_API
> + 
> +-#define H5Eset_auto_vers 2
> + #include <hdf5.h>
> + #include <hdf5_hl.h>
> + 
> +-#undef H5_NO_DEPRECATED_SYMBOLS
> + 
> + //#define __HDF5OBJECTS_DEBUG__
> + //#define __HDF5ERROR_PRINT__
> +diff -ur a/scilab/modules/hdf5/Makefile.am b/scilab/modules/hdf5/Makefile.am
> +--- a/scilab/modules/hdf5/Makefile.am
> ++++ b/scilab/modules/hdf5/Makefile.am
> +@@ -104,8 +104,7 @@
> +     -DH5Gopen_vers=2 \
> +     -DH5Tget_array_dims_vers=2 \
> +     -DH5Acreate_vers=2 \
> +-    -DH5Rdereference_vers=2 \
> +-    -DNO_DEPRECATED_SYMBOLS
> ++    -DH5Rdereference_vers=2
> + 
> + 
> + libscihdf5_la_CPPFLAGS = \
> +diff -ur a/scilab/modules/hdf5/sci_gateway/cpp/sci_hdf5_listvar_v3.cpp b/scilab/modules/hdf5/sci_gateway/cpp/sci_hdf5_listvar_v3.cpp
> +--- a/scilab/modules/hdf5/sci_gateway/cpp/sci_hdf5_listvar_v3.cpp
> ++++ b/scilab/modules/hdf5/sci_gateway/cpp/sci_hdf5_listvar_v3.cpp
> +@@ -13,6 +13,8 @@
> + *
> + */
> + 
> ++#define H5_USE_18_API
> ++
> + #include <vector>
> + #include "function.hxx"
> + #include "string.hxx"
> +diff -ur a/scilab/modules/hdf5/src/c/h5_readDataFromFile.c b/scilab/modules/hdf5/src/c/h5_readDataFromFile.c
> +--- a/scilab/modules/hdf5/src/c/h5_readDataFromFile.c
> ++++ b/scilab/modules/hdf5/src/c/h5_readDataFromFile.c
> +@@ -13,7 +13,7 @@
> + *
> + */
> + 
> +-#define H5_NO_DEPRECATED_SYMBOLS
> ++#define H5_USE_18_API
> + 
> + #ifndef _MSC_VER
> + #include <sys/time.h>
> +diff -ur a/scilab/modules/hdf5/src/c/h5_readDataFromFile_v1.c b/scilab/modules/hdf5/src/c/h5_readDataFromFile_v1.c
> +--- a/scilab/modules/hdf5/src/c/h5_readDataFromFile_v1.c
> ++++ b/scilab/modules/hdf5/src/c/h5_readDataFromFile_v1.c
> +@@ -13,7 +13,7 @@
> + *
> + */
> + 
> +-#define H5_NO_DEPRECATED_SYMBOLS
> ++#define H5_USE_18_API
> + 
> + #ifndef _MSC_VER
> + #include <sys/time.h>
> -- 
> 2.41.0
> 
> 
> 
> 

-- 
Efraim Flashner   <efraim@flashner.co.il>   רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-10-04 15:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-25 21:00 [bug#66201] [PATCH 0/2] Update scilab and remove suitesparse-3 David Elsing
2023-09-25 21:13 ` [bug#66201] [PATCH 1/2] gnu: scilab: Update to 2023.1.0 David Elsing
2023-10-04 15:00   ` bug#66201: " Efraim Flashner
2023-09-25 21:13 ` [bug#66201] [PATCH 2/2] gnu: Remove suitesparse-3 David Elsing

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.