mxe/src/ocaml-native-1-fixes.patch

112 lines
3.4 KiB
Diff
Raw Normal View History

2012-10-04 13:47:35 +01:00
This file is part of MXE.
See index.html for further information.
Contains ad hoc patches for cross building.
2013-01-14 22:48:43 +00:00
From 93d5a514d545567b194af9b9fba0954bb82565e3 Mon Sep 17 00:00:00 2001
2012-10-04 13:47:35 +01:00
From: MXE
Date: Wed, 3 Oct 2012 09:25:11 +0200
2013-01-14 22:48:43 +00:00
Subject: [PATCH 1/2] findlib.ml
2012-10-04 13:47:35 +01:00
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;
--
2013-01-14 22:48:43 +00:00
1.7.9.5
2012-10-04 13:47:35 +01:00
2013-01-14 22:48:43 +00:00
From b2ce063eee6dca5b3cd67bdb59d2a11ed2043995 Mon Sep 17 00:00:00 2001
2012-10-04 13:47:35 +01:00
From: MXE
Date: Wed, 3 Oct 2012 09:31:13 +0200
2013-01-14 22:48:43 +00:00
Subject: [PATCH 2/2] options : support for prefixed ocaml-tools with
ocamlfind
2012-10-04 13:47:35 +01:00
diff --git a/ocamlbuild/options.ml b/ocamlbuild/options.ml
index 1be4b63..48f6648 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"; "ocamlfind"]
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
--
2013-01-14 22:48:43 +00:00
1.7.9.5
2012-10-04 13:47:35 +01:00