mirror of
https://github.com/glebarez/go-sqlite.git
synced 2025-10-19 06:04:46 +08:00
Regenerate bin_linux_*.go using latest CCGO.
modified: generator.go modified: internal/bin/bin_linux_386.go modified: internal/bin/bin_linux_amd64.go
This commit is contained in:
55
generator.go
55
generator.go
@@ -15,6 +15,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"sort"
|
"sort"
|
||||||
@@ -31,15 +32,16 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
cpp = flag.Bool("cpp", false, "")
|
cpp = flag.Bool("cpp", false, "")
|
||||||
dict = xc.Dict
|
dict = xc.Dict
|
||||||
errLimit = flag.Int("errlimit", 10, "")
|
errLimit = flag.Int("errlimit", 10, "")
|
||||||
filter = flag.String("re", "", "")
|
filter = flag.String("re", "", "")
|
||||||
ndebug = flag.Bool("ndebug", false, "")
|
ndebug = flag.Bool("ndebug", false, "")
|
||||||
noexec = flag.Bool("noexec", false, "")
|
noexec = flag.Bool("noexec", false, "")
|
||||||
oLog = flag.Bool("log", false, "")
|
oLog = flag.Bool("log", false, "")
|
||||||
trace = flag.Bool("trc", false, "")
|
trace = flag.Bool("trc", false, "")
|
||||||
yydebug = flag.Int("yydebug", 0, "")
|
unconvertBin string
|
||||||
|
yydebug = flag.Int("yydebug", 0, "")
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -63,9 +65,6 @@ import (
|
|||||||
"github.com/cznic/crt"
|
"github.com/cznic/crt"
|
||||||
)
|
)
|
||||||
|
|
||||||
var inf = math.Inf(1)
|
|
||||||
|
|
||||||
|
|
||||||
func ftrace(s string, args ...interface{}) {
|
func ftrace(s string, args ...interface{}) {
|
||||||
_, fn, fl, _ := runtime.Caller(1)
|
_, fn, fl, _ := runtime.Caller(1)
|
||||||
fmt.Fprintf(os.Stderr, "# %%s:%%d: %%v\n", path.Base(fn), fl, fmt.Sprintf(s, args...))
|
fmt.Fprintf(os.Stderr, "# %%s:%%d: %%v\n", path.Base(fn), fl, fmt.Sprintf(s, args...))
|
||||||
@@ -122,6 +121,27 @@ func errStr(err error) string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func unconvert(pth string) {
|
||||||
|
wd, err := os.Getwd()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if err := os.Chdir(wd); err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
if err := os.Chdir(filepath.Dir(pth)); err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if out, err := exec.Command(unconvertBin, "-apply").CombinedOutput(); err != nil {
|
||||||
|
log.Fatalf("unconvert: %s\n%s", err, out)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func build(predef string, tus [][]string, opts ...cc.Opt) ([]*cc.TranslationUnit, []byte) {
|
func build(predef string, tus [][]string, opts ...cc.Opt) ([]*cc.TranslationUnit, []byte) {
|
||||||
ndbg := ""
|
ndbg := ""
|
||||||
if *ndebug {
|
if *ndebug {
|
||||||
@@ -236,9 +256,14 @@ func macros(buf io.Writer, ast *cc.TranslationUnit) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
const repo = "sqlite.org/sqlite-amalgamation-3180000/"
|
const repo = "sqlite.org/sqlite-amalgamation-3190300/"
|
||||||
|
|
||||||
log.SetFlags(log.Lshortfile | log.Lmicroseconds)
|
log.SetFlags(log.Lshortfile | log.Lmicroseconds)
|
||||||
|
var err error
|
||||||
|
if unconvertBin, err = exec.LookPath("unconvert"); err != nil {
|
||||||
|
log.Fatal("Please install the unconvert tool (go get -u github.com/mdempsky/unconvert)")
|
||||||
|
}
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
pth := findRepo(repo)
|
pth := findRepo(repo)
|
||||||
if pth == "" {
|
if pth == "" {
|
||||||
@@ -281,7 +306,9 @@ func main() {
|
|||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ioutil.WriteFile(fmt.Sprintf("internal/bin/bin_%s_%s.go", runtime.GOOS, runtime.GOARCH), b2, 0664); err != nil {
|
dst := fmt.Sprintf("internal/bin/bin_%s_%s.go", runtime.GOOS, runtime.GOARCH)
|
||||||
|
if err := ioutil.WriteFile(dst, b2, 0664); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
unconvert(dst)
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user