Skip to content

Commit

Permalink
Re-add the ocamlbuild plugin lost in the reorganization.
Browse files Browse the repository at this point in the history
  • Loading branch information
pgj committed Aug 2, 2012
1 parent f7537f4 commit 75ea494
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions packages/myocamlbuild.ml
@@ -0,0 +1,29 @@
open Ocamlbuild_plugin;;
open Command;;

module Util = struct
let split s ch =
let x = ref [] in
let rec go s =
let pos = String.index s ch in
x := (String.before s pos)::!x;
go (String.after s (pos + 1))
in
try
go s
with Not_found -> !x

let split_nl s = split s '\n'
let run_and_read x = List.hd (split_nl (Ocamlbuild_pack.My_unix.run_and_read x))
end

let query dir = Util.run_and_read ("ocamlfind query " ^ dir);;

dispatch begin function
| After_rules ->
flag ["camlp4of"; "build_syntax"]
(S[A "-I"; A "+camlp4"]);
flag ["compile"; "use_custom_stdlib"]
(S[A "-nostdlib"; A "-I"; A (query "mirage-stdlib")]);
| _ -> ()
end;;

0 comments on commit 75ea494

Please sign in to comment.