Skip to content

Commit b56b0e7

Browse files
Create (stdlib) syntax for Coq stanza
Fixes #6163
1 parent 2531e72 commit b56b0e7

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

src/dune_rules/coq_rules.ml

+3
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ let setup_coqdep_rule ~sctx ~loc (cctx : _ Context.t) ~source_rule coq_module =
376376
let source = Coq_module.source coq_module in
377377
let file_flags =
378378
let file_flags = Context.coqc_file_flags cctx in
379+
(if cctx.buildable.stdlib then [] else [Command.Args.A "-boot"]) @
379380
[ Command.Args.S file_flags
380381
; As [ "-dyndep"; "opt" ]
381382
; Dep (Path.build source)
@@ -399,6 +400,8 @@ let coqc_rule (cctx : _ Context.t) ~file_flags coq_module =
399400
|> List.map ~f:fst
400401
in
401402
let native_flags = Context.coqc_native_flags cctx in
403+
(if cctx.buildable.stdlib then [] else
404+
[Command.Args.A "-boot"; A "-noinit"]) @
402405
[ Command.Args.Hidden_targets objects_to
403406
; native_flags
404407
; S file_flags

src/dune_rules/coq_stanza.ml

+7-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ let coq_syntax =
2525
; ((0, 3), `Since (2, 8))
2626
; ((0, 4), `Since (3, 3))
2727
; ((0, 5), `Since (3, 4))
28+
; ((0, 6), `Since (3, 5))
2829
]
2930

3031
module Buildable = struct
@@ -34,6 +35,7 @@ module Buildable = struct
3435
; mode : Loc.t * Coq_mode.t
3536
; plugins : (Loc.t * Lib_name.t) list (** ocaml libraries *)
3637
; theories : (Loc.t * Coq_lib_name.t) list (** coq libraries *)
38+
; stdlib : bool
3739
; loc : Loc.t
3840
}
3941

@@ -71,9 +73,13 @@ module Buildable = struct
7173
field "theories"
7274
(Dune_lang.Syntax.since coq_syntax (0, 2) >>> repeat Coq_lib_name.decode)
7375
~default:[]
76+
and+ stdlib =
77+
field "stdlib"
78+
(Dune_lang.Syntax.since coq_syntax (0, 6) >>> enum ["yes", true; "no", false])
79+
~default:true
7480
in
7581
let plugins = merge_plugins_libraries ~plugins ~libraries in
76-
{ flags; mode; coq_lang_version; plugins; theories; loc }
82+
{ flags; mode; coq_lang_version; plugins; theories; stdlib; loc }
7783
end
7884

7985
module Extraction = struct

src/dune_rules/coq_stanza.mli

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module Buildable : sig
77
; mode : Loc.t * Coq_mode.t
88
; plugins : (Loc.t * Lib_name.t) list (** ocaml plugins *)
99
; theories : (Loc.t * Coq_lib_name.t) list (** coq libraries *)
10+
; stdlib : bool
1011
; loc : Loc.t
1112
}
1213
end

0 commit comments

Comments
 (0)