Do not link to sqlite3 on macos

On macos (darwin), sqlite3 is embedded using "the amalgamation". There
is therefore no need to link to the system sqlite3, and doing so can
cause unexpected behaviour/failures.

Also be explicit about darwin vs. non-darwin port_specs sources.
rebar3 seems to get confused when compiling under eunit command sometimes
This commit is contained in:
Stu Tomlinson
2020-09-23 16:16:01 +01:00
parent 3521791da1
commit bcfbeaac80
3 changed files with 4 additions and 4 deletions

View File

@@ -1,10 +1,9 @@
% -*- mode: erlang -*-
{port_specs, [{"priv/sqlite3_drv.so", ["c_src/*.c"]},
{port_specs, [{"^((?!darwin).)*$", "priv/sqlite3_drv.so", ["c_src/*.c"]},
{"darwin", "priv/sqlite3_drv.so", ["c_src/*.c", "sqlite3_amalgamation/*.c"]}]}.
{port_env, [{"DRV_CFLAGS", "$DRV_CFLAGS -Wall -Wextra -Wno-unused-parameter -Wstrict-prototypes"},
{"DRV_LDFLAGS", "$DRV_LDFLAGS -lsqlite3"},
{"^((?!darwin|win32).)*$", "DRV_LDFLAGS", "$DRV_LDFLAGS -lsqlite3"},
{"ERL_LDFLAGS", " -L$ERL_EI_LIBDIR -lei"},
{".*darwin.*", "DRV_CFLAGS", "$DRV_CFLAGS -DERLANG_SQLITE3_NO_LOAD_EXTENSION"},
{".*win32.*", "DRV_CFLAGS", "$DRV_CFLAGS /O2 /Isqlite3_amalgamation /Ic_src /W4 /wd4100 /wd4204 /wd4820 /wd4255 /wd4668 /wd4710 /wd4711"},
{".*win32.*", "DRV_LDFLAGS", "$DRV_LDFLAGS sqlite3.lib"}]}.
{cover_enabled, true}.