diff options
Diffstat (limited to 'docs/en/erlang.mk/1/guide')
-rw-r--r-- | docs/en/erlang.mk/1/guide/app.asciidoc | 7 | ||||
-rw-r--r-- | docs/en/erlang.mk/1/guide/app/index.html | 19 | ||||
-rw-r--r-- | docs/en/erlang.mk/1/guide/deps.asciidoc | 49 | ||||
-rw-r--r-- | docs/en/erlang.mk/1/guide/deps/index.html | 54 | ||||
-rw-r--r-- | docs/en/erlang.mk/1/guide/escripts.asciidoc | 81 | ||||
-rw-r--r-- | docs/en/erlang.mk/1/guide/escripts/index.html | 90 | ||||
-rw-r--r-- | docs/en/erlang.mk/1/guide/external_plugins_list.asciidoc | 9 | ||||
-rw-r--r-- | docs/en/erlang.mk/1/guide/external_plugins_list/index.html | 11 | ||||
-rw-r--r-- | docs/en/erlang.mk/1/guide/getting_started.asciidoc | 4 | ||||
-rw-r--r-- | docs/en/erlang.mk/1/guide/getting_started/index.html | 4 | ||||
-rw-r--r-- | docs/en/erlang.mk/1/guide/index.html | 5 | ||||
-rw-r--r-- | docs/en/erlang.mk/1/guide/installation.asciidoc | 51 | ||||
-rw-r--r-- | docs/en/erlang.mk/1/guide/installation/index.html | 58 | ||||
-rw-r--r-- | docs/en/erlang.mk/1/guide/releases.asciidoc | 54 | ||||
-rw-r--r-- | docs/en/erlang.mk/1/guide/releases/index.html | 59 | ||||
-rw-r--r-- | docs/en/erlang.mk/1/guide/sfx.asciidoc | 49 | ||||
-rw-r--r-- | docs/en/erlang.mk/1/guide/sfx/index.html | 206 |
17 files changed, 777 insertions, 33 deletions
diff --git a/docs/en/erlang.mk/1/guide/app.asciidoc b/docs/en/erlang.mk/1/guide/app.asciidoc index eef5d45e..229ce973 100644 --- a/docs/en/erlang.mk/1/guide/app.asciidoc +++ b/docs/en/erlang.mk/1/guide/app.asciidoc @@ -130,6 +130,13 @@ your situation. The application callback module. `PROJECT_REGISTERED`:: List of the names of all registered processes. +`PROJECT_ENV`:: + Configuration parameters used by the application. +`PROJECT_APP_EXTRA_KEYS`:: + Other keys you want to add to the application `.app` file. + The variable content is written as-is to the `.app` file, + so be sure to format valid Erlang terms. For example: + `PROJECT_APP_EXTRA_KEYS = {maxT, 10000}, {start_phases, [...]}`. `LOCAL_DEPS`:: List of Erlang/OTP applications this project depends on, excluding `erts`, `kernel` and `stdlib`, or list of diff --git a/docs/en/erlang.mk/1/guide/app/index.html b/docs/en/erlang.mk/1/guide/app/index.html index 41721c9d..6131b394 100644 --- a/docs/en/erlang.mk/1/guide/app/index.html +++ b/docs/en/erlang.mk/1/guide/app/index.html @@ -232,6 +232,25 @@ your situation.</p></div> </p>
</dd>
<dt class="hdlist1">
+<code>PROJECT_ENV</code>
+</dt>
+<dd>
+<p>
+ Configuration parameters used by the application.
+</p>
+</dd>
+<dt class="hdlist1">
+<code>PROJECT_APP_EXTRA_KEYS</code>
+</dt>
+<dd>
+<p>
+ Other keys you want to add to the application <code>.app</code> file.
+ The variable content is written as-is to the <code>.app</code> file,
+ so be sure to format valid Erlang terms. For example:
+ <code>PROJECT_APP_EXTRA_KEYS = {maxT, 10000}, {start_phases, [...]}</code>.
+</p>
+</dd>
+<dt class="hdlist1">
<code>LOCAL_DEPS</code>
</dt>
<dd>
diff --git a/docs/en/erlang.mk/1/guide/deps.asciidoc b/docs/en/erlang.mk/1/guide/deps.asciidoc index eb6f2f0c..723deb0a 100644 --- a/docs/en/erlang.mk/1/guide/deps.asciidoc +++ b/docs/en/erlang.mk/1/guide/deps.asciidoc @@ -286,6 +286,55 @@ 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. +=== Fetching and listing dependencies only + +You can fetch all dependencies recursively without building anything, +with the `make fetch-deps` command. It follows the same rules described +in the section above. + +You can list all dependencies recursively, again without building +anything, with the `make list-deps` command. It will obviously need +to fetch all dependencies exactly like `make fetch-deps`. Once +everything is fetched, it prints a sorted list of absolute paths to the +dependencies. + +By default, `fetch-deps` and `list-deps` work on the `BUILD_DEPS` +and `DEPS` lists only. To also fetch/list `TEST_DEPS`, `DOC_DEPS`, +`REL_DEPS` and/or `SHELL_DEPS`, you have two possibilities: + +* You can use `make fetch-test-deps`, `make fetch-doc-deps`, `make + fetch-rel-deps` and `make fetch-shell-deps` commands respectively. + If you want to list them, you can use `make list-test-deps`, `make + list-doc-deps`, `make list-rel-deps` and `make list-shell-deps` + respectively. +* You can use `make fetch-deps` or `make list-deps` with the Makefile + variable `DEP_TYPES` set to a list of dependency types you want. + The types are `test`, `doc`, `rel` and `shell` respectively. For + example, you can list test and doc dependencies with `make list-deps + DEP_TYPES='test doc'`. + +Note that only first level `TEST_DEPS`, `DOC_DEPS`, `REL_DEPS` and +`SHELL_DEPS` are included, not dependencies' one. In other word, +`make list-test-deps` lists the `TEST_DEPS` of your project, but not +`TEST_DEPS` of the projects yours depend on. + +No matter which method you use, `BUILD_DEPS` and `DEPS` are always +included. + +Internally, the `make fetch-*` commands store the complete list of +dependencies in files named `$(ERLANG_MK_RECURSIVE_DEPS_LIST)`, +`$(ERLANG_MK_RECURSIVE_TEST_DEPS_LIST)`, +`$(ERLANG_MK_RECURSIVE_DOC_DEPS_LIST)`, +`$(ERLANG_MK_RECURSIVE_REL_DEPS_LIST)` and +`$(ERLANG_MK_RECURSIVE_SHELL_DEPS_LIST)`. Those files are simply printed +by the `make list-*` commands. + +`make list-*` commands are made for human beings. If you need the list +of dependencies in a Makefile or a script, you should use the content +of those files directly instead. The reason is that `make fetch-*` and +`make list-*` may have unwanted content in their output, such as actual +fetching of dependencies. + === Ignoring unwanted dependencies Sometimes, you may want to ignore dependencies entirely. diff --git a/docs/en/erlang.mk/1/guide/deps/index.html b/docs/en/erlang.mk/1/guide/deps/index.html index 021c4574..cc8d737d 100644 --- a/docs/en/erlang.mk/1/guide/deps/index.html +++ b/docs/en/erlang.mk/1/guide/deps/index.html @@ -358,6 +358,60 @@ fetching those from B or C.</p></div> </div>
</div>
<div class="sect1">
+<h2 id="_fetching_and_listing_dependencies_only">Fetching and listing dependencies only</h2>
+<div class="sectionbody">
+<div class="paragraph"><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></div>
+<div class="paragraph"><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></div>
+<div class="paragraph"><p>By default, <code>fetch-deps</code> and <code>list-deps</code> work on the <code>BUILD_DEPS</code>
+and <code>DEPS</code> lists only. To also fetch/list <code>TEST_DEPS</code>, <code>DOC_DEPS</code>,
+<code>REL_DEPS</code> and/or <code>SHELL_DEPS</code>, you have two possibilities:</p></div>
+<div class="ulist"><ul>
+<li>
+<p>
+You can use <code>make fetch-test-deps</code>, <code>make fetch-doc-deps</code>, <code>make
+ fetch-rel-deps</code> and <code>make fetch-shell-deps</code> commands respectively.
+ If you want to list them, you can use <code>make list-test-deps</code>, <code>make
+ list-doc-deps</code>, <code>make list-rel-deps</code> and <code>make list-shell-deps</code>
+ respectively.
+</p>
+</li>
+<li>
+<p>
+You can use <code>make fetch-deps</code> or <code>make list-deps</code> with the Makefile
+ variable <code>DEP_TYPES</code> set to a list of dependency types you want.
+ The types are <code>test</code>, <code>doc</code>, <code>rel</code> and <code>shell</code> respectively. For
+ example, you can list test and doc dependencies with <code>make list-deps
+ DEP_TYPES='test doc'</code>.
+</p>
+</li>
+</ul></div>
+<div class="paragraph"><p>Note that only first level ‘TEST_DEPS<code>, `DOC_DEPS</code>, <code>REL_DEPS</code> and
+<code>SHELL_DEPS</code> are included, not dependencies’ one. In other word,
+<code>make list-test-deps</code> lists the <code>TEST_DEPS</code> of your project, but not
+<code>TEST_DEPS</code> of the projects yours depend on.</p></div>
+<div class="paragraph"><p>No matter which method you use, <code>BUILD_DEPS</code> and <code>DEPS</code> are always
+included.</p></div>
+<div class="paragraph"><p>Internally, the <code>make fetch-*</code> commands store the complete list of
+dependencies in files named <code>$(ERLANG_MK_RECURSIVE_DEPS_LIST)</code>,
+<code>$(ERLANG_MK_RECURSIVE_TEST_DEPS_LIST)</code>,
+<code>$(ERLANG_MK_RECURSIVE_DOC_DEPS_LIST)</code>,
+<code>$(ERLANG_MK_RECURSIVE_REL_DEPS_LIST)</code> and
+<code>$(ERLANG_MK_RECURSIVE_SHELL_DEPS_LIST)</code>. Those files are simply printed
+by the <code>make list-*</code> commands.</p></div>
+<div class="paragraph"><p><code>make list-*</code> commands are made for human beings. If you need the list
+of dependencies in a Makefile or a script, you should use the content
+of those files directly instead. The reason is that <code>make fetch-*</code> and
+<code>make list-*</code> may have unwanted content in their output, such as actual
+fetching of dependencies.</p></div>
+</div>
+</div>
+<div class="sect1">
<h2 id="_ignoring_unwanted_dependencies">Ignoring unwanted dependencies</h2>
<div class="sectionbody">
<div class="paragraph"><p>Sometimes, you may want to ignore dependencies entirely.
diff --git a/docs/en/erlang.mk/1/guide/escripts.asciidoc b/docs/en/erlang.mk/1/guide/escripts.asciidoc index 3d68c77b..722dcc6f 100644 --- a/docs/en/erlang.mk/1/guide/escripts.asciidoc +++ b/docs/en/erlang.mk/1/guide/escripts.asciidoc @@ -1,6 +1,83 @@ [[escript]] == Escripts -// @todo Write it. +Escripts are an alternative to release. They are meant to be +used for small command line executables written in Erlang. -Placeholder chapter. +They are not self-contained, unlike xref:relx[releases]. +Erlang must be installed for them to run. This however means +that they are fairly small compared to releases. + +For self-contained executables, check xref:sfx[self-extracting releases]. + +=== Requirements + +Erlang.mk uses `p7zip` by default to generate the escript +archive. Make sure it is installed. On most systems the +package is named `p7zip`; on Ubuntu you need `p7zip-full`. + +If `p7zip` is unavailable, `zip` may be used by setting +the `ESCRIPT_ZIP` variable. For example: + +[source,bash] +$ make escript ESCRIPT_ZIP=zip + +=== Generating an escript + +Run the following command to generate an escript: + +[source,bash] +$ make escript + +This will by default create an escript with the same name as +the project, in the project's directory. If the project is +called `relx` then the escript will be in `./relx`. + +You can run the escript as you would any executable: + +[source,bash] +$ ./relx + +=== Configuration + +You can change the name of the escript by setting `ESCRIPT_NAME`. +The name determines both the default output file name and the +entry module containing the function `main/1`. + +`ESCRIPT_FILE` can be set if you need a different file name +or location. + +The escript header can be entirely customized. The first line +is the shebang, set by `ESCRIPT_SHEBANG`. The second line is +a comment, set by `ESCRIPT_COMMENT`. The third line is the +arguments the VM will use when running the escript, set by +`ESCRIPT_EMU_ARGS`. + +Finally, `ESCRIPT_ZIP` can be set to customize the command used +to create the zip file. Read on for more information. + +=== Extra files + +Generating an escript is a two-part process. First, a zip file +is created with the contents of the escript. Then a header is +added to this file to create the escript. + +It is possible to add commands that will be executed between +the two steps. You can for example add extra files to the zip +archive: + +[source,make] +---- +escript-zip:: + $(verbose) $(ESCRIPT_ZIP) $(ESCRIPT_ZIP_FILE) priv/templates/* +---- + +The `ESCRIPT_ZIP` variable contains the command to run to add +files to the zip archive `ESCRIPT_ZIP_FILE`. + +=== Optimizing for size + +Erlang.mk will by default compile BEAM files with debug +information. You may want to disable this behavior to obtain +smaller escript files. Simply set `ERLC_OPTS` to a value that +does not include `+debug_info`. diff --git a/docs/en/erlang.mk/1/guide/escripts/index.html b/docs/en/erlang.mk/1/guide/escripts/index.html index dec55786..f3ba738f 100644 --- a/docs/en/erlang.mk/1/guide/escripts/index.html +++ b/docs/en/erlang.mk/1/guide/escripts/index.html @@ -69,7 +69,91 @@ <h1 class="lined-header"><span>Escripts</span></h1> -<div class="paragraph"><p>Placeholder chapter.</p></div>
+<div class="paragraph"><p>Escripts are an alternative to release. They are meant to be
+used for small command line executables written in Erlang.</p></div>
+<div class="paragraph"><p>They are not self-contained, unlike <a href="../relx">releases</a>.
+Erlang must be installed for them to run. This however means
+that they are fairly small compared to releases.</p></div>
+<div class="paragraph"><p>For self-contained executables, check <a href="../sfx">self-extracting releases</a>.</p></div>
+<div class="sect1">
+<h2 id="_requirements">Requirements</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>Erlang.mk uses <code>p7zip</code> by default to generate the escript
+archive. Make sure it is installed. On most systems the
+package is named <code>p7zip</code>; on Ubuntu you need <code>p7zip-full</code>.</p></div>
+<div class="paragraph"><p>If <code>p7zip</code> is unavailable, <code>zip</code> may be used by setting
+the <code>ESCRIPT_ZIP</code> variable. For example:</p></div>
+<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>$ make escript <span style="color: #009900">ESCRIPT_ZIP</span><span style="color: #990000">=</span>zip</tt></pre></div></div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_generating_an_escript">Generating an escript</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>Run the following command to generate an escript:</p></div>
+<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>$ make escript</tt></pre></div></div>
+<div class="paragraph"><p>This will by default create an escript with the same name as
+the project, in the project’s directory. If the project is
+called <code>relx</code> then the escript will be in <code>./relx</code>.</p></div>
+<div class="paragraph"><p>You can run the escript as you would any executable:</p></div>
+<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>$ <span style="color: #990000">.</span>/relx</tt></pre></div></div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_configuration">Configuration</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>You can change the name of the escript by setting <code>ESCRIPT_NAME</code>.
+The name determines both the default output file name and the
+entry module containing the function <code>main/1</code>.</p></div>
+<div class="paragraph"><p><code>ESCRIPT_FILE</code> can be set if you need a different file name
+or location.</p></div>
+<div class="paragraph"><p>The escript header can be entirely customized. The first line
+is the shebang, set by <code>ESCRIPT_SHEBANG</code>. The second line is
+a comment, set by <code>ESCRIPT_COMMENT</code>. The third line is the
+arguments the VM will use when running the escript, set by
+<code>ESCRIPT_EMU_ARGS</code>.</p></div>
+<div class="paragraph"><p>Finally, <code>ESCRIPT_ZIP</code> can be set to customize the command used
+to create the zip file. Read on for more information.</p></div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_extra_files">Extra files</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>Generating an escript is a two-part process. First, a zip file
+is created with the contents of the escript. Then a header is
+added to this file to create the escript.</p></div>
+<div class="paragraph"><p>It is possible to add commands that will be executed between
+the two steps. You can for example add extra files to the zip
+archive:</p></div>
+<div class="listingblock">
+<div class="content"></div></div>
+<div class="paragraph"><p>The <code>ESCRIPT_ZIP</code> variable contains the command to run to add
+files to the zip archive <code>ESCRIPT_ZIP_FILE</code>.</p></div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_optimizing_for_size">Optimizing for size</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>Erlang.mk will by default compile BEAM files with debug
+information. You may want to disable this behavior to obtain
+smaller escript files. Simply set <code>ERLC_OPTS</code> to a value that
+does not include <code>+debug_info</code>.</p></div>
+</div>
+</div>
@@ -79,8 +163,8 @@ <nav style="margin:1em 0"> - <a style="float:left" href="https://ninenines.eu/docs/en/erlang.mk/1/guide/releases/"> - Releases + <a style="float:left" href="https://ninenines.eu/docs/en/erlang.mk/1/guide/sfx/"> + Self-extracting releases </a> diff --git a/docs/en/erlang.mk/1/guide/external_plugins_list.asciidoc b/docs/en/erlang.mk/1/guide/external_plugins_list.asciidoc index 317355e6..a194f45d 100644 --- a/docs/en/erlang.mk/1/guide/external_plugins_list.asciidoc +++ b/docs/en/erlang.mk/1/guide/external_plugins_list.asciidoc @@ -28,8 +28,13 @@ as an Erlang.mk plugin. === hexer.mk -An https://github.com/inaka/hexer.mk[Hex plugin] for Erlang.mk. -Hex is a https://hex.pm/[package manager for the Elixir ecosystem]. +An https://github.com/inaka/hexer.mk[Hex plugin] for Erlang.mk +using the `hexer` tool. + +=== hexpm.mk + +Another https://github.com/botsunit/hexpm.mk[Hex plugin] for +Erlang.mk, with support for Hex dependency operators. === jorel diff --git a/docs/en/erlang.mk/1/guide/external_plugins_list/index.html b/docs/en/erlang.mk/1/guide/external_plugins_list/index.html index 803e63b5..9b26460d 100644 --- a/docs/en/erlang.mk/1/guide/external_plugins_list/index.html +++ b/docs/en/erlang.mk/1/guide/external_plugins_list/index.html @@ -104,8 +104,15 @@ as an Erlang.mk plugin.</p></div> <div class="sect1">
<h2 id="_hexer_mk">hexer.mk</h2>
<div class="sectionbody">
-<div class="paragraph"><p>An <a href="https://github.com/inaka/hexer.mk">Hex plugin</a> for Erlang.mk.
-Hex is a <a href="https://hex.pm/">package manager for the Elixir ecosystem</a>.</p></div>
+<div class="paragraph"><p>An <a href="https://github.com/inaka/hexer.mk">Hex plugin</a> for Erlang.mk
+using the <code>hexer</code> tool.</p></div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_hexpm_mk">hexpm.mk</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>Another <a href="https://github.com/botsunit/hexpm.mk">Hex plugin</a> for
+Erlang.mk, with support for Hex dependency operators.</p></div>
</div>
</div>
<div class="sect1">
diff --git a/docs/en/erlang.mk/1/guide/getting_started.asciidoc b/docs/en/erlang.mk/1/guide/getting_started.asciidoc index 3a7c0d10..ca1391d6 100644 --- a/docs/en/erlang.mk/1/guide/getting_started.asciidoc +++ b/docs/en/erlang.mk/1/guide/getting_started.asciidoc @@ -32,7 +32,7 @@ $ wget https://erlang.mk/erlang.mk Or: [source,bash] -$ curl https://erlang.mk/erlang.mk -o erlang.mk +$ curl -O https://erlang.mk/erlang.mk Alternatively, just https://erlang.mk/erlang.mk[click on this link]. @@ -290,7 +290,7 @@ you can always run `make help`: ---- $ make help erlang.mk (version 1.2.0-642-gccd2b9f) is distributed under the terms of the ISC License. -Copyright (c) 2013-2015 Loïc Hoguin <[email protected]> +Copyright (c) 2013-2016 Loïc Hoguin <[email protected]> Usage: [V=1] make [target]... diff --git a/docs/en/erlang.mk/1/guide/getting_started/index.html b/docs/en/erlang.mk/1/guide/getting_started/index.html index 0504e949..10bc1ab3 100644 --- a/docs/en/erlang.mk/1/guide/getting_started/index.html +++ b/docs/en/erlang.mk/1/guide/getting_started/index.html @@ -108,7 +108,7 @@ http://www.gnu.org/software/src-highlite --> by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
-<pre><tt>$ curl https<span style="color: #990000">:</span>//erlang<span style="color: #990000">.</span>mk/erlang<span style="color: #990000">.</span>mk -o erlang<span style="color: #990000">.</span>mk</tt></pre></div></div>
+<pre><tt>$ curl -O https<span style="color: #990000">:</span>//erlang<span style="color: #990000">.</span>mk/erlang<span style="color: #990000">.</span>mk</tt></pre></div></div>
<div class="paragraph"><p>Alternatively, just <a href="https://erlang.mk/erlang.mk">click on this link</a>.</p></div>
<div class="paragraph"><p>Make sure you put the file inside the folder we created previously.</p></div>
</div>
@@ -388,7 +388,7 @@ http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite -->
<pre><tt>$ make <span style="font-weight: bold"><span style="color: #0000FF">help</span></span>
erlang<span style="color: #990000">.</span>mk <span style="color: #990000">(</span>version <span style="color: #993399">1.2</span><span style="color: #990000">.</span><span style="color: #993399">0</span>-<span style="color: #993399">642</span>-gccd2b9f<span style="color: #990000">)</span> is distributed under the terms of the ISC License<span style="color: #990000">.</span>
-Copyright <span style="color: #990000">(</span>c<span style="color: #990000">)</span> <span style="color: #993399">2013</span>-<span style="color: #993399">2015</span> Loïc Hoguin <span style="color: #990000"><</span>essen@ninenines<span style="color: #990000">.</span>eu<span style="color: #990000">></span>
+Copyright <span style="color: #990000">(</span>c<span style="color: #990000">)</span> <span style="color: #993399">2013</span>-<span style="color: #993399">2016</span> Loïc Hoguin <span style="color: #990000"><</span>essen@ninenines<span style="color: #990000">.</span>eu<span style="color: #990000">></span>
Usage<span style="color: #990000">:</span> <span style="color: #990000">[</span><span style="color: #009900">V</span><span style="color: #990000">=</span><span style="color: #993399">1</span><span style="color: #990000">]</span> make <span style="color: #990000">[</span>target<span style="color: #990000">]...</span>
diff --git a/docs/en/erlang.mk/1/guide/index.html b/docs/en/erlang.mk/1/guide/index.html index 66b34a72..dd2d6927 100644 --- a/docs/en/erlang.mk/1/guide/index.html +++ b/docs/en/erlang.mk/1/guide/index.html @@ -122,6 +122,11 @@ </li>
<li>
<p>
+<a href="sfx/">Self-extracting releases</a>
+</p>
+</li>
+<li>
+<p>
<a href="escripts/">Escripts</a>
</p>
</li>
diff --git a/docs/en/erlang.mk/1/guide/installation.asciidoc b/docs/en/erlang.mk/1/guide/installation.asciidoc index cc18e7f1..f3a52cf4 100644 --- a/docs/en/erlang.mk/1/guide/installation.asciidoc +++ b/docs/en/erlang.mk/1/guide/installation.asciidoc @@ -1,24 +1,57 @@ [[installation]] == Installation -This chapter explains how to setup your system in -order to use Erlang.mk. - === On Unix -Erlang.mk requires GNU Make to be installed. GNU Make 3.81 -or later is required. GNU Make 4.1 or later is recommended, -as this is the version Erlang.mk is developed on. +Erlang.mk requires GNU Make to be installed. While it will +currently work with GNU Make 3.81, support for this version +is deprecated and will be removed in 2017. We recommend +GNU Make 4.1 or later. + +Git and Erlang/OTP must also be installed. Some functionality requires that Autoconf 2.59 or later be installed, in order to compile Erlang/OTP. Erlang/OTP may have further requirements depending on your needs. -Erlang.mk currently requires Erlang/OTP to be installed in -order to compile Erlang projects. - Some packages may require additional libraries. +==== Linux + +The commands to install packages vary between distributions: + +.Arch Linux +[source,bash] +$ pacman -Sy erlang git make + +==== FreeBSD + +FreeBSD comes with binary and source packages: + +.Install binary packages +[source,bash] +$ pkg install erlang git gmake + +On FreeBSD the `make` command is BSD Make. Use `gmake` instead. + +==== OS X and macOS + +While Apple distributes their own GNU Make, their version is +very old and plagued with numerous bugs. It is recommended +to install a more recent version from either Homebrew or +MacPorts: + +.Homebrew +[source,bash] +$ brew install erlang git homebrew/dupes/make + +Homebrew installs GNU Make as `gmake`. The `make` command +is the one provided by Apple. + +.MacPorts +[source,bash] +$ sudo port install erlang git gmake + === On Windows Erlang.mk can be used on Windows inside an MSYS2 environment. diff --git a/docs/en/erlang.mk/1/guide/installation/index.html b/docs/en/erlang.mk/1/guide/installation/index.html index 7e4ebfb8..2d711d0f 100644 --- a/docs/en/erlang.mk/1/guide/installation/index.html +++ b/docs/en/erlang.mk/1/guide/installation/index.html @@ -69,20 +69,64 @@ <h1 class="lined-header"><span>Installation</span></h1> -<div class="paragraph"><p>This chapter explains how to setup your system in
-order to use Erlang.mk.</p></div>
<div class="sect1">
<h2 id="_on_unix">On Unix</h2>
<div class="sectionbody">
-<div class="paragraph"><p>Erlang.mk requires GNU Make to be installed. GNU Make 3.81
-or later is required. GNU Make 4.1 or later is recommended,
-as this is the version Erlang.mk is developed on.</p></div>
+<div class="paragraph"><p>Erlang.mk requires GNU Make to be installed. While it will
+currently work with GNU Make 3.81, support for this version
+is deprecated and will be removed in 2017. We recommend
+GNU Make 4.1 or later.</p></div>
+<div class="paragraph"><p>Git and Erlang/OTP must also be installed.</p></div>
<div class="paragraph"><p>Some functionality requires that Autoconf 2.59 or later be
installed, in order to compile Erlang/OTP. Erlang/OTP may
have further requirements depending on your needs.</p></div>
-<div class="paragraph"><p>Erlang.mk currently requires Erlang/OTP to be installed in
-order to compile Erlang projects.</p></div>
<div class="paragraph"><p>Some packages may require additional libraries.</p></div>
+<div class="sect3">
+<h4 id="_linux">Linux</h4>
+<div class="paragraph"><p>The commands to install packages vary between distributions:</p></div>
+<div class="listingblock">
+<div class="title">Arch Linux</div>
+<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>$ pacman -Sy erlang git make</tt></pre></div></div>
+</div>
+<div class="sect3">
+<h4 id="_freebsd">FreeBSD</h4>
+<div class="paragraph"><p>FreeBSD comes with binary and source packages:</p></div>
+<div class="listingblock">
+<div class="title">Install binary packages</div>
+<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>$ pkg install erlang git gmake</tt></pre></div></div>
+<div class="paragraph"><p>On FreeBSD the <code>make</code> command is BSD Make. Use <code>gmake</code> instead.</p></div>
+</div>
+<div class="sect3">
+<h4 id="_os_x_and_macos">OS X and macOS</h4>
+<div class="paragraph"><p>While Apple distributes their own GNU Make, their version is
+very old and plagued with numerous bugs. It is recommended
+to install a more recent version from either Homebrew or
+MacPorts:</p></div>
+<div class="listingblock">
+<div class="title">Homebrew</div>
+<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>$ brew install erlang git homebrew/dupes/make</tt></pre></div></div>
+<div class="paragraph"><p>Homebrew installs GNU Make as <code>gmake</code>. The <code>make</code> command
+is the one provided by Apple.</p></div>
+<div class="listingblock">
+<div class="title">MacPorts</div>
+<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>$ sudo port install erlang git gmake</tt></pre></div></div>
+</div>
</div>
</div>
<div class="sect1">
diff --git a/docs/en/erlang.mk/1/guide/releases.asciidoc b/docs/en/erlang.mk/1/guide/releases.asciidoc index 46183e63..67abe879 100644 --- a/docs/en/erlang.mk/1/guide/releases.asciidoc +++ b/docs/en/erlang.mk/1/guide/releases.asciidoc @@ -17,12 +17,11 @@ RELX_CONFIG = $(CURDIR)/webchat.config Relx does not need to be installed. Erlang.mk will download and build it automatically. -// @todo We are going to fetch relx from repository in the future. The Relx executable will be saved in the '$(RELX)' file. This location defaults to '$(CURDIR)/relx' and can be overriden. -// @todo You can use a custom repository by ??? +// @todo You can use a custom location by ??? === Configuration @@ -56,6 +55,10 @@ the `rel` target can be used: [source,bash] $ make rel +Erlang.mk always generates a tarball alongside the release, +which can be directly uploaded to a server. The tarball is +located at `$(RELX_OUTPUT_DIR)/<name>/<name>-<vsn>.tar.gz`. + === Running the release Erlang.mk provides a convenience function for running the @@ -68,3 +71,50 @@ This command will also build the project and generate the release if they weren't already. It starts the release in _console mode_, meaning you will also have a shell ready to use to check things as needed. + +=== Upgrading a release + +Erlang.mk provides a `relup` target for generating release +upgrades. Release upgrades allow updating the code and the +state of a running release without restarting it. + +Once your changes are done, you need to update the version +of the application(s) that will be updated. You also need +to update the version of the release. + +For each application that needs to be updated, an +http://erlang.org/doc/man/appup.html[appup file] +must be written. Refer to the Erlang/OTP documentation +for more details. + +For the purpose of this section, assume the initial release +version was `1`, and the new version is `2`. The name of the +release will be `example`. + +Once all this is done, you can build the tarball for the +release upgrade: + +[source,bash] +$ make relup + +This will create an archive at the root directory of the +release, `$RELX_OUTPUT_DIR/example/example-2.tar.gz`. + +Move the archive to the correct location on the running +node. From the release's root directory: + +[source,bash] +$ mkdir releases/2/ +$ mv path/to/example-2.tar.gz releases/2/ + +Finally, upgrade the release: + +[source,bash] +$ bin/example_release upgrade "2/example_release" + +Or on Windows: + +[source,bash] +$ bin/example_release.cmd upgrade "2/example_release" + +Your release was upgraded! diff --git a/docs/en/erlang.mk/1/guide/releases/index.html b/docs/en/erlang.mk/1/guide/releases/index.html index bf102a3c..fc98819e 100644 --- a/docs/en/erlang.mk/1/guide/releases/index.html +++ b/docs/en/erlang.mk/1/guide/releases/index.html @@ -123,6 +123,9 @@ by Lorenzo Bettini http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>$ make rel</tt></pre></div></div>
+<div class="paragraph"><p>Erlang.mk always generates a tarball alongside the release,
+which can be directly uploaded to a server. The tarball is
+located at <code>$(RELX_OUTPUT_DIR)/<name>/<name>-<vsn>.tar.gz</code>.</p></div>
</div>
</div>
<div class="sect1">
@@ -142,6 +145,58 @@ release if they weren’t already. It starts the release in use to check things as needed.</p></div>
</div>
</div>
+<div class="sect1">
+<h2 id="_upgrading_a_release">Upgrading a release</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>Erlang.mk provides a <code>relup</code> target for generating release
+upgrades. Release upgrades allow updating the code and the
+state of a running release without restarting it.</p></div>
+<div class="paragraph"><p>Once your changes are done, you need to update the version
+of the application(s) that will be updated. You also need
+to update the version of the release.</p></div>
+<div class="paragraph"><p>For each application that needs to be updated, an
+<a href="http://erlang.org/doc/man/appup.html">appup file</a>
+must be written. Refer to the Erlang/OTP documentation
+for more details.</p></div>
+<div class="paragraph"><p>For the purpose of this section, assume the initial release
+version was <code>1</code>, and the new version is <code>2</code>. The name of the
+release will be <code>example</code>.</p></div>
+<div class="paragraph"><p>Once all this is done, you can build the tarball for the
+release upgrade:</p></div>
+<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>$ make relup</tt></pre></div></div>
+<div class="paragraph"><p>This will create an archive at the root directory of the
+release, <code>$RELX_OUTPUT_DIR/example/example-2.tar.gz</code>.</p></div>
+<div class="paragraph"><p>Move the archive to the correct location on the running
+node. From the release’s root directory:</p></div>
+<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>$ mkdir releases<span style="color: #990000">/</span><span style="color: #993399">2</span><span style="color: #990000">/</span>
+$ mv path/to/example-<span style="color: #993399">2</span><span style="color: #990000">.</span>tar<span style="color: #990000">.</span>gz releases<span style="color: #990000">/</span><span style="color: #993399">2</span><span style="color: #990000">/</span></tt></pre></div></div>
+<div class="paragraph"><p>Finally, upgrade the release:</p></div>
+<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>$ bin/example_release upgrade <span style="color: #FF0000">"2/example_release"</span></tt></pre></div></div>
+<div class="paragraph"><p>Or on Windows:</p></div>
+<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>$ bin/example_release<span style="color: #990000">.</span>cmd upgrade <span style="color: #FF0000">"2/example_release"</span></tt></pre></div></div>
+<div class="paragraph"><p>Your release was upgraded!</p></div>
+</div>
+</div>
@@ -157,8 +212,8 @@ use to check things as needed.</p></div> - <a style="float:right" href="https://ninenines.eu/docs/en/erlang.mk/1/guide/escripts/"> - Escripts + <a style="float:right" href="https://ninenines.eu/docs/en/erlang.mk/1/guide/sfx/"> + Self-extracting releases </a> </nav> diff --git a/docs/en/erlang.mk/1/guide/sfx.asciidoc b/docs/en/erlang.mk/1/guide/sfx.asciidoc new file mode 100644 index 00000000..aae2c8d4 --- /dev/null +++ b/docs/en/erlang.mk/1/guide/sfx.asciidoc @@ -0,0 +1,49 @@ +[[sfx]] +== Self-extracting releases + +Erlang.mk allows you to package xref:relx[Relx releases] as +self-extracting archives. These archives contain all the +files in the release and come in the form of a script that +will extract and run the release automatically. + +This allows you to package the release as a single file +that can then be executed. + +This feature is currently experimental. Feedback is much +appreciated. + +=== Generating the self-extracting archive + +To generate a self-extracting release, all you need to do +is pass the `SFX=1` variable to Make when you build the +release: + +[source,bash] +$ make SFX=1 + +This will create a self-extracting archive in +`$RELX_OUTPUT_DIR/<name>.run`. For example if the release +is named `hello_world` and `$RELX_OUTPUT_DIR` is the default, +the file will be located at `_rel/hello_world.run`. + +=== Running the release + +Simply execute the script to get started: + +[source,bash] +---- +$ ./_rel/hello_world.run +Exec: /tmp/tmp.3eeEq7E1ta/erts-8.1/bin/erlexec ... +Root: /tmp/tmp.3eeEq7E1ta +/tmp/tmp.3eeEq7E1ta +Erlang/OTP 19 [erts-8.1] [source] [64-bit] [smp:4:4] ... + +Eshell V8.1 (abort with ^G) +(hello_world@localhost)1> +---- + +As you can see the archive is extracted to a temporary +directory before the release can be started. + +The self-extracting script currently only supports starting +the release in `console` mode. diff --git a/docs/en/erlang.mk/1/guide/sfx/index.html b/docs/en/erlang.mk/1/guide/sfx/index.html new file mode 100644 index 00000000..8433ab9c --- /dev/null +++ b/docs/en/erlang.mk/1/guide/sfx/index.html @@ -0,0 +1,206 @@ +<!DOCTYPE html> +<html lang="en"> + +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <meta name="description" content=""> + <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara"> + + <meta name="generator" content="Hugo 0.16" /> + + <title>Nine Nines: Self-extracting releases</title> + + <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700,400italic' rel='stylesheet' type='text/css'> + + <link href="/css/bootstrap.min.css" rel="stylesheet"> + <link href="/css/99s.css" 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"> + <link rel="apple-touch-icon-precomposed" sizes="72x72" href="/img/ico/apple-touch-icon-72.png"> + <link rel="apple-touch-icon-precomposed" href="/img/ico/apple-touch-icon-57.png"> + + +</head> + + +<body class=""> + <header id="page-head"> + <div id="topbar" class="container"> + <div class="row"> + <div class="span2"> + <h1 id="logo"><a href="/" title="99s">99s</a></h1> + </div> + <div class="span10"> + + <div id="side-header"> + <nav> + <ul> + <li><a title="Hear my thoughts" href="/articles">Articles</a></li> + <li><a title="Watch my talks" href="/talks">Talks</a></li> + <li class="active"><a title="Read the docs" href="/docs">Documentation</a></li> + <li><a title="Request my services" href="/services">Consulting & Training</a></li> + </ul> + </nav> + <ul id="social"> + <li> + <a href="https://github.com/ninenines" title="Check my Github repositories"><img src="/img/ico_github.png" data-hover="/img/ico_github_alt.png" alt="Github"></a> + </li> + <li> + <a title="Keep in touch!" href="http://twitter.com/lhoguin"><img src="/img/ico_microblog.png" data-hover="/img/ico_microblog_alt.png"></a> + </li> + <li> + <a title="Contact me" href="mailto:[email protected]"><img src="/img/ico_mail.png" data-hover="/img/ico_mail_alt.png"></a> + </li> + </ul> + </div> + </div> + </div> + </div> + + +</header> + +<div id="contents" class="two_col"> +<div class="container"> +<div class="row"> +<div id="docs" class="span9 maincol"> + +<h1 class="lined-header"><span>Self-extracting releases</span></h1> + +<div class="paragraph"><p>Erlang.mk allows you to package <a href="../relx">Relx releases</a> as
+self-extracting archives. These archives contain all the
+files in the release and come in the form of a script that
+will extract and run the release automatically.</p></div>
+<div class="paragraph"><p>This allows you to package the release as a single file
+that can then be executed.</p></div>
+<div class="paragraph"><p>This feature is currently experimental. Feedback is much
+appreciated.</p></div>
+<div class="sect1">
+<h2 id="_generating_the_self_extracting_archive">Generating the self-extracting archive</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>To generate a self-extracting release, all you need to do
+is pass the <code>SFX=1</code> variable to Make when you build the
+release:</p></div>
+<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>$ make <span style="color: #009900">SFX</span><span style="color: #990000">=</span><span style="color: #993399">1</span></tt></pre></div></div>
+<div class="paragraph"><p>This will create a self-extracting archive in
+<code>$RELX_OUTPUT_DIR/<name>.run</code>. For example if the release
+is named <code>hello_world</code> and <code>$RELX_OUTPUT_DIR</code> is the default,
+the file will be located at <code>_rel/hello_world.run</code>.</p></div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_running_the_release">Running the release</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>Simply execute the script to get started:</p></div>
+<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>$ <span style="color: #990000">./</span>_rel/hello_world<span style="color: #990000">.</span>run
+Exec<span style="color: #990000">:</span> /tmp/tmp<span style="color: #990000">.</span>3eeEq7E1ta/erts-<span style="color: #993399">8.1</span>/bin/erlexec <span style="color: #990000">...</span>
+Root<span style="color: #990000">:</span> /tmp/tmp<span style="color: #990000">.</span>3eeEq7E1ta
+/tmp/tmp<span style="color: #990000">.</span>3eeEq7E1ta
+Erlang/OTP <span style="color: #993399">19</span> <span style="color: #990000">[</span>erts-<span style="color: #993399">8.1</span><span style="color: #990000">]</span> <span style="color: #990000">[</span><span style="font-weight: bold"><span style="color: #0000FF">source</span></span><span style="color: #990000">]</span> <span style="color: #990000">[</span><span style="color: #993399">64</span>-bit<span style="color: #990000">]</span> <span style="color: #990000">[</span>smp<span style="color: #990000">:</span><span style="color: #993399">4</span><span style="color: #990000">:</span><span style="color: #993399">4</span><span style="color: #990000">]</span> <span style="color: #990000">...</span>
+
+Eshell V8<span style="color: #990000">.</span><span style="color: #993399">1</span> <span style="color: #990000">(</span>abort with <span style="color: #990000">^</span>G<span style="color: #990000">)</span>
+<span style="color: #990000">(</span>hello_world@localhost<span style="color: #990000">)</span><span style="color: #993399">1</span><span style="color: #990000">></span></tt></pre></div></div>
+<div class="paragraph"><p>As you can see the archive is extracted to a temporary
+directory before the release can be started.</p></div>
+<div class="paragraph"><p>The self-extracting script currently only supports starting
+the release in <code>console</code> mode.</p></div>
+</div>
+</div>
+ + + + + + + + <nav style="margin:1em 0"> + + <a style="float:left" href="https://ninenines.eu/docs/en/erlang.mk/1/guide/releases/"> + Releases + </a> + + + + <a style="float:right" href="https://ninenines.eu/docs/en/erlang.mk/1/guide/escripts/"> + Escripts + </a> + + </nav> + + + + +</div> + +<div class="span3 sidecol"> + + +<h3> + Erlang.mk + 1 + + User Guide +</h3> + +<ul> + + + +</ul> + +<h4 id="docs-nav">Navigation</h4> + +<h4>Version select</h4> +<ul> + + + + <li><a href="/docs/en/erlang.mk/1/guide">1</a></li> + +</ul> + +</div> +</div> +</div> +</div> + + <footer> + <div class="container"> + <div class="row"> + <div class="span6"> + <p id="scroll-top"><a href="#">↑ Scroll to top</a></p> + <nav> + <ul> + <li><a href="mailto:[email protected]" title="Contact us">Contact us</a></li><li><a href="https://github.com/ninenines/ninenines.github.io" title="Github repository">Contribute to this site</a></li> + </ul> + </nav> + </div> + <div class="span6 credits"> + <p><img src="/img/footer_logo.png"></p> + <p>Copyright © Loïc Hoguin 2012-2016</p> + </div> + </div> + </div> + </footer> + + + <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> + <script src="/js/bootstrap-carousel.js"></script> + <script src="/js/bootstrap-dropdown.js"></script> + <script src="/js/custom.js"></script> + </body> +</html> + + |