diff --git a/make.go b/make.go index 0f954f913..f77113e3f 100644 --- a/make.go +++ b/make.go @@ -49,6 +49,7 @@ var ( targets = flag.String("targets", "", "Optional comma-separated list of targets (i.e go packages) to build and install. Empty means all. Example: camlistore.org/server/camlistored,camlistore.org/cmd/camput") quiet = flag.Bool("quiet", false, "Don't print anything unless there's a failure.") ifModsSince = flag.Int64("if_mods_since", 0, "If non-zero return immediately without building if there aren't any filesystem modifications past this time (in unix seconds)") + buildOS = flag.String("os", runtime.GOOS, "Operating system to build for.") ) var ( @@ -70,6 +71,18 @@ func main() { } verifyCamlistoreRoot(camRoot) + if runtime.GOOS != *buildOS { + if *wantSQLite { + log.Fatalf("SQLite isn't available when cross-compiling to another OS. Set --sqlite=false.") + } + // TODO(bradfitz): we can fix this one, though, by + // building genfileembed with the GOOS of the host + // instead: + if *embedResources { + log.Fatalf("Due to a bug, can't currently cross-compile and also embed resources. For now, set --embed_static=false") + } + } + sql := *wantSQLite && haveSQLite() buildBaseDir := "build-gopath" @@ -176,7 +189,7 @@ func main() { } args := append(baseArgs, targs...) if buildAll { - switch runtime.GOOS { + switch *buildOS { case "linux", "darwin": args = append(args, "camlistore.org/cmd/cammount") } @@ -195,9 +208,7 @@ func main() { cmd.Stderr = os.Stderr } if *verbose { - // TODO(reviewer) should this be cmd.Args too? Providing the contents - // of baseArgs doesn't hurt when you're trying to debug. - log.Printf("Running go install of main binaries with args %s", targs) + log.Printf("Running go install of main binaries with args %s", cmd.Args) } if err := cmd.Run(); err != nil { log.Fatalf("Error building main binaries: %v\n%s", err, output.String()) @@ -242,6 +253,9 @@ func cleanGoEnv() (clean []string) { } clean = append(clean, env) } + if *buildOS != runtime.GOOS { + clean = append(clean, "GOOS="+*buildOS) + } return } diff --git a/pkg/fs/fs.go b/pkg/fs/fs.go index e52e41463..5f5cc22c0 100644 --- a/pkg/fs/fs.go +++ b/pkg/fs/fs.go @@ -1,3 +1,5 @@ +// +build linux darwin + /* Copyright 2011 Google Inc. diff --git a/pkg/fs/recent.go b/pkg/fs/recent.go index 346617bf1..eb460cef3 100644 --- a/pkg/fs/recent.go +++ b/pkg/fs/recent.go @@ -1,3 +1,5 @@ +// +build linux darwin + /* Copyright 2013 Google Inc. diff --git a/pkg/fs/root.go b/pkg/fs/root.go index de81f8af1..7af00489e 100644 --- a/pkg/fs/root.go +++ b/pkg/fs/root.go @@ -1,3 +1,5 @@ +// +build linux darwin + /* Copyright 2012 Google Inc. diff --git a/third_party/code.google.com/p/rsc/fuse/fuse.go b/third_party/code.google.com/p/rsc/fuse/fuse.go index e02f4fc3b..faa9b57fa 100644 --- a/third_party/code.google.com/p/rsc/fuse/fuse.go +++ b/third_party/code.google.com/p/rsc/fuse/fuse.go @@ -1,3 +1,5 @@ +// +build linux darwin + // Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/third_party/code.google.com/p/rsc/fuse/fuse_kernel.go b/third_party/code.google.com/p/rsc/fuse/fuse_kernel.go index a57360e63..4e6df7fd6 100644 --- a/third_party/code.google.com/p/rsc/fuse/fuse_kernel.go +++ b/third_party/code.google.com/p/rsc/fuse/fuse_kernel.go @@ -1,3 +1,5 @@ +// +build linux darwin + // Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/third_party/code.google.com/p/rsc/fuse/serve.go b/third_party/code.google.com/p/rsc/fuse/serve.go index fa4f27e3f..2dd41711f 100644 --- a/third_party/code.google.com/p/rsc/fuse/serve.go +++ b/third_party/code.google.com/p/rsc/fuse/serve.go @@ -1,3 +1,5 @@ +// +build linux darwin + // Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/third_party/code.google.com/p/rsc/fuse/tree.go b/third_party/code.google.com/p/rsc/fuse/tree.go index fec0a748f..f42c251c6 100644 --- a/third_party/code.google.com/p/rsc/fuse/tree.go +++ b/third_party/code.google.com/p/rsc/fuse/tree.go @@ -1,3 +1,5 @@ +// +build linux darwin + // Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file.