installation.asciidoc 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. [[installation]]
  2. == Installation
  3. === On Unix
  4. Erlang.mk requires GNU Make to be installed. While it will
  5. currently work with GNU Make 3.81, support for this version
  6. is deprecated and will be removed in the future. We recommend
  7. GNU Make 4.2 or later (especially if you want to benefit
  8. from parallel builds via the `-j` flag).
  9. Git and Erlang/OTP must also be installed.
  10. Some functionality requires that Autoconf 2.59 or later be
  11. installed, in order to compile Erlang/OTP. Erlang/OTP may
  12. have further requirements depending on your needs.
  13. Some packages may require additional libraries.
  14. ==== Linux
  15. The commands to install packages vary between distributions:
  16. .Arch Linux
  17. [source,bash]
  18. $ pacman -S erlang git make
  19. Alpine Linux and other distributions based on BusyBox come
  20. with an incompatible `awk` program. Installing the GNU Awk
  21. (`gawk` on Alpine) solves this issue.
  22. Parallel builds may require the program `flock` that can
  23. be found in the package `util-linux`.
  24. ==== FreeBSD
  25. FreeBSD comes with binary and source packages:
  26. .Install binary packages
  27. [source,bash]
  28. $ pkg install erlang git gmake
  29. On FreeBSD the `make` command is BSD Make. Use `gmake` instead.
  30. ==== OS X and macOS
  31. While Apple distributes their own GNU Make, their version is
  32. very old and plagued with numerous bugs. It is recommended
  33. to install a more recent version from either Homebrew or
  34. MacPorts:
  35. .Homebrew
  36. [source,bash]
  37. $ brew install erlang git make
  38. Homebrew installs GNU Make as `gmake`. The `make` command
  39. is the one provided by Apple.
  40. .MacPorts
  41. [source,bash]
  42. $ sudo port install erlang git gmake
  43. Parallel builds may require the program `flock` which can
  44. be installed via Homebrew or manually. The instructions
  45. to install are available from its repository:
  46. https://github.com/discoteq/flock
  47. === On Windows
  48. Erlang.mk can be used on Windows inside an MSYS2 environment.
  49. Cygwin, MSYS (the original) and native Windows (both Batch
  50. and PowerShell) are currently not supported.
  51. NOTE: Erlang.mk expects Unix line breaks in most of the files
  52. (LF instead of CRLF). Make sure to configure your text editor
  53. adequately.
  54. The rest of this section details how to setup Erlang/OTP and
  55. MSYS2 in order to use Erlang.mk.
  56. ==== Installing Erlang/OTP
  57. Erlang.mk requires Erlang/OTP to be installed. The OTP team
  58. provides binaries of Erlang/OTP for all major and minor releases,
  59. available from the http://www.erlang.org/download.html[official download page].
  60. It is recommended that you use the 64-bit installer unless
  61. technically impossible. Please follow the instructions from
  62. the installer to complete the installation.
  63. The OTP team also provides a short guide to
  64. http://www.erlang.org/download.html[installing Erlang/OTP on Windows]
  65. if you need additional references.
  66. You can install Erlang/OTP silently using the `/S` switch
  67. on the command line:
  68. ----
  69. C:\Users\essen\Downloads> otp_win64_18.0.exe /S
  70. ----
  71. ==== Installing MSYS2
  72. The only supported environment on Windows is MSYS2. MSYS2 is
  73. a lightweight Unix-like environment for Windows that comes
  74. with the Arch Linux package manager, `pacman`.
  75. The MSYS2 project provides a http://msys2.github.io[one click installer]
  76. and instructions to set things up post-installation.
  77. It is currently not possible to use the installer silently.
  78. Thankfully, the MSYS2 project provides an archive that can
  79. be used in lieu of the installer. The archive however requires
  80. _7zip_ to decompress it.
  81. First, download the
  82. http://sourceforge.net/projects/msys2/files/Base/x86_64/msys2-base-x86_64-20150512.tar.xz/download[MSYS2 base archive]
  83. and extract it under 'C:\'. Assuming you downloaded the
  84. archive as 'msys2.tar.xz' and put it in 'C:\', you can
  85. use the following commands to extract it:
  86. ----
  87. C:\> 7z x msys2.tar.xz
  88. C:\> 7z x msys2.tar > NUL
  89. ----
  90. Then you can run the two commands needed to perform the
  91. post-installation setup:
  92. ----
  93. C:\> C:\msys64\usr\bin\bash -lc "pacman --needed --noconfirm -Sy bash pacman pacman-mirrors msys2-runtime"
  94. C:\> C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Syu"
  95. ----
  96. ==== Installing the required MSYS2 packages
  97. After following these instructions, you can install GNU Make,
  98. Git and any other required softwares. From an MSYS2 shell,
  99. you can call `pacman` directly:
  100. [source,bash]
  101. $ pacman -S git make
  102. You can use `pacman -Ss` to search packages. For example,
  103. to find all packages related to GCC:
  104. [source,bash]
  105. $ pacman -Ss gcc
  106. If you are going to compile C/C++ code, you will need to
  107. install this package, as Erlang.mk cannot use the normal
  108. "gcc" package:
  109. [source,bash]
  110. $ pacman -S mingw-w64-x86_64-gcc
  111. You can also run commands under the MSYS2 environment from
  112. the Windows command line or batch files. This command will
  113. install GNU Make and Git:
  114. ----
  115. C:\> C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S git make"
  116. ----
  117. You can use similar `bash` commands if you need to run programs
  118. inside the MSYS2 environment from a batch file.
  119. ==== Gotchas
  120. While most of the basic functionality will just work, there are
  121. still some issues. Erlang.mk needs to be fixed to pass the
  122. right paths when running Erlang scripts. We are working on it.
  123. Erlang.mk is fully tested on both Linux and Windows, but is
  124. lacking tests in the areas not yet covered by this guide,
  125. so expect bugs to be fixed as more tests are added.