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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
This file is part of MXE.
See index.html for further information.
Contains ad hoc patches for cross building.
From 3a3ddccba8fa90a42551fb4d529c921c0aac4f63 Mon Sep 17 00:00:00 2001
From: MXE
Date: Wed, 3 Oct 2012 09:25:11 +0200
Subject: [PATCH] ocamlbuild : support for prefixed
ocaml{c,opt,mklib,mktop,find} tools
diff --git a/ocamlbuild/findlib.ml b/ocamlbuild/findlib.ml
index b5ef878..77454ed 100644
--- a/ocamlbuild/findlib.ml
+++ b/ocamlbuild/findlib.ml
@@ -44,7 +44,7 @@ let report_error e =
prerr_endline (string_of_error e);
exit 2
-let ocamlfind = "ocamlfind"
+let ocamlfind = "@target@-ocamlfind"
type package = {
name: string;
diff --git a/ocamlbuild/options.ml b/ocamlbuild/options.ml
index 1be4b63..e7313de 100644
--- a/ocamlbuild/options.ml
+++ b/ocamlbuild/options.ml
@@ -39,16 +39,17 @@ let use_menhir = ref false
let catch_errors = ref true
let use_ocamlfind = ref false
-let mk_virtual_solvers =
+let mk_virtual_solvers target =
let dir = Ocamlbuild_where.bindir in
List.iter begin fun cmd ->
- let opt = cmd ^ ".opt" in
+ let target_cmd = target^cmd in
+ let opt = target_cmd ^ ".opt" in
let a_opt = A opt in
- let a_cmd = A cmd in
+ let a_cmd = A target_cmd in
let search_in_path = memo Command.search_in_path in
let solver () =
if sys_file_exists !dir then
- let long = filename_concat !dir cmd in
+ let long = filename_concat !dir target_cmd in
let long_opt = long ^ ".opt" in
if file_or_exe_exists long_opt then A long_opt
else if file_or_exe_exists long then A long
@@ -61,9 +62,9 @@ let mk_virtual_solvers =
end
let () =
- mk_virtual_solvers
- ["ocamlc"; "ocamlopt"; "ocamldep"; "ocamldoc";
- "ocamlyacc"; "menhir"; "ocamllex"; "ocamlmklib"; "ocamlmktop"; "ocamlfind"]
+ mk_virtual_solvers "@target@-"
+ ["ocamlc"; "ocamlopt"; "ocamldep"; "ocamlmklib"; "ocamlmktop"; "ocamlfind"];
+ mk_virtual_solvers "" ["ocamldoc"; "ocamlyacc"; "menhir"; "ocamllex"]
let ocamlc = ref (V"OCAMLC")
let ocamlopt = ref (V"OCAMLOPT")
let ocamldep = ref (V"OCAMLDEP")
@@ -73,7 +74,7 @@ let ocamllex = ref (V"OCAMLLEX")
let ocamlmklib = ref (V"OCAMLMKLIB")
let ocamlmktop = ref (V"OCAMLMKTOP")
let ocamlrun = ref N
-let ocamlfind x = S[V"OCAMLFIND"; x]
+let ocamlfind = (V"OCAMLFIND")
let program_to_execute = ref false
let must_clean = ref false
let show_documentation = ref false
@@ -261,11 +262,19 @@ let init () =
(* TODO: warning message when using an option such as -ocamlc *)
(* Note that plugins can still modify these variables After_options.
This design decision can easily be changed. *)
- ocamlc := ocamlfind & A"ocamlc";
- ocamlopt := ocamlfind & A"ocamlopt";
- ocamldep := ocamlfind & A"ocamldep";
- ocamldoc := ocamlfind & A"ocamldoc";
- ocamlmktop := ocamlfind & A"ocamlmktop";
+ List.iter (fun (option,string) ->
+ (match !option with
+ | Sh s
+ | A s ->
+ Log.eprintf "Warning : Command '-%s %s' overidden by option -use-ocamlfind" string s
+ | _ -> ()
+ );
+ option := S[ocamlfind; A string]
+ ) [(ocamlc,"ocamlc");
+ (ocamlopt,"ocamlopt");
+ (ocamldep,"ocamldep");
+ (ocamldoc,"ocamldoc");
+ (ocamlmktop,"ocamlmktop")]
end;
let reorder x y = x := !x @ (List.concat (List.rev !y)) in
--
1.8.1.2
|