aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2017-10-23 21:50:40 +0100
committerLoïc Hoguin <[email protected]>2017-10-23 21:50:56 +0100
commit522c4f52f511d7f2dc4a9166a5dbbeb282e5c8fa (patch)
treebe0d7e6f3825d6c882c7075640dba3f4a1e36e36
parentc0f3338fa3afd0b8c9ae8033a4e8c71dfdb9bdbd (diff)
downloaderlang.mk-522c4f52f511d7f2dc4a9166a5dbbeb282e5c8fa.tar.gz
erlang.mk-522c4f52f511d7f2dc4a9166a5dbbeb282e5c8fa.tar.bz2
erlang.mk-522c4f52f511d7f2dc4a9166a5dbbeb282e5c8fa.zip
Add CONFIG and SCRIPT variables to .app.src.script files
Ew rebar, geez!
-rw-r--r--core/deps.mk5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/deps.mk b/core/deps.mk
index 9cec5a1..58466a6 100644
--- a/core/deps.mk
+++ b/core/deps.mk
@@ -476,7 +476,10 @@ endef
define dep_autopatch_appsrc_script.erl
AppSrc = "$(call core_native_path,$(DEPS_DIR)/$1/src/$1.app.src)",
AppSrcScript = AppSrc ++ ".script",
- Bindings = erl_eval:new_bindings(),
+ {ok, Conf0} = file:consult(AppSrc),
+ Bindings0 = erl_eval:new_bindings(),
+ Bindings1 = erl_eval:add_binding('CONFIG', Conf0, Bindings0),
+ Bindings = erl_eval:add_binding('SCRIPT', AppSrcScript, Bindings1),
{ok, [Conf]} = file:script(AppSrcScript, Bindings),
ok = file:write_file(AppSrc, io_lib:format("~p.~n", [Conf])),
halt()