When the contents of a package are recorded in dune-package files, we don't make a distinction between files and directory targets: just the edge of the directory target is recorded in the (files) field.
Later, when (package p) is expanded, this causes the following error:
Error: File unavailable:
/path/to/share/X
This is not a regular file (S_DIR)
There are several ways we could try to fix this:
- expand the list of all installed files in dune-package (rather than just storing the directory name)
- recursively copy the contents when something depends on an installed "thing" that happens to be a directory (not sure that's possible or a good idea)
- add an extra field (dirs) in dune-package files which contains "opaque" directories
The first one seems the most reasonable.