I am trying to keep my project self-contained, with all major 3rd party library dependencies built and referenced within the project repository. The main ocaml portions of my project rely on ocamlbuild.
But for complex packages like Batteries Included, there seems to be a strong expectation that they be linked into a project via ocamlfind. ocamlfind seems to assume that packages will be installed globally. (I realize it allows environment variables and its conf to point to alternate locations, but it fundamentally still seems to be built around the assumption that packages are globally configured--it has no equivalent of -I
or -L
flags to dynamically extend the search path for packages, for example. It may be possible to set environment variables to dynamically override the ocamlfind configuration to search the project-local tree, but this is much more awkward than mere arguments, and it also seems like it would be challenging to do so without simultaneously removing discoverability of the main system packages in the primary site-lib
, which may also be needed.)
What is a sane strategy for building and building against nontrivial 3rd party packages within a project-local tree for a project using ocamlbuild?