-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrebar.config.script
50 lines (38 loc) · 1.11 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
%% -*- erlang -*-
Opts = [
{erl_opts, [
{d, 'NIFEXT'}
]},
{port_specs, [
{"priv/erstar.so", ["c_src/*.c"]},
{"priv/erstar_geo.so", ["c_src/geo/*.c"]}
]},
{port_env, [
{".*", "CXXFLAGS", "$CXXFLAGS -g -Wall -Werror -O3"},
{"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin)", "LDFLAGS", "$LDFLAGS -lstdc++"},
%% OS X Leopard flags for 64-bit
{"darwin9.*-64$", "CXXFLAGS", "-m64"},
{"darwin9.*-64$", "LDFLAGS", "-arch x86_64"},
%% OS X Snow Leopard flags for 32-bit
{"darwin10.*-32$", "CXXFLAGS", "-m32"},
{"darwin10.*-32$", "LDFLAGS", "-arch i386"}
]}
],
Append = fun
(F, Config, []) ->
Config;
(F, Config, [{E, Opts} | Rest]) ->
WereOpts = case lists:keysearch(E, 1, Config) of
false ->
[];
{value, {E, Value}} ->
Value
end,
F(F, lists:keystore(E, 1, Config, {E, WereOpts ++ Opts}), Rest)
end,
case os:getenv("ERSTAR_NIFEXT") of
false ->
CONFIG;
_ ->
Append(Append, CONFIG, Opts)
end.