summary refs log tree commit diff
path: root/gnu/packages/libreoffice.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/libreoffice.scm')
-rw-r--r--gnu/packages/libreoffice.scm42
1 files changed, 38 insertions, 4 deletions
diff --git a/gnu/packages/libreoffice.scm b/gnu/packages/libreoffice.scm
index 667e93db26..04279fff63 100644
--- a/gnu/packages/libreoffice.scm
+++ b/gnu/packages/libreoffice.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2018, 2020 Jonathan Brielmaier <jonathan.brielmaier@web.de>
 ;;; Copyright © 2019 Chris Marusich <cmmarusich@gmail.com>
 ;;; Copyright © 2020 Marcin Karpezo <sirmacik@wioo.waw.pl>
+;;; Copyright © 2023 Nicolas Graves <ngraves@ngraves.fr>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -900,7 +901,7 @@ commonly called @code{ftoa} or @code{dtoa}.")
 (define-public libreoffice
   (package
     (name "libreoffice")
-    (version "7.5.1.2")
+    (version "7.5.4.2")
     (source
      (origin
        (method url-fetch)
@@ -909,10 +910,15 @@ commonly called @code{ftoa} or @code{dtoa}.")
          "https://download.documentfoundation.org/libreoffice/src/"
          (version-prefix version 3) "/libreoffice-" version ".tar.xz"))
        (sha256
-        (base32 "1dy0lvrvgkr7mbmiag26a38pivcddav8piph7jin1kw4phaxs3cj"))))
+        (base32 "1s3592ick745kl60yjlv7ki3p7nnwswj0mgjh3nk6k7skyvx3fv8"))))
     (build-system glib-or-gtk-build-system)
     (arguments
      (list
+      #:imported-modules `((guix build python-build-system)
+                           ,@%glib-or-gtk-build-system-modules)
+      #:modules `(((guix build python-build-system) #:select (python-version))
+                  (ice-9 textual-ports)
+                  ,@%glib-or-gtk-build-system-modules)
       #:tests? #f                       ; Building the tests already fails.
       #:phases
       #~(modify-phases %standard-phases
@@ -976,7 +982,12 @@ commonly called @code{ftoa} or @code{dtoa}.")
             ;; Create 'soffice' and 'libreoffice' symlinks to the executable
             ;; script.
             (lambda _
-              (let ((out #$output))
+              (let* ((out #$output)
+                     (python-libdir
+                      (string-append out "/lib/python"
+                                     (python-version
+                                      #$(this-package-input "python"))
+                                     "/site-packages/")))
                 (define (symlink-output src dst)
                   (mkdir-p (dirname (string-append out dst)))
                   (symlink (string-append out src) (string-append out dst)))
@@ -1002,6 +1013,24 @@ commonly called @code{ftoa} or @code{dtoa}.")
                                  "sysui/desktop/appstream-appdata/"
                                  "libreoffice-" app ".appdata.xml")
                                 (string-append out "/share/appdata")))
+                (define (install-python-script name)
+                  (with-input-from-file
+                      (string-append out "/lib/libreoffice/program/" name ".py")
+                    (lambda _
+                      (let ((file (get-string-all (current-input-port))))
+                        (with-output-to-file
+                            (string-append python-libdir name ".py")
+                          (lambda _
+                            (format (current-output-port) "~a"
+                                    (string-append
+                                     "import sys, os\n"
+                                     "sys.path.append('"
+                                     out "/lib/libreoffice/program" "')\n"
+                                     "os.putenv('URE_BOOTSTRAP', 'vnd.sun.star.pathname:"
+                                     out "/lib/libreoffice/program/fundamentalrc')\n\n"
+                                     file)))))))
+                  (delete-file
+                   (string-append out "/lib/libreoffice/program/" name ".py")))
                 (symlink-output "/lib/libreoffice/program/soffice"
                                 "/bin/soffice")
                 (symlink-output "/lib/libreoffice/program/soffice"
@@ -1016,7 +1045,12 @@ commonly called @code{ftoa} or @code{dtoa}.")
                           '("base" "calc" "draw" "impress" "writer"))
                 (mkdir-p (string-append out "/share/icons/hicolor"))
                 (copy-recursively "sysui/desktop/icons/hicolor"
-                                  (string-append out "/share/icons/hicolor"))))))
+                                  (string-append out "/share/icons/hicolor"))
+                (mkdir-p python-libdir)
+                (for-each install-python-script
+                          '("access2base" "mailmerge" "msgbox" "officehelper"
+                            "pythonloader" "pythonscript" "scriptforge"
+                            "unohelper" "uno"))))))
       #:configure-flags
       #~(list
          "--enable-release-build"