summaryrefslogtreecommitdiff
path: root/gnu/packages
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-03-28 19:26:39 +0100
committerLudovic Courtès <ludo@gnu.org>2021-03-30 22:48:43 +0200
commit7d873f194ca69d6096d28d7a224ab78e83e34fe1 (patch)
treea89f505ab352b729908c8ca1691ac57fc61a5ba3 /gnu/packages
parenta76b6f8120d54516e784da265884245cd6a3cc7d (diff)
build-system: Rewrite using gexps.
* guix/packages.scm (expand-input): Remove 'store', 'system', and 'cross-system' parameters; add #:native?. Rewrite to return name/gexp-input tuples. (bag->derivation): Adjust accordingly. Lower (bag-build bag). (bag->cross-derivation): Ditto. Instead of #:native-drvs and #:target-drvs, pass #:build-inputs, #:host-inputs, and #:target-inputs. (%derivation-cache): Remove. * gnu/packages/bootstrap.scm (raw-build): Turn into a monadic procedure. * gnu/packages/commencement.scm (glibc-final)[arguments]: Use 'gexp-input' for the #:allowed-references argument. * guix/build-system/cmake.scm (cmake-build): Remove 'store' parameter. Switch to the use of gexps and 'gexp->derivation'. (lower): Remove #:source from 'private-keywords'. * guix/build-system/glib-or-gtk.scm (glib-or-gtk-build, lower): Likewise. * guix/build-system/font.scm (font-build): Likewise. * guix/build-system/gnu.scm (gnu-build): Likewise, and remove 'canonicalize-reference'. (gnu-cross-build): Likewise, and expect #:build-inputs, #:host-inputs, and #:target-inputs instead of #:native-drvs and #:target-drvs. (lower): Likewise. * guix/build-system/perl.scm (perl-build, lower): Likewise. * guix/build-system/python.scm (python-build, lower): Likewise. * guix/build-system/ruby.scm (ruby-build, lower): Likewise. * guix/build-system/waf.scm (waf-build, lower): Likewise. * guix/build-system/trivial.scm (guile-for-build): Remove. (trivial-build): Remove 'store' parameter, change to gexps. (trivial-cross-build): Ditto, and change to #:build-inputs & co. * guix/build-system/cargo.scm (cargo-build): Change to 'gexp->derivation'. * guix/build-system/copy.scm (copy-build): Likewise. * guix/build-system/dune.scm (dune-build): Likewise. * guix/build-system/guile.scm (guile-build, guile-cross-build): Likewise. * guix/build-system/meson.scm (meson-build): Likewise. * guix/build-system/ocaml.scm (ocaml-build): Likewise. * guix/build-system/scons.scm (scons-build): Likewise. * guix/build-system/texlive.scm (texlive-build): Likewise. * guix/build-system/android-ndk.scm (android-ndk-build): Likewise. * guix/build-system/ant.scm (ant-build): Likewise. * guix/build-system/asdf.scm (asdf-build/source, asdf-build): Likewise. * guix/build-system/chicken.scm (chicken-build): Likewise. * guix/build-system/clojure.scm (clojure-build): Likewise. (source->output-path, maybe-guile->guile): Remove. * guix/build-system/dub.scm (dub-build): Likewise. * guix/build-system/emacs.scm (emacs-build): Likewise. * guix/build-system/go.scm (go-build): Likewise. * guix/build-system/haskell.scm (haskell-build): Likewise. * guix/build-system/julia.scm (julia-build): Likewise. * guix/build-system/linux-module.scm (linux-module-build) (linux-module-build-cross): Likewise. * guix/build-system/maven.scm (maven-build): Likewise. * guix/build-system/minify.scm (minify-build): Likewise. * guix/build-system/node.scm (node-build): Likewise. * guix/build-system/qt.scm (qt-build, qt-cross-build): Likewise. * guix/build-system/r.scm (r-build): Likewise. * guix/build-system/rakudo.scm (rakudo-build): Likewise. * guix/build-system/renpy.scm (renpy-build): Likewise. * tests/builders.scm ("gnu-build"): Call 'store-lower' on 'gnu-build'. Pass #:source parameter. * tests/packages.scm ("search paths"): Use 'abort-to-prompt' instead of a normal return from the 'build' method. ("package->bag, sensitivity to %current-target-system"): Change 'build' to match the new build system signature. squash! build-system: Rewrite using gexps. squash! build-system: Rewrite using gexps.
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/bootstrap.scm115
-rw-r--r--gnu/packages/commencement.scm3
2 files changed, 60 insertions, 58 deletions
diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm
index c50e94e891..c8844a40a8 100644
--- a/gnu/packages/bootstrap.scm
+++ b/gnu/packages/bootstrap.scm
@@ -32,11 +32,13 @@
#:use-module (guix build-system gnu)
#:use-module (guix build-system trivial)
#:use-module ((guix store)
- #:select (run-with-store add-to-store add-text-to-store))
+ #:select (%store-monad interned-file text-file store-lift))
#:use-module ((guix derivations)
- #:select (derivation derivation-input derivation->output-path))
- #:use-module ((guix utils) #:select (gnu-triplet->nix-system))
+ #:select (raw-derivation derivation-input derivation->output-path))
+ #:use-module (guix utils)
+ #:use-module ((guix build utils) #:select (elf-file?))
#:use-module ((guix gexp) #:select (lower-object))
+ #:use-module (guix monads)
#:use-module (guix memoization)
#:use-module (guix i18n)
#:use-module (srfi srfi-1)
@@ -376,59 +378,58 @@ or false to signal an error."
%bootstrap-base-urls))
(sha256 (bootstrap-guile-hash system))))
-(define (download-bootstrap-guile store system)
+(define (download-bootstrap-guile system)
"Return a derivation that downloads the bootstrap Guile tarball for SYSTEM."
(let* ((path (bootstrap-guile-url-path system))
(base (basename path))
(urls (map (cut string-append <> path) %bootstrap-base-urls)))
- (run-with-store store
- (url-fetch urls 'sha256 (bootstrap-guile-hash system)
- #:system system))))
+ (url-fetch urls 'sha256 (bootstrap-guile-hash system)
+ #:system system)))
-(define* (raw-build store name inputs
+(define* (raw-build name inputs
#:key outputs system search-paths
#:allow-other-keys)
(define (->store file)
- (run-with-store store
- (lower-object (bootstrap-executable file system)
- system)))
-
- (let* ((tar (->store "tar"))
- (xz (->store "xz"))
- (mkdir (->store "mkdir"))
- (bash (->store "bash"))
- (guile (download-bootstrap-guile store system))
- ;; 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 "\
+ (lower-object (bootstrap-executable file system)
+ system))
+
+ (define (make-guile-wrapper bash guile-real)
+ ;; 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.
+ '(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"
- (format #f "
+ bash out out dollar guile-real dollar)))
+ (chmod guile #o555)
+ (chmod bin-dir #o555))))))
+
+ (mlet* %store-monad ((tar (->store "tar"))
+ (xz (->store "xz"))
+ (mkdir (->store "mkdir"))
+ (bash (->store "bash"))
+ (guile (download-bootstrap-guile system))
+ (wrapper -> (make-guile-wrapper bash guile))
+ (builder
+ (text-file "build-bootstrap-guile.sh"
+ (format #f "
echo \"unpacking bootstrap Guile to '$out'...\"
~a $out
cd $out
@@ -441,19 +442,19 @@ $out/bin/guile -c ~s $out ~a
# Sanity check.
$out/bin/guile --version~%"
- (derivation->output-path mkdir)
- (derivation->output-path xz)
- (derivation->output-path tar)
- (format #f "~s" make-guile-wrapper)
- (derivation->output-path bash)))))
- (derivation store name
- (derivation->output-path bash) `(,builder)
- #:system system
- #:inputs (map derivation-input
- (list bash mkdir tar xz guile))
- #:sources (list builder)
- #:env-vars `(("GUILE_TARBALL"
- . ,(derivation->output-path guile))))))
+ (derivation->output-path mkdir)
+ (derivation->output-path xz)
+ (derivation->output-path tar)
+ (object->string wrapper)
+ (derivation->output-path bash)))))
+ (raw-derivation name
+ (derivation->output-path bash) `(,builder)
+ #:system system
+ #:inputs (map derivation-input
+ (list bash mkdir tar xz guile))
+ #:sources (list builder)
+ #:env-vars `(("GUILE_TARBALL"
+ . ,(derivation->output-path guile))))))
(define* (make-raw-bag name
#:key source inputs native-inputs outputs
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 7c39a84008..3eba960447 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -52,6 +52,7 @@
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages rsync)
#:use-module (gnu packages xml)
+ #:use-module (guix gexp)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix build-system gnu)
@@ -3375,7 +3376,7 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
;; if 'allowed-references' were per-output.
(arguments
`(#:allowed-references
- ((,gcc-boot0 "lib")
+ (,(gexp-input gcc-boot0 "lib")
,(kernel-headers-boot0)
,static-bash-for-glibc
,@(if (hurd-system?)