summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilip McGrath <philip@philipmcgrath.com>2022-05-09 02:02:47 -0400
committerLudovic Courtès <ludo@gnu.org>2022-05-12 10:30:08 +0200
commit9f88d8b72d8250168f8c5347ed0b01dfc46f7e45 (patch)
tree50bf1fadb30e89abe022187db676d1ec98a0e035
parent7ea79beda3aea0beba993285103f50b6d94cb14e (diff)
downloadguix-9f88d8b72d8250168f8c5347ed0b01dfc46f7e45.tar.gz
gnu: stex: Get machine type dynamically.
* gnu/packages/chez.scm (stex)[arguments]: Run 'scheme' to determine
the machine type.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
-rw-r--r--gnu/packages/chez.scm14
1 files changed, 12 insertions, 2 deletions
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 785b6837c1..dd485d37e1 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -602,6 +602,10 @@ Chez Scheme.")))
                             ("src" "lib/stex/")
                             ("Mf-stex" "lib/stex/")
                             ("Makefile.template" "lib/stex/"))
+         #:modules
+         '((guix build copy-build-system)
+           (guix build utils)
+           (ice-9 popen))
          #:phases
          #~(modify-phases %standard-phases
              (add-before 'install 'patch-sources
@@ -633,8 +637,14 @@ Chez Scheme.")))
                         (define makefile
                           (string-append (getcwd) "/Makefile"))
                         (define machine
-                          #$(and=> (nix-system->chez-machine)
-                                   chez-machine->threaded))
+                          (let ((pipe (open-pipe* OPEN_BOTH scheme "-q")))
+                            ;; try to not be wrong for cross-compilation
+                            ;; (avoid #% reader abbreviation for Guile)
+                            (write '(($primitive $target-machine)) pipe)
+                            (force-output pipe)
+                            (let ((sym (read pipe)))
+                              (close-pipe pipe)
+                              (symbol->string sym))))
                         (with-directory-excursion
                             (search-input-directory outputs "/lib/stex")
                           (invoke "make"