Subject: [PATCH] gnu: aacircuit: Wrap program properly.

From: Evgeny Pisemsky <[email-masked]>
Date: Tue, 25 Mar 2025 20:30:26 +0300

* gnu/packages/engineering.scm (aacircuit): Wrap program properly.
[arguments]: Import modules from glib-or-gtk-build-system, add new phases:
generate-gdk-pixbuf-loaders-cache-file, glib-or-gtk-wrap, wrap-aacircuit.
[propagated-inputs]: Move every input from here...
[inputs]: to here, add bash-minimal.

Change-Id: Ia9e5b0908b7464a0dfe0fd8ffa4675cad95c0dd9
---
 gnu/packages/engineering.scm | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index 8b6bd85293..c55dfe8726 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -195,8 +195,17 @@ (define-public aacircuit
       (build-system pyproject-build-system)
       (arguments
        (list
+        #:imported-modules `((guix build glib-or-gtk-build-system)
+                             ,@%pyproject-build-system-modules)
+        #:modules '(((guix build glib-or-gtk-build-system)
+                     #:prefix glib-or-gtk:)
+                    (guix build pyproject-build-system)
+                    (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))
             (replace 'check
               (lambda* (#:key tests? #:allow-other-keys)
                 (when tests?
@@ -208,7 +217,18 @@ (define-public aacircuit
                                          "test_import_aacircuit_export_pdf")
                                        ","))
                   (setenv "HOME" "/tmp")
-                  (invoke "xvfb-run" "./testrunner.sh")))))))
+                  (invoke "xvfb-run" "./testrunner.sh"))))
+            (add-after 'wrap 'glib-or-gtk-wrap
+              (assoc-ref glib-or-gtk:%standard-phases
+                         'glib-or-gtk-wrap))
+            (add-after 'glib-or-gtk-wrap 'wrap-aacircuit
+              (lambda* (#:key outputs #:allow-other-keys)
+                (wrap-program (string-append (assoc-ref outputs "out")
+                                             "/bin/aacircuit")
+                  `("GDK_PIXBUF_MODULE_FILE" =
+                    (,(getenv "GDK_PIXBUF_MODULE_FILE")))
+                  `("GI_TYPELIB_PATH" ":" prefix
+                    (,(getenv "GI_TYPELIB_PATH")))))))))
       (native-inputs
        ;; XXX: Test runner may be migrated to Pytest
        ;; <https://docs.pytest.org/en/7.1.x/how-to/nose.html> after report to
@@ -218,8 +238,9 @@ (define-public aacircuit
              python-setuptools
              python-wheel
              xvfb-run))
-      (propagated-inputs
-       (list gtk+
+      (inputs
+       (list bash-minimal
+             gtk+
              python-bresenham
              python-platformdirs
              python-pycairo

base-commit: ff019629025871caa2fbc78cf921fb46e96e94de
-- 
2.49.0