mirror of
https://github.com/octoleo/syncthing.git
synced 2025-02-02 11:58:28 +00:00
build: Add an option to specify output dir for crosscompiling all (#8109)
When GOBIN is set, 'go install' cannot install cross-compilied binaries. To satisfy cross-compilation, it's necessary to add the '-o' to build target, otherwise 'go build' will discarding the resulting objects when compiling multiple packages. Signed-off-by: bekcpear <i@bitbili.net>
This commit is contained in:
parent
1242ac74ab
commit
40bb52fdd8
5
build.go
5
build.go
@ -47,6 +47,7 @@ var (
|
||||
cc string
|
||||
run string
|
||||
benchRun string
|
||||
buildOut string
|
||||
debugBinary bool
|
||||
coverage bool
|
||||
long bool
|
||||
@ -374,6 +375,7 @@ func parseFlags() {
|
||||
flag.StringVar(&run, "run", "", "Specify which tests to run")
|
||||
flag.StringVar(&benchRun, "bench", "", "Specify which benchmarks to run")
|
||||
flag.BoolVar(&withNextGenGUI, "with-next-gen-gui", withNextGenGUI, "Also build 'newgui'")
|
||||
flag.StringVar(&buildOut, "build-out", "", "Set the '-o' value for 'go build'")
|
||||
flag.Parse()
|
||||
}
|
||||
|
||||
@ -506,6 +508,9 @@ func build(target target, tags []string) {
|
||||
}
|
||||
|
||||
args := []string{"build", "-v"}
|
||||
if buildOut != "" {
|
||||
args = append(args, "-o", buildOut)
|
||||
}
|
||||
args = appendParameters(args, tags, target.buildPkgs...)
|
||||
runPrint(goCmd, args...)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user