[PATCH] gnu: scilab: Fix and hardcode script inputs.

  • Done
  • quality assurance status badge
Details
4 participants
  • Efraim Flashner
  • Ludovic Courtès
  • Tobias Geerinckx-Rice
  • Nicolas Graves
Owner
unassigned
Submitted by
Nicolas Graves
Severity
normal
Merged with
N
N
Nicolas Graves wrote on 10 Sep 2023 18:18
(address . guix-patches@gnu.org)(address . ngraves@ngraves.fr)
0852115dc8e706b80b05d57cfbfae64de79fdac5.1694362722.git.ngraves@ngraves.fr
* gnu/packages/maths.scm (scilab): Fix script inputs.
[inputs]: Reorder alphabetically. Add coreutils, grep, sed.
[arguments](phases): Add phase hardcode-script-inputs.
---
gnu/packages/maths.scm | 43 ++++++++++++++++++++++++++++++------------
1 file changed, 31 insertions(+), 12 deletions(-)

Toggle diff (85 lines)
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 38e71e18f8..40883d71c1 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -8448,22 +8448,25 @@ (define-public scilab
(base32 "0phg9pn24yw98hbh475ik84dnikf1225b2knh7qbhdbdx6fm2d57"))))
(build-system gnu-build-system)
(native-inputs (list pkg-config gfortran))
- (inputs (list libxml2
+ (inputs (list arpack-ng
+ coreutils
+ curl
+ fftw
+ gettext-minimal
+ grep
+ hdf5-1.8
+ lapack
+ libxml2
+ libx11
+ matio
+ openblas
`(,pcre "bin")
`(,pcre "out")
readline
- hdf5-1.8
- curl
- openblas
- lapack
- arpack-ng
- fftw
- gettext-minimal
+ sed
suitesparse-3
tcl
- tk
- libx11
- matio))
+ tk))
(arguments
`(#:tests? #f
#:configure-flags
@@ -8534,7 +8537,23 @@ (define-public scilab
(("if \\(array_size > 0\\)")
"if (*array_size > 0)"))
;; Set SCIHOME to /tmp before macros compilation.
- (setenv "SCIHOME" "/tmp"))))))
+ (setenv "SCIHOME" "/tmp")))
+ (add-after 'install 'hardcode-script-inputs
+ (lambda _
+ (substitute* (string-append #$output "/bin/scilab")
+ (("grep")
+ #$(file-append (this-package-input "grep") "/bin/grep"))
+ (("sed")
+ #$(file-append (this-package-input "sed") "/bin/sed"))
+ (("uname")
+ #$(file-append (this-package-input "coreutils")
+ "/bin/uname"))
+ (("dirname")
+ #$(file-append (this-package-input "coreutils")
+ "/bin/dirname"))
+ (("basename")
+ #$(file-append (this-package-input "coreutils")
+ "/bin/basename"))))))))
(home-page "https://scilab.org")
(synopsis "Software for engineers and scientists")
(description "This package provides the non-graphical version of the Scilab

base-commit: 2eb6df537c36da8bf8e81ff698421f6fb1bfd1ab
prerequisite-patch-id: eb618ab7b10483d917c308a38792af98baa517e2
prerequisite-patch-id: 40b6c9f09f27833367a71ec25d77afae4d2a835e
prerequisite-patch-id: c12968d02d99c253f858586a86b16fa32d41f1c1
prerequisite-patch-id: 09d995d48139f8e61183d5634cda13a01cdb50f7
prerequisite-patch-id: 86baa45ec2aad977c8c8135f7613aa391155de6d
prerequisite-patch-id: 3425fbbff6a603d60b4e143ea2141aabf4ddc92c
prerequisite-patch-id: c373c01aab5dcba3503a97d51c62a595147a041c
prerequisite-patch-id: cda857c790b88c681c4e713c5f71e40291970daf
prerequisite-patch-id: 8e234d0f4d93d2aad499eec8842be3d28da98707
prerequisite-patch-id: 5f664cb2fd995a53765c5ffc19a708ac795cc0c4
prerequisite-patch-id: ed447cba9cf9b7e1a1b47aa27acb14f8f2da0a8e
prerequisite-patch-id: 9f80c5bbbfb8cd3347951c4d57634e93ffa79924
prerequisite-patch-id: 1aaa9f0d466e2d6837f75844df48a98beb70ff24
prerequisite-patch-id: 34502820d8c0355b3ed2638c457084edeaba029d
prerequisite-patch-id: a96258da9e78cfb9ac9893cdcdeb38b69b75f134
--
2.41.0
N
N
Nicolas Graves wrote on 10 Sep 2023 19:49
(address . control@debbugs.gnu.org)
87wmwxyl3s.fsf@ngraves.fr
merge 65853 65856 65857

--
Best regards,
Nicolas Graves
E
E
Efraim Flashner wrote on 28 Sep 2023 18:36
(name . Nicolas Graves)(address . ngraves@ngraves.fr)
ZRWrh5B6M7acbiZj@3900XT
Attachment: file
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmUVq4cACgkQQarn3Mo9
g1EG4hAAh8ME+50XTo564T8EC73SMtQi7n5FeQhzf16YBIT2ccY7lrOosPE3JnZm
vEnqscq6w84GBsOYrzGc7K/VHri6r0WNnnKuOtMY18rP2rK+a3ktFSytHBKlwUgr
yWnW42aHp1FaNp1Xz4MdscQ5QBhEAZiMaYX42+D+OHbzvWpRm7csy8+GOASOecQN
8HMhNIW7g4g4IFXQhEMqCAT3ehc5B+Ajeb58bqCWn0FVvNk4CEyJMs7fw8efvqA8
riQobkgHgWejTGM1lb7Z0M5cAc/ZPlYhmXBmxT+yKMrqbiepB6IWXew7bK7WOSIM
sGkzxAyIVteFomx54U5z/66l+9Y/muaiarnWwnZLjYN6ts2tQUPtIxM5PjklFgAs
zsXxhMO1S/j0yLzk8n2EwynuAMpnXntZZdItTkIVpGYxN4dsLmrRfunB0D1w4i61
dyEVWfV0mqs+YdnHTXatBdpvkZtPOmH5OwsHJrKnx7wGzA2hR7HgZHSUaolSgpfL
sfVefMKenCm3d2YbX2EIED8f8/bcvyXWMOzdeg5NXAhnpop4m8AND39D0wx2WWmF
2bCuuwdfUQXS2HpIqr/q5qEShhyhF3JnL1a8uC/Iy6Opz8ZqbvAGdkYF9nPdPCjH
znFRBo28MP2U6/5ZdANxb1Auq3WxUq8qek8BgFxTDw7FfEPtDUQ=
=D1b/
-----END PGP SIGNATURE-----


N
N
Nicolas Graves wrote on 28 Sep 2023 20:30
(name . Efraim Flashner)(address . efraim@flashner.co.il)
87cyy2gnfh.fsf@ngraves.fr
On 2023-09-28 19:36, Efraim Flashner wrote:

Toggle quote (8 lines)
> A couple of things I noticed:
>
> On Sun, Sep 10, 2023 at 06:18:42PM +0200, Nicolas Graves wrote:
>> + coreutils
>
> This can be coreutils-minimal
>

Will change it.
Toggle quote (7 lines)
>> + (("grep")
>> + #$(file-append (this-package-input "grep") "/bin/grep"))
>
> These can be (search-input-file #$inputs "/bin/grep") to make it easier
> to swap out the packages for something else if people want.
>

Fine for me.

Toggle quote (5 lines)
>> + (("sed")
>
> I checked the script, it should be ((" sed ") since there are a couple
> of instances of 'sed' in the script which aren't invocations of sed.

Yes I indeed noticed it too, probably forgot to resubmit a patch but my
local version works well.
Toggle quote (19 lines)
>
>> + #$(file-append (this-package-input "sed") "/bin/sed"))
>> + (("uname")
>> + #$(file-append (this-package-input "coreutils")
>> + "/bin/uname"))
>> + (("dirname")
>> + #$(file-append (this-package-input "coreutils")
>> + "/bin/dirname"))
>> + (("basename")
>> + #$(file-append (this-package-input "coreutils")
>> + "/bin/basename"))))))))
>
> Are there more binaries which should be substituted? I saw glxgears,
> chcon, a couple instances of java, pwd, valgrind, docbook paths. And
> then there's a couple of other scripts and binaries in the bin/ folder.
> I think it'd be better to use wrap-script or wrap-program and then use
> substitute* to strip the leading /usr/bin/ from the different calls to
> the different binaries.

I don't use more than that for a CLI usage. The thing is that we already
build without the GUI (so without java). Maybe valgrind could be useful
for debugging, docbook for documentation...

I'll take a look in the coming weeks, but I can guarantee it works for
me, so I propose we should process with this one, and add other patches
on top when someone needs them. But we should be mindful that all
possible paths / binaries are not reachable when the script is run
(IIRC, they also depend on the OS and options).

--
Best regards,
Nicolas Graves
N
N
Nicolas Graves wrote on 28 Sep 2023 21:03
[PATCH v2] gnu: scilab: Fix and hardcode script inputs.
(address . 65853@debbugs.gnu.org)(address . ngraves@ngraves.fr)
0dd0a7387a8232abd43f484b87f183c9340497b0.1695927790.git.ngraves@ngraves.fr
* gnu/packages/maths.scm (scilab): Fix script inputs.
[inputs]: Reorder alphabetically. Add coreutils-minimal, grep, sed.
[arguments](phases): Add phase hardcode-script-inputs.
---
gnu/packages/maths.scm | 46 +++++++++++++++++++++++++++---------------
1 file changed, 30 insertions(+), 16 deletions(-)

Toggle diff (80 lines)
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 62d4adfbd1..f7e1de41f3 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -8433,22 +8433,25 @@ (define-public scilab
(base32 "0phg9pn24yw98hbh475ik84dnikf1225b2knh7qbhdbdx6fm2d57"))))
(build-system gnu-build-system)
(native-inputs (list pkg-config gfortran))
- (inputs (list libxml2
+ (inputs (list arpack-ng
+ coreutils-minimal
+ curl
+ fftw
+ gettext-minimal
+ grep
+ hdf5-1.8
+ lapack
+ libxml2
+ libx11
+ matio
+ openblas
`(,pcre "bin")
`(,pcre "out")
readline
- hdf5-1.8
- curl
- openblas
- lapack
- arpack-ng
- fftw
- gettext-minimal
+ sed
suitesparse-3
tcl
- tk
- libx11
- matio))
+ tk))
(arguments
`(#:tests? #f
#:configure-flags
@@ -8484,10 +8487,6 @@ (define-public scilab
,#~(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")
@@ -8519,7 +8518,22 @@ (define-public scilab
(("if \\(array_size > 0\\)")
"if (*array_size > 0)"))
;; Set SCIHOME to /tmp before macros compilation.
- (setenv "SCIHOME" "/tmp"))))))
+ (setenv "SCIHOME" "/tmp")))
+ (add-after 'install 'hardcode-script-inputs
+ (lambda _
+ (substitute* (string-append #$output "/bin/scilab")
+ (("grep")
+ (search-inputs-file #$inputs "/bin/grep"))
+ ((" sed ") ; some "sed" strings are not binaries invocations
+ (string-append " " (search-inputs-file #$inputs "/bin/sed") " "))
+ (("/bin/ls")
+ (search-inputs-file #$inputs "/bin/ls"))
+ (("uname")
+ (search-inputs-file #$inputs "/bin/uname"))
+ (("dirname")
+ (search-inputs-file #$inputs "/bin/dirname"))
+ (("basename")
+ (search-inputs-file #$inputs "/bin/basename"))))))))
(home-page "https://scilab.org")
(synopsis "Software for engineers and scientists")
(description "This package provides the non-graphical version of the Scilab

base-commit: f9784991eb6c7ec1a20f76d080873a3319be0908
--
2.41.0
T
T
Tobias Geerinckx-Rice wrote on 28 Sep 2023 21:12
(no subject)
(address . control@debbugs.gnu.org)
555ae5875d161140e91feb94486ba7d6@tobias.gr
merge 65857 65856 65853
L
L
Ludovic Courtès wrote on 5 Oct 2023 16:51
Re: bug#65857: [PATCH v2 2/2] gnu: scilab: Set SCIHOME default to respect XDG base dirs.
(name . Nicolas Graves)(address . ngraves@ngraves.fr)
87bkdd3yxc.fsf_-_@gnu.org
Hi,

Nicolas Graves <ngraves@ngraves.fr> skribis:

Toggle quote (6 lines)
> + (add-after 'install 'hardcode-script-inputs
> + (lambda _
> + (substitute* (string-append #$output "/bin/scilab")
> + (("grep")
> + (search-inputs-file #$inputs "/bin/grep"))

I’ll contradict Efraim, but hopefully they’ll pardon me: I’d write it
like so:

(lambda* (#:key inputs #:allow-other-keys)
(substitute* …
(("grep")
(search-input-file inputs "/bin/grep"))))

That way it’ll DTRT even when creating a variant of this package.

(The code above had a typo too, with “inputs” as plural.)

Could you send one last updated patch?

Thanks,
Ludo’.
N
N
Nicolas Graves wrote on 5 Oct 2023 17:09
(name . Ludovic Courtès)(address . ludo@gnu.org)
871qe9p0m7.fsf@ngraves.fr
On 2023-10-05 16:51, Ludovic Courtès wrote:

Toggle quote (24 lines)
> Hi,
>
> Nicolas Graves <ngraves@ngraves.fr> skribis:
>
>> + (add-after 'install 'hardcode-script-inputs
>> + (lambda _
>> + (substitute* (string-append #$output "/bin/scilab")
>> + (("grep")
>> + (search-inputs-file #$inputs "/bin/grep"))
>
> I’ll contradict Efraim, but hopefully they’ll pardon me: I’d write it
> like so:
>
> (lambda* (#:key inputs #:allow-other-keys)
> (substitute* …
> (("grep")
> (search-input-file inputs "/bin/grep"))))
>
> That way it’ll DTRT even when creating a variant of this package.
>
> (The code above had a typo too, with “inputs” as plural.)
>
> Could you send one last updated patch?

Yes, it also has to be rebased now that scilab is version 2023.
Toggle quote (4 lines)
>
> Thanks,
> Ludo’.

--
Best regards,
Nicolas Graves
N
N
Nicolas Graves wrote on 6 Nov 2023 00:51
[PATCH v3 0/8] Scilab: Big update.
(address . 65853@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20231106000354.32423-1-ngraves@ngraves.fr
This patch series now introduces several changes to the scilab package:
1) non-failing tests are included. failing tests are harder to fix,
but it identifies these places quite well.
2) I've read the scilab-cli script to understand that it basically only serves to properly define a few environment variables. We don't need 40ko for this, so I've rewrapped the script to have a clean 110 lines guix-defined scilab-cli. We loose some low-level debugging functionality, but we didn't set the right inputs for this low-level debugging anyway, and I don't expect Scilab developpers to be using guix right now, so that's fine for now. Later we can wrap the script or hardcode inputs if someone needs it.
3) Updated the version to 2024.0.0. We don't need the hdf5 patch anymore.
4) Set the version so that the welcoming message is up-to-date (not the timestamp though).
5) Set a SCIHOME default value that matches XDG base dirs specification, and doesn't override user-set -scihome (since it happens after when scilab-cli -scihome is called). Now SCIHOME doesn't seem to be read from the user environment at all, so the only way is through -scihome.

Nicolas Graves (8):
gnu: scilab: Remove uneeded code.
gnu: scilab: Activate tests and disable failing tests.
gnu: scilab: Use gexp for tcl and tk libraries.
gnu: scilab: Add phase rewrap-scilab-cli.
gnu: scilab: Reindent.
gnu: scilab: Update to 2024.0.0.
gnu: scilab: Add phase set-version.
gnu: scilab: Set default SCIHOME value.

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

--
2.41.0
N
N
Nicolas Graves wrote on 6 Nov 2023 00:51
[PATCH v3 2/8] gnu: scilab: Activate tests and disable failing tests.
(address . 65853@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20231106000354.32423-3-ngraves@ngraves.fr
* gnu/packages/maths.scm (scilab): Activate tests and disable failing tests.
[arguments]:
(tests?): Activate tests.
(phases):
[remove-desktop-files]: Extend and rename to restrain-to-scilab-cli.
[disable-failing-tests]: Add phase.

Change-Id: Icfec349c6efe14e7787ba8d385e5d51f82be82ea
---
gnu/packages/maths.scm | 33 +++++++++++++++++++++++++--------
1 file changed, 25 insertions(+), 8 deletions(-)

Toggle diff (53 lines)
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 88b52eb4fc..f6d0575979 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -9622,8 +9622,6 @@ (define-public scilab
tk))
(arguments
(list
- ;; The tests require java code.
- #:tests? #f
#:configure-flags
#~(list
"--enable-relocatable"
@@ -9663,12 +9661,31 @@ (define-public scilab
"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 ="))))
+ (add-after 'unpack 'restrain-to-scilab-cli
+ (lambda _
+ ;; Install only scilab-cli.desktop
+ (substitute* "desktop/Makefile.am"
+ (("desktop_DATA =")
+ "desktop_DATA = scilab-cli.desktop\nDUMMY ="))
+ ;; Replace scilab with scilab-cli for tests.
+ (substitute* "Makefile.incl.am"
+ (("scilab-bin") "scilab-cli-bin")
+ (("scilab -nwni") "scilab-cli")
+ ;; Do not install tests, demos and examples.
+ ;; This saves up to 140 Mo in the final output.
+ (("(TESTS|DEMOS|EXAMPLES)_DIR=.*" all kind)
+ (string-append kind "_DIR=")))))
+ (add-before 'check 'disable-failing-tests
+ (lambda _
+ (substitute* "Makefile"
+ (("TESTS = .*")
+ "TESTS =\n"))
+ (substitute* "modules/functions_manager/Makefile"
+ (("check:.*")
+ "check:\n"))
+ (substitute* "modules/types/Makefile"
+ (("\\$\\(MAKE\\) \\$\\(AM_MAKEFLAGS\\) check-am")
+ ""))))
;; These generated files are assumed to be present during
;; the build.
(add-after 'bootstrap 'bootstrap-dynamic_link-scripts
--
2.41.0
N
N
Nicolas Graves wrote on 6 Nov 2023 00:51
[PATCH v3 3/8] gnu: scilab: Use gexp for tcl and tk libraries.
(address . 65853@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20231106000354.32423-4-ngraves@ngraves.fr
* gnu/packages/maths.scm (scilab): Use gexp for tcl and tk libraries.
[argments](configure-flags): Use gexp for tcl and tk libraries.

Change-Id: I31fe9a9e2afd9b6266a2e7a2c7044b3c9d0dfa4f
---
gnu/packages/maths.scm | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)

Toggle diff (47 lines)
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index f6d0575979..62c935a868 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -9621,6 +9621,8 @@ (define-public scilab
tcl
tk))
(arguments
+ (let* ((tcl (this-package-input "tcl"))
+ (tk (this-package-input "tk")))
(list
#:configure-flags
#~(list
@@ -9633,18 +9635,10 @@ (define-public scilab
"--disable-build-help"
"--with-external-scirenderer"
;; Tcl and Tk library locations.
- (string-append "--with-tcl-include="
- (dirname
- (search-input-file %build-inputs "include/tcl.h")))
- (string-append "--with-tcl-library="
- (dirname
- (search-input-directory %build-inputs "lib/tcl8")))
- (string-append "--with-tk-include="
- (dirname
- (search-input-file %build-inputs "include/tk.h")))
- (string-append "--with-tk-library="
- (dirname
- (search-input-directory %build-inputs "lib/tk8.6")))
+ (string-append "--with-tcl-include=" #$tcl "/include")
+ (string-append "--with-tcl-library=" #$tcl "/lib")
+ (string-append "--with-tk-include=" #$tk "/include")
+ (string-append "--with-tk-library=" #$tk "/lib")
(string-append "--with-eigen-include="
(search-input-directory %build-inputs "include/eigen3"))
;; Find and link to the OCaml Num package
@@ -9709,7 +9703,7 @@ (define-public scilab
(apply invoke "make"
"src/cpp/parse/parsescilab.cpp"
"src/cpp/parse/scanscilab.cpp"
- make-flags)))))))
+ 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
--
2.41.0
N
N
Nicolas Graves wrote on 6 Nov 2023 00:51
[PATCH v3 4/8] gnu: scilab: Add phase rewrap-scilab-cli.
(address . 65853@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20231106000354.32423-5-ngraves@ngraves.fr
* gnu/packages/maths.scm (scilab): Add phase rewrap-scilab-cli.

Change-Id: Ia3ca5df1a4795c34b6c1cdc8c3b0d7cc2badf0cb
---
gnu/packages/maths.scm | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)

Toggle diff (35 lines)
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 62c935a868..68e041c33b 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -9703,7 +9703,27 @@ (define-public scilab
(apply invoke "make"
"src/cpp/parse/parsescilab.cpp"
"src/cpp/parse/scanscilab.cpp"
- make-flags))))))))
+ make-flags))))
+ ;; The startup script is mostly there to define the following env
+ ;; variables properly. We can do this with guix directly.
+ (add-after 'install 'rewrap-scilab-cli
+ (lambda _
+ (define (bin path) (string-append #$output "/bin/" path))
+ (delete-file (bin "scilab-cli"))
+ (wrap-program (bin "scilab-cli-bin")
+ `("SCI" = (,(string-append #$output "/share/scilab")))
+ `("LD_LIBRARY_PATH" ":" prefix
+ (,(string-append #$output "/lib/scilab")))
+ `("TCL_LIBRARY" = (,(string-append #$tcl "/lib")))
+ `("TK_LIBRARY" = (,(string-append #$tk "/lib"))))
+ (copy-file (bin "scilab-cli-bin") (bin "scilab-cli"))
+ (copy-file (bin ".scilab-cli-bin-real") (bin "scilab-cli-bin"))
+ (delete-file (bin ".scilab-cli-bin-real"))
+ (substitute* (bin "scilab-cli")
+ (("\\.scilab-cli-bin-real")
+ "scilab-cli-bin")
+ (("export SCI=")
+ "unset LANGUAGE\nexport SCI="))))))))
(home-page "https://www.scilab.org/")
(synopsis "Software for engineers and scientists")
(description "This package provides the non-graphical version of the Scilab
--
2.41.0
N
N
Nicolas Graves wrote on 6 Nov 2023 00:51
[PATCH v3 5/8] gnu: scilab: Reindent.
(address . 65853@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20231106000354.32423-6-ngraves@ngraves.fr
* gnu/packages/maths.scm (scilab): Reindent.

Change-Id: I4813863a8ef5cb36de597ed31bcce0b34cfb1160
---
gnu/packages/maths.scm | 139 +++++++++++++++++++++--------------------
1 file changed, 70 insertions(+), 69 deletions(-)

Toggle diff (173 lines)
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 68e041c33b..e3045f4fee 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -58,6 +58,7 @@
;;; Copyright © 2022, 2023 Liliana Marie Prikler <liliana.prikler@gmail.com>
;;; Copyright © 2022 Maximilian Heisinger <mail@maxheisinger.at>
;;; Copyright © 2022 Akira Kyle <akira@akirakyle.com>
+;;; Copyright © 2022, 2023 Nicolas Graves <ngraves@ngraves.fr>
;;; Copyright © 2022 Roman Scherer <roman.scherer@burningswell.com>
;;; Copyright © 2023 Jake Leporte <jakeleporte@outlook.com>
;;; Copyright © 2023 Camilo Q.S. (Distopico) <distopico@riseup.net>
@@ -9572,18 +9573,18 @@ (define-public scilab
;; And finally some files in the modules directory:
(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"))
+ (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")
(for-each delete-file
'("modules/ast/src/cpp/parse/scanscilab.cpp"
@@ -9623,38 +9624,38 @@ (define-public scilab
(arguments
(let* ((tcl (this-package-input "tcl"))
(tk (this-package-input "tk")))
- (list
- #: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=" #$tcl "/include")
- (string-append "--with-tcl-library=" #$tcl "/lib")
- (string-append "--with-tk-include=" #$tk "/include")
- (string-append "--with-tk-library=" #$tk "/lib")
- (string-append "--with-eigen-include="
- (search-input-directory %build-inputs "include/eigen3"))
- ;; Find and link to the OCaml Num package
- "OCAMLC=ocamlfind ocamlc -package num"
- "OCAMLOPT=ocamlfind ocamlopt -package num -linkpkg")
- #: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") ""))))
+ (list
+ #: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=" #$tcl "/include")
+ (string-append "--with-tcl-library=" #$tcl "/lib")
+ (string-append "--with-tk-include=" #$tk "/include")
+ (string-append "--with-tk-library=" #$tk "/lib")
+ (string-append "--with-eigen-include="
+ (search-input-directory %build-inputs "include/eigen3"))
+ ;; Find and link to the OCaml Num package
+ "OCAMLC=ocamlfind ocamlc -package num"
+ "OCAMLOPT=ocamlfind ocamlopt -package num -linkpkg")
+ #: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") ""))))
(add-after 'unpack 'restrain-to-scilab-cli
(lambda _
;; Install only scilab-cli.desktop
@@ -9680,31 +9681,31 @@ (define-public scilab
(substitute* "modules/types/Makefile"
(("\\$\\(MAKE\\) \\$\\(AM_MAKEFLAGS\\) check-am")
""))))
- ;; 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"
- ((assoc-ref %standard-phases 'bootstrap)))))
- (add-before 'build 'pre-build
- (lambda* (#:key inputs #:allow-other-keys)
- ;; Fix scilab script.
- (substitute* "bin/scilab"
- (("/bin/ls")
- (search-input-file inputs "bin/ls")))
- ;; Fix core.start.
- (substitute* "modules/core/etc/core.start"
- (("'SCI/modules")
- "SCI+'/modules"))))
- ;; Prevent race condition
- (add-after 'pre-build 'build-parsers
- (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))))
- ;; The startup script is mostly there to define the following env
+ ;; 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"
+ ((assoc-ref %standard-phases 'bootstrap)))))
+ (add-before 'build 'pre-build
+ (lambda* (#:key inputs #:allow-other-keys)
+ ;; Fix scilab script.
+ (substitute* "bin/scilab"
+ (("/bin/ls")
+ (search-input-file inputs "bin/ls")))
+ ;; Fix core.start.
+ (substitute* "modules/core/etc/core.start"
+ (("'SCI/modules")
+ "SCI+'/modules"))))
+ ;; Prevent race condition
+ (add-after 'pre-build 'build-parsers
+ (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))))
+ ;; The startup script is mostly there to define the following env
;; variables properly. We can do this with guix directly.
(add-after 'install 'rewrap-scilab-cli
(lambda _
--
2.41.0
N
N
Nicolas Graves wrote on 6 Nov 2023 00:51
[PATCH v3 6/8] gnu: scilab: Update to 2024.0.0.
(address . 65853@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20231106000354.32423-7-ngraves@ngraves.fr
Change-Id: Ie1af4dc620cee644388f6b8acf88ea50c4148b65
---
gnu/packages/maths.scm | 16 +++--
.../patches/scilab-hdf5-1.8-api.patch | 71 -------------------
2 files changed, 11 insertions(+), 76 deletions(-)
delete mode 100644 gnu/packages/patches/scilab-hdf5-1.8-api.patch

Toggle diff (144 lines)
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index e3045f4fee..ce0b5a8949 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -104,6 +104,7 @@ (define-module (gnu packages maths)
#:use-module (gnu packages algebra)
#:use-module (gnu packages audio)
#:use-module (gnu packages autotools)
+ #:use-module (gnu packages backup)
#:use-module (gnu packages base)
#:use-module (gnu packages bash)
#:use-module (gnu packages bison)
@@ -9525,7 +9526,7 @@ (define-public optizelle
(define-public scilab
(package
(name "scilab")
- (version "2023.1.0")
+ (version "2024.0.0")
(source
(origin
(method git-fetch)
@@ -9535,10 +9536,9 @@ (define-public scilab
(file-name (git-file-name name version))
(sha256
(base32
- "0hbqsnc67b4f8zc690kl79bwhjaasykjlmqbln8iymnjcn3l5ypd"))
+ "08nyfli3x7gd396ffd1a8zn9fj3gm6a8yw0ggm547c09sp2rgvl7"))
(modules '((guix build utils)
(ice-9 ftw)))
- (patches (search-patches "scilab-hdf5-1.8-api.patch"))
(snippet
#~(begin
;; Delete everything except for scilab itself:
@@ -9593,7 +9593,7 @@ (define-public scilab
"modules/ast/src/cpp/parse/parsescilab.cpp"))))))
(build-system gnu-build-system)
(native-inputs
- (list autoconf
+ (list autoconf-2.71
autoconf-archive
automake
bison
@@ -9610,8 +9610,9 @@ (define-public scilab
curl
fftw
gettext-minimal
- hdf5-1.14
+ hdf5-1.10
lapack
+ libarchive
libx11
libxml2
matio
@@ -9656,6 +9657,11 @@ (define-public scilab
"modules/scicos/src/translator/makefile.mak"
"modules/scicos/src/modelica_compiler/makefile.mak")
(("nums\\.cmx?a") ""))))
+ (add-after 'unpack 'fix-linking
+ (lambda _
+ (substitute* "modules/Makefile.am"
+ (("libscilab_cli_la_LDFLAGS = .*\\)" all)
+ (string-append all " -lcurl")))))
(add-after 'unpack 'restrain-to-scilab-cli
(lambda _
;; Install only scilab-cli.desktop
diff --git a/gnu/packages/patches/scilab-hdf5-1.8-api.patch b/gnu/packages/patches/scilab-hdf5-1.8-api.patch
deleted file mode 100644
index 8b453e4720..0000000000
--- a/gnu/packages/patches/scilab-hdf5-1.8-api.patch
+++ /dev/null
@@ -1,71 +0,0 @@
-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
N
N
Nicolas Graves wrote on 6 Nov 2023 00:51
[PATCH v3 1/8] gnu: scilab: Remove uneeded code.
(address . 65853@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20231106000354.32423-2-ngraves@ngraves.fr
* gnu/packages/maths.scm (scilab):
[source](snippet): Remove directory Visual-Studio-settings and file Scilab.sln.
[arguments](configure-flags):
Remove uneeded FFLAGS environment variable set.
[arguments](phases):
prebuild: Remove uneeded SCIHOME setting code.

Change-Id: I71c044e19617bf556bbe95e7ba0cdbd716921055
---
gnu/packages/maths.scm | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)

Toggle diff (53 lines)
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index ed1708c77b..88b52eb4fc 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -9554,7 +9554,8 @@ (define-public scilab
(for-each delete-file-recursively
'("scilab"
"config"
- "libs/GetWindowsVersion"))
+ "libs/GetWindowsVersion"
+ "Visual-Studio-settings"))
(for-each delete-file
(cons* "aclocal.m4"
"configure"
@@ -9566,6 +9567,7 @@ (define-public scilab
"m4/ltversion.m4"
"m4/lt~obsolete.m4"
"m4/pkg.m4"
+ "Scilab.sln"
(find-files "." "^Makefile\\.in$")))
;; And finally some files in the modules directory:
@@ -9649,10 +9651,7 @@ (define-public scilab
(search-input-directory %build-inputs "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")
+ "OCAMLOPT=ocamlfind ocamlopt -package num -linkpkg")
#:phases
#~(modify-phases %standard-phases
;; The Num library is specified with the OCAMLC and
@@ -9680,14 +9679,12 @@ (define-public scilab
(lambda* (#:key inputs #:allow-other-keys)
;; Fix scilab script.
(substitute* "bin/scilab"
- (("\\/bin\\/ls")
+ (("/bin/ls")
(search-input-file inputs "bin/ls")))
;; Fix core.start.
(substitute* "modules/core/etc/core.start"
(("'SCI/modules")
- "SCI+'/modules"))
- ;; Set SCIHOME to /tmp before macros compilation.
- (setenv "SCIHOME" "/tmp")))
+ "SCI+'/modules"))))
;; Prevent race condition
(add-after 'pre-build 'build-parsers
(lambda* (#:key (make-flags #~'()) #:allow-other-keys)
--
2.41.0
N
N
Nicolas Graves wrote on 6 Nov 2023 00:51
[PATCH v3 7/8] gnu: scilab: Add phase set-version.
(address . 65853@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20231106000354.32423-8-ngraves@ngraves.fr
* gnu/packages/maths.scm (scilab): Add phase set-version.
[arguments](phases): Add phase set-version.

Change-Id: I0e461a229931d159196cae73d1db584250c579b2
---
gnu/packages/maths.scm | 7 +++++++
1 file changed, 7 insertions(+)

Toggle diff (20 lines)
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index ce0b5a8949..dae4c528e2 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -9662,6 +9662,13 @@ (define-public scilab
(substitute* "modules/Makefile.am"
(("libscilab_cli_la_LDFLAGS = .*\\)" all)
(string-append all " -lcurl")))))
+ (add-after 'unpack 'set-version
+ (lambda _
+ (substitute* "modules/core/includes/version.h.in"
+ (("scilab-branch-main") ; version
+ (string-append
+ "scilab-"
+ #$(version-major+minor (package-version this-package)))))))
(add-after 'unpack 'restrain-to-scilab-cli
(lambda _
;; Install only scilab-cli.desktop
--
2.41.0
N
N
Nicolas Graves wrote on 6 Nov 2023 00:51
[PATCH v3 8/8] gnu: scilab: Set default SCIHOME value.
(address . 65853@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20231106000354.32423-9-ngraves@ngraves.fr
* gnu/packages/maths.scm (scilab): Set default SCIHOME value.
[argmuments](phases)[rewrap-scilab-cli]: Set default -scihome option
to respect XDG base dirs specification.

Change-Id: I9b55758a3ca1fbc523c3e40e891a2462f3246390
---
gnu/packages/maths.scm | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

Toggle diff (21 lines)
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index dae4c528e2..355f2132bd 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -9734,8 +9734,12 @@ (define (bin path) (string-append #$output "/bin/" path))
(copy-file (bin ".scilab-cli-bin-real") (bin "scilab-cli-bin"))
(delete-file (bin ".scilab-cli-bin-real"))
(substitute* (bin "scilab-cli")
- (("\\.scilab-cli-bin-real")
- "scilab-cli-bin")
+ ;; Also set SCIHOME to sensible XDG base dirs value.
+ (("\\.scilab-cli-bin-real\"")
+ (string-append
+ "scilab-cli-bin\" -scihome "
+ "\"${XDG_STATE_HOME:-$HOME/.local/state}/scilab/"
+ #$(package-version this-package) "\""))
(("export SCI=")
"unset LANGUAGE\nexport SCI="))))))))
(home-page "https://www.scilab.org/")
--
2.41.0
L
L
Ludovic Courtès wrote on 23 Nov 2023 11:30
Re: bug#65857: [PATCH v2 2/2] gnu: scilab: Set SCIHOME default to respect XDG base dirs.
(name . Nicolas Graves)(address . ngraves@ngraves.fr)
87fs0wep7x.fsf_-_@gnu.org
Hi Nicolas,

Nicolas Graves <ngraves@ngraves.fr> skribis:

Toggle quote (9 lines)
> gnu: scilab: Remove uneeded code.
> gnu: scilab: Activate tests and disable failing tests.
> gnu: scilab: Use gexp for tcl and tk libraries.
> gnu: scilab: Add phase rewrap-scilab-cli.
> gnu: scilab: Reindent.
> gnu: scilab: Update to 2024.0.0.
> gnu: scilab: Add phase set-version.
> gnu: scilab: Set default SCIHOME value.

I added one commit log that was mostly missing and applied the whole
series. Thank you!

Ludo’.
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 65853@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 65853
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch