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 996887EE99 for ; Wed, 11 Dec 2013 21:28:54 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of gmalecha@cs.harvard.edu) identity=pra; client-ip=140.247.173.28; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gmalecha@cs.harvard.edu"; x-sender="gmalecha@cs.harvard.edu"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of gmalecha@cs.harvard.edu) identity=mailfrom; client-ip=140.247.173.28; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gmalecha@cs.harvard.edu"; x-sender="gmalecha@cs.harvard.edu"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail.eecs.harvard.edu) identity=helo; client-ip=140.247.173.28; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gmalecha@cs.harvard.edu"; x-sender="postmaster@mail.eecs.harvard.edu"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Aq8BAMnKqFKM960cnGdsb2JhbABZFoMpU4MDo1GTI4EVHg4BAQEBAQgUCTyCJQEBBAEjVgULCQILDSoCAiEBEgEFARwGEwiHaAMJBg2WW49bjAaIUw1XhjsXjHWCEweCbIFIBIlCjGeBa4EwiyqDTBgphHM X-IPAS-Result: Aq8BAMnKqFKM960cnGdsb2JhbABZFoMpU4MDo1GTI4EVHg4BAQEBAQgUCTyCJQEBBAEjVgULCQILDSoCAiEBEgEFARwGEwiHaAMJBg2WW49bjAaIUw1XhjsXjHWCEweCbIFIBIlCjGeBa4EwiyqDTBgphHM X-IronPort-AV: E=Sophos;i="4.93,873,1378850400"; d="scan'208";a="40549284" Received: from eecs-mail.seas.harvard.edu (HELO mail.eecs.harvard.edu) ([140.247.173.28]) by mail3-smtp-sop.national.inria.fr with ESMTP; 11 Dec 2013 21:28:37 +0100 Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by mail.eecs.harvard.edu (Postfix) with ESMTP id 09B21B0202 for ; Wed, 11 Dec 2013 15:28:36 -0500 (EST) Received: by mail-vc0-f182.google.com with SMTP id lc6so5985521vcb.41 for ; Wed, 11 Dec 2013 12:28:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=DymHgyrgyssr7fygxVxq8tHcsPHcatQKay5Ty6dLteY=; b=ICODXImaT6Dj1wHV/qrMbB3Apt9HdpiOfbsYZRC0qP+hLjM0jHqf50lbmVOCMhRDAx 9bXm4H/MTg4id2n9Yl0EhxIHX3iZrMe6KwAUU56Rz8rJgYtwPauvVuKCR9triX0DxwDM eY4mzKpQDUI4hbRpBXwif28ch1C+3b9C9XoDXeJDMWQgZMNgCrENu7aRNRrbgjS3PKkd VkiaAzEBJpSCQUlE9+UXubmhh64JhNbgX2RLUBc8LmcP8W3g1dPYksOtfqV3yUWVVUEz +d/wj2/wYX7FuiTT1U1h/DhzoEFDRpcRitt/KO6EmkEn+tFKdLFWmYvQgYIwQwvokoOA aBaQ== X-Received: by 10.58.210.66 with SMTP id ms2mr1401728vec.10.1386793715737; Wed, 11 Dec 2013 12:28:35 -0800 (PST) MIME-Version: 1.0 Received: by 10.52.181.37 with HTTP; Wed, 11 Dec 2013 12:27:55 -0800 (PST) In-Reply-To: References: From: Gregory Malecha Date: Wed, 11 Dec 2013 15:27:55 -0500 Message-ID: To: Gabriel Scherer Cc: caml users Content-Type: multipart/alternative; boundary=047d7bd6ae8ccdb0df04ed481288 X-Validation-by: gmalecha@cs.harvard.edu Subject: Re: [Caml-list] ocamlbuild plugins and external libraries --047d7bd6ae8ccdb0df04ed481288 Content-Type: text/plain; charset=UTF-8 Thanks Gabriel -- I couldn't figure out how to get the package included, which you do with -use-ocamlfind. On Wed, Dec 11, 2013 at 1:03 AM, Gabriel Scherer wrote: > Since 4.01, ocamlbuild supports a new (experimental) option "-plugin-tag" > that allows to specify (built-in) ocamlbuild tags to use when compiling > myocamlbuild.ml. If you package coq-paths using findlib, you can then use > > ocamlbuild -use-ocamlfind -plugin-tag "package(coq-path)" ... > > > On Tue, Dec 10, 2013 at 11:20 PM, Gregory Malecha > wrote: > >> Hello -- >> >> I have several ocamlbuild plugins that are very similar and I'm trying to >> figure out how to refactor them. I pulled out a bunch of definitions into >> another file (coq_paths.ml) and then said 'open Coq_paths' in ' >> myocamlbuild.ml'. But when I do this, ocamlbuild can no longer build the >> plugin, not even if foo.cmo already exists in the _build directory. >> >> After hacking on this for a long time (and digging through the ocamlbuild >> sources) I found that you can write a Makefile that will build >> myocamlbuild.cmo using ocamlbuild without a plugin, and then manually link >> this against ocamlbuild.cmo and to produce a custom version of ocamlbuild >> that uses the plugin (this is exactly what ocamlbuild does). My question >> is: 'is there any nicer way to do this?' I'm including my Makefile below: >> >> OCAMLBUILDDIR=$(shell ocamlfind query ocamlbuild) >> >> all: _build/coq_builder >> @ ./_build/coq_builder -no-plugin coq.otarget >> >> _build/coq_builder: myocamlbuild.ml coq_paths.ml >> @ echo "building builder...." >> @ ocamlbuild -cflags -I,`ocamlfind query ocamlbuild` -no-plugin >> myocamlbuild.cmo >> @ ocamlc.opt unix.cma -I $(OCAMLBUILDDIR) >> $(OCAMLBUILDDIR)/ocamlbuildlib.cma \ >> _build/coq_paths.cmo _build/myocamlbuild.cmo \ >> $(OCAMLBUILDDIR)/ocamlbuild.cmo -o _build/coq_builder >> @ echo "done" >> >> clean: >> ocamlbuild -clean >> >> Thanks in advance. >> >> -- >> gregory malecha >> http://www.people.fas.harvard.edu/~gmalecha/ >> > > -- gregory malecha http://www.people.fas.harvard.edu/~gmalecha/ --047d7bd6ae8ccdb0df04ed481288 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thanks Gabriel --

