mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
Merge 316fddfd23 into 93c0f1715d
This commit is contained in:
commit
17a5ea75f0
3 changed files with 23 additions and 10 deletions
10
Makefile
10
Makefile
|
|
@ -16,6 +16,13 @@ geth:
|
|||
@echo "Done building."
|
||||
@echo "Run \"$(GOBIN)/geth\" to launch geth."
|
||||
|
||||
geth-static:
|
||||
build/env.sh go run build/ci.go install -static ./cmd/geth
|
||||
@echo "Done building."
|
||||
@echo "Run \"$(GOBIN)/geth\" to launch geth."
|
||||
|
||||
static: geth-static
|
||||
|
||||
swarm:
|
||||
build/env.sh go run build/ci.go install ./cmd/swarm
|
||||
@echo "Done building."
|
||||
|
|
@ -24,6 +31,9 @@ swarm:
|
|||
all:
|
||||
build/env.sh go run build/ci.go install
|
||||
|
||||
all-static:
|
||||
build/env.sh go run build/ci.go install -static
|
||||
|
||||
android:
|
||||
build/env.sh go run build/ci.go aar --local
|
||||
@echo "Done building."
|
||||
|
|
|
|||
18
build/ci.go
18
build/ci.go
|
|
@ -174,12 +174,13 @@ 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 a static linked binary")
|
||||
)
|
||||
flag.CommandLine.Parse(cmdline)
|
||||
env := build.Env()
|
||||
|
||||
env.Static = *static
|
||||
// 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") {
|
||||
|
|
@ -247,13 +248,14 @@ func buildFlags(env build.Environment) (flags []string) {
|
|||
if env.Commit != "" {
|
||||
ld = append(ld, "-X", "main.gitCommit="+env.Commit)
|
||||
}
|
||||
if runtime.GOOS == "darwin" {
|
||||
ld = append(ld, "-s")
|
||||
ld = append(ld, "-s")
|
||||
ld = append(ld, "-w")
|
||||
|
||||
if env.Static {
|
||||
ld = append(ld, "-extldflags -static")
|
||||
}
|
||||
|
||||
if len(ld) > 0 {
|
||||
flags = append(flags, "-ldflags", strings.Join(ld, " "))
|
||||
}
|
||||
flags = append(flags, "-ldflags", strings.Join(ld, " "))
|
||||
return flags
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,11 +41,12 @@ type Environment struct {
|
|||
Buildnum string
|
||||
IsPullRequest bool
|
||||
IsCronJob bool
|
||||
Static bool
|
||||
}
|
||||
|
||||
func (env Environment) String() string {
|
||||
return fmt.Sprintf("%s env (commit:%s branch:%s tag:%s buildnum:%s pr:%t)",
|
||||
env.Name, env.Commit, env.Branch, env.Tag, env.Buildnum, env.IsPullRequest)
|
||||
return fmt.Sprintf("%s env (commit:%s branch:%s tag:%s buildnum:%s pr:%t static:%t)",
|
||||
env.Name, env.Commit, env.Branch, env.Tag, env.Buildnum, env.IsPullRequest, env.Static)
|
||||
}
|
||||
|
||||
// Env returns metadata about the current CI environment, falling back to LocalEnv
|
||||
|
|
|
|||
Loading…
Reference in a new issue