From c807880f7ac73f813b2660ea81a00f7712a4e793 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 29 Aug 2016 12:39:49 +0200 Subject: Add old mailing list archives --- docs/en/erlang.mk/1/guide/deps/index.html | 152 +++++------------------------- 1 file changed, 24 insertions(+), 128 deletions(-) (limited to 'docs/en/erlang.mk/1/guide/deps') diff --git a/docs/en/erlang.mk/1/guide/deps/index.html b/docs/en/erlang.mk/1/guide/deps/index.html index ad4a3523..780aaf56 100644 --- a/docs/en/erlang.mk/1/guide/deps/index.html +++ b/docs/en/erlang.mk/1/guide/deps/index.html @@ -109,11 +109,7 @@ http://www.gnu.org/software/src-highlite -->

Once you find the package you need, adding it as a dependency to your project is a one-liner:

-
-
DEPS = cowboy
+

And that’s it! The next time you run make, Erlang.mk will fetch and compile Cowboy. Erlang.mk will also ensure Cowboy is available whenever you use the shell, run tests and any @@ -128,20 +124,11 @@ dependencies.

For example, you could add a parse transform project like this to make it available only at build time:

-
-
BUILD_DEPS = erlando
+

Or you could depend on a C project directly, if you are building a NIF:

-
-
BUILD_DEPS = leveldb
-dep_leveldb = git https://github.com/basho/leveldb 2.1.3
+

This dependency will be built before your application, so you could easily copy the resulting shared file into your priv/ directory as part of the build process. More information @@ -155,43 +142,22 @@ Do note that there is no way to choose the version, the application used will be the one already on your system.

You could depend on the Crypto application, for example:

-
-
LOCAL_DEPS = crypto
+

Erlang.mk comes with additional types of dependencies. It has TEST_DEPS for dependencies used only for testing:

-
-
TEST_DEPS = ct_helper
-dep_ct_helper = git https://github.com/ninenines/ct_helper master
+

DOC_DEPS for dependencies used only when building documentation:

-
-
DOC_DEPS = edown
+

REL_DEPS for dependencies required to build the release, or to include extra applications in the release:

-
-
REL_DEPS = recon
+

And SHELL_DEPS for dependencies to make available when running the make shell command:

-
-
SHELL_DEPS = tddreloader
+

All these will be documented in more details in their respective chapters.

@@ -200,11 +166,7 @@ chapters.

find the project you are looking for, if you only provide its name. This is this case:

-
-
DEPS = cowboy
+

If you need a different version, you need to define another variable. There are two ways to do this, each being useful for different reasons.

@@ -212,12 +174,7 @@ for different reasons.

need to do is to define the dep_$(DEP_NAME)_commit variable. In the case of Cowboy, this would look like this:

-
-
DEPS = cowboy
-dep_cowboy_commit = 2.0.0-pre.2
+

Erlang.mk will use the package index to get all information about Cowboy, except the commit number which will be overriden.

If you need to set the fetch method or repository information @@ -225,12 +182,7 @@ too, for example because you want to use your own fork, or simply because the project is missing from the index, you can define the dep_$(DEP_NAME) variable with everything:

-
-
DEPS = cowboy
-dep_cowboy = git https://github.com/essen/cowboy 2.0.0-pre.2
+

This will fetch Cowboy from your fork at the given commit.

@@ -304,61 +256,33 @@ You can use any valid commit, tag or branch in that repository for the commit value.

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:

-
-
dep_ehsa = hg https://bitbucket.org/a12n/ehsa 4.0.3
+

Git also comes with a concept of submodules. Erlang.mk can automatically initializes and updates submodules for dependencies, as long as they were added beforehand using git submodule add:

-
-
dep_cowboy = git-submodule
+

The svn method only has a repository value, but that’s simply because the SVN repository URL can also contain the path and commit.

This would fetch an example project from the trunk:

-
-
dep_ex1 = svn https://example.com/svn/trunk/project/ex1
+

And this would fetch a separate example project from a specific commit:

-
-
dep_ex2 = svn svn://example.com/svn/branches/erlang-proj/ex2@264
+

You can copy a directory from your machine using the cp method. It only takes the path to copy from:

-
-
dep_cowboy = cp $(HOME)/ninenines/cowboy
+

Finally, you can use a package from the Hex repository:

-
-
dep_cowboy = hex 1.0.3
+

Custom fetch methods

@@ -371,14 +295,7 @@ Or in layman terms, if your dependency is Cowboy, this would become deps/cowboy.

To give an example, this is what the Git method does:

-
-
define dep_fetch_git
-        git clone -q -n -- $(call dep_repo,$1) $(DEPS_DIR)/$(call dep_name,$1); \
-        cd $(DEPS_DIR)/$(call dep_name,$1) && git checkout -q $(call dep_commit,$1);
-endef
+

Note that, like dependency information, this custom fetch method must be written before including erlang.mk.

@@ -452,20 +369,11 @@ on your system.

To ignore a dependency, simply add it to the IGNORE_DEPS variable:

-
-
IGNORE_DEPS += edown proper
+

This will only ignore dependencies that are needed for building. It is therefore safe to write:

-
-
IGNORE_DEPS += edown proper
-TEST_DEPS = proper
+

The PropEr application will be fetched as intended when running make tests or make check. It will however not be fetched when running make or make deps.

@@ -483,11 +391,7 @@ own dependencies.

if you know you will never use this project as a dependency, = will work. But to avoid it biting you later on, do this:

-
-
DEPS_DIR ?= $(CURDIR)/libs
+

The $(CURDIR) part is important, otherwise dependencies of dependencies will be fetched in the wrong directory.

Erlang.mk will also export the REBAR_DEPS_DIR variable for @@ -656,19 +560,11 @@ Other projects with no Makefile are left untouched.

You can disable the replacing of the erlang.mk file by defining the NO_AUTOPATCH_ERLANG_MK variable:

-
-
NO_AUTOPATCH_ERLANG_MK = 1
+

You can also disable autopatch entirely for a few select projects using the NO_AUTOPATCH variable:

-
-
NO_AUTOPATCH = cowboy ranch cowlib
+
-- cgit v1.2.3