I couldn't figure= out how to get the package included, which you do with -use-ocamlfind.


On We= d, Dec 11, 2013 at 1:03 AM, Gabriel Scherer <gabriel.scherer@gma= il.com> wrote:
Since 4.01, ocamlbuild= supports a new (experimental) option "-plugin-tag" that allows t= o specify (built-in) ocamlbuild tags to use when compiling myocamlbuild.ml. If you package co= q-paths using findlib, you can then use

=C2=A0 ocamlbuild -use-ocamlfind -plugin-tag "package(coq-pa= th)" ...


On = Tue, Dec 10, 2013 at 11:20 PM, Gregory Malecha <gmalecha@cs.harvard.= edu> wrote:
Hello --

I have several ocamlbuild plugins that are very similar and I'm trying= to figure out how to refactor them. I pulled out a bunch of definitions in= to another file (coq_path= s.ml) and then said 'open Coq_paths' in 'myocamlbuild.ml'. But when I do = this, ocamlbuild can no longer build the plugin, not even if foo.cmo alread= y exists in the _build directory.

After hacking on this for a long time (and digging thro= ugh the ocamlbuild sources) I found that you can write a Makefile that will= build myocamlbuild.cmo using ocamlbuild without a plugin, and then manuall= y link this against ocamlbuild.cmo and to produce a custom version of ocaml= build that uses the plugin (this is exactly what ocamlbuild does). My quest= ion is: 'is there any nicer way to do this?' I'm including my M= akefile below:

OCAMLBUILDDI= R=3D$(shell ocamlfind query ocamlbuild)

all: _build/coq_builder
=C2=A0 =C2=A0 =C2=A0 =C2=A0 @ ./= _build/coq_builder -no-plugin coq.otarget

_build/coq_builder: myocamlbuild.ml = coq_paths.ml
=C2=A0 =C2=A0 =C2=A0 =C2=A0 @ ec= ho "building builder...."
=C2=A0 =C2=A0 =C2=A0 =C2=A0 @ ocamlbuild -cflags -I,`ocamlf= ind query ocamlbuild` -no-plugin myocamlbuild.cmo
=C2=A0 =C2=A0 =C2=A0 =C2=A0 @ oc= amlc.opt unix.cma -I $(OCAMLBUILDDIR) $(OCAMLBUILDDIR)/ocamlbuildlib.cma \<= /font>
=C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0_build/coq_paths.cmo _build/myocamlbuild.cmo \<= /div>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0$(OCAMLBUILDDIR)/ocamlbuild.cmo -o _build/coq_builder
=C2=A0 =C2=A0 =C2=A0 =C2=A0 @ e= cho "done"

clean:
=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ocam= lbuild -clean

Thanks in advan= ce.

--




--
=
--047d7bd6ae8ccdb0df04ed481288--