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=1.1 required=5.0 tests=AWL,DNS_FROM_SECURITYSAGE autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id AC86ABBAF for ; Mon, 17 Nov 2008 10:53:48 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvgCAJHNIEnAXQImgWdsb2JhbACTVgEBFiK5UoJ5 X-IronPort-AV: E=Sophos;i="4.33,617,1220220000"; d="scan'208";a="20025498" Received: from discorde.inria.fr ([192.93.2.38]) by mail1-smtp-roc.national.inria.fr with ESMTP; 17 Nov 2008 10:53:48 +0100 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id mAH9rmDv005639 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Mon, 17 Nov 2008 10:53:48 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvgCAJHNIEmBrw8EgWdsb2JhbACTVgEBFiK5UoJ5 X-IronPort-AV: E=Sophos;i="4.33,617,1220220000"; d="scan'208";a="17271043" Received: from ext.lri.fr ([129.175.15.4]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 17 Nov 2008 10:53:47 +0100 Received: from localhost (localhost [127.0.0.1]) by ext.lri.fr (Postfix) with ESMTP id B59C4A46F8; Mon, 17 Nov 2008 10:53:47 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at lri.fr Received: from ext.lri.fr ([127.0.0.1]) by localhost (ext.lri.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xiSisAONXe9k; Mon, 17 Nov 2008 10:53:47 +0100 (CET) Received: from smtp.lri.fr (vhost3-23 [129.175.3.23]) by ext.lri.fr (Postfix) with ESMTP id 9E6A9A46EC; Mon, 17 Nov 2008 10:53:47 +0100 (CET) Received: from [129.175.4.107] (lri4-107 [129.175.4.107]) by smtp.lri.fr (Postfix) with ESMTP id A72C4E04A4; Mon, 17 Nov 2008 10:53:47 +0100 (CET) Message-ID: <49213F3B.5030805@lri.fr> Date: Mon, 17 Nov 2008 10:54:03 +0100 From: Romain Bardou User-Agent: Thunderbird 2.0.0.17 (X11/20080925) MIME-Version: 1.0 To: =?ISO-8859-1?Q?Daniel_B=FCnzli?= Cc: Nicolas Pouillard , caml-list Subject: Re: [Caml-list] ocamlbuild and installed modules and libraries References: <6C9617AA-8360-4857-9BC0-EB13ACBEF8AD@erratique.ch> <1226867823-sup-903@ausone.local> <8C3D2D08-575C-4746-B130-80C1F8417948@erratique.ch> In-Reply-To: <8C3D2D08-575C-4746-B130-80C1F8417948@erratique.ch> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Miltered: at discorde with ID 49213F2C.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; lri:01 bunzli:01 cmx:01 cmx:01 byte:01 ocamldep:01 ocamlc:01 cmo:01 ocamlc:01 cmo:01 byte:01 findlib:01 makefile:01 findlib:01 compile:01 Daniel Bünzli a écrit : > > Le 16 nov. 08 à 21:37, Nicolas Pouillard a écrit : > >> I'm a bit uncomfortable with this kind of dynamic or special tags. >> >> However the simplest solution to your problem is probably one of those: >> >> 1/ ocamlbuild -cflags -I,+xmlm,xmlm.cmx test.native > > You meant, > >> ocamlbuild -cflags -I,+xmlm -lflags -I,+xmlm,xmlm.cmx test.native > > > I still think using ocamlbuild with installed libraries/modules is a > little bit problematic. If we have to do it that way [1] we are > hard-coding the location of the library in the plugin which doesn't feel > right. > > For me there should be (1) a way of defining the dependency on a > module/library (hopefully without needing a plugin) and (2) a way of > defining its location (-I). These two aspects should be decoupled. This > makes it easier to drive the installation process in build scripts by > using environment variables, i.e. I just need > to specify the location of the module/library I depend on via a suitable > -I $DEPDIR to compile the sources. Isn't it almost as simple to write, in a script: ocamlbuild -cflags -I,$DEPDIR -lflags -I,$DEPDIR instead of: ocamlbuild -I $DEPDIR Remember that $DEPDIR must be absolute, or relative to the _build directory. Then you can use ocamlbuild with the -lib option as usual, in a "decoupled" way. For instance, if bla/bla.cma is in your current directory: $ ocamlbuild -classic-display -lib bla -cflags -I,../bla -lflags -I,../bla test.byte ocamldep.opt -modules test.ml > test.ml.depends ocamlc.opt -c -I ../bla -o test.cmo test.ml ocamlc.opt -I ../bla bla.cma test.cmo -o test.byte And for modules, instead of -lib bla, you write -lflags bla.cmo or -lflags bla.cmx. You can have several -lflags if you want. Unfortunately you have to specify the extension, so it is true that a -mod option would actually add something. I admit, though, that it is not really easy to understand how to include a library. One solution would be to have findlib in ocamlbuild, but even then, there would be problems if you want a Makefile which is supposed to work also when findlib is not installed. I think there is a recent debate about the -I option of Ocamlbuild... -- Romain Bardou