diff options
author | Wei-Ning Huang <w@dexon.org> | 2019-04-12 18:14:43 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-15 22:09:55 +0800 |
commit | 4ad9119a92ea63b0568f1100729a8cf377adfe2a (patch) | |
tree | 93578b9ee96c4ca3f68e639ef9321dd1e334e946 /build/ci.go | |
parent | d5daf97dba3156ef9adbf129a9d1e276f80d1095 (diff) | |
download | go-tangerine-4ad9119a92ea63b0568f1100729a8cf377adfe2a.tar go-tangerine-4ad9119a92ea63b0568f1100729a8cf377adfe2a.tar.gz go-tangerine-4ad9119a92ea63b0568f1100729a8cf377adfe2a.tar.bz2 go-tangerine-4ad9119a92ea63b0568f1100729a8cf377adfe2a.tar.lz go-tangerine-4ad9119a92ea63b0568f1100729a8cf377adfe2a.tar.xz go-tangerine-4ad9119a92ea63b0568f1100729a8cf377adfe2a.tar.zst go-tangerine-4ad9119a92ea63b0568f1100729a8cf377adfe2a.zip |
build: disable static built by default (#359)
Diffstat (limited to 'build/ci.go')
-rw-r--r-- | build/ci.go | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/build/ci.go b/build/ci.go index 280dd8f8a..044a9d80d 100644 --- a/build/ci.go +++ b/build/ci.go @@ -207,8 +207,9 @@ func main() { func doInstall(cmdline []string) { var ( - arch = flag.String("arch", "", "Architecture to cross build for") - cc = flag.String("cc", "", "C compiler to cross build with") + arch = flag.String("arch", "", "Architecture to cross build for") + cc = flag.String("cc", "", "C compiler to cross build with") + static = flag.Bool("static", false, "Build static binaries") ) flag.CommandLine.Parse(cmdline) env := build.Env() @@ -235,7 +236,7 @@ func doInstall(cmdline []string) { packages = build.ExpandPackagesNoVendor(packages) if *arch == "" || *arch == runtime.GOARCH { - goinstall := goTool("install", buildFlags(env)...) + goinstall := goTool("install", buildFlags(env, *static)...) goinstall.Args = append(goinstall.Args, "-v") goinstall.Args = append(goinstall.Args, packages...) build.MustRun(goinstall) @@ -249,7 +250,7 @@ func doInstall(cmdline []string) { } } // Seems we are cross compiling, work around forbidden GOBIN - goinstall := goToolArch(*arch, *cc, "install", buildFlags(env)...) + goinstall := goToolArch(*arch, *cc, "install", buildFlags(env, *static)...) goinstall.Args = append(goinstall.Args, "-v") goinstall.Args = append(goinstall.Args, []string{"-buildmode", "archive"}...) goinstall.Args = append(goinstall.Args, packages...) @@ -263,7 +264,7 @@ func doInstall(cmdline []string) { } for name := range pkgs { if name == "main" { - gobuild := goToolArch(*arch, *cc, "build", buildFlags(env)...) + gobuild := goToolArch(*arch, *cc, "build", buildFlags(env, *static)...) gobuild.Args = append(gobuild.Args, "-v") gobuild.Args = append(gobuild.Args, []string{"-o", executablePath(cmd.Name())}...) gobuild.Args = append(gobuild.Args, "."+string(filepath.Separator)+filepath.Join("cmd", cmd.Name())) @@ -275,7 +276,7 @@ func doInstall(cmdline []string) { } } -func buildFlags(env build.Environment) (flags []string) { +func buildFlags(env build.Environment, static bool) (flags []string) { var ld []string if env.Commit != "" { ld = append(ld, "-X", "main.gitCommit="+env.Commit) @@ -287,6 +288,9 @@ func buildFlags(env build.Environment) (flags []string) { if len(ld) > 0 { flags = append(flags, "-ldflags", strings.Join(ld, " ")) } + if static { + flags = append(flags, "-tags", "static") + } return flags } @@ -342,7 +346,7 @@ func doTest(cmdline []string) { // Run the actual tests. // Test a single package at a time. CI builders are slow // and some tests run into timeouts under load. - gotest := goTool("test", buildFlags(env)...) + gotest := goTool("test", buildFlags(env, false)...) gotest.Args = append(gotest.Args, "-p", "1", "-timeout", "5m") if *coverage { gotest.Args = append(gotest.Args, "-covermode=atomic", "-cover") @@ -351,7 +355,7 @@ func doTest(cmdline []string) { gotest.Args = append(gotest.Args, packages...) build.MustRun(gotest) - gotestForLegacyEvm := goTool("test", buildFlags(env)...) + gotestForLegacyEvm := goTool("test", buildFlags(env, false)...) gotestForLegacyEvm.Args = append(gotestForLegacyEvm.Args, "-p", "1", "-timeout", "10m") if *coverage { gotestForLegacyEvm.Args = append(gotestForLegacyEvm.Args, "-covermode=atomic", "-cover") @@ -1033,7 +1037,7 @@ func doXgo(cmdline []string) { build.MustRun(gogetxgo) // If all tools building is requested, build everything the builder wants - args := append(buildFlags(env), flag.Args()...) + args := append(buildFlags(env, false), flag.Args()...) if *alltools { args = append(args, []string{"--dest", GOBIN}...) |