diff options
Diffstat (limited to 'docs/en/erlang.mk/1/guide/deps/index.html')
-rw-r--r-- | docs/en/erlang.mk/1/guide/deps/index.html | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/docs/en/erlang.mk/1/guide/deps/index.html b/docs/en/erlang.mk/1/guide/deps/index.html index 11e9171f..4337ddf6 100644 --- a/docs/en/erlang.mk/1/guide/deps/index.html +++ b/docs/en/erlang.mk/1/guide/deps/index.html @@ -10,7 +10,7 @@ <title>Nine Nines: Packages and dependencies</title> <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700,400italic' rel='stylesheet' type='text/css'> - <link href="/css/99s.css?r=2" rel="stylesheet"> + <link href="/css/99s.css?r=3" rel="stylesheet"> <link rel="shortcut icon" href="/img/ico/favicon.ico"> <link rel="apple-touch-icon-precomposed" sizes="114x114" href="/img/ico/apple-touch-icon-114.png"> @@ -148,6 +148,11 @@ http://www.gnu.org/software/src-highlite --> <pre><tt><font color="#009900">SHELL_DEPS =</font> tddreloader</tt></pre> </div></div> <p>All these will be documented in more details in their respective chapters.</p> +<p>Note that these additional types of dependencies will only be fetched after normal dependencies by default. You can force a dependency to be downloaded first by extending the target <code>deps::</code> before including <em>erlang.mk</em>, for example:</p> +<dl><dt>deps</dt> +<dd><p>$(CURDIR)/deps/triq</p> +</dd> +</dl> <h4 id="_modifying_the_dependency_source_or_version">Modifying the dependency source or version</h4> <p>By default, Erlang.mk will look into its package index to find the project you are looking for, if you only provide its name. This is this case:</p> <div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8 @@ -305,6 +310,16 @@ endef</tt></pre> <p>What about conflicts between the dependencies of different applications? Simple. Since builds are ordered, this means that the first version of an application that is fetched will be the one that wins.</p> <p>This means that if project A depends on projects B and C, in this order, and that both B and C depend on a different version of D, it will always be B's version of D that wins, because we fetch the dependencies of B before fetching those from C.</p> <p>Similarly, if project A depends on projects B, C and D, regardless of the order, and A, B and C depend on a different version of D, it will always be A's version that wins, because we fetch all dependencies of A before fetching those from B or C.</p> +<p>Once a dependency is built, it will not be built again by default. Typically dependencies do not need to be recompiled and this speeds up building immensely. There are a few ways to force recompiling a dependency however:</p> +<ul><li>The dependency directory is a symbolic link; the dependency will always be recompiled. +</li> +<li>The dependency is built directly, for example with a command like <code>make -C deps/cowlib</code>, or <code>make</code> in the dependency's directory. +</li> +<li>The variable <code>FULL</code> is set, for example <code>make FULL=1</code>. This will force building of all dependencies. This can be added to your Makefile before including <em>erlang.mk</em>. +</li> +<li>The file <code>ebin/dep_built</code> in the dependency is removed. +</li> +</ul> <h2 id="_fetching_and_listing_dependencies_only">Fetching and listing dependencies only</h2> <p>You can fetch all dependencies recursively without building anything, with the <code>make fetch-deps</code> command. It follows the same rules described in the section above.</p> <p>You can list all dependencies recursively, again without building anything, with the <code>make list-deps</code> command. It will obviously need to fetch all dependencies exactly like <code>make fetch-deps</code>. Once everything is fetched, it prints a sorted list of absolute paths to the dependencies.</p> @@ -403,7 +418,7 @@ http://www.gnu.org/software/src-highlite --> <li>Run autopatch on the project </li> </ul> -<p>Autopatch first checks if there is any project-specific patch enabled. There are currently two: <code>RABBITMQ_CLIENT_PATCH</code> for the <code>amqp_client</code> dependency, and <code>RABBITMQ_SERVER_PATCH</code> for the <code>rabbit</code> dependency. These are needed only for RabbitMQ versions before 3.6.0 (assuming you are using upstream RabbitMQ, and not a fork).</p> +<p>Autopatch first checks if there is any project-specific patch enabled. There are currently three: <code>RABBITMQ_CLIENT_PATCH</code> for the <code>amqp_client</code> dependency (before 3.6.0), <code>RABBITMQ_SERVER_PATCH</code> for the <code>rabbit</code> dependency (before 3.6.0) and <code>ELIXIR_PATCH</code> for the <code>elixir</code> dependency.</p> <p>Otherwise, autopatch performs different operations depending on the kind of project it finds the dependency to be.</p> <ul><li>Rebar projects are automatically converted to use Erlang.mk as their build tool. This essentially patches Rebar out, and fixes and converts the project to be compatible with Erlang.mk. </li> @@ -416,6 +431,23 @@ http://www.gnu.org/software/src-highlite --> <li>Other projects with no Makefile are left untouched. </li> </ul> +<p>You can add additional commands to be run immediately before or after autopatch is done by extending the target <code>autopatch-$(dep)::</code>, for example this would remove a module:</p> +<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8 +by Lorenzo Bettini +http://www.lorenzobettini.it +http://www.gnu.org/software/src-highlite --> +<pre><tt><font color="#990000">autopatch-ranch::</font> + rm -f <font color="#009900">$(DEPS_DIR)</font>/ranch/src/ranch_proxy_header.erl</tt></pre> +</div></div> +<p>A common use case for this feature is to apply a PATCH file on the dependency immediately after fetching it. It can also be used to add compiler options, for example:</p> +<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8 +by Lorenzo Bettini +http://www.lorenzobettini.it +http://www.gnu.org/software/src-highlite --> +<pre><tt><font color="#990000">autopatch-couchbeam::</font> + <b><font color="#0000FF">printf</font></b> <font color="#FF0000">"</font><font color="#CC33CC">\n</font><font color="#FF0000">ERLC_OPTS += -DWITH_JIFFY</font><font color="#CC33CC">\n</font><font color="#FF0000">"</font> <font color="#990000">>></font> <font color="#009900">$(DEPS_DIR)</font>/couchbeam/Makefile</tt></pre> +</div></div> +<p>The commands will run before autopatch when the target is defined before including <em>erlang.mk</em>, and after otherwise.</p> <p>You can disable the replacing of the <em>erlang.mk</em> file by defining the <code>NO_AUTOPATCH_ERLANG_MK</code> variable:</p> <div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8 by Lorenzo Bettini |