LEFT | RIGHT |
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package build | 5 package build |
6 | 6 |
7 import ( | 7 import ( |
8 "bytes" | 8 "bytes" |
9 "errors" | 9 "errors" |
10 "fmt" | 10 "fmt" |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 c.CgoEnabled = true | 300 c.CgoEnabled = true |
301 case "0": | 301 case "0": |
302 c.CgoEnabled = false | 302 c.CgoEnabled = false |
303 default: | 303 default: |
304 // golang.org/issue/5141 | 304 // golang.org/issue/5141 |
305 // cgo should be disabled for cross compilation builds | 305 // cgo should be disabled for cross compilation builds |
306 if runtime.GOARCH == c.GOARCH && runtime.GOOS == c.GOOS { | 306 if runtime.GOARCH == c.GOARCH && runtime.GOOS == c.GOOS { |
307 c.CgoEnabled = cgoEnabled[c.GOOS+"/"+c.GOARCH] | 307 c.CgoEnabled = cgoEnabled[c.GOOS+"/"+c.GOARCH] |
308 break | 308 break |
309 } | 309 } |
310 fmt.Printf("# CGO_ENABLED not set. Defaulting to '0' for %s/%s."
, c.GOOS, c.GOARCH) | |
311 c.CgoEnabled = false | 310 c.CgoEnabled = false |
312 } | 311 } |
313 | 312 |
314 return c | 313 return c |
315 } | 314 } |
316 | 315 |
317 func envOr(name, def string) string { | 316 func envOr(name, def string) string { |
318 s := os.Getenv(name) | 317 s := os.Getenv(name) |
319 if s == "" { | 318 if s == "" { |
320 return def | 319 return def |
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1115 switch goarch { | 1114 switch goarch { |
1116 case "386": | 1115 case "386": |
1117 return "8", nil | 1116 return "8", nil |
1118 case "amd64": | 1117 case "amd64": |
1119 return "6", nil | 1118 return "6", nil |
1120 case "arm": | 1119 case "arm": |
1121 return "5", nil | 1120 return "5", nil |
1122 } | 1121 } |
1123 return "", errors.New("unsupported GOARCH " + goarch) | 1122 return "", errors.New("unsupported GOARCH " + goarch) |
1124 } | 1123 } |
LEFT | RIGHT |