From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.7 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 3B451BB84 for ; Mon, 9 Feb 2009 22:24:46 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AosCAIMtkEnUGyoDlGdsb2JhbACUOQEBAQEJCwgJEQO8VoQaBg X-IronPort-AV: E=Sophos;i="4.37,406,1231110000"; d="scan'208";a="20864575" Received: from smtp3-g21.free.fr ([212.27.42.3]) by mail2-smtp-roc.national.inria.fr with ESMTP; 09 Feb 2009 22:24:45 +0100 Received: from smtp3-g21.free.fr (localhost [127.0.0.1]) by smtp3-g21.free.fr (Postfix) with ESMTP id 28133818166; Mon, 9 Feb 2009 22:24:39 +0100 (CET) Received: from [192.168.0.10] (cac94-7-82-243-25-161.fbx.proxad.net [82.243.25.161]) by smtp3-g21.free.fr (Postfix) with ESMTP id 1D0A681816C; Mon, 9 Feb 2009 22:24:37 +0100 (CET) Message-ID: <49909F14.6010601@doomeer.com> Date: Mon, 09 Feb 2009 22:24:36 +0100 From: DooMeeR User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: Jon Harrop Cc: caml-list@yquem.inria.fr Subject: Re: ocamlbuild documentation (was Re: [Caml-list] Re: [ANN] OCaml Batteries Included, alpha 3) References: <1233936696.6216.65.camel@Blefuscu> <0520EBEC-B30C-4D83-9153-A72BC3C986BF@erratique.ch> <499036C6.5070504@lri.fr> <200902091828.30057.jon@ffconsultancy.com> In-Reply-To: <200902091828.30057.jon@ffconsultancy.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; ocaml:01 ocamlopt:01 foo:01 lablgl:01 lablgl:01 cmxa:01 lablglut:01 cmxa:01 foo:01 ocaml:01 lib:01 extern:01 lib:01 extern:01 lablglut:01 I'll skip over the documentation questions because people are beginning to say that I troll too much :p > Instead, I found that ocamlbuild replaces my current build option of choice: > > ocamlopt foo.ml -I +lablGL lablgl.cmxa lablglut.cmxa foo.ml -o foo > > with lots of incidental complexity: > > $ cat myocamlbuild.ml > open Ocamlbuild_plugin;; > open Command;; > > dispatch begin function > | After_rules -> > ocaml_lib ~extern:true ~dir:"+lablGL" "lablgl"; > ocaml_lib ~extern:true ~dir:"+lablGL" "lablglut"; > | _ -> () > end;; > > $ cat _tags > : use_lablgl, use_lablglut > <**/*.ml>: use_lablgl > > $ ocamlbuild foo.native This is, indeed, and in my opinion, one of the BIGGEST problem with Ocamlbuild right now. In fact you didn't chose the easiest solution, which is: ocamlbuild -cflags -I,+lablGL -lflags -I,+lablGL -lib lablgl -lib lablglut foo.native However, this is of course very hackish, not documented (took me a while to figure that this was the simplest way of using a library), and still not satisfying at all. The extension of Ocamlbuild I am working on should allow you to replace this by: ocamlbuild -pkg lablGL.glut foo.native (the package lablGL.glut depends on the package lablGL, which will thus be included automatically) I will work on an extension to allow tags such as use_pkg(lablGL.glut) to put this in a _tag file if you get tired of using the command line option. This will require findlib though. If you do not have findlib, another solution I may implement someday would be: ocamlbuild -libs +lablGL/lablgl,+lablGL/lablglut foo.native Which is still better than the solution using ocamlopt directly IMO (because here, ocamlbuild can at least guess whether it should include the .cmxa or the .cma). Now, I don't think it will happen someday that Ocamlbuild will be able to guess that lablGL should be included. It raises too many questions :( -- Romain Bardou