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 BFEFB7F723 for ; Tue, 10 Dec 2013 23:21:25 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of gmalecha@cs.harvard.edu) identity=pra; client-ip=140.247.173.28; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gmalecha@cs.harvard.edu"; x-sender="gmalecha@cs.harvard.edu"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of gmalecha@cs.harvard.edu) identity=mailfrom; client-ip=140.247.173.28; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gmalecha@cs.harvard.edu"; x-sender="gmalecha@cs.harvard.edu"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.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=mail2-smtp-roc.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: AksCANB8p1KM960cnGdsb2JhbABZFoMpU4J/o1oBAYlxiWoeDgEBAQEBCBQJPIJPbwYHNwIkEgEFARYnh3oNlV6MVoMFjAaJRYYQF48iglaBSASJQo5SgTCLLINKGCmEcw X-IPAS-Result: AksCANB8p1KM960cnGdsb2JhbABZFoMpU4J/o1oBAYlxiWoeDgEBAQEBCBQJPIJPbwYHNwIkEgEFARYnh3oNlV6MVoMFjAaJRYYQF48iglaBSASJQo5SgTCLLINKGCmEcw X-IronPort-AV: E=Sophos;i="4.93,867,1378850400"; d="scan'208";a="48159498" Received: from eecs-mail.seas.harvard.edu (HELO mail.eecs.harvard.edu) ([140.247.173.28]) by mail2-smtp-roc.national.inria.fr with ESMTP; 10 Dec 2013 23:21:24 +0100 Received: from mail-ve0-f172.google.com (mail-ve0-f172.google.com [209.85.128.172]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by mail.eecs.harvard.edu (Postfix) with ESMTP id 57881B0182 for ; Tue, 10 Dec 2013 17:21:23 -0500 (EST) Received: by mail-ve0-f172.google.com with SMTP id jw12so5377051veb.31 for ; Tue, 10 Dec 2013 14:21:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:from:date:message-id:subject:to:content-type; bh=iL3trNoqnzHry9W5i+1GmDDwZOLyrq149W9sMCtbuqY=; b=WsA2KycvKnbOsIrR/pvhS3E1FTjwvSQCTib9wmZUhJP6B5WRt7Yv2H6/yDb5HdwYKN cs6DeCE8ApCT/EDRygQNLao7Dant7It7SA8hTJlC3aGBwm9MCrL/6yyfcGsG+Z/5CQhG yej3Pgm/cvIAJ+odccegaq2tlLUy5N3W3wUwk5LiwEBApNrHbw5rUgmRXJP38n5PDZNt T8LCX04Y4BeKgiicK5q0zZtgzGEEibsie9ZjC2ewlLGL8mnbHwuHcoEY7/Lox+VVSTwi RKj1RC6bmJDfatW+oiLn4VRzirlIUYxbqgGIjeR5dbZZXM021ERUEyon+ehAKDNYwG9b DOdg== X-Received: by 10.220.124.68 with SMTP id t4mr844713vcr.52.1386714082993; Tue, 10 Dec 2013 14:21:22 -0800 (PST) MIME-Version: 1.0 Received: by 10.52.181.37 with HTTP; Tue, 10 Dec 2013 14:20:42 -0800 (PST) From: Gregory Malecha Date: Tue, 10 Dec 2013 17:20:42 -0500 Message-ID: To: caml-list@inria.fr Content-Type: multipart/alternative; boundary=089e013a290852701704ed3588be X-Validation-by: gmalecha@cs.harvard.edu Subject: [Caml-list] ocamlbuild plugins and external libraries --089e013a290852701704ed3588be Content-Type: text/plain; charset=UTF-8 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/ --089e013a290852701704ed3588be Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hello --

I have several ocamlbuild plug= ins 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 wh= en I do this, ocamlbuild can no longer build the plugin, not even if foo.cm= o already 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.

--
--089e013a290852701704ed3588be--