Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

math can build, try to cgo-build goroot pkgs, added some more exceptions

  • Loading branch information...
commit a1eedb529376dcc64cac380e407291102420d848 1 parent 8b930a4
@skelterjohn skelterjohn authored
Showing with 48 additions and 15 deletions.
  1. +17 −10 gb/cgo.go
  2. +2 −1  gb/files.go
  3. +24 −4 gb/gb.go
  4. +5 −0 gb/pkg.go
View
27 gb/cgo.go
@@ -50,9 +50,11 @@ var TestCGO = true
func BuildCgoPackage(pkg *Package) (err error) {
//defer fmt.Println(err)
- if pkg.IsInGOROOT {
- return MakeBuild(pkg)
- }
+ /*
+ if pkg.IsInGOROOT {
+ return MakeBuild(pkg)
+ }
+ */
if !TestCGO {
return MakeBuild(pkg)
@@ -109,15 +111,20 @@ func BuildCgoPackage(pkg *Package) (err error) {
err = Copy(pkg.Dir, cgosrc, cgd)
cgo_argv = append(cgo_argv, cgb)
}
- if Verbose {
- fmt.Printf("%s:", cgodir)
- }
- err = RunExternal(CGoCMD, cgodir, cgo_argv)
- if err != nil {
- return
+ if len(pkg.CGoSources) != 0 {
+ if Verbose {
+ fmt.Printf("%s:", cgodir)
+ }
+ err = RunExternal(CGoCMD, cgodir, cgo_argv)
+ if err != nil {
+ return
+ }
}
- var allsrc = []string{filepath.Join("_cgo", "_obj", "_cgo_gotypes.go")}
+ var allsrc []string
+ if len(pkg.CGoSources) != 0 {
+ allsrc = append(allsrc, filepath.Join("_cgo", "_obj", "_cgo_gotypes.go"))
+ }
for _, src := range cgobases {
gs := src[:len(src)-3] + ".cgo1.go"
allsrc = append(allsrc, filepath.Join("_cgo", "_obj", gs))
View
3  gb/files.go
@@ -30,6 +30,7 @@ var (
"windows": true,
"darwin": true,
"freebsd": true,
+ "openbsd": true,
"linux": true,
"plan9": true,
}
@@ -53,7 +54,7 @@ func CheckCGOFlag(flag string) bool {
return true
}
if flag == "bsd" &&
- (GOOS == "darwin" || GOOS == "freebsd" || GOOS == "bsd") {
+ (GOOS == "darwin" || GOOS == "freebsd" || GOOS == "bsd" || GOOS == "openbsd") {
return true
}
return false
View
28 gb/gb.go
@@ -80,14 +80,11 @@ var WarnLog = log.New(os.Stderr, "gb warning: ", 0)
/*
gb doesn't know how to build these packages
- math has both pure go and asm versions of many functions, and which is used depends
- on the architexture
-
go/build has a source-generation step that uses make variables
os has source generation
- syscall has crazy pure go/asm versions and unused source files
+ syscall has files type_$(GOOS).go that aren't build, but can't reasonably be filtered
crypto/tls has a file root_stub.go which is excluded
*/
@@ -95,6 +92,8 @@ var ForceMakePkgs = map[string]bool{
//"math": true,
"go/build": true,
"os": true,
+ "os/user": true,
+ "net": true,
"hash/crc32": true,
"syscall": true,
"runtime": true,
@@ -102,6 +101,27 @@ var ForceMakePkgs = map[string]bool{
"godoc": true,
}
+var DoNotBuildGOROOT = map[string]bool{
+ "src/cmd/5a": true,
+ "src/cmd/5c": true,
+ "src/cmd/5g": true,
+ "src/cmd/5l": true,
+ "src/cmd/6a": true,
+ "src/cmd/6c": true,
+ "src/cmd/6g": true,
+ "src/cmd/6l": true,
+ "src/cmd/8a": true,
+ "src/cmd/8c": true,
+ "src/cmd/8g": true,
+ "src/cmd/8l": true,
+ "src/cmd/cc": true,
+ "src/cmd/gc": true,
+ "src/cmd/cov": true,
+ "src/cmd/gopack": true,
+ "src/cmd/nm": true,
+ "src/cmd/prof": true,
+}
+
const (
ObjDir = "_obj"
TestDir = "_test"
View
5 gb/pkg.go
@@ -163,6 +163,11 @@ func NewPackage(base, dir string, inTestData string, cfg Config) (this *Package,
return
}
+ if this.IsInGOROOT && DoNotBuildGOROOT[GetRelative(GOROOT, this.Dir, CWD)] {
+ err = errors.New("can't build GOROOT core tools")
+ return
+ }
+
if len(this.Sources) == 0 {
err = errors.New("no source")
return
Please sign in to comment.
Something went wrong with that request. Please try again.