From 3d6c6f934500002267363041852b31a7a4e32159 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Wed, 11 Mar 2015 15:18:10 -0400 Subject: [PATCH 1/2] Rename sqlite3.{c,h} to sqlite3-binding.{c,h} MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes the problem where when building with gccgo, sqlite3.c is overwritten, leading to a build failure. An alternative would have been to move sqlite3*.{c,h} to a subdirectory, but that seems to confuse the linker a fair bit and would just swap one implementation-dependent issue for another. Closes #20 Signed-off-by: Stéphane Graber --- README.md | 4 +++- _example/mod_vtable/sqlite3_mod_vtable.cc | 2 +- backup.go | 2 +- sqlite3.c => sqlite3-binding.c | 0 sqlite3.h => sqlite3-binding.h | 0 sqlite3.go | 2 +- sqlite3ext.h | 2 +- 7 files changed, 7 insertions(+), 5 deletions(-) rename sqlite3.c => sqlite3-binding.c (100%) rename sqlite3.h => sqlite3-binding.h (100%) diff --git a/README.md b/README.md index 1433fe5..4383f0c 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,9 @@ License MIT: http://mattn.mit-license.org/2012 -sqlite.c, sqlite3.h, sqlite3ext.h +sqlite3-binding.c, sqlite3-binding.h, sqlite3ext.h + +The -binding suffix was added to avoid build failures under gccgo. In this repository, those files are amalgamation code that copied from SQLite3. The license of those codes are depend on the license of SQLite3. diff --git a/_example/mod_vtable/sqlite3_mod_vtable.cc b/_example/mod_vtable/sqlite3_mod_vtable.cc index 4caf484..5bd4e66 100644 --- a/_example/mod_vtable/sqlite3_mod_vtable.cc +++ b/_example/mod_vtable/sqlite3_mod_vtable.cc @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include #include "picojson.h" diff --git a/backup.go b/backup.go index 270446a..3807c60 100644 --- a/backup.go +++ b/backup.go @@ -6,7 +6,7 @@ package sqlite3 /* -#include +#include #include */ import "C" diff --git a/sqlite3.c b/sqlite3-binding.c similarity index 100% rename from sqlite3.c rename to sqlite3-binding.c diff --git a/sqlite3.h b/sqlite3-binding.h similarity index 100% rename from sqlite3.h rename to sqlite3-binding.h diff --git a/sqlite3.go b/sqlite3.go index 5f94a96..4cdc4d5 100644 --- a/sqlite3.go +++ b/sqlite3.go @@ -9,7 +9,7 @@ package sqlite3 #cgo CFLAGS: -std=gnu99 #cgo CFLAGS: -DSQLITE_ENABLE_RTREE -DSQLITE_THREADSAFE #cgo CFLAGS: -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -#include +#include #include #include diff --git a/sqlite3ext.h b/sqlite3ext.h index ecf93f6..7cc58b6 100644 --- a/sqlite3ext.h +++ b/sqlite3ext.h @@ -17,7 +17,7 @@ */ #ifndef _SQLITE3EXT_H_ #define _SQLITE3EXT_H_ -#include "sqlite3.h" +#include "sqlite3-binding.h" typedef struct sqlite3_api_routines sqlite3_api_routines; From e688f0a8eb3db91c7cd1bf0925bac5bdf951a553 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Wed, 11 Mar 2015 15:20:07 -0400 Subject: [PATCH 2/2] Link against pthread MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is required by gccgo because of the pthread_mutex_trylock symbol. Signed-off-by: Stéphane Graber --- sqlite3.go | 1 + 1 file changed, 1 insertion(+) diff --git a/sqlite3.go b/sqlite3.go index 4cdc4d5..edf3663 100644 --- a/sqlite3.go +++ b/sqlite3.go @@ -9,6 +9,7 @@ package sqlite3 #cgo CFLAGS: -std=gnu99 #cgo CFLAGS: -DSQLITE_ENABLE_RTREE -DSQLITE_THREADSAFE #cgo CFLAGS: -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS +#cgo LDFLAGS: -lpthread #include #include #include