Skip to content

Commit 435cd89

Browse files
committed
added myocamlbuild and setup.ml back.
They have useful code.
1 parent 0b714fa commit 435cd89

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

myocamlbuild.ml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
(* OASIS_START *)
2+
(* OASIS_STOP *)
3+
let oasis_env =
4+
BaseEnvLight.load
5+
~filename:MyOCamlbuildBase.env_filename
6+
~allow_empty:true
7+
()
8+
let nonempty = function (A s) -> String.length s != 0 | _ -> true
9+
let expand s = BaseEnvLight.var_expand s oasis_env;;
10+
11+
rule "piqic: piqi -> .ml & _ext.ml"
12+
~prods:["%_piqi.ml"; "%_piqi_ext.ml"]
13+
~deps:["%.piqi"]
14+
(fun env _ ->
15+
Cmd(S (List.filter nonempty [A (expand "${piqic}"); A (expand "${piqic_flags}"); A "-I"; A ".."; A (env "%.piqi"); A"--multi-format"])));;
16+
17+
Ocamlbuild_plugin.dispatch dispatch_default;;

setup.ml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
(* OASIS_START *)
2+
(* OASIS_STOP *)
3+
4+
let def_piqic (() : unit) : unit =
5+
let chop str = try
6+
Filename.chop_extension str
7+
with _ -> str in
8+
let piqic_path = BaseCheck.prog_best "piqic_path" ["piqic-ocaml"; "piqic"] () in
9+
BaseEnv.var_define "piqic_flags" (fun () ->
10+
if chop (Filename.basename (BaseEnv.var_get "piqic"))
11+
= "piqic"
12+
then "ocaml"
13+
else "") |> ignore;
14+
BaseEnv.var_define "piqic" (fun () ->
15+
if (BaseStandardVar.os_type () = "Cygwin") || (BaseStandardVar.os_type () = "Win32")
16+
then String.concat " "
17+
(OASISExec.run_read_output ~ctxt:!BaseContext.default "cygpath" [piqic_path])
18+
else piqic_path) |> ignore
19+
20+
let () =
21+
def_piqic ();
22+
setup ();;

0 commit comments

Comments
 (0)