From d2a3f2cedd7c00d0933222aed9c06b3149aa4db4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?=
To find a package, search for it:
You can also list everything and use regular command line tools to find what you need, for example:
Once you find the package you need, adding it as a dependency to your project is a one-liner:
For example, you could add a parse transform project like this to make it available only at build time:
Or you could depend on a C project directly, if you are building a NIF:
You could depend on the Crypto application, for example:
Erlang.mk comes with additional types of dependencies.
It has TEST_DEPS
for dependencies used only for testing:
DOC_DEPS
for dependencies used only when building documentation:
REL_DEPS
for dependencies required to build the release,
or to include extra applications in the release:
And SHELL_DEPS
for dependencies to make available when running
the make shell
command:
dep_$(DEP_NAME)_commit
variable. In the case of Cowboy, this would look like this:dep_$(DEP_NAME)
variable with everything:For example, to fetch Cowboy with tag 2.0.0-pre.2 from Git:
dep_cowboy = git https://github.com/ninenines/cowboy 2.0.0-pre.2
Or to fetch Ehsa tag 4.0.3 from Mercurial:
git submodule add
:This would fetch an example project from the trunk:
And this would fetch a separate example project from a specific commit:
You can copy a directory from your machine using the cp
method.
It only takes the path to copy from:
Finally, you can use a package from the Hex repository:
To give an example, this is what the Git method does:
To ignore a dependency, simply add it to the IGNORE_DEPS
variable:
This will only ignore dependencies that are needed for building. It is therefore safe to write:
=
will work. But to avoid it biting you later on, do this:For example, to create a full fledged OTP application as a local dependency:
$ make new-app in=webchat
Or, the same as an OTP library:
You can disable the replacing of the erlang.mk file by
defining the NO_AUTOPATCH_ERLANG_MK
variable:
You can also disable autopatch entirely for a few select
projects using the NO_AUTOPATCH
variable:
A typical usage would be: