guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch core-updates updated: services: shepherd: Cross-compilation fix.


From: guix-commits
Subject: branch core-updates updated: services: shepherd: Cross-compilation fix.
Date: Sat, 25 Apr 2020 13:38:13 -0400

This is an automated email from the git hooks/post-receive script.

janneke pushed a commit to branch core-updates
in repository guix.

The following commit(s) were added to refs/heads/core-updates by this push:
     new d2fc764  services: shepherd: Cross-compilation fix.
d2fc764 is described below

commit d2fc76462e72268ee5b04fe53805efc05c35e139
Author: Jan (janneke) Nieuwenhuizen <address@hidden>
AuthorDate: Sat Apr 25 15:20:04 2020 +0200

    services: shepherd: Cross-compilation fix.
    
    Fixes <https://bugs.gnu.org/40839>.
    Reported by Jan (janneke) Nieuwenhuizen <address@hidden>
    Fix suggested by Mathieu Othacehe <address@hidden>
    
    However, <https://bugs.gnu.org/29296> still applies; %current-target-system
    may not be bound.
    
    * gnu/services/shepherd.scm (scm->go): Use `with-target' when 
cross-compiling.
---
 gnu/services/shepherd.scm | 39 +++++++++++++++++++++++----------------
 1 file changed, 23 insertions(+), 16 deletions(-)

diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm
index 2f30c6c..655a45a 100644
--- a/gnu/services/shepherd.scm
+++ b/gnu/services/shepherd.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2013, 2014, 2015, 2016, 2018, 2019, 2020 Ludovic Courtès 
<address@hidden>
 ;;; Copyright © 2017 Clément Lassieur <address@hidden>
 ;;; Copyright © 2018 Carlo Zancanaro <address@hidden>
+;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -25,6 +26,7 @@
   #:use-module (guix store)
   #:use-module (guix records)
   #:use-module (guix derivations)                 ;imported-modules, etc.
+  #:use-module (guix utils)
   #:use-module (gnu services)
   #:use-module (gnu services herd)
   #:use-module (gnu packages admin)
@@ -260,22 +262,27 @@ stored."
 (define (scm->go file)
   "Compile FILE, which contains code to be loaded by shepherd's config file,
 and return the resulting '.go' file."
-  (with-extensions (list shepherd)
-    (computed-file (string-append (basename (scheme-file-name file) ".scm")
-                                  ".go")
-                   #~(begin
-                       (use-modules (system base compile))
-
-                       ;; Do the same as the Shepherd's 'load-in-user-module'.
-                       (let ((env (make-fresh-user-module)))
-                         (module-use! env (resolve-interface '(oop goops)))
-                         (module-use! env (resolve-interface '(shepherd 
service)))
-                         (compile-file #$file #:output-file #$output
-                                       #:env env)))
-
-                   ;; It's faster to build locally than to download.
-                   #:options '(#:local-build? #t
-                               #:substitutable? #f))))
+  ;; FIXME: %current-target-system may not be bound 
<https://bugs.gnu.org/29296>
+  (let ((target (%current-target-system)))
+    (with-extensions (list shepherd)
+      (computed-file (string-append (basename (scheme-file-name file) ".scm")
+                                    ".go")
+                     #~(begin
+                         (use-modules (system base compile)
+                                      (system base target))
+
+                         ;; Do the same as the Shepherd's 
'load-in-user-module'.
+                         (let ((env (make-fresh-user-module)))
+                           (module-use! env (resolve-interface '(oop goops)))
+                           (module-use! env (resolve-interface '(shepherd 
service)))
+                           (with-target #$(or target #~%host-type)
+                             (lambda _
+                               (compile-file #$file #:output-file #$output
+                                             #:env env)))))
+
+                     ;; It's faster to build locally than to download.
+                     #:options '(#:local-build? #t
+                                 #:substitutable? #f)))))
 
 (define (shepherd-configuration-file services)
   "Return the shepherd configuration file for SERVICES."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]