Subject: bug#72647: closed ([PATCH] fix siril gui in pure environments)

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 16 Aug 2024 19:06:02 +0000

Your bug report

#72647: [PATCH] fix siril gui in pure environments

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
72647: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=72647
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: [PATCH] fix siril gui in pure environments
From: Sharlatan Hellseher <[email-masked]>
To: [email-masked]
Date: Fri, 16 Aug 2024 20:03:46 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

Thanks for the patch!

Pushed as ff7d4d821a033bfd77b8cbb00339738570bac3bc to master with added
commit message.

--
Oleg

Subject: [PATCH] fix siril gui in pure environments
From: Iliya Tikhonenko <[email-masked]>
To: [email-masked]
Cc: Iliya Tikhonenko <[email-masked]>
Date: Fri, 16 Aug 2024 04:08:10 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Change-Id: Ia5c1043fa4824275f84c2f0e6db6234c9d2fb2ed
---
When launching in a container with

guix -C siril --network --preserve='^DISPLAY$' -E'^XDG_RUNTIME_DIR$' --share="${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}" -- siril

the program was crashing due to missing gsettings schemas. The fix is to 
add the right build phase with #:glib-or-gtk #t and wrap program once
more to get the icons displaying without glitches.

 gnu/packages/astronomy.scm | 46 +++++++++++++++++++++++++++++---------
 1 file changed, 35 insertions(+), 11 deletions(-)

diff --git a/gnu/packages/astronomy.scm b/gnu/packages/astronomy.scm
index 613e4d3fee..835ea044ec 100644
--- a/gnu/packages/astronomy.scm
+++ b/gnu/packages/astronomy.scm
@@ -9,7 +9,7 @@
 ;;; Copyright © 2021, 2022 Vinicius Monego <[email-masked]>
 ;;; Copyright © 2021 Greg Hogan <[email-masked]>
 ;;; Copyright © 2021 Foo Chuan Wei <[email-masked]>
-;;; Copyright © 2023 Iliya Tikhonenko <[email-masked]>
+;;; Copyright © 2023-2024 Iliya Tikhonenko <[email-masked]>
 ;;; Copyright © 2023 Andreas Enge <[email-masked]>
 ;;; Copyright © 2023 Simon Tournier <[email-masked]>
 ;;; Copyright © 2024 Ricardo Wurmus <[email-masked]>
@@ -35,6 +35,7 @@ (define-module (gnu packages astronomy)
   #:use-module (gnu packages algebra)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages bash)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages check)
@@ -1538,25 +1539,48 @@ (define-public siril
   (package
     (name "siril")
     (version "1.2.3")
-    (source (origin
-              (method git-fetch)
-              (uri (git-reference
-                    (url "https://gitlab.com/free-astro/siril")
-                    (commit version)))
-              (sha256
-               (base32
-                "0gkd8w2bpwq4ibl3vawx008yrm5k6zlj77lp98fflffcf7cj8hr5"))
-              (file-name (git-file-name name version))))
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://gitlab.com/free-astro/siril")
+             (commit version)))
+       (sha256
+        (base32 "0gkd8w2bpwq4ibl3vawx008yrm5k6zlj77lp98fflffcf7cj8hr5"))
+       (file-name (git-file-name name version))))
     (build-system meson-build-system)
-    (native-inputs (list cmake git glib libconfig pkg-config))
+    (arguments
+     (list
+      #:glib-or-gtk? #t
+      #:imported-modules `(,@%meson-build-system-modules (guix build
+                                                          glib-or-gtk-build-system))
+      #:modules '((guix build meson-build-system)
+                  ((guix build glib-or-gtk-build-system)
+                   #:prefix glib-or-gtk:)
+                  (guix build utils))
+      #:phases #~(modify-phases %standard-phases
+                   (add-after 'unpack 'generate-gdk-pixbuf-loaders-cache-file
+                     (assoc-ref glib-or-gtk:%standard-phases
+                                'generate-gdk-pixbuf-loaders-cache-file))
+                   (add-after 'install 'wrap-program
+                     (lambda* _
+                       (wrap-program (string-append #$output "/bin/siril")
+                         ;; Wrapping GDK_PIXBUF_MODULE_FILE
+                         ;; to load icons in pure environments.
+                         `("GDK_PIXBUF_MODULE_FILE" =
+                           (,(getenv "GDK_PIXBUF_MODULE_FILE")))))))))
+    (native-inputs (list cmake git libconfig pkg-config))
     (inputs (list cfitsio
+                  (librsvg-for-system)
                   exiv2
                   ffms2
                   fftwf
                   gsl
+                  gdk-pixbuf
                   gtk+
                   json-glib
                   libheif
+                  bash-minimal ;for wrap-program
                   libraw
                   librtprocess
                   opencv))

base-commit: 888fdfd1b1c4e4b3913b7b229f1ebc9f4596be20
-- 
2.45.2