forked from basho/eleveldb
-
Notifications
You must be signed in to change notification settings - Fork 1
/
rebar.config.script
32 lines (31 loc) · 1.34 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
%%-*- 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} ->
OSXVersion = re:replace(os:cmd("sw_vers -productVersion"), "[\n]", "", [global, {return, list}]),
Opt = " -mmacosx-version-min=" ++ OSXVersion ++ " -stdlib=libc++ -std=c++11",
[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.