From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 0DAF781799 for ; Fri, 26 Jul 2013 06:49:48 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of gabriel.scherer@gmail.com) identity=pra; client-ip=209.85.214.45; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of gabriel.scherer@gmail.com designates 209.85.214.45 as permitted sender) identity=mailfrom; client-ip=209.85.214.45; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-bk0-f45.google.com) identity=helo; client-ip=209.85.214.45; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="postmaster@mail-bk0-f45.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnIEAJX/8VHRVdYtk2dsb2JhbABAGoM7UKs8kiUEAYEOCBYOAQEBAQcLCwkUBCSCJAEBBAEnGQEbEgsBAwELBgULDQ0hIQEBEQEFAQoSBhMSCIdjAQMJBgwzmxiMT4J/hEAKGScDCmSHdAEFDI0JgSMtZTMHhAADlXaBaYEpin6DQRYphDw6 X-IPAS-Result: AnIEAJX/8VHRVdYtk2dsb2JhbABAGoM7UKs8kiUEAYEOCBYOAQEBAQcLCwkUBCSCJAEBBAEnGQEbEgsBAwELBgULDQ0hIQEBEQEFAQoSBhMSCIdjAQMJBgwzmxiMT4J/hEAKGScDCmSHdAEFDI0JgSMtZTMHhAADlXaBaYEpin6DQRYphDw6 X-IronPort-AV: E=Sophos;i="4.89,748,1367964000"; d="scan'208";a="22301236" Received: from mail-bk0-f45.google.com ([209.85.214.45]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 26 Jul 2013 06:49:47 +0200 Received: by mail-bk0-f45.google.com with SMTP id je9so946160bkc.32 for ; Thu, 25 Jul 2013 21:49:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=WOytz3h4cOtiAaku1R0phk6aAR4Cbn5UWF8Ji217YUE=; b=MTlR1pKhNxf0yd2uEXWFWrale/BfyFi45e6SSszG7WSEa3s9rBri0JWcdsvmMcNwid ozDkglzG4hYdLlFv9wKHff9/in+Pc8amQM5Jc+Wb6CtDDB0MTwIkyNnh3FJ/sVlqftws jO2UrWtk53CZx5UYfI5I0hFmuKD8Sg6Os8Qdi6vyY9qb6PO6aTpzuxnuv6mefr/GZgNl VSpp6pNFlhf8eqPWkmdoIgRqxmox0thxfmT1E1ZAZ0px9DusbYasntx03HMAOgDypfdj yFUz6S4KWaANu04zCUgEs5fxLrOluqlSuwcZzhV/Xji3lzODle9vncfpEIl8NteKq5Hd /76A== X-Received: by 10.204.241.75 with SMTP id ld11mr2041028bkb.35.1374814186538; Thu, 25 Jul 2013 21:49:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.204.20.131 with HTTP; Thu, 25 Jul 2013 21:49:04 -0700 (PDT) In-Reply-To: References: <51ECF4EB.1060301@libertysurf.fr> <1672419877.217810363.1374484053368.JavaMail.root@zimbra27-e5.priv.proxad.net> <20130723153956.605104b3@xivilization.net> From: Gabriel Scherer Date: Fri, 26 Jul 2013 06:49:04 +0200 Message-ID: To: Martin DeMello Cc: Marek Kubica , r.3@libertysurf.fr, "caml-list@inria.fr" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] which ocaml build system > You can see the pretty simple makefile here: > https://github.com/martindemello/varix/blob/master/makefile - I can't > remember exactly what difficulties I had with ocamlbuild and omake > now. We all love ocamlbuild exercises in the morning! First, I was unable to build your project using the makefile on my machine (simple 3.12.1 OCaml with Debian package), because of the mix of libs that now use Camlp4, and Ledit code integrated into your project. I took the quick route, removed dependency on ledit code (by removing the relevant target from your makefile) and replaced the code of the "let readline prompt" function of varix.ml by an "assert false". Then your makefile succeeded in compiling the program (that is, once I added a META file to the aurochs sources for aurochs_lib). Porting this working makefile to ocamlbuild was then extremely easy. (1) You use the following ocamlfind packages: PACKS =3D unix bigarray str mikmatch_pcre pcre batteries aurochs_lib to which correspond the following line in a _tags file: true: package(unix), package(bigarray), package(str), \ package(mikmatch_pcre), package(pcre), package(batteries), \ package(aurochs_lib) (remember to compile with "ocamlbuild -use-ocamlfind" to enable direct ocamlfind use; otherwise you'll get a build error with these) (you may want to be a tad more specific about which modules of your code use which packages; or at least you now have the possibility to be more specific.) (2) I had to ask ocamlbuild not to look into the ledit/ directory to avoid hygiene complaints. Again in _tags "ledit": -traverse (3) You use camlp4 preprocessing. Again in _tags: true: syntax(camlp4o) (4) You have a rule to build a .ml from a .peg: vx.ml: vx.peg aurochs -target ml vx.peg ocamlbuild doesn't support aurochs out-of-the-box, so we need to add a new rule in a myocamlbuild.ml plugin. This looks like the beginning of bad news (nobody likes to write myocamlbuild.ml plugins), but the Google link for "ocamlbuild plugin" brought me to http://brion.inria.fr/gallium/index.php/Using_alphaCaml_with_ocamlbuild which is *exactly* your use-case (building a .ml/.mli pair from an external tool). I copy-pasted the plugin code in the link above, adapting it lightly: open Ocamlbuild_plugin;; open Command;; let alphaCaml =3D A"aurochs";; dispatch begin function | After_rules -> rule "aurochs: peg -> ml" ~prods:["%.ml"; "%.mli"] ~dep:"%.peg" begin fun env _build -> Cmd(S[alphaCaml; A"-target"; A"ml"; P(env "%.peg")]) end; | _ -> () end Note that the makefile rule says you only produce a .ml, but aurochs in fact produce a .ml and .mli. I initially only had ~prods:["%.ml"] because I believed the makefile, and that caused a build failure. (5) Voil=E0: ocamlbuild -use-ocamlfind varix.native If you're tired of adding -use-ocamlfind each time, you can also add Options.use_ocamlfind :=3D true;; to myocamlbuild.ml The META I added to aurochs and the changes I did to varix are available at: https://github.com/gasche/aurochs https://github.com/gasche/varix Note that I have no particular opinion on which build system *you* should be using -- probably the one that you find most convenient. On Thu, Jul 25, 2013 at 11:45 PM, Martin DeMello wrote: > On Tue, Jul 23, 2013 at 6:39 AM, Marek Kubica wr= ote: >> >>> I would like to gather thoughts on that in the ocaml.org website, >>> because actually its advice is 'make + OcamlMakefile' and 'Omake', >>> and I am not sure it is the best advice. >> >> I suppose this advice used to be good, but today maybe not as much >> anymore. > > I have an old (and fairly small) project that I've tried at least > thrice to migrate off OcamlMakefile to something more > modern/ocaml-specific, and failed each time (after spending 1-2 > evenings on it). I'll give it another go and report back on my > experience, but at least historically OCamlMakefile was the easiest > thing to get up and running. > > You can see the pretty simple makefile here: > https://github.com/martindemello/varix/blob/master/makefile - I can't > remember exactly what difficulties I had with ocamlbuild and omake > now. > > martin > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs