Patch files are stored in version-specific subdirectories. In each such
subdirectory, a versions.eterm file contains patterns identifying which
OTP application versions are compatible with the patches.
The versions.eterm file is read with file:consult/1, and shall
contain {AppName, BaseNameRegexp} tuples. For example:
{mnesia,"mnesia-4\\.15\\.[123]"}.
which matches mnesia versions "4.15.1", "4.15.2" and "4.15.3".
The compile script will test each subdirectory, and pick the first one
for which all application patterns match. It will then copy the relevant
source files from the current OTP to the otp_patches directory, apply
the patches and compile the result into otp_patches/ebin. This directory
will then be copied into the release and pre-pended to the code path of
the system.
rebar3 hook
In the rebar.config file, the patch compilation can be specified as
a pre_hook, e.g.
Currently, files are compiled with debug_info and include paths to thesrc/ and include/ directories of the source file's application.
More compile options, and support for specifying options per-application
or per-module may have to be added later.