forked from coq/coq
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try to get stdlib to not depend on coqc using (env (binaries))
Doesn't work properly. NB: if there's a coqc in PATH it appears to work, but if there's not it will say ~~~ Couldn't find Coq standard library, and theory is not using (stdlib no) ~~~
- Loading branch information
1 parent
69da2d8
commit a3a342e
Showing
6 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
; NB rocq dep will declare the dependency on the worker | ||
(env | ||
(_ | ||
(binaries | ||
(tools/rocqc.exe as coqc) | ||
(tools/rocqdep.exe as coqdep)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
(library | ||
(name rocq_info) | ||
(modules rocq_info)) | ||
|
||
(executable | ||
(name rocqc) | ||
(modules rocqc) | ||
(libraries rocq_info unix)) | ||
|
||
(executable | ||
(name rocqdep) | ||
(modules rocqdep) | ||
(libraries rocq_info unix)) | ||
|
||
(executable | ||
(name mkinfo) | ||
(modules mkinfo)) | ||
|
||
(rule | ||
(targets rocq_info.ml) | ||
(deps %{bin:rocq}) | ||
(action (with-stdout-to %{targets} (run ./mkinfo.exe %{deps})))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
let () = | ||
let hash = Digest.file Sys.argv.(1) in | ||
Printf.printf "let path = %S\n" Sys.argv.(1); | ||
Printf.printf "let hash = %S\n%!" (Digest.to_hex hash) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
val path : string | ||
val hash : string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
let () = | ||
match Sys.argv.(1) with | ||
| exception Invalid_argument _ -> () | ||
| "-debug-shim" -> | ||
Printf.eprintf "expected rocq hash = %s\n%!" Rocq_info.hash | ||
| _ -> () | ||
|
||
let exec_or_create_process prog argv = | ||
if Sys.os_type <> "Win32" then | ||
Unix.execv prog argv | ||
else | ||
let pid = Unix.create_process prog argv Unix.stdin Unix.stdout Unix.stderr in | ||
if pid = 0 then begin | ||
Printf.eprintf "coqc shim: create_process failed\n%!"; | ||
exit 127 | ||
end; | ||
let _, status = Unix.waitpid [] pid in | ||
match status with | ||
| WEXITED n | WSIGNALED n -> exit n | ||
| WSTOPPED _ -> | ||
(* is there anything sensible to do with WSTOPPED? can it even happen on windows? *) | ||
assert false | ||
|
||
let () = | ||
exec_or_create_process Rocq_info.path | ||
(Array.append [|Rocq_info.path;"compile"|] | ||
(Array.sub Sys.argv 1 (Array.length Sys.argv - 1))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
let () = | ||
match Sys.argv.(1) with | ||
| exception Invalid_argument _ -> () | ||
| "-debug-shim" -> | ||
Printf.eprintf "expected rocq hash = %s\n%!" Rocq_info.hash | ||
| _ -> () | ||
|
||
let exec_or_create_process prog argv = | ||
if Sys.os_type <> "Win32" then | ||
Unix.execv prog argv | ||
else | ||
let pid = Unix.create_process prog argv Unix.stdin Unix.stdout Unix.stderr in | ||
if pid = 0 then begin | ||
Printf.eprintf "coqc shim: create_process failed\n%!"; | ||
exit 127 | ||
end; | ||
let _, status = Unix.waitpid [] pid in | ||
match status with | ||
| WEXITED n | WSIGNALED n -> exit n | ||
| WSTOPPED _ -> | ||
(* is there anything sensible to do with WSTOPPED? can it even happen on windows? *) | ||
assert false | ||
|
||
let () = | ||
exec_or_create_process Rocq_info.path | ||
(Array.append [|Rocq_info.path;"dep"|] | ||
(Array.sub Sys.argv 1 (Array.length Sys.argv - 1))) |