]> Cypherpunks repositories - gostls13.git/commitdiff
go: don't clobber command install paths
authorAnthony Martin <ality@pbrane.org>
Mon, 30 Jan 2012 18:54:22 +0000 (13:54 -0500)
committerRuss Cox <rsc@golang.org>
Mon, 30 Jan 2012 18:54:22 +0000 (13:54 -0500)
This fixes a regression that was made when adding
support for building with gccgo (in d6a14e6fac0c).

External commands (those not from the Go tree) were
being installed to the package directory instead of
the binary directory.

R=golang-dev, rsc, adg, remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/5564072

src/cmd/go/pkg.go

index 2ca0bf7d4795ac8a40f28f52a29905af2239e196..940d31a2b69c7b0ebdca3e8a74f34abb12877bda 100644 (file)
@@ -279,17 +279,20 @@ func scanPackage(ctxt *build.Context, t *build.Tree, arg, importPath, dir string
                        p.target += ".exe"
                }
        } else {
-               p.target = filepath.Join(t.PkgDir(), filepath.FromSlash(importPath)+".a")
-       }
-
-       // For gccgo, rewrite p.target with the expected library name. We won't do
-       // that for the standard library for the moment.
-       if !p.Standard {
                dir := t.PkgDir()
+               // For gccgo, rewrite p.target with the expected library name.
                if _, ok := buildToolchain.(gccgoToolchain); ok {
                        dir = filepath.Join(filepath.Dir(dir), "gccgo", filepath.Base(dir))
                }
                p.target = buildToolchain.pkgpath(dir, p)
+
+               // NB. Currently we have gccgo install the standard libraries
+               // in the "usual" location, where the Go toolchain puts them.
+               if p.Standard {
+                       if _, ok := buildToolchain.(gccgoToolchain); ok {
+                               p.target = goToolchain{}.pkgpath(dir, p)
+                       }
+               }
        }
 
        var built time.Time