Closed dbuenzli closed 4 years ago
Oh and the pkg-config
module must be upgraded and hooked-in aswell.
While I was redesigning the Pkg part to bring it to the new API, I also did so with the ocamlfind query module.
Per Gerd's comment on the mailing list It seems that the most reliable way to query ocamlfind is to use
ocamlfind TOOL -only-show -package PKG1,PKG2,PKG3
This will also allow to avoid the stuttering and the puzzling outputs of ocamlfind query
. So the As_ocamlfind module should be rewritten using this strategy.
(However this will not solve the problem of duplicate recursive dependencies)
Regarding the recursive deps problem it seems to me that the correct way of dealing with it is to integrate at the Pkg part API level a notion of package dependency.
That is in addition to the lookup
function that maps contexts to flags, package parts should have another deps
attribute that define the package's package dependencies (which is not at the level of part needs; ou pas, or not, maybe the system could automatically create the needs for packages, this should be figured out; but a priori no, since it would depend on the configuration while parts are statically defined).
This means that whenever we query ocamlfind
to define the lookup
function (that maps contexts to flags) we should never invoke ocamlfind
with -r
. Rather we will invoke ocamlfind query -r -format "%p" PKG
to define that deps
attribute.
When we need to query the packages for an operation we will have the packages that come from Pkg
parts and those that come from their deps
attribute (or needs --- if that works). We can then treat all these names as a partially ordered set and inject each of their flags according to their lookup function on the command line without having duplicates (which is of utmost importance during linking).
It seems that the most reliable way to query ocamlfind is to use [...]
Forget about that. Basically we should simply shortcut all the ocamlfind flags logic and query the property values directly using the -format "%(property)"
notation to get the various objects and constructs the command lines ourselves.
While I was redesigning the Pkg part to bring it to the new API, I also did so with the
ocamlfind
query module. This should be tested and errors reported in this issue.One problem of the current Pkg part (not the
ocamlfind
query strategy) is that it will break on recusrive duplicates recursive dependencies. Something should be done...