diff options
Diffstat (limited to 'vendor/modernc.org/sqlite/generator.go')
-rw-r--r-- | vendor/modernc.org/sqlite/generator.go | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/vendor/modernc.org/sqlite/generator.go b/vendor/modernc.org/sqlite/generator.go index 36b89a401..a00df7805 100644 --- a/vendor/modernc.org/sqlite/generator.go +++ b/vendor/modernc.org/sqlite/generator.go @@ -372,6 +372,7 @@ func fail(s string, args ...interface{}) { } func main() { + fmt.Printf("Running on %s/%s.\n", runtime.GOOS, runtime.GOARCH) env := os.Getenv("GO_GENERATE") goarch := runtime.GOARCH goos := runtime.GOOS @@ -393,13 +394,15 @@ func main() { } more = append(more, ndebug...) download() - // experimental pthreads support currently only on linux/amd64 - if goos != "linux" || goarch != "amd64" { + switch fmt.Sprintf("%s/%s", goos, goarch) { + case "linux/amd64": + // experimental pthreads support currently only on linux/amd64 + default: configProduction = append(configProduction, "-DSQLITE_MUTEX_NOOP") configTest = append(configTest, "-DSQLITE_MUTEX_NOOP") } switch goos { - case "linux", "freebsd": + case "linux", "freebsd", "netbsd": configProduction = append(configProduction, "-DSQLITE_OS_UNIX=1") case "darwin": configProduction = append(configProduction, @@ -447,7 +450,7 @@ func configure(goos, goarch string) { cmd.Run() var args []string switch goos { - case "linux", "freebsd": + case "linux", "freebsd", "netbsd": // nop case "darwin": args = append(args, "--with-tcl=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Tcl.framework") @@ -576,6 +579,31 @@ func makeTestfixture(goos, goarch string, more []string) { } configure(goos, goarch) + var defines, includes []string + switch goos { + case "freebsd": + includes = []string{"-I/usr/local/include/tcl8.6"} + case "linux": + includes = []string{"-I/usr/include/tcl8.6"} + case "windows": + includes = []string{"-I/usr/include/tcl8.6"} + case "netbsd": + includes = []string{"-I/usr/pkg/include"} + defines = []string{ + "-D__libc_cond_broadcast=pthread_cond_broadcast", + "-D__libc_cond_destroy=pthread_cond_destroy", + "-D__libc_cond_init=pthread_cond_init", + "-D__libc_cond_signal=pthread_cond_signal", + "-D__libc_cond_wait=pthread_cond_wait", + "-D__libc_mutex_destroy=pthread_mutex_destroy", + "-D__libc_mutex_init=pthread_mutex_init", + "-D__libc_mutex_lock=pthread_mutex_lock", + "-D__libc_mutex_trylock=pthread_mutex_trylock", + "-D__libc_mutex_unlock=pthread_mutex_unlock", + "-D__libc_thr_yield=sched_yield", + } + } + args := join( []string{ "ccgo", @@ -584,7 +612,10 @@ func makeTestfixture(goos, goarch string, more []string) { "-DSQLITE_SERVER=1", "-DTCLSH_INIT_PROC=sqlite3TestInit", "-D_HAVE_SQLITE_CONFIG_H", - "-I/usr/include/tcl8.6", //TODO should not be hardcoded + }, + defines, + includes, + []string{ "-export-defines", "", "-export-fields", "F", "-trace-translation-units", @@ -607,10 +638,6 @@ func makeTestfixture(goos, goarch string, more []string) { more, configTest, ) - // experimental pthreads support currently only on linux/amd64 - if goos != "linux" || goarch != "amd64" { - args = append(args, "-lmodernc.org/sqlite/internal/libc2") - } task := ccgo.NewTask(args, nil, nil) if err := task.Main(); err != nil { fail("%s\n", err) |