Skip to content
Snippets Groups Projects
Commit 5d6792f0 authored by Mark H Weaver's avatar Mark H Weaver
Browse files

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.
parent 1f4335ae
No related branches found
No related tags found
No related merge requests found
...@@ -197,6 +197,33 @@ (define (->store file) ...@@ -197,6 +197,33 @@ (define (->store file)
"guile-2.0.11.tar.xz") "guile-2.0.11.tar.xz")
(_ (_
"guile-2.0.9.tar.xz")))) "guile-2.0.9.tar.xz"))))
;; The following code, run by the bootstrap guile after it is
;; unpacked, creates a wrapper for itself to set its load path.
;; This replaces the previous non-portable method based on
;; reading the /proc/self/exe symlink.
(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 (builder
(add-text-to-store store (add-text-to-store store
"build-bootstrap-guile.sh" "build-bootstrap-guile.sh"
...@@ -206,10 +233,17 @@ (define (->store file) ...@@ -206,10 +233,17 @@ (define (->store file)
cd $out cd $out
~a -dc < ~a | ~a xv ~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. # Sanity check.
$out/bin/guile --version~%" $out/bin/guile --version~%"
mkdir xz guile tar) mkdir xz guile tar
(list mkdir xz guile tar)))) (format #f "~s" make-guile-wrapper)
bash)
(list mkdir xz guile tar bash))))
(derivation store name (derivation store name
bash `(,builder) bash `(,builder)
#:system system #:system system
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment