mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
guix: dune-build-system: Add a package parameter.
* guix/build-system/dune.scm: Add a package parameter. * guix/build/dune.scm (build, test, install): Use it. * doc/guix.texi: Document it.
This commit is contained in:
parent
f92854fea1
commit
78b3748c1c
3 changed files with 17 additions and 7 deletions
|
@ -5816,6 +5816,11 @@ list of flags passed to the @code{dune} command during the build.
|
|||
The @code{#:jbuild?} parameter can be passed to use the @code{jbuild}
|
||||
command instead of the more recent @code{dune} command while building
|
||||
a package. Its default value is @code{#f}.
|
||||
|
||||
The @code{#:package} parameter can be passed to specify a package name, which
|
||||
is useful when a package contains multiple packages and you want to build
|
||||
only one of them. This is equivalent to passing the @code{-p} argument to
|
||||
@code{dune}.
|
||||
@end defvr
|
||||
|
||||
@defvr {Scheme Variable} go-build-system
|
||||
|
|
|
@ -87,6 +87,7 @@ (define* (dune-build store name inputs
|
|||
(build-flags ''())
|
||||
(out-of-source? #t)
|
||||
(jbuild? #f)
|
||||
(package #f)
|
||||
(tests? #t)
|
||||
(test-flags ''())
|
||||
(test-target "test")
|
||||
|
@ -125,6 +126,7 @@ (define builder
|
|||
#:build-flags ,build-flags
|
||||
#:out-of-source? ,out-of-source?
|
||||
#:jbuild? ,jbuild?
|
||||
#:package ,package
|
||||
#:tests? ,tests?
|
||||
#:test-target ,test-target
|
||||
#:install-target ,install-target
|
||||
|
|
|
@ -31,27 +31,30 @@ (define-module (guix build dune-build-system)
|
|||
;; Code:
|
||||
|
||||
(define* (build #:key (build-flags '()) (jbuild? #f)
|
||||
(use-make? #f) #:allow-other-keys)
|
||||
(use-make? #f) (package #f) #:allow-other-keys)
|
||||
"Build the given package."
|
||||
(let ((program (if jbuild? "jbuilder" "dune")))
|
||||
(apply invoke program "build" "@install" build-flags))
|
||||
(apply invoke program "build" "@install"
|
||||
(append (if package (list "-p" package) '()) build-flags)))
|
||||
#t)
|
||||
|
||||
(define* (check #:key (test-flags '()) (test-target "test") tests?
|
||||
(jbuild? #f) #:allow-other-keys)
|
||||
(jbuild? #f) (package #f) #:allow-other-keys)
|
||||
"Test the given package."
|
||||
(when tests?
|
||||
(let ((program (if jbuild? "jbuilder" "dune")))
|
||||
(apply invoke program "runtest" test-target test-flags)))
|
||||
(apply invoke program "runtest" test-target
|
||||
(append (if package (list "-p" package) '()) test-flags))))
|
||||
#t)
|
||||
|
||||
(define* (install #:key outputs (install-target "install") (jbuild? #f)
|
||||
#:allow-other-keys)
|
||||
(package #f) #:allow-other-keys)
|
||||
"Install the given package."
|
||||
(let ((out (assoc-ref outputs "out"))
|
||||
(program (if jbuild? "jbuilder" "dune")))
|
||||
(invoke program install-target "--prefix" out "--libdir"
|
||||
(string-append out "/lib/ocaml/site-lib")))
|
||||
(apply invoke program install-target "--prefix" out "--libdir"
|
||||
(string-append out "/lib/ocaml/site-lib")
|
||||
(if package (list package) '())))
|
||||
#t)
|
||||
|
||||
(define %standard-phases
|
||||
|
|
Loading…
Reference in a new issue