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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 1FB637EE99 for ; Wed, 11 Dec 2013 07:04:16 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of gabriel.scherer@gmail.com) identity=pra; client-ip=209.85.214.48; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of gabriel.scherer@gmail.com designates 209.85.214.48 as permitted sender) identity=mailfrom; client-ip=209.85.214.48; receiver=mail2-smtp-roc.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 (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-bk0-f48.google.com) identity=helo; client-ip=209.85.214.48; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="postmaster@mail-bk0-f48.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArACANr/p1LRVdYwm2dsb2JhbABZDgiDKVOmYYlxiFGBGAgWDgEBAQEBBgsLCRQogiUBAQQBQAEbHQEDAQsGBQsDOCIBEQEFARwGE4dvAQMJBg2lcIxZgwmEPQoZJw1khgMRAQUMjnkHhDQEmBSBMIssg0oYKYQWQDs X-IPAS-Result: ArACANr/p1LRVdYwm2dsb2JhbABZDgiDKVOmYYlxiFGBGAgWDgEBAQEBBgsLCRQogiUBAQQBQAEbHQEDAQsGBQsDOCIBEQEFARwGE4dvAQMJBg2lcIxZgwmEPQoZJw1khgMRAQUMjnkHhDQEmBSBMIssg0oYKYQWQDs X-IronPort-AV: E=Sophos;i="4.93,870,1378850400"; d="scan'208";a="48208468" Received: from mail-bk0-f48.google.com ([209.85.214.48]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 11 Dec 2013 07:03:57 +0100 Received: by mail-bk0-f48.google.com with SMTP id r7so123872bkg.35 for ; Tue, 10 Dec 2013 22:03:56 -0800 (PST) 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; bh=yrJJmVbJvu73Khh8Odmkx8Q1qRKo/Vh5+xgKrkfbfu4=; b=wxKK86MlScg45nfU+4RQwwIAIo4V3bVyGK1VL+UHGiBzusxdr0HL3q7TzxGUjmBd/Y mztS12cXy5uT4RmBh7IqU2J0c80TyRnB18DJdJUkYbeZm876xA2G3isRb8upvRStfNd3 4AmW+QtI/Zif0qorJpq6heYRRLOiFDkE+5RBb66XwJwqhwYpufVhuLC1TSvjPatBTj1B wQryQWkuBI8yt9q+0E7Yt4w82W4nCkEQ5uWzJEUJVts0IgrqMU1peDoaOQ6T7C7gxKSD UA0ZXgreKp/8LuEW73Nulg22+mramXbR2Siba1ORoIEn0Zo1QZweSCEx1UrOffGkAHNx CLtA== X-Received: by 10.204.172.145 with SMTP id l17mr609615bkz.26.1386741836715; Tue, 10 Dec 2013 22:03:56 -0800 (PST) MIME-Version: 1.0 Received: by 10.204.122.72 with HTTP; Tue, 10 Dec 2013 22:03:16 -0800 (PST) In-Reply-To: References: From: Gabriel Scherer Date: Wed, 11 Dec 2013 07:03:16 +0100 Message-ID: To: Gregory Malecha Cc: caml users Content-Type: multipart/alternative; boundary=bcaec52c5f5b92c2cc04ed3bfef9 Subject: Re: [Caml-list] ocamlbuild plugins and external libraries --bcaec52c5f5b92c2cc04ed3bfef9 Content-Type: text/plain; charset=ISO-8859-1 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/ > --bcaec52c5f5b92c2cc04ed3bfef9 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
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

=A0 ocamlbuild -use-ocamlfind -plugin-tag "package(coq-path)= " ...

On Tue, Dec 10, 2013 at 11:20 PM, Gregory Male= cha <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
=A0 =A0 =A0 =A0 @ ./_build/coq_b= uilder -no-plugin coq.otarget

_buil= d/coq_builder: myocaml= build.ml coq_paths.ml=
=A0 =A0 =A0 =A0 @ echo "bui= lding builder...."
=A0 =A0 =A0 =A0 @ ocamlbuild -cflags -I,`ocamlfind query ocamlbuild` -n= o-plugin myocamlbuild.cmo
=A0 =A0 =A0 =A0 @ ocamlc.opt uni= x.cma -I $(OCAMLBUILDDIR) $(OCAMLBUILDDIR)/ocamlbuildlib.cma \
=
=A0 =A0 =A0 =A0 =A0 =A0_build/co= q_paths.cmo _build/myocamlbuild.cmo \
=A0 =A0 =A0 =A0 =A0 =A0$(OCAMLBU= ILDDIR)/ocamlbuild.cmo -o _build/coq_builder
=A0 =A0 =A0 =A0 @ echo "done"

clean:
=
=A0 =A0 =A0 =A0 ocamlbuild -clea= n

<= div>Thanks in advance.

--

--bcaec52c5f5b92c2cc04ed3bfef9--