forked from mmzeeman/esqlite
-
Notifications
You must be signed in to change notification settings - Fork 1
/
rebar.config.script
50 lines (40 loc) · 1.53 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
NifSharedSources = ["c_src/esqlite3_nif.c", "c_src/queue.c"].
NifStaticSources = NifSharedSources ++ ["c_src/sqlite3/sqlite3.c"].
CFlagsDefault = "$CFLAGS -DSQLITE_THREADSAFE=1 -DSQLITE_USE_URI -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS".
DrvLdFlagsDefault = "-shared -lsqlite3".
DrvLdFlags =
case os:getenv("ESQLITE_CFLAGS") of
NotDefined when NotDefined == false; NotDefined == [] -> DrvLdFlagsDefault;
DrvLdFlagsOverride -> DrvLdFlagsOverride
end.
{NifSources, LdEnv, CFlagsExt} =
case os:getenv("ESQLITE_USE_SYSTEM") of
NotDefined when NotDefined == false; NotDefined == [] -> {NifStaticSources, [], " -Ic_src/sqlite3"};
_Defined -> {NifSharedSources, [{"DRV_LDFLAGS", DrvLdFlags}], []}
end.
CFlags =
case os:getenv("ESQLITE_CFLAGS") of
NotDefined when NotDefined == false; NotDefined == [] -> CFlagsDefault ++ CFlagsExt;
CFlagsOverride -> CFlagsOverride
end.
[
{require_min_otp_vsn, "R15"},
{port_env, [
%% Default darwin ldflags causes loading of system sqlite. Removed -bundle flag.
{"darwin", "DRV_LDFLAGS",
"-flat_namespace -undefined suppress $ERL_LDFLAGS"},
{"solaris", "CFLAGS",
"$CFLAGS -std=c99"},
{"linux", "CFLAGS",
"$CFLAGS -std=c11"},
{"CFLAGS", CFlags}
] ++ LdEnv},
{port_specs, [
{"priv/esqlite3_nif.so", NifSources}
]},
{plugins, [pc]},
{provider_hooks,
[{post,
[{compile, {pc, compile}},
{clean, {pc, clean}}]}]}
].