66 lines
1.8 KiB
Plaintext
66 lines
1.8 KiB
Plaintext
|
|
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, "21"},
|
|
|
|
{xref_checks, [undefined_function_calls]},
|
|
|
|
{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}}]}]},
|
|
|
|
{dialyzer, [
|
|
{warnings, [
|
|
unmatched_returns,
|
|
error_handling,
|
|
race_conditions,
|
|
underspecs
|
|
]}
|
|
]},
|
|
|
|
{hex, [{doc, edoc}]}
|
|
|
|
].
|