Added additional build details
This commit is contained in:
parent
2fe2d9ac62
commit
137e04acb6
15
Makefile
15
Makefile
|
@ -18,6 +18,17 @@ GO_FILES := $(shell find . -name '*.go' | grep -v /vendor/ | grep -v '*_test.go'
|
||||||
GO_TEST_FILES := $(shell find . -name '*_test.go' -type f | rev | cut -d "/" -f2- | rev | sort -u)
|
GO_TEST_FILES := $(shell find . -name '*_test.go' -type f | rev | cut -d "/" -f2- | rev | sort -u)
|
||||||
GO_BUILD_FILES := $(shell find . -name 'main.go')
|
GO_BUILD_FILES := $(shell find . -name 'main.go')
|
||||||
|
|
||||||
|
VERSION := `git describe --tags`
|
||||||
|
GITCOMMIT := `git rev-parse HEAD`
|
||||||
|
BUILDDATE := `date +%Y-%m-%d`
|
||||||
|
BUILDUSER := `whoami`
|
||||||
|
LDFLAGSSTRING :=-X github.com/zcash/lightwalletd/common.Version=$(VERSION)
|
||||||
|
LDFLAGSSTRING +=-X github.com/zcash/lightwalletd/common.GitCommit=$(GITCOMMIT)
|
||||||
|
LDFLAGSSTRING +=-X github.com/zcash/lightwalletd/common.Branch=$(BRANCH)
|
||||||
|
LDFLAGSSTRING +=-X github.com/zcash/lightwalletd/common.BuildDate=$(BUILDDATE)
|
||||||
|
LDFLAGSSTRING +=-X github.com/zcash/lightwalletd/common.BuildUser=$(BUILDUSER)
|
||||||
|
LDFLAGS :=-ldflags "$(LDFLAGSSTRING)"
|
||||||
|
|
||||||
# There are some files that are generated but are also in source control
|
# There are some files that are generated but are also in source control
|
||||||
# (so that the average clone - build doesn't need the required tools)
|
# (so that the average clone - build doesn't need the required tools)
|
||||||
GENERATED_FILES := docs/rtd/index.html walletrpc/compact_formats.pb.go walletrpc/service.pb.go
|
GENERATED_FILES := docs/rtd/index.html walletrpc/compact_formats.pb.go walletrpc/service.pb.go
|
||||||
|
@ -120,10 +131,10 @@ dep:
|
||||||
|
|
||||||
# Build binary
|
# Build binary
|
||||||
build:
|
build:
|
||||||
GO111MODULE=on go build -ldflags="-X github.com/zcash/lightwalletd/common.Version=`git describe --tags`"
|
GO111MODULE=on go build $(LDFLAGS)
|
||||||
|
|
||||||
build_rel:
|
build_rel:
|
||||||
GO111MODULE=on GOOS=linux go build -ldflags="-X github.com/zcash/lightwalletd/common.Version=`git describe --tags`"
|
GO111MODULE=on GOOS=linux go build $(LDFLAGS)
|
||||||
|
|
||||||
# Install binaries into Go path
|
# Install binaries into Go path
|
||||||
install:
|
install:
|
||||||
|
|
|
@ -13,6 +13,10 @@ var versionCmd = &cobra.Command{
|
||||||
Short: "Dispaly lightwalletd version",
|
Short: "Dispaly lightwalletd version",
|
||||||
Long: `Dispaly lightwalletd version.`,
|
Long: `Dispaly lightwalletd version.`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
fmt.Println("lightwalletd version", common.Version)
|
fmt.Println("lightwalletd version: ", common.Version)
|
||||||
|
fmt.Println("from commit: ", common.GitCommit)
|
||||||
|
fmt.Println("on: ", common.BuildDate)
|
||||||
|
fmt.Println("by: ", common.BuildUser)
|
||||||
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,9 @@ import (
|
||||||
|
|
||||||
// 'make build' will overwrite this string with the output of git-describe (tag)
|
// 'make build' will overwrite this string with the output of git-describe (tag)
|
||||||
var Version = "v0.0.0.0-dev"
|
var Version = "v0.0.0.0-dev"
|
||||||
|
var GitCommit = ""
|
||||||
|
var BuildDate = ""
|
||||||
|
var BuildUser = ""
|
||||||
|
|
||||||
type Options struct {
|
type Options struct {
|
||||||
BindAddr string `json:"bind_address,omitempty"`
|
BindAddr string `json:"bind_address,omitempty"`
|
||||||
|
|
Loading…
Reference in New Issue