Commit 7f062fa2 authored by Ian Lance Taylor's avatar Ian Lance Taylor

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
parent d5fbad0d
......@@ -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
}
......
......@@ -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
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment