aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmilio Jesus Gallego Arias2019-02-04 18:16:39 +0100
committerEmilio Jesus Gallego Arias2019-02-04 18:16:39 +0100
commit0439543db9f3be84d59cfdc1dcad34bd114036e3 (patch)
treec116ee4f057c34109abfc5fc27a45e57cad436a7
parentc70412ec8b0bb34b7a5607c07d34607a147d834c (diff)
[dune] Fix Dune build in Windows.
In order for Dune to work in Windows we need to tweak some script calls, they need a POSIX shell and the `(run ...)` / `(system ...)` actions use `cmd.exe` on Windows. Hopefully, we will rely less on `bash` when Dune can understand Coq libraries. This affects shell scripts in `kernel/**.sh` for example. It is interesting to see how faster the Coq Windows build is with Dune + Windows. There are some problems with PATHs that prevent the test suite from working, these will be fixed in a future PR.
-rw-r--r--Makefile.dune2
-rw-r--r--dune4
-rw-r--r--kernel/byterun/dune4
-rw-r--r--kernel/dune4
-rw-r--r--test-suite/misc/universes/dune2
-rw-r--r--tools/coq_dune.ml9
6 files changed, 15 insertions, 10 deletions
diff --git a/Makefile.dune b/Makefile.dune
index ee3e2d6cb7..78ecc4b056 100644
--- a/Makefile.dune
+++ b/Makefile.dune
@@ -40,7 +40,7 @@ help:
voboot:
dune build $(DUNEOPT) @vodeps
- dune exec coq_dune $(BUILD_CONTEXT)/.vfiles.d
+ dune exec ./tools/coq_dune.exe $(BUILD_CONTEXT)/.vfiles.d
states: voboot
dune build $(DUNEOPT) theories/Init/Prelude.vo
diff --git a/dune b/dune
index 1706cb44b1..95041512e2 100644
--- a/dune
+++ b/dune
@@ -19,7 +19,7 @@
(deps
(source_tree theories)
(source_tree plugins))
- (action (with-stdout-to .vfiles.d (system "%{bin:coqdep} -dyndep opt -noglob -boot `find theories plugins -type f -name *.v`"))))
+ (action (with-stdout-to .vfiles.d (bash "%{bin:coqdep} -dyndep opt -noglob -boot `find theories plugins -type f -name *.v`"))))
(alias
(name vodeps)
@@ -35,7 +35,7 @@
(rule
(targets revision)
(deps (:rev-script dev/tools/make_git_revision.sh))
- (action (with-stdout-to revision (run %{rev-script}))))
+ (action (with-stdout-to revision (bash %{rev-script}))))
; Use summary.log as the target
(alias
diff --git a/kernel/byterun/dune b/kernel/byterun/dune
index 3a714a8a59..c3c44670be 100644
--- a/kernel/byterun/dune
+++ b/kernel/byterun/dune
@@ -6,5 +6,5 @@
(rule
(targets coq_jumptbl.h)
- (deps (:h-file coq_instruct.h))
- (action (run ./make_jumptbl.sh %{h-file} %{targets})))
+ (deps (:h-file coq_instruct.h) make_jumptbl.sh)
+ (action (bash "./make_jumptbl.sh %{h-file} %{targets}")))
diff --git a/kernel/dune b/kernel/dune
index 79161519ba..1f2d696a36 100644
--- a/kernel/dune
+++ b/kernel/dune
@@ -8,8 +8,8 @@
(rule
(targets copcodes.ml)
- (deps (:h-file byterun/coq_instruct.h) make-opcodes)
- (action (run ./make_opcodes.sh %{h-file} %{targets})))
+ (deps (:h-file byterun/coq_instruct.h) make-opcodes make_opcodes.sh)
+ (action (bash "./make_opcodes.sh %{h-file} %{targets}")))
(executable
(name write_uint63)
diff --git a/test-suite/misc/universes/dune b/test-suite/misc/universes/dune
index 58bba300d2..0772f95604 100644
--- a/test-suite/misc/universes/dune
+++ b/test-suite/misc/universes/dune
@@ -5,4 +5,4 @@
(source_tree ../../../plugins))
(action
(with-outputs-to all_stdlib.v
- (run ./build_all_stdlib.sh))))
+ (bash "./build_all_stdlib.sh"))))
diff --git a/tools/coq_dune.ml b/tools/coq_dune.ml
index 6681b79e38..68371edcb1 100644
--- a/tools/coq_dune.ml
+++ b/tools/coq_dune.ml
@@ -271,8 +271,13 @@ let exec_ifile f =
match Array.length Sys.argv with
| 1 -> f stdin
| 2 ->
- let ic = open_in Sys.argv.(1) in
- (try f ic with _ -> close_in ic)
+ let in_file = Sys.argv.(1) in
+ begin try
+ let ic = open_in in_file in
+ (try f ic
+ with _ -> eprintf "Error: exec_ifile@\n%!"; close_in ic)
+ with _ -> eprintf "Error: cannot open input file %s@\n%!" in_file
+ end
| _ -> eprintf "Error: wrong number of arguments@\n%!"; exit 1
let _ =