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

@ -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

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

@ -63,7 +63,8 @@ directory."
(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 @@ directory."
(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