I like dlang but i don't like dub

Tobias Pankrath tobias at pankrath.net
Mon Mar 21 10:19:34 UTC 2022


On Monday, 21 March 2022 at 09:25:56 UTC, Dadoum wrote:
> On Friday, 18 March 2022 at 04:13:36 UTC, Alain De Vos wrote:
>> Dlang includes some good ideas.
>> But dub pulls in so much stuff. Too much for me.
>> I like things which are clean,lean,little,small.
>> But when i use dub it links with so many libraries.
>> Are they really needed ?
>> And how do you compare to pythons pip.
>> Feel free to elaborate.
>
> Personally I use CMake, it allows me to access to C and C++ 
> libraries while still being able to use small Dub libraries. 
> Also everyone knows how to build a project with CMake nowadays.

I do the same with meson and I wish dub would be easier to 
integrate into third party build systems.

The first problem with dub is, that it doesn't really let you 
decide where it puts stuff. There is `--cache`, but that doesn't 
accept an path either and does not guarantee that afterwards 
everything you need is there. For example if you `dub fetch A 
--cache=local` and some dependencies of A are already under 
$HOME/.dub, you won't have them locally afterwards.

There is a workaround for this though: `HOME=. dub fetch A`.

A second problem is that `dub describe` returns paths to the 
packages directories not to the actual build directories, thus 
you can only use one compiler and the last `dub build` wins. 
Although there are custom build directories per compiler and half 
of the code to integrate dub packages in meson is to find and use 
the correct build directory (instead of just calling `dub 
describe`).

This would be much easier, if there were a `dub provide` (or 
whatever) that builds all deps for a project, installs them into 
a given prefix/path and makes them usable from `dub describe` 
afterwards, so that dub describe works more or less like 
pkg-config afterwards.


More information about the Digitalmars-d-learn mailing list