From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id pASFX8Oj031979 for ; Mon, 28 Nov 2011 16:33:08 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjIBAC2p007RVdY2imdsb2JhbABDqnYIIgEBAQoJDQcSBiGCCwIsAQE3ASgmRgEFASI1h2WaCAqKM4QWAY4oB4l/Y44FlCE9g3c X-IronPort-AV: E=Sophos;i="4.69,584,1315173600"; d="scan'208,223";a="132992798" Received: from mail-bw0-f54.google.com ([209.85.214.54]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 28 Nov 2011 16:33:03 +0100 Received: by bkbzs8 with SMTP id zs8so12830588bkb.27 for ; Mon, 28 Nov 2011 07:33:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=from:content-type:subject:date:message-id:cc:to:mime-version :x-mailer; bh=zhIgivhROFm1/pDo31oIWfcrNZEVTG1nij0VQjeOSCY=; b=uAg6bQrDitCwHeWltrOwHK7JnJUbfzyUhqmX6BG8hM3z9VcmCBAyXDNsZaP1lpHGB7 vEAVhuk9ybWw4eMamt6q9EKFXVQp9tfZhlJvpm68ARap8r5H0NAFlw8f4pYZgCsB7uai KW5FSgWZXQMakuuXviWr60jmX7GwN9MZSrzS4= Received: by 10.204.128.77 with SMTP id j13mr14613539bks.124.1322494382981; Mon, 28 Nov 2011 07:33:02 -0800 (PST) Received: from coruscant.kosmos.all (ip-95-223-170-32.unitymediagroup.de. [95.223.170.32]) by mx.google.com with ESMTPS id fa8sm22107351bkc.14.2011.11.28.07.33.00 (version=SSLv3 cipher=OTHER); Mon, 28 Nov 2011 07:33:01 -0800 (PST) From: Benedikt Meurer Content-Type: multipart/mixed; boundary="Apple-Mail=_4872E734-0BC3-4AE5-9117-A5929457682A" Date: Mon, 28 Nov 2011 16:32:59 +0100 Message-Id: <982F7673-E945-4E19-80B9-A0EB7B054640@googlemail.com> Cc: caml-list@inria.fr To: Gerd Stolpmann Mime-Version: 1.0 (Apple Message framework v1251.1) X-Mailer: Apple Mail (2.1251.1) Subject: [Caml-list] Add support for ocamlmklib subcommand to ocamlfind --Apple-Mail=_4872E734-0BC3-4AE5-9117-A5929457682A Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hey, Attached is a simple patch for findlib 1.2.7, which adds support for a new = subcommand "ocamlmklib" to ocamlfind. This (combined with an appropriate fi= x to OASIS) makes it easier to cross-compile projects using OASIS and C sou= rces. I'm not sure about the predicates to use for ocamlmklib, it's "byte" = and "native" in the patch, but it may be safer to specify no defaults at al= l. greets, Benedikt --Apple-Mail=_4872E734-0BC3-4AE5-9117-A5929457682A Content-Disposition: attachment; filename=0001-Add-support-for-a-new-ocamlmklib-subcommand.patch Content-Type: application/octet-stream; name="0001-Add-support-for-a-new-ocamlmklib-subcommand.patch" Content-Transfer-Encoding: quoted-printable >From 662f62575c44ef21c47e69092012754e48c24523 Mon Sep 17 00:00:00 2001=0A= From: Benedikt Meurer =0A= Date: Mon, 28 Nov 2011 16:26:39 +0100=0A= Subject: [PATCH] Add support for a new "ocamlmklib" subcommand.=0A= =0A= ---=0A= src/findlib/findlib.ml | 19 +++++++++++++------=0A= src/findlib/findlib.mli | 19 ++++++++++---------=0A= src/findlib/frontend.ml | 12 +++++++++++-=0A= 3 files changed, 34 insertions(+), 16 deletions(-)=0A= =0A= diff --git a/src/findlib/findlib.ml b/src/findlib/findlib.ml=0A= index 1ea162b..a432906 100644=0A= --- a/src/findlib/findlib.ml=0A= +++ b/src/findlib/findlib.ml=0A= @@ -24,6 +24,7 @@ let conf_ignore_dups_in =3D ref (None : string option);;= =0A= let ocamlc_default =3D "ocamlc";;=0A= let ocamlopt_default =3D "ocamlopt";;=0A= let ocamlcp_default =3D "ocamlcp";;=0A= +let ocamlmklib_default =3D "ocamlmklib";;=0A= let ocamlmktop_default =3D "ocamlmktop";;=0A= let ocamldep_default =3D "ocamldep";;=0A= let ocamlbrowser_default =3D "ocamlbrowser";;=0A= @@ -34,6 +35,7 @@ let init_manually=0A= ?(ocamlc_command =3D ocamlc_default)=0A= ?(ocamlopt_command =3D ocamlopt_default)=0A= ?(ocamlcp_command =3D ocamlcp_default)=0A= + ?(ocamlmklib_command =3D ocamlmklib_default)=0A= ?(ocamlmktop_command =3D ocamlmktop_default)=0A= ?(ocamldep_command =3D ocamldep_default)=0A= ?(ocamlbrowser_command =3D ocamlbrowser_default)=0A= @@ -47,6 +49,7 @@ let init_manually=0A= conf_command :=3D [ `ocamlc, ocamlc_command;=0A= `ocamlopt, ocamlopt_command;=0A= `ocamlcp, ocamlcp_command;=0A= + `ocamlmklib, ocamlmklib_command;=0A= `ocamlmktop, ocamlmktop_command;=0A= `ocamldep, ocamldep_command;=0A= `ocamlbrowser, ocamlbrowser_command;=0A= @@ -131,8 +134,8 @@ let init=0A= | None -> []=0A= | Some p -> [p] in=0A= =20=0A= - let sys_ocamlc, sys_ocamlopt, sys_ocamlcp, sys_ocamlmktop, sys_ocamldep,= =0A= - sys_ocamlbrowser, sys_ocamldoc,=0A= + let sys_ocamlc, sys_ocamlopt, sys_ocamlcp, sys_ocamlmklib,=0A= + sys_ocamlmktop, sys_ocamldep, sys_ocamlbrowser, sys_ocamldoc,=0A= sys_search_path, sys_destdir, sys_metadir, sys_stdlib, sys_ldconf = =3D=20=0A= (=0A= let config_vars =3D=0A= @@ -154,6 +157,7 @@ let init=0A= ( (lookup "ocamlc" ocamlc_default),=0A= (lookup "ocamlopt" ocamlopt_default),=0A= (lookup "ocamlcp" ocamlcp_default),=0A= + (lookup "ocamlmklib" ocamlmklib_default),=0A= (lookup "ocamlmktop" ocamlmktop_default),=0A= (lookup "ocamldep" ocamldep_default),=0A= (lookup "ocamlbrowser" ocamlbrowser_default),=0A= @@ -166,8 +170,9 @@ let init=0A= )=0A= )=0A= else=0A= - ( ocamlc_default, ocamlopt_default, ocamlcp_default, ocamlmktop_default,= =0A= - ocamldep_default, ocamlbrowser_default, ocamldoc_default,=0A= + ( ocamlc_default, ocamlopt_default, ocamlcp_default, ocamlmklib_default,= =0A= + ocamlmktop_default, ocamldep_default, ocamlbrowser_default,=0A= + ocamldoc_default,=0A= [],=0A= "",=0A= "none",=0A= @@ -226,12 +231,13 @@ let init=0A= try Some(Sys.getenv "OCAMLFIND_IGNORE_DUPS_IN")=20=0A= with Not_found -> None in=0A= =20=0A= - let ocamlc, ocamlopt, ocamlcp, ocamlmktop, ocamldep, ocamlbrowser,=0A= - ocamldoc,=0A= + let ocamlc, ocamlopt, ocamlcp, ocamlmklib, ocamlmktop,=0A= + ocamldep, ocamlbrowser, ocamldoc,=0A= search_path, destdir, metadir, stdlib, ldconf =3D=0A= (try List.assoc "ocamlc" env_commands with Not_found -> sys_ocamlc= ),=0A= (try List.assoc "ocamlopt" env_commands with Not_found -> sys_ocamlo= pt),=0A= (try List.assoc "ocamlcp" env_commands with Not_found -> sys_ocamlc= p),=0A= + (try List.assoc "ocamlmklib" env_commands with Not_found -> sys_ocamlm= klib),=0A= (try List.assoc "ocamlmktop" env_commands with Not_found -> sys_ocamlm= ktop),=0A= (try List.assoc "ocamldep" env_commands with Not_found -> sys_ocamld= ep),=0A= (try List.assoc "ocamlbrowser" env_commands with Not_found -> sys_ocam= lbrowser),=0A= @@ -247,6 +253,7 @@ let init=0A= ~ocamlc_command: ocamlc=0A= ~ocamlopt_command: ocamlopt=0A= ~ocamlcp_command: ocamlcp=0A= + ~ocamlmklib_command: ocamlmklib=0A= ~ocamlmktop_command: ocamlmktop=0A= ~ocamldep_command: ocamldep=0A= ~ocamlbrowser_command: ocamlbrowser=0A= diff --git a/src/findlib/findlib.mli b/src/findlib/findlib.mli=0A= index e22a39d..1b704af 100644=0A= --- a/src/findlib/findlib.mli=0A= +++ b/src/findlib/findlib.mli=0A= @@ -56,13 +56,13 @@ val init :=0A= * The special value ["none"] turns this feature off.=0A= * - The search path is the concatenation of the env variable OCAMLPATH= =0A= * and the variable [path] of the config file=0A= - * - The executables of (ocamlc|ocamlopt|ocamlcp|ocamlmktop) are determi= ned=0A= - * as follows: if the env variable OCAMLFIND_COMMANDS is set and non-e= mpty,=0A= - * its contents specify the executables. Otherwise, if the config file= =0A= - * variables [ocamlc], [ocamlopt], [ocamlcp] and [ocamlmktop] are set,= =0A= - * their contents specify the executables. Otherwise, the obvious defa= ult=0A= - * values are chosen: ["ocamlc"] for [ocamlc], ["ocamlopt"] for [ocaml= opt],=0A= - * and so on.=0A= + * - The executables of (ocamlc|ocamlopt|ocamlcp|ocamlmklib|ocamlmktop) = are=0A= + * determined as follows: if the env variable OCAMLFIND_COMMANDS is set= =0A= + * and non-empty, its contents specify the executables. Otherwise, if = the=0A= + * config file variables [ocamlc], [ocamlopt], [ocamlcp], [ocamlmklib]= and=0A= + * [ocamlmktop] are set, their contents specify the executables. Other= wise,=0A= + * the obvious default values are chosen: ["ocamlc"] for [ocamlc],=0A= + * ["ocamlopt"] for [ocamlopt], and so on.=0A= * - The directory of the standard library is the value of the environme= nt=0A= * variable CAMLLIB (or OCAMLLIB), or if unset or empty, the value of= =0A= * the configuration variable [stdlib], or if unset the built-in locat= ion=0A= @@ -77,6 +77,7 @@ val init_manually :=0A= ?ocamlc_command: string -> (* default: "ocamlc" *)=0A= ?ocamlopt_command: string -> (* default: "ocamlopt" *)=0A= ?ocamlcp_command: string -> (* default: "ocamlcp" *)=0A= + ?ocamlmklib_command: string -> (* default: "ocamlmklib" *)=0A= ?ocamlmktop_command: string -> (* default: "ocamlmktop" *)=0A= ?ocamldep_command: string -> (* default: "ocamldep" *)=0A= ?ocamlbrowser_command: string -> (* default: "ocamlbrowser" *)=0A= @@ -105,8 +106,8 @@ val meta_directory : unit -> string=0A= val search_path : unit -> string list=0A= (** Get the search path for packages *)=0A= =20=0A= -val command : [ `ocamlc | `ocamlopt | `ocamlcp | `ocamlmktop | `ocamldep= =0A= - | `ocamlbrowser | `ocamldoc=0A= +val command : [ `ocamlc | `ocamlopt | `ocamlcp | `ocamlmklib=20=0A= + | `ocamlmktop | `ocamldep | `ocamlbrowser | `ocamldoc=0A= ] ->=20=0A= string=0A= (** Get the name/path of the executable *)=0A= diff --git a/src/findlib/frontend.ml b/src/findlib/frontend.ml=0A= index 813180d..a453605 100644=0A= --- a/src/findlib/frontend.ml=0A= +++ b/src/findlib/frontend.ml=0A= @@ -722,6 +722,7 @@ let ocamlc which () =3D=0A= match which with=0A= | "ocamlc" -> Ocaml_args.ocamlc_spec=0A= | "ocamlcp" -> Ocaml_args.ocamlcp_spec=0A= + | "ocamlmklib" -> Ocaml_args.ocamlmklib_spec=0A= | "ocamlmktop" -> Ocaml_args.ocamlmktop_spec=0A= | "ocamlopt" -> Ocaml_args.ocamlopt_spec=0A= | _ -> None in=0A= @@ -752,7 +753,7 @@ let ocamlc which () =3D=0A= "-ignore-error", Arg.Set ignore_error,=0A= " Ignore the 'error' directive in META files";=0A= "-passopt", Arg.String (fun s -> pass_options :=3D !pass_options @ [= s]),=0A= - " Pass option directly to ocamlc/opt/mktop\n= STANDARD OPTIONS:";=0A= + " Pass option directly to ocamlc/opt/mklib/m= ktop\nSTANDARD OPTIONS:";=0A= ];=0A= =20=0A= merge_native_arguments=20=0A= @@ -795,6 +796,7 @@ let ocamlc which () =3D=0A= begin match which with=0A= "ocamlc" -> predicates :=3D "byte" :: !predicates;=0A= | "ocamlcp" -> predicates :=3D "byte" :: !predicates;=0A= + | "ocamlmklib" -> predicates :=3D "byte" :: "native" :: !predicates;=0A= | "ocamlmktop" -> predicates :=3D "byte" :: "create_toploop" :: !predica= tes;=0A= | "ocamlopt" -> predicates :=3D "native" :: !predicates;=0A= | _ -> failwith "unsupported backend"=0A= @@ -1066,7 +1068,12 @@ let ocamlc which () =3D=0A= (fun pkg -> ["-dllpath"; slashify pkg] )=0A= dll_dirs) in=0A= =20=0A= + let mklib_options =3D=0A= + ["-ocamlc"; Findlib.command `ocamlc;=0A= + "-ocamlopt"; Findlib.command `ocamlopt] in=0A= +=0A= let arguments =3D=0A= + (if which =3D "ocamlmklib" then mklib_options else []) @=0A= !pass_options @ (* other options from the command line *)=0A= i_options @ (* Generated -I options from package analysis *)=0A= pp_command @ (* Optional preprocessor command *)=0A= @@ -1082,6 +1089,7 @@ let ocamlc which () =3D=0A= "ocamlc" -> Findlib.command `ocamlc=0A= | "ocamlopt" -> Findlib.command `ocamlopt=0A= | "ocamlcp" -> Findlib.command `ocamlcp=0A= + | "ocamlmklib" -> Findlib.command `ocamlmklib=0A= | "ocamlmktop" -> Findlib.command `ocamlmktop=0A= | _ -> assert false=0A= in=0A= @@ -2071,6 +2079,7 @@ let rec select_mode () =3D=0A= | ("remove"|"-remove") -> incr Arg.current; M_remove= =0A= | ("ocamlc"|"-ocamlc"|"c") -> incr Arg.current; M_compiler= "ocamlc"=0A= | ("ocamlcp"|"-ocamlcp"|"cp") -> incr Arg.current; M_compiler= "ocamlcp"=0A= + | ("ocamlmklib"|"-ocamlmklib"|"mklib") -> incr Arg.current; M_compiler= "ocamlmklib"=0A= | ("ocamlmktop"|"-ocamlmktop"|"mktop") -> incr Arg.current; M_compiler= "ocamlmktop"=0A= | ("ocamlopt"|"-ocamlopt"|"opt") -> incr Arg.current; M_compiler= "ocamlopt"=0A= | ("ocamldep"|"-ocamldep"|"dep") -> incr Arg.current; M_dep=0A= @@ -2126,6 +2135,7 @@ let main() =3D=0A= prerr_endline "Usage: ocamlfind query [-help | other options]= ...";=0A= prerr_endline " or: ocamlfind ocamlc [-help | other options]= ...";=0A= prerr_endline " or: ocamlfind ocamlcp [-help | other options]= ...";=0A= + prerr_endline " or: ocamlfind ocamlmklib [-help | other options]= ...";=0A= prerr_endline " or: ocamlfind ocamlmktop [-help | other options]= ...";=0A= prerr_endline " or: ocamlfind ocamlopt [-help | other options]= ...";=0A= prerr_endline " or: ocamlfind ocamldep [-help | other options]= ...";=0A= --=20=0A= 1.7.5.4=0A= =0A= --Apple-Mail=_4872E734-0BC3-4AE5-9117-A5929457682A--