How do I create a package?

Steven Schveighoffer schveiguy at
Sat Mar 5 15:54:20 UTC 2022

On 3/5/22 10:30 AM, M wrote:
> On Saturday, 5 March 2022 at 15:12:35 UTC, M wrote:
> I've created a directory bcm2835. Then within source/bcm2835 I have 
> bcm2835.d.
> I run dub build, and file called libbcm2835.a gets built.
> I type
>          dub list
> and  it reports
>      Packages present in the system and known to dub:
>      ...
>      bcm2835 ~master: /home/pi/repos/cerbo/dsp/dlang/bcm2835/
> So, some kind of success, presumably.
> So then, in the app I want to build, I type
>        dub add bcm2835
> but it says
>       Could not find package 'bcm2835'.
> So, dunno, any ideas?

`dub add` *requires* the package to be hosted on the dub online 
repository. `dub add` is like "lookup the latest version of package X 
and add the dependency for that into my build". I agree it would be nice 
for dub to glance at your locally-added packages.

You can `dub add-local` the package (as it appears you have done), and 
*then* edit the dub.json or dub.sdl file directly to add the dependency 
yourself. Then it will find the package when building.

I use this for private packages I'm not ready to publish.


More information about the Digitalmars-d-learn mailing list