-
Notifications
You must be signed in to change notification settings - Fork 1
/
rebar.config.script
31 lines (30 loc) · 1.19 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
%%-*- mode: erlang -*-
%% Set the minimum Mac target to 10.8 for 10.9 or greater. This runtime
%% check is needed since rebar's system_architecture check looks only at
%% the version of the OS used to build the Erlang runtime, not the version
%% actually running.
case os:type() of
{unix,darwin} ->
Opt = " -mmacosx-version-min=10.8",
[Mjr|_] = string:tokens(os:cmd("/usr/bin/uname -r"), "."),
Major = list_to_integer(Mjr),
if
Major >= 13 ->
Flags = ["CFLAGS", "CXXFLAGS", "DRV_CFLAGS", "DRV_LDFLAGS"],
{port_env, Vals} = lists:keyfind(port_env, 1, CONFIG),
Fold = fun({Flag,Val}, Acc) ->
case lists:member(Flag, Flags) of
true ->
[{Flag, Val++Opt}|Acc];
false ->
Acc
end
end,
NewVals = lists:foldl(Fold, [], Vals),
lists:keyreplace(port_env, 1, CONFIG, {port_env, NewVals});
true ->
CONFIG
end;
_ ->
CONFIG
end.