Dub support was added to Meson

Russel Winder russel at winder.org.uk
Fri Aug 10 14:38:10 UTC 2018


On Sat, 2018-08-04 at 16:07 +0000, Filipe Laíns via Digitalmars-d-announce
wrote:
> Hello,
> 
> Dub support was finally merged to the Meson's upstream.
> For the ones that don't know, Meson[1] is a fast build system 
> that uses ninja[2] as a backend. Until now it was impossible to 
> use dependencies via the Dub and many many packages only 
> supported Dub. Now you can import dependencies that already exist 
> in Dub's local repo. You still need to fetch and build them 
> though.

Sadly not in Meson 0.47.1 is a new release due soon?

> First, you need to fetch and build the dependency.
> 
>    dub fetch vibe-d
>    dub build vibe-d

This feels a little unsatisfactory. Dub (and soon SCons I hope) builds handle
getting the dependency as well as building it and thence linking the project
to it. Meson both depends on the dub executable and yet isn't doing the
getting, it is assuming already got.

Of course Meson relies on all dependencies being present at build
specification time, so nothing inconsistent, it just seems a wee bit
incomplete.

I haven't finished reading the Meson source to find out which Dub built
archive is used in the Meson build but if it is the one in
~/.dub/packages/<package>-<version>/<package> then stuff can go wrong since it
is the result of the last build. In order to get the build with the specific
compiler on the specific platform you have to delve into
~/.dub/packages/<package>-<version>/<package>/.dub/ and know the Dub naming
strategy. For SCons I am having problems with this because of the extra stuff
in the directory name.

> Then you just need to specify Dub as the dependency method.
> 
>    vibed_dep = dependency('vibe-d', method: 'dub')

I have been getting projects such as Unit-Threaded, DInotify, TinyEndian, and
D_YAML to have Meson builds so as to create shared libraries prior to using
pkg-config to handle D project being dependent on these libraries. It's
working nicely (for me anyway) except Dub uses GitHub tags for versioning and
Meson requires version numbers in the meson.build file. This duplication is
getting quite annoying for all concerned. As is the Meson requirement to list
all source files, rather than have a convention over configuration approach as
Dub does – SCons has a different approach but still avoids explicit source
lists. I can get round it with Meson, but I am informed it is naughty and
should not be done.

These builds create shared objects and allow for dynamic linking. Using Dub
built archives means static linking. Unless Meson somehow manages to get
shared objects out of the Dub build.

Unless Dub can generate shared objects, having the dependencies build locally
and creating pkg-config files actually seems a better way that accessing Dub
builds.

But I may be missing something! 
 
[…]
-- 
Russel.
===========================================
Dr Russel Winder      t: +44 20 7585 2200
41 Buckmaster Road    m: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-announce/attachments/20180810/8e81fbff/attachment.sig>


More information about the Digitalmars-d-announce mailing list