build-system/ruby: Add #:gem-flags parameter.

* guix/build-system/ruby.scm (build): add 'gem-flags' key
* guix/build/ruby-build-system.scm (build): use 'gem-flags' key
* doc/guix.texi (Build Systems): Mention #:gem-flags.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
pjotrp 2015-07-13 15:32:36 +02:00 committed by Ludovic Courtès
parent 702675c515
commit 6e9f2913ba
3 changed files with 11 additions and 6 deletions

View file

@ -2458,7 +2458,8 @@ implements the RubyGems build procedure used by Ruby packages, which
involves running @code{gem build} followed by @code{gem install}.
Which Ruby package is used can be specified with the @code{#:ruby}
parameter.
parameter. A list of additional flags to be passed to the @command{gem}
command can be specified with the @code{#:gem-flags} parameter.
@end defvr
@defvr {Scheme Variable} waf-build-system

View file

@ -71,6 +71,7 @@ (define private-keywords
(define* (ruby-build store name inputs
#:key
(gem-flags ''())
(test-target "test")
(tests? #t)
(phases '(@ (guix build ruby-build-system)
@ -95,6 +96,7 @@ (define builder
(source
source))
#:system ,system
#:gem-flags ,gem-flags
#:test-target ,test-target
#:tests? ,tests?
#:phases ,phases

View file

@ -63,7 +63,8 @@ (define* (check #:key tests? test-target #:allow-other-keys)
(zero? (system* "rake" test-target))
#t))
(define* (install #:key source inputs outputs #:allow-other-keys)
(define* (install #:key source inputs outputs (gem-flags '())
#:allow-other-keys)
(let* ((ruby-version
(match:substring (string-match "ruby-(.*)\\.[0-9]$"
(assoc-ref inputs "ruby"))
@ -72,10 +73,11 @@ (define* (install #:key source inputs outputs #:allow-other-keys)
(gem-home (string-append out "/lib/ruby/gems/" ruby-version ".0")))
(setenv "GEM_HOME" gem-home)
(mkdir-p gem-home)
(zero? (system* "gem" "install" "--local"
(zero? (apply system* "gem" "install" "--local"
(first-matching-file "\\.gem$")
;; Executables should go into /bin, not /lib/ruby/gems.
"--bindir" (string-append out "/bin")))))
"--bindir" (string-append out "/bin")
gem-flags))))
(define %standard-phases
(modify-phases gnu:%standard-phases