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:
37
generator.go
37
generator.go
@@ -15,6 +15,7 @@ import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"sort"
|
||||
@@ -39,6 +40,7 @@ var (
|
||||
noexec = flag.Bool("noexec", false, "")
|
||||
oLog = flag.Bool("log", false, "")
|
||||
trace = flag.Bool("trc", false, "")
|
||||
unconvertBin string
|
||||
yydebug = flag.Int("yydebug", 0, "")
|
||||
)
|
||||
|
||||
@@ -63,9 +65,6 @@ import (
|
||||
"github.com/cznic/crt"
|
||||
)
|
||||
|
||||
var inf = math.Inf(1)
|
||||
|
||||
|
||||
func ftrace(s string, args ...interface{}) {
|
||||
_, fn, fl, _ := runtime.Caller(1)
|
||||
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) {
|
||||
ndbg := ""
|
||||
if *ndebug {
|
||||
@@ -236,9 +256,14 @@ func macros(buf io.Writer, ast *cc.TranslationUnit) {
|
||||
}
|
||||
|
||||
func main() {
|
||||
const repo = "sqlite.org/sqlite-amalgamation-3180000/"
|
||||
const repo = "sqlite.org/sqlite-amalgamation-3190300/"
|
||||
|
||||
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()
|
||||
pth := findRepo(repo)
|
||||
if pth == "" {
|
||||
@@ -281,7 +306,9 @@ func main() {
|
||||
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)
|
||||
}
|
||||
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