From 46d6f4d9ced31143f77c9ba09bfacade4f3799e9 Mon Sep 17 00:00:00 2001 From: mpl Date: Wed, 19 Jun 2013 01:04:27 +0200 Subject: [PATCH] make.go: allow for installation of genfileembed With -embed_static, genfileembed is built, and installed in tmp/build-gopath/bin Change-Id: Ibca9c90349a7cf8d43e1f865792802772e9a08d3 --- make.go | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/make.go b/make.go index 348499ad5..df00dfdfc 100644 --- a/make.go +++ b/make.go @@ -118,7 +118,12 @@ func main() { log.Fatal(err) } wantDestFile[closureEmbed] = true + if err = buildGenfileembed(goPath); err != nil { + log.Fatal(err) + } } + // because we do not want the main install to install genfileembed as well. + wantDestFile[filepath.Join(buildSrcPath, "pkg", "fileembed", "genfileembed", "genfileembed.go")] = false deleteUnwantedOldMirrorFiles(buildSrcPath) @@ -175,6 +180,34 @@ func cleanGoEnv() (clean []string) { return } +func buildGenfileembed(goPath string) error { + args := []string{"install", "-v"} + if *all { + args = append(args, "-a") + } + args = append(args, + "camlistore.org/pkg/fileembed/genfileembed", + ) + cmd := exec.Command("go", args...) + // We don't even need to set GOBIN as it defaults to $GOPATH/bin + // and that is where we want genfileembed to go. + cmd.Env = append(cleanGoEnv(), + "GOPATH="+goPath, + ) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + if *verbose { + log.Printf("Running go with args %s", args) + } + if err := cmd.Run(); err != nil { + return fmt.Errorf("Error building genfileembed: %v", err) + } + if *verbose { + log.Printf("genfileembed installed in %s", filepath.Join(goPath, "bin")) + } + return nil +} + // getVersion returns the version of Camlistore. Either from a VERSION file at the root, // or from git. func getVersion(camRoot string) string { @@ -224,7 +257,7 @@ func mirrorDir(src, dst string) error { } base := fi.Name() if fi.IsDir() { - if base == "testdata" || base == "genfileembed" || + if base == "testdata" || strings.HasSuffix(path, "pkg/misc/closure/genclosuredeps") || strings.HasSuffix(path, "third_party/closure") || (base == "cmd" && strings.Contains(path, "github.com/camlistore/goexif")) {