Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usability issues with the way dune handles headers #3907

Open
rgrinberg opened this issue Nov 1, 2020 · 3 comments
Open

Usability issues with the way dune handles headers #3907

rgrinberg opened this issue Nov 1, 2020 · 3 comments

Comments

@rgrinberg
Copy link
Member

rgrinberg commented Nov 1, 2020

I've looked over @aantron's luv library, and I noticed that there are too many contortions required to use C headers the way one wants. Even with all the contortions, one still does not get a desirable result. Here's a list of the issues:

  • To preserve the file structure of the headers (as is often required), one is required to write install stanzas manually like here https://github.com/aantron/luv/blob/44db25c2b2669f9d1373377006a4d5850e0820e3/src/c/dune#L15

  • Introducing a dependency on the library to which the headers belong does not introduce a dependency on the headers. To depend on the headers, one has to add a (package luv) dependency somewhere.

  • When the package containing the headers is installed, things are still broken because dependencies aren't inferred correctly. Dune only adds dependencies on the header files in the root of the package, and omits dependencies on headers in sub directories.

@aantron
Copy link
Collaborator

aantron commented Nov 2, 2020

  • one is required to write install stanzas manually like here

Furthermore, since the set of headers of a vendored library might change over time, Luv even has an upgrade-time generator for the install stanza: https://github.com/aantron/luv/blob/44db25c2b2669f9d1373377006a4d5850e0820e3/src/gen/headers.ml. If Luv could specify to install uv.h. and the directory uv with all its contents recursively, the generator would be unnecessary.

A main header plus a subdirectory is the common "detail header" pattern of organizing header files.

@bobot
Copy link
Collaborator

bobot commented Nov 2, 2020

When the package containing the headers is installed, things are still broken ...

Do you have an example or precision for the last point?

@rgrinberg
Copy link
Member Author

Do you have an example or precision for the last point?

Suppose we have the following headers installed

./uv/uv.h
./uv/linux/blah.h

We only introduce dependencies on uv.h when depending on the library uv.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants