[Caml-list] OCamlBuild question
Hi everyone, I'm trying to write a OCamlBuild plug-in to automatically generate the .mli corresponding to a .mlpack (for documentation purposes). I've written a [rule] which lets me depend a .mli on the corresponding .mlpack . From this .mlpack, I can obtain the list of modules involved in the construction of the pack. Now, I only have to 1. find the corresponding source .mli files 2. find the corresponding .mli.depends files 3. do a topological sort and create the destination .mli . Part 3 is no problem. On the other hand, I haven't been able to progress much with parts 1 and 2. Part 2 requires waiting until the corresponding .mli.depends have been created, but * neither [~insert:`bottom] nor [~insert:(`after foo)] seem to help here * attempting to [build] an ad-hoc list of files somehow extracted from the mlpack only gives me dependency errors * attempting [Solve.solve_target] doesn't seem to help any further. As for part 1, it requires the ability to find which source .ml / .mli correspond to a given module. I can only assume OCamlBuild offers some kind of API for this purpose, because I'd rather avoid folding through the whole tree, resolving [include] directives myself to find a .ml or a .mli which may be the right file. Does anyone have suggestions? Thanks, David -- David Teller-Rajchenbach Security of Distributed Systems http://www.univ-orleans.fr/lifo/Members/David.Teller Angry researcher: French Universities need reforms, but the LRU act brings liquidations. ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs
[Caml-list] Ocamlbuild question
Hello, I'm trying to manage "internal" camlfind packages. I use "internal" with the same meanning than in ocamlbuild documentation when speaking about libraries. I want my camlfind packages to be re-installed if one of their dependency was modified. For this, I wrote a simple rule, based on %.iocamlfind files containing the files to install into findlib directory. This rule also produces a stamp file : %.oocamlfind. I also want my camlfind package to be installed if they are needed by another rule. For this, I do: dep ["pkg_"^nm][nm ^ ".oocamlfind"] for each internal package. It seems to work ok: Suppose that package toto requires package tutu. When I ask ocamlbuild toto.oocamlfind, the packages tutu is re-built if needed. And if I modify one file of tutu, and then ask ocamlbuild to generate toto.oocamlbuild, tutu is re-built and installed into findlib directories. fine. BUT, when I'm producing a %.native from %.cmx, my dependencies (ie %.oocamlfind files) are inserted in the command line... Here is an example: ocamlfind ocamlopt -linkpkg -package mtsvrac -package log logtest/test.cmx mtsvrac.oocamlfind log.oocamlfind -o logtest/test.native mtsvrac.oocamlfind and log.oocamlfind where added to the dependencies of logtest/test.native. What would be the right solution to avoid this problem? Is there something like a "dependency that should not be linked?" Thanks Salutations Matt ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs
Re: [Caml-list] Ocamlbuild question
Excerpts from Matthieu Dubuget's message of Wed Feb 11 23:26:43 +0100 2009: > Hello, > > I'm trying to manage "internal" camlfind packages. I use "internal" with > the same meanning than in ocamlbuild documentation when speaking about > libraries. > > I want my camlfind packages to be re-installed if one of their > dependency was modified. For this, I wrote a simple rule, based on > %.iocamlfind files containing the files to install into findlib > directory. This rule also produces a stamp file : %.oocamlfind. > > I also want my camlfind package to be installed if they are needed by > another rule. For this, I do: dep ["pkg_"^nm][nm ^ ".oocamlfind"] for > each internal package. > > It seems to work ok: Suppose that package toto requires package tutu. > When I ask ocamlbuild toto.oocamlfind, the packages tutu is re-built if > needed. And if I modify one file of tutu, and then ask ocamlbuild to > generate toto.oocamlbuild, tutu is re-built and installed into findlib > directories. fine. > > BUT, when I'm producing a %.native from %.cmx, my dependencies (ie > %.oocamlfind files) are inserted in the command line... > > Here is an example: > ocamlfind ocamlopt -linkpkg -package mtsvrac -package log > logtest/test.cmx mtsvrac.oocamlfind log.oocamlfind -o logtest/test.native > > mtsvrac.oocamlfind and log.oocamlfind where added to the dependencies of > logtest/test.native. > > What would be the right solution to avoid this problem? > Is there something like a "dependency that should not be linked?" Hello, You should try to tag your .oocamlfind file with the dont_link_with tag. (this point certainly needs an entry in the FAQ...) Best regards, -- Nicolas Pouillard ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs
Re: [Caml-list] Ocamlbuild question
Nicolas Pouillard a écrit : > Excerpts from Matthieu Dubuget's message of Wed Feb 11 23:26:43 +0100 2009: > >> Hello, >> >> I'm trying to manage "internal" camlfind packages. I use "internal" with >> the same meanning than in ocamlbuild documentation when speaking about >> libraries. >> >> I want my camlfind packages to be re-installed if one of their >> dependency was modified. For this, I wrote a simple rule, based on >> %.iocamlfind files containing the files to install into findlib >> directory. This rule also produces a stamp file : %.oocamlfind. >> >> I also want my camlfind package to be installed if they are needed by >> another rule. For this, I do: dep ["pkg_"^nm][nm ^ ".oocamlfind"] for >> each internal package. >> >> It seems to work ok: Suppose that package toto requires package tutu. >> When I ask ocamlbuild toto.oocamlfind, the packages tutu is re-built if >> needed. And if I modify one file of tutu, and then ask ocamlbuild to >> generate toto.oocamlbuild, tutu is re-built and installed into findlib >> directories. fine. >> >> BUT, when I'm producing a %.native from %.cmx, my dependencies (ie >> %.oocamlfind files) are inserted in the command line... >> >> Here is an example: >> ocamlfind ocamlopt -linkpkg -package mtsvrac -package log >> logtest/test.cmx mtsvrac.oocamlfind log.oocamlfind -o logtest/test.native >> >> mtsvrac.oocamlfind and log.oocamlfind where added to the dependencies of >> logtest/test.native. >> >> What would be the right solution to avoid this problem? >> Is there something like a "dependency that should not be linked?" >> > > Hello, > > You should try to tag your .oocamlfind file with the dont_link_with tag. > > (this point certainly needs an entry in the FAQ...) > > Best regards, > > It seems not to work – at least with ocaml 3.10.2 from godi. I have: >> ocamlbuild -show-tags mtsvrac.oocamlfind >> Tags for "mtsvrac.oocamlfind": >> {. dont_link_with, extension:oocamlfind, file:mtsvrac.oocamlfind, quiet, >> traverse .} >> Finished, 0 targets (0 cached) in 00:00:00. and still >> ocamlopt.opt: don't know what to do with mtsvrac.oocamlfind. I will check at home with 3.11 Thanks Salutations Matt ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs
Re: [Caml-list] Ocamlbuild question
Matthieu Dubuget a écrit : > Nicolas Pouillard a écrit : >> Excerpts from Matthieu Dubuget's message of Wed Feb 11 23:26:43 +0100 2009: >> >>> Hello, >>> >>> I'm trying to manage "internal" camlfind packages. I use "internal" with >>> the same meanning than in ocamlbuild documentation when speaking about >>> libraries. >>> >>> I want my camlfind packages to be re-installed if one of their >>> dependency was modified. For this, I wrote a simple rule, based on >>> %.iocamlfind files containing the files to install into findlib >>> directory. This rule also produces a stamp file : %.oocamlfind. >>> >>> I also want my camlfind package to be installed if they are needed by >>> another rule. For this, I do: dep ["pkg_"^nm][nm ^ ".oocamlfind"] for >>> each internal package. >>> >>> It seems to work ok: Suppose that package toto requires package tutu. >>> When I ask ocamlbuild toto.oocamlfind, the packages tutu is re-built if >>> needed. And if I modify one file of tutu, and then ask ocamlbuild to >>> generate toto.oocamlbuild, tutu is re-built and installed into findlib >>> directories. fine. >>> >>> BUT, when I'm producing a %.native from %.cmx, my dependencies (ie >>> %.oocamlfind files) are inserted in the command line... >>> >>> Here is an example: >>> ocamlfind ocamlopt -linkpkg -package mtsvrac -package log >>> logtest/test.cmx mtsvrac.oocamlfind log.oocamlfind -o logtest/test.native >>> >>> mtsvrac.oocamlfind and log.oocamlfind where added to the dependencies of >>> logtest/test.native. >>> >>> What would be the right solution to avoid this problem? >>> Is there something like a "dependency that should not be linked?" >>> >> Hello, >> >> You should try to tag your .oocamlfind file with the dont_link_with tag. >> >> (this point certainly needs an entry in the FAQ...) >> >> Best regards, >> >> > > It seems not to work – at least with ocaml 3.10.2 from godi. > > I have: > >>> ocamlbuild -show-tags mtsvrac.oocamlfind >>> Tags for "mtsvrac.oocamlfind": >>> {. dont_link_with, extension:oocamlfind, file:mtsvrac.oocamlfind, quiet, >>> traverse .} >>> Finished, 0 targets (0 cached) in 00:00:00. > > and still > >>> ocamlopt.opt: don't know what to do with mtsvrac.oocamlfind. > > I will check at home with 3.11 Idem > > Thanks > > Salutations > > Matt > > > ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs
Re: [Caml-list] Ocamlbuild question
Matthieu Dubuget a écrit : > Matthieu Dubuget a écrit : > >> Nicolas Pouillard a écrit : >> >>> Excerpts from Matthieu Dubuget's message of Wed Feb 11 23:26:43 +0100 2009: >>> >>> Hello, I'm trying to manage "internal" camlfind packages. I use "internal" with the same meanning than in ocamlbuild documentation when speaking about libraries. I want my camlfind packages to be re-installed if one of their dependency was modified. For this, I wrote a simple rule, based on %.iocamlfind files containing the files to install into findlib directory. This rule also produces a stamp file : %.oocamlfind. I also want my camlfind package to be installed if they are needed by another rule. For this, I do: dep ["pkg_"^nm][nm ^ ".oocamlfind"] for each internal package. It seems to work ok: Suppose that package toto requires package tutu. When I ask ocamlbuild toto.oocamlfind, the packages tutu is re-built if needed. And if I modify one file of tutu, and then ask ocamlbuild to generate toto.oocamlbuild, tutu is re-built and installed into findlib directories. fine. BUT, when I'm producing a %.native from %.cmx, my dependencies (ie %.oocamlfind files) are inserted in the command line... Here is an example: ocamlfind ocamlopt -linkpkg -package mtsvrac -package log logtest/test.cmx mtsvrac.oocamlfind log.oocamlfind -o logtest/test.native mtsvrac.oocamlfind and log.oocamlfind where added to the dependencies of logtest/test.native. What would be the right solution to avoid this problem? Is there something like a "dependency that should not be linked?" >>> Hello, >>> >>> You should try to tag your .oocamlfind file with the dont_link_with tag. >>> >>> (this point certainly needs an entry in the FAQ...) >>> >>> Best regards, >>> >>> >>> >> It seems not to work – at least with ocaml 3.10.2 from godi. >> >> I have: >> >> ocamlbuild -show-tags mtsvrac.oocamlfind Tags for "mtsvrac.oocamlfind": {. dont_link_with, extension:oocamlfind, file:mtsvrac.oocamlfind, quiet, traverse .} Finished, 0 targets (0 cached) in 00:00:00. >> and still >> >> ocamlopt.opt: don't know what to do with mtsvrac.oocamlfind. >> I will check at home with 3.11 >> > > Idem > Thanks to Nicolas: the solution was: - tag .oocamlfind files with "dont_link_with" - and add "dont_link_with" in left part of dep: > dep ["pkg_"^nm;"dont_link_with"][nm ^ ".oocamlfind"] Matt ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs
Re: [Caml-list] Ocamlbuild question
Correction: Matthieu Dubuget a écrit : > Thanks to Nicolas: the solution was: > - tag .oocamlfind files with "dont_link_with" In fact, tagging .oocamlfind files is not needed. The key point is to add "dont_link_with" when calling dep: > - and add "dont_link_with" in left part of dep: > >> dep ["pkg_"^nm;"dont_link_with"][nm ^ ".oocamlfind"] > > Matt ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs
Re: [Caml-list] Ocamlbuild question
Matthieu Dubuget a écrit : > Correction: > > Matthieu Dubuget a écrit : > >> Thanks to Nicolas: the solution was: >> - tag .oocamlfind files with "dont_link_with" >> > > In fact, tagging .oocamlfind files is not needed. > > The key point is to add "dont_link_with" when calling dep: > >>> dep ["pkg_"^nm;"dont_link_with"][nm ^ ".oocamlfind"] >>> And I also had to add this in _tags file of the project's root directory: <**/*.{ml,mli}>: dont_link_with Salutations Matt ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs