From 0d5a559f0f81e14c695e5aab178b30edf66088f3 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 3 Oct 2014 18:06:16 +0200 Subject: build-system: Introduce "bags" as an intermediate representation. * guix/build-system.scm ()[build, cross-build]: Remove. [lower]: New field. (): New record type. (make-bag): New procedure. * guix/packages.scm (bag-transitive-inputs, bag-transitive-build-inputs, bag-transitive-host-inputs, bag-transitive-target-inputs, package->bag): New procedures. (package-derivation): Use it; use the bag, apply its build procedure, etc. (package-cross-derivation): Likewise. * gnu/packages/bootstrap.scm (raw-build, make-raw-bag): New procedure. (%bootstrap-guile): Use them. * guix/build-system/trivial.scm (lower): New procedure. (trivial-build, trivial-cross-build): Remove 'source' parameter. Pass INPUTS as is. (trivial-build-system): Adjust accordingly. * guix/build-system/gnu.scm (%store, inputs-search-paths, standard-search-paths, expand-inputs, standard-inputs): Remove. (gnu-lower): New procedure. (gnu-build): Remove 'source' and #:implicit-inputs? parameters. Remove 'implicit-inputs' and 'implicit-search-paths' variables. Get the source from INPUT-DRVS. (gnu-cross-build): Likewise. (standard-cross-packages): Remove call to 'standard-packages'. (standard-cross-inputs, standard-cross-search-paths): Remove. (gnu-build-system): Remove 'build' and 'cross-build'; add 'lower'. * guix/build-system/cmake.scm (lower): New procedure. (cmake-build): Remove 'source' and #:cmake parameters. Use INPUTS and SEARCH-PATHS as is. Get the source from INPUTS. * guix/build-system/perl.scm: Likewise. * guix/build-system/python.scm: Likewise. * guix/build-system/ruby.scm: Likewise. * gnu/packages/cross-base.scm (cross-gcc): Change "cross-linux-headers" to "linux-headers". (cross-libc)[xlinux-headers]: Pass #:implicit-cross-inputs? #f. Likewise. In 'propagated-inputs', change "cross-linux-headers" to "linux-headers". * guix/git-download.scm (git-fetch): Use 'standard-packages' instead of 'standard-inputs'. * tests/builders.scm ("gnu-build-system"): Remove use of 'build-system-builder'. ("gnu-build"): Remove 'source' and #:implicit-inputs? arguments to 'gnu-build'. * tests/packages.scm ("search paths"): Adjust to new build system API. ("package-cross-derivation, no cross builder"): Likewise. * doc/guix.texi (Build Systems): Add paragraph on bags. --- guix/build-system/trivial.scm | 45 ++++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 16 deletions(-) (limited to 'guix/build-system/trivial.scm') diff --git a/guix/build-system/trivial.scm b/guix/build-system/trivial.scm index 897c5c6152..1b07f14e63 100644 --- a/guix/build-system/trivial.scm +++ b/guix/build-system/trivial.scm @@ -34,42 +34,55 @@ (guile (module-ref distro 'guile-final))) (package-derivation store guile system))))) -(define* (trivial-build store name source inputs +(define* (lower name + #:key source inputs native-inputs outputs target + guile builder modules) + "Return a bag for NAME." + (bag + (name name) + (host-inputs `(,@(if source + `(("source" ,source)) + '()) + ,@inputs)) + (build-inputs native-inputs) + (outputs outputs) + (build (if target trivial-cross-build trivial-build)) + (arguments `(#:guile ,guile + #:builder ,builder + #:modules ,modules)))) + +(define* (trivial-build store name inputs #:key outputs guile system builder (modules '()) search-paths) "Run build expression BUILDER, an expression, for SYSTEM. SOURCE is ignored." (build-expression->derivation store name builder - #:inputs (if source - `(("source" ,source) ,@inputs) - inputs) + #:inputs inputs #:system system #:outputs outputs #:modules modules #:guile-for-build (guile-for-build store guile system))) -(define* (trivial-cross-build store name target source inputs native-inputs +(define* (trivial-cross-build store name #:key + target native-drvs target-drvs outputs guile system builder (modules '()) search-paths native-search-paths) - "Like `trivial-build', but in a cross-compilation context." + "Run build expression BUILDER, an expression, for SYSTEM. SOURCE is +ignored." (build-expression->derivation store name builder + #:inputs (append native-drvs target-drvs) #:system system - #:inputs - (let ((inputs (append native-inputs inputs))) - (if source - `(("source" ,source) ,@inputs) - inputs)) #:outputs outputs #:modules modules #:guile-for-build (guile-for-build store guile system))) (define trivial-build-system - (build-system (name 'trivial) - (description - "Trivial build system, to run arbitrary Scheme build expressions") - (build trivial-build) - (cross-build trivial-cross-build))) + (build-system + (name 'trivial) + (description + "Trivial build system, to run arbitrary Scheme build expressions") + (lower lower))) -- cgit v1.2.3