mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
Disable symbol table and DWARF generation by default.
Trimpath if compiling with Go >= 1.13
This commit is contained in:
parent
2fc29f9272
commit
638f2a2dff
1 changed files with 11 additions and 7 deletions
16
build/ci.go
16
build/ci.go
|
|
@ -187,13 +187,13 @@ func doInstall(cmdline []string) {
|
||||||
flag.CommandLine.Parse(cmdline)
|
flag.CommandLine.Parse(cmdline)
|
||||||
env := build.Env()
|
env := build.Env()
|
||||||
|
|
||||||
// Check Go version. People regularly open issues about compilation
|
|
||||||
// failure with outdated Go. This should save them the trouble.
|
|
||||||
if !strings.Contains(runtime.Version(), "devel") {
|
|
||||||
// Figure out the minor version number since we can't textually compare (1.10 < 1.9)
|
// Figure out the minor version number since we can't textually compare (1.10 < 1.9)
|
||||||
var minor int
|
var minor int
|
||||||
fmt.Sscanf(strings.TrimPrefix(runtime.Version(), "go1."), "%d", &minor)
|
fmt.Sscanf(strings.TrimPrefix(runtime.Version(), "go1."), "%d", &minor)
|
||||||
|
|
||||||
|
// Check Go version. People regularly open issues about compilation
|
||||||
|
// failure with outdated Go. This should save them the trouble.
|
||||||
|
if !strings.Contains(runtime.Version(), "devel") {
|
||||||
if minor < 9 {
|
if minor < 9 {
|
||||||
log.Println("You have Go version", runtime.Version())
|
log.Println("You have Go version", runtime.Version())
|
||||||
log.Println("go-ethereum requires at least Go version 1.9 and cannot")
|
log.Println("go-ethereum requires at least Go version 1.9 and cannot")
|
||||||
|
|
@ -210,6 +210,9 @@ func doInstall(cmdline []string) {
|
||||||
|
|
||||||
if *arch == "" || *arch == runtime.GOARCH {
|
if *arch == "" || *arch == runtime.GOARCH {
|
||||||
goinstall := goTool("install", buildFlags(env)...)
|
goinstall := goTool("install", buildFlags(env)...)
|
||||||
|
if minor >= 13 {
|
||||||
|
goinstall.Args = append(goinstall.Args, "-trimpath")
|
||||||
|
}
|
||||||
goinstall.Args = append(goinstall.Args, "-v")
|
goinstall.Args = append(goinstall.Args, "-v")
|
||||||
goinstall.Args = append(goinstall.Args, packages...)
|
goinstall.Args = append(goinstall.Args, packages...)
|
||||||
build.MustRun(goinstall)
|
build.MustRun(goinstall)
|
||||||
|
|
@ -224,6 +227,9 @@ func doInstall(cmdline []string) {
|
||||||
}
|
}
|
||||||
// Seems we are cross compiling, work around forbidden GOBIN
|
// Seems we are cross compiling, work around forbidden GOBIN
|
||||||
goinstall := goToolArch(*arch, *cc, "install", buildFlags(env)...)
|
goinstall := goToolArch(*arch, *cc, "install", buildFlags(env)...)
|
||||||
|
if minor >= 13 {
|
||||||
|
goinstall.Args = append(goinstall.Args, "-trimpath")
|
||||||
|
}
|
||||||
goinstall.Args = append(goinstall.Args, "-v")
|
goinstall.Args = append(goinstall.Args, "-v")
|
||||||
goinstall.Args = append(goinstall.Args, []string{"-buildmode", "archive"}...)
|
goinstall.Args = append(goinstall.Args, []string{"-buildmode", "archive"}...)
|
||||||
goinstall.Args = append(goinstall.Args, packages...)
|
goinstall.Args = append(goinstall.Args, packages...)
|
||||||
|
|
@ -253,9 +259,7 @@ func buildFlags(env build.Environment) (flags []string) {
|
||||||
var ld []string
|
var ld []string
|
||||||
if env.Commit != "" {
|
if env.Commit != "" {
|
||||||
ld = append(ld, "-X", "main.gitCommit="+env.Commit)
|
ld = append(ld, "-X", "main.gitCommit="+env.Commit)
|
||||||
}
|
ld = append(ld, "-s", "-w")
|
||||||
if runtime.GOOS == "darwin" {
|
|
||||||
ld = append(ld, "-s")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(ld) > 0 {
|
if len(ld) > 0 {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue