Sometimes a package consists of several archive files that are closely related. It is now possible to express dependencies between these archives by splitting the package into several parts called subpackages. For example, package p consists of a base archive p_base.cma, and two extensions p_ext1.cma and p_ext2.cma that both require the base archive but are independent of each other. This META file expresses this dependency directly:
# META file of package p: requires = "p.base" package "base" ( archive(byte) = "p_base.cma" ) package "ext1" ( requires = "p.base" archive(byte) = "p_ext1.cma" ) package "ext2" ( requires = "p.base" archive(byte) = "p_ext2.cma" )If installed as package "p", this definition actually defines four logical packages: "p" (the main package), "p.base", "p.ext1", and "p.ext2" (the subpackages). These four entities only share the META file in which they are declared, and the directory where the archive files are stored, but all other properties can be individually set for each package. This also means that all package dependencies must explicitly added by "requires" variables, as there are no implied dependencies. In this example, the main package and "p.ext1" and "p.ext2" are all dependent on "p.base".
The users of this installation can refer to all four packages. This means that
ocamlfind ocamlc -package p -linkpkg ...links only p_base.cma into the final program, while
ocamlfind ocamlc -package p.ext1 -linkpkg ...selects both p_base.cma and p_ext1.cma.