aboutsummaryrefslogtreecommitdiffstats
path: root/guide/installation.html
blob: 1d8aafc599b78937e3f366b283c88886179f65a0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Erlang.mk User Guide</title>
<style type="text/css"><!--
body{background:white;color:black;font-family:"Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;justify-content:center;margin:0 auto;padding:0;width:600px}
header {align-items:center;display:flex;justify-content:center}
header nav.left{text-align:right;width:150px}
header nav.right{text-align:left;width:150px}
header nav a{display:block;margin:1.5em 1em}
main{margin-top:2em;text-align:justify}
main h2, main h3{margin-top:2em}
main h1, main div.chapter>div.titlepage h2{font-size:2em;margin-top:.67em}
a{color:#d9230f;text-decoration:none}
a:hover{text-decoration:underline}
a.xref{display:none}
h1, h2, h3{font-weight:normal}
div.navfooter{margin-bottom:1em}
--></style>
</head>
<body>
<header>
	<nav class="left">
		<a href="index.html">User guide</a>
		<a href="getting_started.html">Tutorials</a>
	</nav>
	<a href="/" class="logo"><img src="../res/logo-small.png" alt="Erlang.mk" title="Erlang.mk: A build tool for Erlang that just works" height="200" width="206"/></a>
	<nav class="right">
		<a href="https://github.com/ninenines/erlang.mk/tree/master/index">470+ packages</a>
		<a href="https://github.com/ninenines/erlang.mk/issues">Issues?</a>
	</nav>
</header>
<main>

<div class="navheader"><table width="100%" summary="Navigation header"><tr><td width="20%" align="left"><a accesskey="p" href="index.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="getting_started.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a id="installation"></a>Chapter 1. Installation</h1></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_on_unix"></a>1.1. On Unix</h2></div></div></div><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><p>Git and Erlang/OTP must also be installed.</p><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><p>Some packages may require additional libraries.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_linux"></a>1.1.1. Linux</h3></div></div></div><p>The commands to install packages vary between distributions:</p><p><strong>Arch Linux. </strong>
</p><pre class="programlisting">$ pacman -S erlang git make</pre><p>
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_freebsd"></a>1.1.2. FreeBSD</h3></div></div></div><p>FreeBSD comes with binary and source packages:</p><p><strong>Install binary packages. </strong>
</p><pre class="programlisting">$ pkg install erlang git gmake</pre><p>
</p><p>On FreeBSD the <code class="literal">make</code> command is BSD Make. Use <code class="literal">gmake</code> instead.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_os_x_and_macos"></a>1.1.3. OS X and macOS</h3></div></div></div><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><p><strong>Homebrew. </strong>
</p><pre class="programlisting">$ brew install erlang git homebrew/dupes/make</pre><p>
</p><p>Homebrew installs GNU Make as <code class="literal">gmake</code>. The <code class="literal">make</code> command
is the one provided by Apple.</p><p><strong>MacPorts. </strong>
</p><pre class="programlisting">$ sudo port install erlang git gmake</pre><p>
</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_on_windows"></a>1.2. On Windows</h2></div></div></div><p>Erlang.mk can be used on Windows inside an MSYS2 environment.
Cygwin, MSYS (the original) and native Windows (both Batch
and PowerShell) are currently not supported.</p><p>The rest of this section details how to setup Erlang/OTP and
MSYS2 in order to use Erlang.mk.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_installing_erlang_otp"></a>1.2.1. Installing Erlang/OTP</h3></div></div></div><p>Erlang.mk requires Erlang/OTP to be installed. The OTP team
provides binaries of Erlang/OTP for all major and minor releases,
available from the <a class="ulink" href="http://www.erlang.org/download.html" target="_top">official download page</a>.
It is recommended that you use the 64-bit installer unless
technically impossible. Please follow the instructions from
the installer to complete the installation.</p><p>The OTP team also provides a short guide to
<a class="ulink" href="http://www.erlang.org/download.html" target="_top">installing Erlang/OTP on Windows</a>
if you need additional references.</p><p>You can install Erlang/OTP silently using the <code class="literal">/S</code> switch
on the command line:</p><pre class="screen">C:\Users\essen\Downloads&gt; otp_win64_18.0.exe /S</pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_installing_msys2"></a>1.2.2. Installing MSYS2</h3></div></div></div><p>The only supported environment on Windows is MSYS2. MSYS2 is
a lightweight Unix-like environment for Windows that comes
with the Arch Linux package manager, <code class="literal">pacman</code>.</p><p>The MSYS2 project provides a <a class="ulink" href="http://msys2.github.io" target="_top">one click installer</a>
and instructions to set things up post-installation.</p><p>It is currently not possible to use the installer silently.
Thankfully, the MSYS2 project provides an archive that can
be used in lieu of the installer. The archive however requires
<span class="emphasis"><em>7zip</em></span> to decompress it.</p><p>First, download the
<a class="ulink" href="http://sourceforge.net/projects/msys2/files/Base/x86_64/msys2-base-x86_64-20150512.tar.xz/download" target="_top">MSYS2 base archive</a>
and extract it under <span class="emphasis"><em>C:\</em></span>. Assuming you downloaded the
archive as <span class="emphasis"><em>msys2.tar.xz</em></span> and put it in <span class="emphasis"><em>C:\</em></span>, you can
use the following commands to extract it:</p><pre class="screen">C:\&gt; 7z x msys2.tar.xz
C:\&gt; 7z x msys2.tar &gt; NUL</pre><p>Then you can run the two commands needed to perform the
post-installation setup:</p><pre class="screen">C:\&gt; C:\msys64\usr\bin\bash -lc "pacman --needed --noconfirm -Sy bash pacman pacman-mirrors msys2-runtime"
C:\&gt; C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Syu"</pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_installing_the_required_msys2_packages"></a>1.2.3. Installing the required MSYS2 packages</h3></div></div></div><p>After following these instructions, you can install GNU Make,
Git and any other required softwares. From an MSYS2 shell,
you can call <code class="literal">pacman</code> directly:</p><pre class="programlisting">$ pacman -S git make</pre><p>You can use <code class="literal">pacman -Ss</code> to search packages. For example,
to find all packages related to GCC:</p><pre class="programlisting">$ pacman -Ss gcc</pre><p>If you are going to compile C/C++ code, you will need to
install this package, as Erlang.mk cannot use the normal
"gcc" package:</p><pre class="programlisting">$ pacman -S mingw-w64-x86_64-gcc</pre><p>You can also run commands under the MSYS2 environment from
the Windows command line or batch files. This command will
install GNU Make and Git:</p><pre class="screen">C:\&gt; C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S git make"</pre><p>You can use similar <code class="literal">bash</code> commands if you need to run programs
inside the MSYS2 environment from a batch file.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_gotchas"></a>1.2.4. Gotchas</h3></div></div></div><p>While most of the basic functionality will just work, there are
still some issues. Erlang.mk needs to be fixed to pass the
right paths when running Erlang scripts. We are working on it.
Erlang.mk is fully tested on both Linux and Windows, but is
lacking tests in the areas not yet covered by this guide,
so expect bugs to be fixed as more tests are added.</p></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="index.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="getting_started.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> </td></tr></table></div>
</main>
</body>
</html>