-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathconfigure
More file actions
executable file
·53 lines (44 loc) · 1.23 KB
/
Copy pathconfigure
File metadata and controls
executable file
·53 lines (44 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env ocaml -I +unix unix.cma
(* ./configure generates a file config.ml. *)
let version = "Zrun.2025"
let subversion = "dev"
let prefix = "_build/install/default/"
let suffix = "share/zrun"
(* let prefix = "_build/default/lib/std/" and suffix = "" *)
let prefix = ref (Filename.concat (Sys.getcwd ()) prefix)
let get_stdlib_prefix () = Filename.concat !prefix suffix
let get_current_date () =
let open Unix in
let t = gmtime @@ time () in
Printf.sprintf
"%.2d-%.2d-%d-%d:%d"
(1900 + t.tm_year) (1 + t.tm_mon) t.tm_mday
t.tm_hour t.tm_min
let () =
let options =
[
"--prefix", Arg.Set_string prefix, " Installation prefix";
]
in
Arg.parse
options
(fun cmd ->
Printf.eprintf "Don't know what to do with \"%s\".\n" cmd;
exit 1)
"Usage: ./configure [OPTIONS]";
(* Generate configuration module. *)
let statements =
let dquote s = "\"" ^ s ^ "\"" in
[
"version", dquote @@ version;
"subversion", dquote @@ subversion;
"stdlib", dquote @@ get_stdlib_prefix ();
"date", dquote @@ get_current_date ();
]
in
let oc = open_out_bin "config.ml" in
List.iter
(fun (x, s) -> Printf.fprintf oc {|let %s = %s
|} x s)
statements;
close_out oc;