diff options
Diffstat (limited to 'guix/build-system/ruby.scm')
-rw-r--r-- | guix/build-system/ruby.scm | 76 |
1 files changed, 44 insertions, 32 deletions
diff --git a/guix/build-system/ruby.scm b/guix/build-system/ruby.scm index 426ca3718c..8312629fd8 100644 --- a/guix/build-system/ruby.scm +++ b/guix/build-system/ruby.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2014 David Thompson <davet@gnu.org> +;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -23,9 +24,7 @@ #:use-module (guix derivations) #:use-module (guix build-system) #:use-module (guix build-system gnu) - #:use-module (gnu packages version-control) #:use-module (ice-9 match) - #:use-module (srfi srfi-26) #:export (ruby-build ruby-build-system)) @@ -35,9 +34,33 @@ (let ((ruby (resolve-interface '(gnu packages ruby)))) (module-ref ruby 'ruby))) -(define* (ruby-build store name source inputs +(define* (lower name + #:key source inputs native-inputs outputs target + (ruby (default-ruby)) + #:allow-other-keys + #:rest arguments) + "Return a bag for NAME." + (define private-keywords + '(#:source #:target #:ruby #:inputs #:native-inputs)) + + (and (not target) ;XXX: no cross-compilation + (bag + (name name) + (host-inputs `(,@(if source + `(("source" ,source)) + '()) + ,@inputs + + ;; Keep the standard inputs of 'gnu-build-system'. + ,@(standard-packages))) + (build-inputs `(("ruby" ,ruby) + ,@native-inputs)) + (outputs outputs) + (build ruby-build) + (arguments (strip-keyword-arguments private-keywords arguments))))) + +(define* (ruby-build store name inputs #:key - (ruby (default-ruby)) (test-target "test") (tests? #t) (phases '(@ (guix build ruby-build-system) @@ -52,25 +75,24 @@ (modules '((guix build ruby-build-system) (guix build utils)))) "Build SOURCE using RUBY and INPUTS." - (define ruby-search-paths - (append (package-native-search-paths ruby) - (standard-search-paths))) - (define builder `(begin (use-modules ,@modules) (ruby-build #:name ,name - #:source ,(if (derivation? source) - (derivation->output-path source) - source) + #:source ,(match (assoc-ref inputs "source") + (((? derivation? source)) + (derivation->output-path source)) + ((source) + source) + (source + source)) #:system ,system #:test-target ,test-target #:tests? ,tests? #:phases ,phases #:outputs %outputs #:search-paths ',(map search-path-specification->sexp - (append ruby-search-paths - search-paths)) + search-paths) #:inputs %build-inputs))) (define guile-for-build @@ -82,25 +104,15 @@ (guile (module-ref distro 'guile-final))) (package-derivation store guile system))))) - (let ((ruby (package-derivation store ruby system)) - (git (package-derivation store git system))) - (build-expression->derivation store name builder - #:inputs - `(,@(if source - `(("source" ,source)) - '()) - ("ruby" ,ruby) - ,@inputs - ;; Keep the standard inputs of - ;; 'gnu-build-system'. - ,@(standard-inputs system)) - #:system system - #:modules imported-modules - #:outputs outputs - #:guile-for-build guile-for-build))) + (build-expression->derivation store name builder + #:inputs inputs + #:system system + #:modules imported-modules + #:outputs outputs + #:guile-for-build guile-for-build)) (define ruby-build-system (build-system - (name 'ruby) - (description "The standard Ruby build system") - (build ruby-build))) + (name 'ruby) + (description "The standard Ruby build system") + (lower lower))) |