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.9 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_WHOIS 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 6F5B5BBC1 for ; Wed, 5 Mar 2008 14:41:13 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAALoxzkfOvjGuoWdsb2JhbACQcgEBAQEBAQUEBgkIAReaOw X-IronPort-AV: E=Sophos;i="4.25,450,1199660400"; d="scan'208";a="8032502" Received: from web54604.mail.re2.yahoo.com ([206.190.49.174]) by mail2-smtp-roc.national.inria.fr with SMTP; 05 Mar 2008 14:41:12 +0100 Received: (qmail 66631 invoked by uid 60001); 5 Mar 2008 13:41:11 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=xudE1/wieVtSf6BUSPDSbcHtDMNCe24yq41CiSluaSZkrdUcPFoFt6ATUIwwxetthlQrqOX6R0aj5MOrg8kpKXnHWPRQjOjmoBxtKrK2e2c6KAzylhJCKv2X40eu4Fl3sTMoxKCaXmyl52wqubzafK5YaCDpCwW8zMT+daeRL5Q=; X-YMail-OSG: jqCeId8VM1kLJLQ9tNBxWyCnQilXJEPTCcVIe4Du0yH_NNVSXzEnznXpQx7WVemVh4lTqMTDzsveMiefyhsquyKilHFAIHwQ3DTr6q_J9U1cAeeSNno1ME2.pmYZzCr4_Fg9JQarE04hCUT2U.x85BkmaQ-- Received: from [85.244.9.139] by web54604.mail.re2.yahoo.com via HTTP; Wed, 05 Mar 2008 13:41:11 GMT Date: Wed, 5 Mar 2008 13:41:11 +0000 (GMT) From: Dario Teixeira Subject: Ocamlbuild with findlib + camlp4 To: caml-list@yquem.inria.fr MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <644528.65296.qm@web54604.mail.re2.yahoo.com> X-Spam: no; 0.00; findlib:01 camlp:01 camlp:01 syntax:01 findlib:01 ocamlfind:01 ocamlc:01 -package:01 syntax:01 ocamlfind:01 pcre:01 -package:01 ocamlc:01 ocamlopt:01 ocamlopt:01 Hi, I'm trying to create an Ocamlbuild plugin for an application that uses PG'OCaml. This library relies on a Camlp4 syntax extension, and comes by default with a META file for findlib that enables one to simply type on the command line: ocamlfind ocamlc -package pgocaml.statements -syntax camlp4o -c test.ml I still don't grok Ocamlbuild quite enough to automate this behaviour. The best I have so far is the plugin below; it adds support for findlib, and creates a "use_pgocaml" tag that explicitly loads all the modules required by the syntax extension. Note that "use_pgocaml" makes no use of the findlib support; while it works, this is of course hackish and ugly. Ideally, "use_pgocaml" should simply tell ocamlbuild to use findlib to automatically load all the modules. Any ideas on how this could be achieved? (And incidentally, I vote for "built-in findlib support" as my #1 wish for Ocamlbuild). Thanks in advance! Dario Teixeira ############################################################################## open Ocamlbuild_plugin open Command let ocamlfind x = let packages = "pcre,extlib,lwt,ocsigen,pgocaml,json-wheel" in S[A"ocamlfind"; x; A"-package"; A packages];; dispatch begin function | Before_options -> Options.ocamlc := ocamlfind & A"ocamlc"; Options.ocamlopt := ocamlfind & A"ocamlopt"; Options.ocamldep := ocamlfind & A"ocamldep" | After_rules -> flag ["ocaml"; "link"] (A"-linkpkg"); let root = "/home/dario/.godi/lib/ocaml/" in let str = root ^ "std-lib/str.cma" and pcre = root ^ "pkg-lib/pcre/pcre.cma" and extlib = root ^ "pkg-lib/extlib/extLib.cma" and calendar = root ^ "pkg-lib/calendar/calendar.cma" and csv = root ^ "pkg-lib/csv/csv.cma" and pgocaml = root ^ "site-lib/pgocaml/pgocaml.cma" and pa_pgsql = root ^ "site-lib/pgocaml/pa_pgsql.cmo" in flag ["ocaml"; "pp"; "use_pgsql"] (S[A str; A pcre; A extlib; A calendar; A csv; A pgocaml; A pa_pgsql]) | _ -> () end;; ############################################################################## ___________________________________________________________ Rise to the challenge for Sport Relief with Yahoo! For Good http://uk.promotions.yahoo.com/forgood/