build: Add -cc argument that is not used by build.go (#5447)
This commit is contained in:
parent
0b03b6a9ec
commit
d4f0544d9e
4
build.go
4
build.go
|
@ -46,6 +46,7 @@ var (
|
||||||
extraTags string
|
extraTags string
|
||||||
installSuffix string
|
installSuffix string
|
||||||
pkgdir string
|
pkgdir string
|
||||||
|
cc string
|
||||||
debugBinary bool
|
debugBinary bool
|
||||||
timeout = "120s"
|
timeout = "120s"
|
||||||
)
|
)
|
||||||
|
@ -329,6 +330,7 @@ func parseFlags() {
|
||||||
flag.StringVar(&extraTags, "tags", extraTags, "Extra tags, space separated")
|
flag.StringVar(&extraTags, "tags", extraTags, "Extra tags, space separated")
|
||||||
flag.StringVar(&installSuffix, "installsuffix", installSuffix, "Install suffix, optional")
|
flag.StringVar(&installSuffix, "installsuffix", installSuffix, "Install suffix, optional")
|
||||||
flag.StringVar(&pkgdir, "pkgdir", "", "Set -pkgdir parameter for `go build`")
|
flag.StringVar(&pkgdir, "pkgdir", "", "Set -pkgdir parameter for `go build`")
|
||||||
|
flag.StringVar(&cc, "cc", os.Getenv("CC"), "Set CC environment variable for `go build`")
|
||||||
flag.BoolVar(&debugBinary, "debug-binary", debugBinary, "Create unoptimized binary to use with delve, set -gcflags='-N -l' and omit -ldflags")
|
flag.BoolVar(&debugBinary, "debug-binary", debugBinary, "Create unoptimized binary to use with delve, set -gcflags='-N -l' and omit -ldflags")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
}
|
}
|
||||||
|
@ -398,6 +400,7 @@ func install(target target, tags []string) {
|
||||||
|
|
||||||
os.Setenv("GOOS", goos)
|
os.Setenv("GOOS", goos)
|
||||||
os.Setenv("GOARCH", goarch)
|
os.Setenv("GOARCH", goarch)
|
||||||
|
os.Setenv("CC", cc)
|
||||||
|
|
||||||
// On Windows generate a special file which the Go compiler will
|
// On Windows generate a special file which the Go compiler will
|
||||||
// automatically use when generating Windows binaries to set things like
|
// automatically use when generating Windows binaries to set things like
|
||||||
|
@ -425,6 +428,7 @@ func build(target target, tags []string) {
|
||||||
|
|
||||||
os.Setenv("GOOS", goos)
|
os.Setenv("GOOS", goos)
|
||||||
os.Setenv("GOARCH", goarch)
|
os.Setenv("GOARCH", goarch)
|
||||||
|
os.Setenv("CC", cc)
|
||||||
|
|
||||||
// On Windows generate a special file which the Go compiler will
|
// On Windows generate a special file which the Go compiler will
|
||||||
// automatically use when generating Windows binaries to set things like
|
// automatically use when generating Windows binaries to set things like
|
||||||
|
|
Loading…
Reference in New Issue