all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Mark H Weaver <mhw@netris.org>
To: guix-devel@gnu.org
Subject: [PATCH] gnu: bootstrap: Create a wrapper for guile to set the system load path
Date: Wed, 08 Jul 2015 12:45:40 -0400	[thread overview]
Message-ID: <87380y1tu3.fsf@netris.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 733 bytes --]

Hello Guix,

We currently use gnu/packages/patches/guile-relocatable.patch to set the
system load path in the bootstrap guile.  However, that patch depends on
/proc/self/exe which is not present on the Hurd.  Therefore, I came up
with another approach in the attached patch.  After unpacking the
bootstrap guile, we use it to create its own wrapper that sets the
GUILE_SYSTEM_PATH and GUILE_SYSTEM_COMPILED_PATH environment variables.

My only concern is that these variables will be present in the
environment in any subprograms launched by the bootstrap guile, and so
if the bootstrap guile ever tries to run a different version of guile,
those variable settings may cause trouble.

Comments and suggestions welcome.

      Mark



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: [PATCH] gnu: bootstrap: Create a wrapper for guile to set the system load path --]
[-- Type: text/x-patch, Size: 2888 bytes --]

From 885997fec1f0a175279edbf56b86050731892148 Mon Sep 17 00:00:00 2001
From: Mark H Weaver <mhw@netris.org>
Date: Wed, 8 Jul 2015 12:31:32 -0400
Subject: [PATCH] gnu: bootstrap: Create a wrapper for guile to set the system
 load path.

* gnu/packages/bootstrap.scm (raw-build): After unpacking, use the bootstrap
  guile to create its own wrapper that sets the guile system load path.
---
 gnu/packages/bootstrap.scm | 34 ++++++++++++++++++++++++++++++++--
 1 file changed, 32 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm
index ae8c289..8598c10 100644
--- a/gnu/packages/bootstrap.scm
+++ b/gnu/packages/bootstrap.scm
@@ -199,6 +199,29 @@ successful, or false to signal an error."
                             "guile-2.0.11.tar.xz")
                            (_
                             "guile-2.0.9.tar.xz"))))
+         (make-guile-wrapper
+          '(begin
+             (use-modules (ice-9 match))
+             (match (command-line)
+               ((_ out bash)
+                (let ((bin-dir    (string-append out "/bin"))
+                      (guile      (string-append out "/bin/guile"))
+                      (guile-real (string-append out "/bin/.guile-real"))
+                      ;; We must avoid using a bare dollar sign in this code,
+                      ;; because it would be interpreted by the shell.
+                      (dollar     (string (integer->char 36))))
+                  (chmod bin-dir #o755)
+                  (rename-file guile guile-real)
+                  (call-with-output-file guile
+                    (lambda (p)
+                      (format p "\
+#!~a
+export GUILE_SYSTEM_PATH=~a/share/guile/2.0
+export GUILE_SYSTEM_COMPILED_PATH=~a/lib/guile/2.0/ccache
+exec -a \"~a0\" ~a \"~a@\"\n"
+                              bash out out dollar guile-real dollar)))
+                  (chmod guile   #o555)
+                  (chmod bin-dir #o555))))))
          (builder
           (add-text-to-store store
                              "build-bootstrap-guile.sh"
@@ -208,10 +231,17 @@ echo \"unpacking bootstrap Guile to '$out'...\"
 cd $out
 ~a -dc < ~a | ~a xv
 
+# Use the bootstrap guile to create its own wrapper to set the load path.
+GUILE_SYSTEM_PATH=$out/share/guile/2.0 \
+GUILE_SYSTEM_COMPILED_PATH=$out/lib/guile/2.0/ccache \
+$out/bin/guile -c ~s $out ~a
+
 # Sanity check.
 $out/bin/guile --version~%"
-                                     mkdir xz guile tar)
-                             (list mkdir xz guile tar))))
+                                     mkdir xz guile tar
+                                     (format #f "~s" make-guile-wrapper)
+                                     bash)
+                             (list mkdir xz guile tar bash))))
     (derivation store name
                 bash `(,builder)
                 #:system system
-- 
2.4.3


             reply	other threads:[~2015-07-08 16:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-08 16:45 Mark H Weaver [this message]
2015-07-08 20:01 ` [PATCH] gnu: bootstrap: Create a wrapper for guile to set the system load path Mark H Weaver
2015-07-08 20:39   ` Mark H Weaver
2015-07-09 10:14     ` Manolis Ragkousis
2015-07-09 18:24       ` Manolis Ragkousis
2015-07-10 20:42 ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87380y1tu3.fsf@netris.org \
    --to=mhw@netris.org \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.