Merge pull request #6 from nosnilmot/darwin-nolink

Do not link to sqlite3 on macos
This commit is contained in:
Paweł Chmielowski
2020-12-23 12:54:19 +01:00
committed by GitHub
3 changed files with 4 additions and 4 deletions

View File

@@ -400,7 +400,7 @@ static int changes(sqlite3_drv_t *drv, char *buf, int len) {
} }
static int enable_load_extension(sqlite3_drv_t* drv, char *buf, int len) { static int enable_load_extension(sqlite3_drv_t* drv, char *buf, int len) {
#ifndef ERLANG_SQLITE3_NO_LOAD_EXTENSION #ifdef ERLANG_SQLITE3_LOAD_EXTENSION
char enable = buf[0]; char enable = buf[0];
int result = sqlite3_enable_load_extension(drv->db, (int) enable); int result = sqlite3_enable_load_extension(drv->db, (int) enable);
if (result) { if (result) {

View File

@@ -4,6 +4,7 @@
#endif #endif
#define _CRT_SECURE_NO_WARNINGS // secure functions aren't cross-platform #define _CRT_SECURE_NO_WARNINGS // secure functions aren't cross-platform
#define ERLANG_SQLITE3_LOAD_EXTENSION // comment out if SQLite is built with SQLITE_OMIT_LOAD_EXTENSION
#include <erl_driver.h> #include <erl_driver.h>
#include <ei.h> #include <ei.h>

View File

@@ -1,10 +1,9 @@
% -*- mode: erlang -*- % -*- 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"]}]}. {"darwin", "priv/sqlite3_drv.so", ["c_src/*.c", "sqlite3_amalgamation/*.c"]}]}.
{port_env, [{"DRV_CFLAGS", "$DRV_CFLAGS -Wall -Wextra -Wno-unused-parameter -Wstrict-prototypes"}, {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"}, {"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_CFLAGS", "$DRV_CFLAGS /O2 /Isqlite3_amalgamation /Ic_src /W4 /wd4100 /wd4204 /wd4820 /wd4255 /wd4668 /wd4710 /wd4711"},
{".*win32.*", "DRV_LDFLAGS", "$DRV_LDFLAGS sqlite3.lib"}]}. {".*win32.*", "DRV_LDFLAGS", "$DRV_LDFLAGS sqlite3.lib"}]}.
{cover_enabled, true}. {cover_enabled, true}.