1
0
mirror of https://github.com/golang/go synced 2024-11-23 15:00:03 -07:00

cmd/go: build SWIG shared libraries in work directory

Remove test of whether SWIG shared library is older than
sources--should be covered by test of package file anyhow.

Fixes #5739.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/13352046
This commit is contained in:
Ian Lance Taylor 2013-09-10 11:00:26 -07:00
parent d5fbad0de8
commit 7f062fa2de
2 changed files with 5 additions and 18 deletions

View File

@ -1005,8 +1005,9 @@ func (b *builder) install(a *action) (err error) {
return err
}
soname := a.p.swigSoname(f)
source := filepath.Join(a.objdir, soname)
target := filepath.Join(dir, soname)
if err = b.copyFile(a, target, soname, perm); err != nil {
if err = b.copyFile(a, target, source, perm); err != nil {
return err
}
}
@ -2255,7 +2256,8 @@ func (b *builder) swigOne(p *Package, file, obj string, cxx bool, intgosize stri
cxxlib = []string{"-lstdc++"}
}
ldflags := stringList(osldflags[goos], cxxlib)
b.run(p.Dir, p.ImportPath, nil, b.gccCmd(p.Dir), "-o", soname, gccObj, ldflags)
target := filepath.Join(obj, soname)
b.run(p.Dir, p.ImportPath, nil, b.gccCmd(p.Dir), "-o", target, gccObj, ldflags)
return obj + goFile, cObj, nil
}

View File

@ -680,28 +680,13 @@ func isStale(p *Package, topRoot map[string]bool) bool {
return false
}
srcs := stringList(p.GoFiles, p.CFiles, p.CXXFiles, p.HFiles, p.SFiles, p.CgoFiles, p.SysoFiles)
srcs := stringList(p.GoFiles, p.CFiles, p.CXXFiles, p.HFiles, p.SFiles, p.CgoFiles, p.SysoFiles, p.SwigFiles, p.SwigCXXFiles)
for _, src := range srcs {
if olderThan(filepath.Join(p.Dir, src)) {
return true
}
}
for _, src := range stringList(p.SwigFiles, p.SwigCXXFiles) {
if olderThan(filepath.Join(p.Dir, src)) {
return true
}
soname := p.swigSoname(src)
fi, err := os.Stat(soname)
if err != nil {
return true
}
fiSrc, err := os.Stat(src)
if err != nil || fiSrc.ModTime().After(fi.ModTime()) {
return true
}
}
return false
}