unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] gnu: bootstrap: Create a wrapper for guile to set the system load path
@ 2015-07-08 16:45 Mark H Weaver
  2015-07-08 20:01 ` Mark H Weaver
  2015-07-10 20:42 ` Ludovic Courtès
  0 siblings, 2 replies; 6+ messages in thread
From: Mark H Weaver @ 2015-07-08 16:45 UTC (permalink / raw)
  To: guix-devel

[-- 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] gnu: bootstrap: Create a wrapper for guile to set the system load path
  2015-07-08 16:45 [PATCH] gnu: bootstrap: Create a wrapper for guile to set the system load path Mark H Weaver
@ 2015-07-08 20:01 ` Mark H Weaver
  2015-07-08 20:39   ` Mark H Weaver
  2015-07-10 20:42 ` Ludovic Courtès
  1 sibling, 1 reply; 6+ messages in thread
From: Mark H Weaver @ 2015-07-08 20:01 UTC (permalink / raw)
  To: guix-devel

Mark H Weaver <mhw@netris.org> writes:

> 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.

'guile-final' built successfully on x86_64 with this patch, and that was
the package that I was most worried about, so maybe everything will work
out in practice.

     Mark

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gnu: bootstrap: Create a wrapper for guile to set the system load path
  2015-07-08 20:01 ` Mark H Weaver
@ 2015-07-08 20:39   ` Mark H Weaver
  2015-07-09 10:14     ` Manolis Ragkousis
  0 siblings, 1 reply; 6+ messages in thread
From: Mark H Weaver @ 2015-07-08 20:39 UTC (permalink / raw)
  To: guix-devel

Mark H Weaver <mhw@netris.org> writes:

> Mark H Weaver <mhw@netris.org> writes:
>
>> 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.
>
> 'guile-final' built successfully on x86_64 with this patch, and that was
> the package that I was most worried about, so maybe everything will work
> out in practice.

FYI, I successfully built GNU Hello with that patch applied.

      Mark

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gnu: bootstrap: Create a wrapper for guile to set the system load path
  2015-07-08 20:39   ` Mark H Weaver
@ 2015-07-09 10:14     ` Manolis Ragkousis
  2015-07-09 18:24       ` Manolis Ragkousis
  0 siblings, 1 reply; 6+ messages in thread
From: Manolis Ragkousis @ 2015-07-09 10:14 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: Guix-devel

Hey Mark

First of all thank you for helping on this :-)

Seems to work fine for me, but I will need a bit more time to test it
on my local Hurd vm because the
vm filesystem crashed for some reason yesterday, some, not previously
encountered, errors appeared
after I restored the vm and had to run make clean && make again on the vm.  :-(

Manolis

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gnu: bootstrap: Create a wrapper for guile to set the system load path
  2015-07-09 10:14     ` Manolis Ragkousis
@ 2015-07-09 18:24       ` Manolis Ragkousis
  0 siblings, 0 replies; 6+ messages in thread
From: Manolis Ragkousis @ 2015-07-09 18:24 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: Guix-devel

Solved the problem with bootstrap guile on Hurd.

Manolis

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gnu: bootstrap: Create a wrapper for guile to set the system load path
  2015-07-08 16:45 [PATCH] gnu: bootstrap: Create a wrapper for guile to set the system load path Mark H Weaver
  2015-07-08 20:01 ` Mark H Weaver
@ 2015-07-10 20:42 ` Ludovic Courtès
  1 sibling, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2015-07-10 20:42 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guix-devel

Mark H Weaver <mhw@netris.org> skribis:

> 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.

That sounds nice!

> 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.

Good point.  I think that happens when ‘guile-final’ gets built, but you
mentioned that it built perfectly, right?  But in that case it’s OK
because meta/uninstalled-env overrides GUILE_SYSTEM_* anyway.

> 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.

[...]

> +         (make-guile-wrapper
> +          '(begin

Could you add a comment above mentioning that this replaces the previous
non-portable option based on /proc/self/exe?

OK for core-updates.

Thanks for helping out with this!

Ludo’.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-07-10 20:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-08 16:45 [PATCH] gnu: bootstrap: Create a wrapper for guile to set the system load path Mark H Weaver
2015-07-08 20:01 ` 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

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).