forked from rvirding/luerl
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrebar.config.script
33 lines (29 loc) · 1.05 KB
/
rebar.config.script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
%% -*- mode: erlang; indent-tabs-mode: nil -*-
Conf0 = CONFIG,
HasOpt = {d,'HAS_MAPS',true},
FullOpt = {d,'HAS_FULL_KEYS',true},
RecOpt = {d,'NEW_REC_CORE',true},
RandOpt = {d,'NEW_RAND',true},
Version = case erlang:system_info(otp_release) of
[$R,N1,N2|_] when is_integer(N1), is_integer(N2) ->
[N1,N2];
Rel -> Rel
end,
Copts0 = [{d,'ERLANG_VERSION',Version}],
Copts1 = if Version >= "17" -> Copts0 ++ [HasOpt];
true -> Copts0
end,
Copts2 = if Version >= "18" -> Copts1 ++ [FullOpt];
true -> Copts1
end,
Copts3 = if Version >= "19" -> Copts2 ++ [RecOpt,RandOpt];
true -> Copts2
end,
Copts = Copts3, %This is it
case lists:keyfind(erl_opts, 1, Conf0) of
{erl_opts,Opts} -> %Existing erl_opts
NewOpts = {erl_opts,Opts ++ Copts},
lists:keyreplace(erl_opts, 1, Conf0, NewOpts);
false -> %No erl_opts
Conf0 ++ [{erl_opts,Copts}]
end.