This is an automated email from the ASF dual-hosted git repository.

iilyak pushed a commit to branch specify-enc-location
in repository https://gitbox.apache.org/repos/asf/couchdb-jiffy.git

commit 7c905a9662a3272223fe186e26988cd6e8473c9c
Author: ILYA Khlopotov <[email protected]>
AuthorDate: Fri Jul 2 04:55:01 2021 -0700

    Allow overiding of ./enc location
---
 Makefile            |  4 ++--
 rebar.config.script | 14 ++++++++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index bce7e82..b375c2b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
-REBAR?=rebar
-
+REBAR?=./rebar
+ENC?=./enc
 
 all: build
 
diff --git a/rebar.config.script b/rebar.config.script
index a5da769..c550ddc 100644
--- a/rebar.config.script
+++ b/rebar.config.script
@@ -17,7 +17,7 @@ Config1 = case lists:keyfind(erl_opts, 1, CONFIG) of
         CONFIG ++ [{erl_opts, ErlOpts}]
 end,
 
-case os:type() of
+Config2 = case os:type() of
     {unix, _} ->
         CC = case os:getenv("CC") of
             false -> "cc";
@@ -36,4 +36,14 @@ case os:type() of
         end;
     _ ->
         Config1
-end.
+end,
+
+case os:getenv("ENC") of
+    false ->
+        Config2;
+    ENC ->
+        PreHook = {pre_hooks, [{"", compile, "escript " ++ ENC ++ " 
compile"}]},
+        PostHook = {post_hooks, [{"", clean, "escript " ++ ENC ++ " 
compile"}]},
+        Config3 = lists:keyreplace(post_hooks, 1, Config2, PostHook),
+        lists:keyreplace(pre_hooks, 1, Config3, PreHook)
+end.
\ No newline at end of file

Reply via email to