question on dub and postgresql
Mike Parker
aldacron at gmail.com
Mon Oct 5 09:24:33 UTC 2020
On Monday, 5 October 2020 at 09:05:16 UTC, Alaindevos wrote:
> A name dependency solution is at least vage.
> How do I install ,
> https://github.com/denizzzka/dpq2
> on unix so in the code i write the .d files of that library and
> after compilation linked to the libary shared objects. For that
> shared object must be installed. How ?
You don't need to install dpq2 if you are using dub to build your
project. Add it as a dependency to your dub.json (or dub.sdl if
you prefer that format). When you build your project, dub will
download the version you configured as your dependency and
compile it along with your project.
In your project root directory (where your dub.json/sdl is
located), you should be able to run `dub add dpq2` and dub will
add the dependency to your configuration. Or you can add it
manually.
For dub.json:
"dependencies": {
"dpq2": "~>1.0.17"
}
For dub.sdl:
dependency "dpq2" version="~>1.0.17"
Make sure libpq is installed on your system and you should be
good to go.
See:
https://code.dlang.org/packages/dpq2
https://dub.pm/package-format-json
https://dub.pm/package-format-sdl
If you aren't using dub to build your project, then you could
potentially use `dub install dpq2` and it will install it in a
cache folder which, IIRC, should be in ~/.dub. However, I would
use `git clone` or `dub fetch` so that you can keep it in a
specific folder. I have some instructions for using my old
Derelict packages when you aren't using dub for your project. You
can adapt that to dpq2:
http://derelictorg.github.io/building/without-dub/
Once you've pulled down dpq2, you'll need to build it, then when
building your project you'll have to pass the dpq source path to
the compiler (with the -Ipath) so it can find the imports, the
path to the dpq library you built (with -L-Lpath), and the dpq
library (-L-ldpq).
More information about the Digitalmars-d-learn
mailing list