Thread overview
Using DUB packages with Meson
Apr 12, 2023
Dmitry Olshansky
Apr 12, 2023
Dmitry Olshansky
Apr 12, 2023
Dmitry Olshansky
Apr 12, 2023
Dmitry Olshansky
Apr 27, 2023
Denis Feklushkin
Apr 28, 2023
Denis Feklushkin
April 12, 2023

I'm trying to use my new DUB package from Photon, which is polyglot project and is built with Meson.

Have anyone worked with DUB packages in Meson? I've found this bit of documentation:
https://mesonbuild.com/Dependencies.html#dub

And I did fetch & build but I do not understand how to introduce library dependency on a specific DUB package.

--
Dmitry Olshansky

April 12, 2023
I'm going to guess that you need to use the version specifier in the package name. Because I'm not seeing anything there to handle it specifically.

https://github.com/mesonbuild/meson/blob/master/mesonbuild/dependencies/dub.py

i.e. ``dub build [<package>[@<version-spec>]] [<options...>]``

So use ``package:sub@1.0.2``.

Also I just noticed meson doesn't support shared libraries from dub, so something to keep in mind.
April 12, 2023
On Wednesday, 12 April 2023 at 10:24:48 UTC, Richard (Rikki) Andrew Cattermole wrote:
> I'm going to guess that you need to use the version specifier in the package name. Because I'm not seeing anything there to handle it specifically.
>
> https://github.com/mesonbuild/meson/blob/master/mesonbuild/dependencies/dub.py
>
> i.e. ``dub build [<package>[@<version-spec>]] [<options...>]``
>
> So use ``package:sub@1.0.2``.
>
> Also I just noticed meson doesn't support shared libraries from dub, so something to keep in mind.

Oh, Rikki, you are so helpful. Thanks!

--
Dmitry Olshansky
April 12, 2023
On Wednesday, 12 April 2023 at 10:24:48 UTC, Richard (Rikki) Andrew Cattermole wrote:
> I'm going to guess that you need to use the version specifier in the package name. Because I'm not seeing anything there to handle it specifically.
>
> https://github.com/mesonbuild/meson/blob/master/mesonbuild/dependencies/dub.py
>
> i.e. ``dub build [<package>[@<version-spec>]] [<options...>]``
>
> So use ``package:sub@1.0.2``.
>
> Also I just noticed meson doesn't support shared libraries from dub, so something to keep in mind.

I'm getting closer. I'm stuck with this at the moment:

Found DUB: /home/d.olshanskiy/bin/dub (DUB version 1.31.1, built on Mar 12 2023)
ERROR: strand found but it wasn't compiled with ldc
Run-time dependency strand found: NO

src/meson.build:22:0: ERROR: Dependency "strand" not found

--
Dmitry Olshansky
April 12, 2023
Did you compile the library with dub using ldc2?
April 12, 2023
On Wednesday, 12 April 2023 at 11:07:56 UTC, Richard (Rikki) Andrew Cattermole wrote:
> Did you compile the library with dub using ldc2?

Yup, I do not have other compilers installed.

--
Dmitry Olshansky
April 27, 2023

On Wednesday, 12 April 2023 at 10:06:22 UTC, Dmitry Olshansky wrote:

>

And I did fetch & build

What are possible ways to automate such download? Meson knows exactly which versions of packages suit to build. Is it possible, for example, to get somehow packages list and then download using dub fetch?

April 28, 2023
On 28/04/2023 1:43 AM, Denis Feklushkin wrote:
> On Wednesday, 12 April 2023 at 10:06:22 UTC, Dmitry Olshansky wrote:
>> And I did fetch & build
> 
> What are possible ways to automate such download? Meson knows exactly which versions of packages suit to build. Is it possible, for example, to get somehow packages list and then download using dub fetch?

On dubs end yes, and yes.

$ dub build package@version

```
$ dub search knocker
==== registry at https://code.dlang.org/ (fallbacks registry at https://codemirror.dlang.org/, registry at https://dub.byt

ecraft.nl/, registry at https://code-mirror.dlang.io/) ====
  knocker (1.0.3) Knocks on ports to open up another. Compatible with Knockd.
```

You can also get the entire manifest from dub-registry directly if you want it (you shouldn't need it).
April 28, 2023
On Thursday, 27 April 2023 at 20:48:45 UTC, Richard (Rikki) Andrew Cattermole wrote:
> On 28/04/2023 1:43 AM, Denis Feklushkin wrote:
>> On Wednesday, 12 April 2023 at 10:06:22 UTC, Dmitry Olshansky wrote:
>>> And I did fetch & build
>> 
>> What are possible ways to automate such download? Meson knows exactly which versions of packages suit to build. Is it possible, for example, to get somehow packages list and then download using dub fetch?
>
> On dubs end yes, and yes.
>
> $ dub build package@version

I guess I didn't express myself that way

How to get list of packages that can be passed to DUB by this way as above?