summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build-aux/build-self.scm49
1 files changed, 0 insertions, 49 deletions
diff --git a/build-aux/build-self.scm b/build-aux/build-self.scm
index ad2aeea6323..7dce08fed07 100644
--- a/build-aux/build-self.scm
+++ b/build-aux/build-self.scm
@@ -135,55 +135,6 @@
135 #+(and xz (file-append xz "/bin/xz"))))))) 135 #+(and xz (file-append xz "/bin/xz")))))))
136 136
137 137
138;;;
139;;; 'gexp->script'.
140;;;
141;;; This is our own variant of 'gexp->script' with an extra #:module-path
142;;; parameter, which was unavailable in (guix gexp) until commit
143;;; 1ae16033f34cebe802023922436883867010850f (March 2018.)
144;;;
145
146(define (load-path-expression modules path)
147 "Return as a monadic value a gexp that sets '%load-path' and
148'%load-compiled-path' to point to MODULES, a list of module names. MODULES
149are searched for in PATH."
150 (mlet %store-monad ((modules (imported-modules modules
151 #:module-path path))
152 (compiled (compiled-modules modules
153 #:module-path path)))
154 (return (gexp (eval-when (expand load eval)
155 (set! %load-path
156 (cons (ungexp modules) %load-path))
157 (set! %load-compiled-path
158 (cons (ungexp compiled)
159 %load-compiled-path)))))))
160
161(define* (gexp->script name exp
162 #:key (guile (default-guile))
163 (module-path %load-path))
164 "Return an executable script NAME that runs EXP using GUILE, with EXP's
165imported modules in its search path."
166 (mlet %store-monad ((set-load-path
167 (load-path-expression (gexp-modules exp)
168 module-path)))
169 (gexp->derivation name
170 (gexp
171 (call-with-output-file (ungexp output)
172 (lambda (port)
173 ;; Note: that makes a long shebang. When the store
174 ;; is /gnu/store, that fits within the 128-byte
175 ;; limit imposed by Linux, but that may go beyond
176 ;; when running tests.
177 (format port
178 "#!~a/bin/guile --no-auto-compile~%!#~%"
179 (ungexp guile))
180
181 (write '(ungexp set-load-path) port)
182 (write '(ungexp exp) port)
183 (chmod port #o555))))
184 #:module-path module-path)))
185
186
187(define (date-version-string) 138(define (date-version-string)
188 "Return the current date and hour in UTC timezone, for use as a poor 139 "Return the current date and hour in UTC timezone, for use as a poor
189person's version identifier." 140person's version identifier."