installation.asciidoc 4.8 KB

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