Skip to content
Browse files

[fix] windows,buildrules: factor build_dir, and workaround Option.bui…

…ld_dir behaviour
  • Loading branch information...
1 parent 9cad032 commit 28eccd9fcd2eebe0c2fac96029573ee1481d4d72 Rudy Sicard committed with OpaOnWindowsNow Oct 31, 2012
Showing with 13 additions and 5 deletions.
  1. +0 −1 tools/build/build_rules.ml
  2. +13 −4 tools/build/myocamlbuild_prefix.ml
View
1 tools/build/build_rules.ml
@@ -51,7 +51,6 @@ def_stubs ~dir:"ocamllib/appruntime" "io";
let prefixed_plugins_dir = prefix_me "lib" / "plugins" in
let libbase_dir = prefix_me "ocamllib" / "libbase" in
-let build_dir = Pathname.pwd / !Options.build_dir in
let extralib_opt = function
| Some (lib,ldir,idir) ->
View
17 tools/build/myocamlbuild_prefix.ml
@@ -19,6 +19,15 @@ let opalang_prefix =
let prefix_me s = opalang_prefix ^ s
+let build_dir =
+ if (Pathname.is_relative !Options.build_dir)
+ && not (Pathname.is_prefix Pathname.pwd !Options.build_dir)
+ (*is_relative does not work on cygwin/windows*)
+ then
+ Pathname.pwd / !Options.build_dir
+ else
+ !Options.build_dir
+
(**
{6 Portability utility functions }
*)
@@ -109,7 +118,7 @@ let build_list build targets =
List.iter Outcome.ignore_good (build (List.map (fun f -> [f]) targets))
let mlstatelibs = try Sys.getenv "MLSTATELIBS" with
- Not_found -> Pathname.pwd / !Options.build_dir
+ Not_found -> build_dir
type tool_type = Internal of Pathname.t | External of Pathname.t
let tools_table = (Hashtbl.create 17: (string, tool_type) Hashtbl.t)
@@ -131,7 +140,7 @@ let get_tool ?local:(local=false) name =
try
(match Hashtbl.find tools_table name with
| Internal f ->
- let f = if local then f else Pathname.pwd / !Options.build_dir / f in
+ let f = if local then f else build_dir / f in
let wintools_b, winf = try
let c = List.assoc name as_wintools in
true, (if c <> "" then c else (wingate f))
@@ -145,7 +154,7 @@ let get_tool ?local:(local=false) name =
let force_copy_tool t =
List.iter
(fun x ->
- let dir = Pathname.pwd / !Options.build_dir / Pathname.dirname x in
+ let dir = build_dir / Pathname.dirname x in
Command.execute
(Seq [ Cmd(S[P"mkdir"; A"-p"; P dir]);
cp x dir;
@@ -565,7 +574,7 @@ let _ = dispatch begin function
);
(* for C #includes *)
- flag ["extension:c"] (S[A"-I";P (Pathname.pwd / !Options.build_dir)]);
+ flag ["extension:c"] (S[A"-I";P (build_dir)]);
(* -- Directory contexts -- *)

0 comments on commit 28eccd9

Please sign in to comment.
Something went wrong with that request. Please try again.