dune icon indicating copy to clipboard operation
dune copied to clipboard

Allow globbing in the install stanza

Open ivg opened this issue 3 years ago • 2 comments

Desired Behavior

The following should be accepted,
(install
  (files (glob_files *.lisp))
  (package bap-primus-lisp)
  (section (site (bap lisp))))

Instead if fails with

dune build
File "plugins/primus_lisp/site-lisp/dune", line 2, characters 9-28:
2 |   (files (glob_files *.lisp))
             ^^^^^^^^^^^^^^^^^^^
Error: invalid format, <name> or (<name> as <install-as>) expected

Justification

Sometimes we just want to install all data files from a certain directory, like all *.png files or lisp codes, etc. Other build systems, e.g., oasis, cmake, autotools commonly allow this, so this sounds as an expected feature for a build system. Right now I have to enumerate each file which bloats the dune file and makes it easy to forget to include a file.

Alternatives

Other build systems allow the installation of directories, which might (or might not) be easier to implement.

Workarounds

Right now I just abuse Emacs C-u M-| ls to include all files in the directory, but if there are any other options (like generating the installation files) or some stanza that I am missing, the I will be happy to learn.

ivg avatar Jul 27 '22 15:07 ivg

See #5059 for installable directories. I think there's an open issue about globbing in install but I can't find it at the moment.

emillon avatar Jul 28 '22 08:07 emillon

#6139 will enable it but through the use of a generator.

emillon avatar Sep 15 '22 08:09 emillon