Install multiple executables with DUB

Jon Degenhardt jond at
Fri Sep 4 08:50:41 UTC 2020

On Friday, 4 September 2020 at 07:27:33 UTC, glis-glis wrote:
> On Thursday, 3 September 2020 at 14:34:48 UTC, Jacob Carlborg 
> wrote:
>> Oh, multiple binaries, I missed that. You can try to add 
>> multiple configurations [1]. Or if you have executables 
>> depending on only one source file, you can use single-file 
>> packages [2].
> Thanks, but this still means I would have to write an 
> install-script running
> `dub build --single`
> on each script, right?
> I looked at tsv-utils [1] which seems to be a similar use-case 
> as mine, and they declare each tool as a subpackage. The main 
> package runs a d-file called `dub_build.d` which compiles all 
> subpackages. Fells like an overkill to me, I'll probably just 
> stick to a makefile.
> [1] 

The `dub_build.d` is so that people can use `$ dub fetch` to 
download and build the tools with `$ dub run`, from dub fetch/run is the typical dub sequence. But 
it's awkward. And it geared toward users that have a D compiler 
plus dub already installed. For building your own binaries you 
might as well use `make`. However, if you decide to add your 
tools to the public dub package registry you might consider the 

My understanding is that the dub developers recognize that 
multiple binaries are inconvenient at present and have ideas on 
improvements. Having a few more concrete use cases might help 
nail down the requirements.

The tsv-utils directory layout may be worth a look. It's been 
pretty successful for multiple binaries in a single repo with 
some shared code. (Different folks made suggestions leading to 
this structure.) It works for both make and dub, and works well 
with other tools, like dlpdocs (Adam Ruppe's doc generator). The 
tsv-utils `make` setup is quite messy at this point, you can 
probably do quite a bit better.


More information about the Digitalmars-d-learn mailing list