From 672f9310b5a1fc9e6b7bb65f725f278666511db3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 5 Dec 2018 09:38:56 +0100 Subject: Allow hooking before/after autopatch --- doc/src/guide/deps.asciidoc | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) (limited to 'doc') diff --git a/doc/src/guide/deps.asciidoc b/doc/src/guide/deps.asciidoc index 9939e82..913fa24 100644 --- a/doc/src/guide/deps.asciidoc +++ b/doc/src/guide/deps.asciidoc @@ -502,11 +502,10 @@ performed: * Run autopatch on the project Autopatch first checks if there is any project-specific patch -enabled. There are currently two: `RABBITMQ_CLIENT_PATCH` for -the `amqp_client` dependency, and `RABBITMQ_SERVER_PATCH` for -the `rabbit` dependency. These are needed only for RabbitMQ -versions before 3.6.0 (assuming you are using upstream RabbitMQ, -and not a fork). +enabled. There are currently three: `RABBITMQ_CLIENT_PATCH` for +the `amqp_client` dependency (before 3.6.0), `RABBITMQ_SERVER_PATCH` +for the `rabbit` dependency (before 3.6.0) and `ELIXIR_PATCH` +for the `elixir` dependency. Otherwise, autopatch performs different operations depending on the kind of project it finds the dependency to be. @@ -529,6 +528,30 @@ empty Makefile generated, for compatibility purposes. * Other projects with no Makefile are left untouched. +You can add additional commands to be run immediately before +or after autopatch is done by extending the target +`autopatch-$(dep)::`, for example this would remove +a module: + +[source,make] +---- +autopatch-ranch:: + rm -f $(DEPS_DIR)/ranch/src/ranch_proxy_header.erl +---- + +A common use case for this feature is to apply a PATCH +file on the dependency immediately after fetching it. +It can also be used to add compiler options, for example: + +[source,make] +---- +autopatch-couchbeam:: + printf "\nERLC_OPTS += -DWITH_JIFFY\n" >> $(DEPS_DIR)/couchbeam/Makefile +---- + +The commands will run before autopatch when the target is +defined before including 'erlang.mk', and after otherwise. + You can disable the replacing of the 'erlang.mk' file by defining the `NO_AUTOPATCH_ERLANG_MK` variable: -- cgit v1.2.3