Subject: [PATCH v2] gnu: scilab: Set SCIHOME default to respect XDG base dirs.

From: Nicolas Graves <[email-masked]>
Date: Thu, 28 Sep 2023 21:05:06 +0200

* gnu/packages/maths.scm (scilab): Set SCIHOME default to respect XDG base dirs.
[arguments](phases): Add phase respect-xdg-base-dirs.
---
 gnu/packages/maths.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index f7e1de41f3..580d98417c 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -8533,7 +8533,14 @@ (define-public scilab
                   (("dirname")
                    (search-inputs-file #$inputs "/bin/dirname"))
                   (("basename")
-                   (search-inputs-file #$inputs "/bin/basename"))))))))
+                   (search-inputs-file #$inputs "/bin/basename")))))
+            (add-after 'hardcode-script-inputs 'respect-xdg-base-dirs
+              (lambda _
+                (substitute* (string-append #$output "/bin/scilab")
+                  (("IS_SCILAB_BINARY=0" all)
+                   (string-append all
+                                  "\n[ -n \"$SCIHOME\" ] &&\
+ SCIHOME=\"${XDG_STATE_HOME:$HOME/.local/state}/scilab\""))))))))
     (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
prerequisite-patch-id: 5ec00d550739652cba67dc8663fbde73ff268491
-- 
2.41.0