Adding upstream version 1.37.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
42613ad5c6
commit
271b368104
1329 changed files with 4727104 additions and 0 deletions
15
vendor_libsqlite3/go.mod
Normal file
15
vendor_libsqlite3/go.mod
Normal file
|
@ -0,0 +1,15 @@
|
|||
module modernc.org/sqlite/vendor_libsqlite3
|
||||
|
||||
go 1.23.0
|
||||
|
||||
toolchain go1.24.1
|
||||
|
||||
require (
|
||||
github.com/dustin/go-humanize v1.0.1 // indirect
|
||||
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
||||
modernc.org/gc/v3 v3.1.0 // indirect
|
||||
modernc.org/mathutil v1.7.1 // indirect
|
||||
modernc.org/strutil v1.2.1 // indirect
|
||||
modernc.org/token v1.1.0 // indirect
|
||||
)
|
14
vendor_libsqlite3/go.sum
Normal file
14
vendor_libsqlite3/go.sum
Normal file
|
@ -0,0 +1,14 @@
|
|||
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
|
||||
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
|
||||
github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k=
|
||||
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
|
||||
modernc.org/gc/v3 v3.1.0 h1:CiObI+9ROz7pjjH3iAgMPaFCN5zE3sN5KF4jet8BWdc=
|
||||
modernc.org/gc/v3 v3.1.0/go.mod h1:HFK/6AGESC7Ex+EZJhJ2Gni6cTaYpSMmU/cT9RmlfYY=
|
||||
modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU=
|
||||
modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg=
|
||||
modernc.org/strutil v1.2.1 h1:UneZBkQA+DX2Rp35KcM69cSsNES9ly8mQWD71HKlOA0=
|
||||
modernc.org/strutil v1.2.1/go.mod h1:EHkiggD70koQxjVdSBM3JKM7k6L0FbGE5eymy9i3B9A=
|
||||
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
|
||||
modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
|
126
vendor_libsqlite3/main.go
Normal file
126
vendor_libsqlite3/main.go
Normal file
|
@ -0,0 +1,126 @@
|
|||
// Copyright 2024 The Sqlite Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build none
|
||||
// +build none
|
||||
|
||||
// Tool for 1.28+ -> 1.29+. Pulls adjusted libsqlite3 code to this repo.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"go/token"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"modernc.org/gc/v3"
|
||||
)
|
||||
|
||||
func fail(rc int, msg string, args ...any) {
|
||||
fmt.Fprintln(os.Stderr, strings.TrimSpace(fmt.Sprintf(msg, args...)))
|
||||
os.Exit(rc)
|
||||
}
|
||||
|
||||
func main() {
|
||||
for _, v := range []struct{ goos, goarch string }{
|
||||
{"darwin", "amd64"},
|
||||
{"darwin", "arm64"},
|
||||
{"freebsd", "amd64"},
|
||||
{"freebsd", "arm64"},
|
||||
{"linux", "386"},
|
||||
{"linux", "amd64"},
|
||||
{"linux", "arm"},
|
||||
{"linux", "arm64"},
|
||||
{"linux", "loong64"},
|
||||
{"linux", "ppc64le"},
|
||||
{"linux", "riscv64"},
|
||||
{"linux", "s390x"},
|
||||
{"windows", "386"},
|
||||
{"windows", "amd64"},
|
||||
} {
|
||||
base := fmt.Sprintf("ccgo_%s_%s.go", v.goos, v.goarch)
|
||||
if v.goos == "windows" && v.goarch == "amd64" {
|
||||
base = "ccgo_windows.go"
|
||||
}
|
||||
ifn := filepath.Join("..", "libsqlite3", base)
|
||||
fmt.Printf("%s/%s\t%s\n", v.goos, v.goarch, ifn)
|
||||
in, err := os.ReadFile(ifn)
|
||||
if err != nil {
|
||||
fail(1, "%s\n", err)
|
||||
}
|
||||
|
||||
ast, err := gc.ParseFile(ifn, in)
|
||||
if err != nil {
|
||||
fail(1, "%s\n", err)
|
||||
}
|
||||
|
||||
b := bytes.NewBuffer(nil)
|
||||
s := ast.SourceFile.PackageClause.Source(true)
|
||||
s = strings.Replace(s, "package libsqlite3", "package sqlite3", 1)
|
||||
fmt.Fprintln(b, s)
|
||||
fmt.Fprint(b, ast.SourceFile.ImportDeclList.Source(true))
|
||||
taken := map[string]struct{}{}
|
||||
for n := ast.SourceFile.TopLevelDeclList; n != nil; n = n.List {
|
||||
switch x := n.TopLevelDecl.(type) {
|
||||
case *gc.TypeDeclNode:
|
||||
adn := x.TypeSpecList.TypeSpec.(*gc.AliasDeclNode)
|
||||
nm := adn.IDENT.Src()
|
||||
taken[nm] = struct{}{}
|
||||
}
|
||||
}
|
||||
loop:
|
||||
for n := ast.SourceFile.TopLevelDeclList; n != nil; n = n.List {
|
||||
switch x := n.TopLevelDecl.(type) {
|
||||
case *gc.ConstDeclNode:
|
||||
switch y := x.ConstSpec.(type) {
|
||||
case *gc.ConstSpecNode:
|
||||
if y.IDENT.Src() != "SQLITE_TRANSIENT" {
|
||||
fmt.Fprintln(b, x.Source(true))
|
||||
}
|
||||
default:
|
||||
panic(fmt.Sprintf("%v: %T %q", x.Position(), y, x.Source(false)))
|
||||
}
|
||||
|
||||
case *gc.FunctionDeclNode:
|
||||
fmt.Fprintln(b, x.Source(true))
|
||||
case *gc.TypeDeclNode:
|
||||
fmt.Fprintln(b, x.Source(true))
|
||||
adn := x.TypeSpecList.TypeSpec.(*gc.AliasDeclNode)
|
||||
nm := adn.IDENT.Src()
|
||||
nm2 := nm[1:]
|
||||
if _, ok := taken[nm2]; ok {
|
||||
break
|
||||
}
|
||||
|
||||
if token.IsExported(nm) {
|
||||
fmt.Fprintf(b, "\ntype %s = %s\n", nm2, nm)
|
||||
}
|
||||
case *gc.VarDeclNode:
|
||||
fmt.Fprintln(b, x.Source(true))
|
||||
default:
|
||||
fmt.Printf("%v: TODO %T\n", n.Position(), x)
|
||||
break loop
|
||||
}
|
||||
}
|
||||
|
||||
b.WriteString(`
|
||||
type Sqlite3_int64 = sqlite3_int64
|
||||
type Sqlite3_mutex_methods = sqlite3_mutex_methods
|
||||
type Sqlite3_value = sqlite3_value
|
||||
|
||||
type Sqlite3_index_info = sqlite3_index_info
|
||||
type Sqlite3_module = sqlite3_module
|
||||
type Sqlite3_vtab = sqlite3_vtab
|
||||
type Sqlite3_vtab_cursor = sqlite3_vtab_cursor
|
||||
|
||||
`)
|
||||
base = strings.Replace(base, "ccgo_", "sqlite_", 1)
|
||||
if err := os.WriteFile(filepath.Join("lib", base), b.Bytes(), 0660); err != nil {
|
||||
fail(1, "%s\n", err)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue