原文链接 https://erlang.mk/guide/kerl.html
Chapter 12. OTP version management
Erlang.mk comes with integrated support for Kerl, a shell script that automates the downloading, building and installing of Erlang/OTP. It can be used to easily build a specific Erlang/OTP version (with or without custom build options) or maintain different versions side by side.
Erlang.mk集成了对Kerl的支持,Kerl是一个可以自动下载、构建和安装 Erlang/OTP 的shell脚本。 它可以用来轻松构建一个特定的 Erlang/OTP 版本(不论是否有自定义构建选项)或同时维护不同的版本。
12.1. Erlang versions
12.1. Erlang的版本格式
Erlang.mk uses the Git tags from Erlang/OTP to identify OTP versions. The most recent tag at the time of writing is OTP-20.0.4
, which is a patch release of OTP-20.0
. A patch release is a non-official release containing a few fixes on top of the official release.
Erlang.mk使用 Erlang/OTP 的Git标签来识别OTP版本。 在编写本文时,最新标签是OTP-20.0.4,它是OTP-20.0的补丁版本。 修补发行版是在正式发行版上包含一些补丁的非官方发行版。
Older versions used a slightly different versioning scheme and tag format, for example: OTP_R16B03
. Beware though, there also was an OTP_R16B03-1
release that fixed a critical issue in the initial release.
较早的版本使用稍微不同的版本方案和标签格式,例如:OTP_R16B03
,但是要小心,还有一个OTP_R16B03-1
的发行版,它修复了OTP_R16B03
中的一个关键问题。
The README file for all official Erlang/OTP releases can be found on erlang.org. To obtain information about patch releases when they are released you need to be subscribed to the erlang-questions mailing list.
所有官方 Erlang/OTP 版本的README文件都可以在erlang.org上找到。 要获得补丁版本的相关信息,您需要订阅erlang-questions邮件列表。
12.2. OTP version pinning
12.2. 指定OTP版本
Erlang.mk can use a specific version of Erlang/OTP when interacting with your project. This can be very useful when you are working with a team because you can define the version you need in the Makefile and Erlang.mk will ensure this version is used by everyone in your team.
Erlang.mk可以为你的项目指定特定版本的 Erlang/OTP。 这对于团队工作可能非常有用,因为你可以在Makefile中定义你需要的版本,Erlang.mk将确保你的团队中的每个人都使用这个版本的 Erlang/OTP。
To pin the version all you need to do is to set the ERLANG_OTP
variable in your Makefile before including Erlang.mk. For example, to use OTP-20.0.4
:
要指定 Erlang/OTP 版本,你只需要在Makefile包含 Erlang.mk 前设置 ERLANG_OTP
变量。例如,要使用OTP-20.0.4
:
ERLANG_OTP = OTP-20.0.4 include erlang.mk
The next time you run make
Erlang.mk will build and use the version you configured.
下一次运行 make
Erlang.mk 时会构建并使用你配置的版本。
Note that there has been reports that this functionality is not compatible with the .ONESHELL
feature from GNU Make.
请注意,有报告称这个功能与GNU Make的 .ONESHELL
功能不兼容。
12.3. Continuous integration
12.3. 持续集成
Erlang.mk can automatically test your project against many different Erlang/OTP versions. This functionality is documented in the Continuous integration chapter.
Erlang.mk可以在许多不同 Erlang/OTP 版本上对你的项目进行自动测试。 该功能在“持续集成”一章中介绍。
12.4. Configuring Kerl
12.4. 配置Kerl
All of the Kerl variables can be configured directly in the Makefile. All you need to do is to export them. For example, to change the installation directory for the Erlang/OTP versions managed by Kerl, you could add the following to your Makefile:
所有Kerl变量都可以直接在Makefile中配置,你只需导出它们即可。 例如,要更改由Kerl管理的 Erlang/OTP 版本的安装目录,可以将以下内容添加到你的Makefile中:
export KERL_INSTALL_DIR = $(CURDIR)/erlang
When configuring paths like this, always make sure to provide an absolute path in the value. Erlang.mk will NOT expand them automatically for you.
当像这样配置路径时,一定要确保赋值是绝对路径。 Erlang.mk不会自动为你扩展它们。