Browse Source

Merge pull request #923 from tendermint/enable-homebrew-installation-from-source

Enable homebrew installation from source
pull/927/head
Ethan Buchman 7 years ago
committed by GitHub
parent
commit
6a7c399c2d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 31 deletions
  1. +1
    -4
      .editorconfig
  2. +20
    -22
      Makefile
  3. +3
    -2
      scripts/dist_build.sh
  4. +1
    -0
      test/docker/Dockerfile
  5. +4
    -3
      version/version.go

+ 1
- 4
.editorconfig View File

@ -8,10 +8,7 @@ end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[Makefile]
indent_style = tab
[*.sh]
[*.{sh,Makefile}]
indent_style = tab
[*.proto]


+ 20
- 22
Makefile View File

@ -1,25 +1,24 @@
GOTOOLS = \
github.com/mitchellh/gox \
github.com/tcnksm/ghr \
github.com/Masterminds/glide \
github.com/alecthomas/gometalinter
PACKAGES=$(shell go list ./... | grep -v '/vendor/')
BUILD_TAGS?=tendermint
TMHOME = $${TMHOME:-$$HOME/.tendermint}
all: install test
BUILD_FLAGS = -ldflags "-X github.com/tendermint/tendermint/version.GitCommit=`git rev-parse --short HEAD`"
install: get_vendor_deps
@go install --ldflags '-extldflags "-static"' \
--ldflags "-X github.com/tendermint/tendermint/version.GitCommit=`git rev-parse HEAD`" ./cmd/tendermint
all: get_vendor_deps install test
install:
CGO_ENABLED=0 go install $(BUILD_FLAGS) ./cmd/tendermint
build:
go build \
--ldflags "-X github.com/tendermint/tendermint/version.GitCommit=`git rev-parse HEAD`" -o build/tendermint ./cmd/tendermint/
CGO_ENABLED=0 go build $(BUILD_FLAGS) -o build/tendermint ./cmd/tendermint/
build_race:
go build -race -o build/tendermint ./cmd/tendermint
CGO_ENABLED=0 go build -race $(BUILD_FLAGS) -o build/tendermint ./cmd/tendermint
# dist builds binaries for all platforms and packages them for distribution
dist:
@ -38,7 +37,7 @@ test_race:
test_integrations:
@bash ./test/test.sh
release:
test_release:
@go test -tags release $(PACKAGES)
test100:
@ -61,24 +60,23 @@ get_deps:
grep -v /vendor/ | sort | uniq | \
xargs go get -v -d
get_vendor_deps: ensure_tools
update_deps:
@echo "--> Updating dependencies"
@go get -d -u ./...
get_vendor_deps:
@hash glide 2>/dev/null || go get github.com/Masterminds/glide
@rm -rf vendor/
@echo "--> Running glide install"
@glide install
update_deps: tools
@echo "--> Updating dependencies"
@go get -d -u ./...
revision:
-echo `git rev-parse --verify HEAD` > $(TMHOME)/revision
-echo `git rev-parse --verify HEAD` >> $(TMHOME)/revision_history
update_tools:
@echo "--> Updating tools"
@go get -u $(GOTOOLS)
tools:
go get -u -v $(GOTOOLS)
ensure_tools:
go get $(GOTOOLS)
@echo "--> Installing tools"
@go get $(GOTOOLS)
@gometalinter --install
### Formatting, linting, and vetting
@ -115,4 +113,4 @@ metalinter_test:
#--enable=vet \
#--enable=vetshadow \
.PHONY: install build build_race dist test test_race test_integrations test100 draw_deps list_deps get_deps get_vendor_deps update_deps revision tools
.PHONY: install build build_race dist test test_race test_integrations test100 draw_deps list_deps get_deps get_vendor_deps update_deps update_tools tools test_release

+ 3
- 2
scripts/dist_build.sh View File

@ -11,7 +11,6 @@ cd "$DIR"
# Get the git commit
GIT_COMMIT="$(git rev-parse --short HEAD)"
GIT_DESCRIBE="$(git describe --tags --always)"
GIT_IMPORT="github.com/tendermint/tendermint/version"
# Determine the arch/os combos we're building for
@ -25,12 +24,14 @@ make tools
make get_vendor_deps
# Build!
# ldflags: -s Omit the symbol table and debug information.
# -w Omit the DWARF symbol table.
echo "==> Building..."
"$(which gox)" \
-os="${XC_OS}" \
-arch="${XC_ARCH}" \
-osarch="!darwin/arm !solaris/amd64 !freebsd/amd64" \
-ldflags "-X ${GIT_IMPORT}.GitCommit='${GIT_COMMIT}' -X ${GIT_IMPORT}.GitDescribe='${GIT_DESCRIBE}'" \
-ldflags "-s -w -X ${GIT_IMPORT}.GitCommit='${GIT_COMMIT}'" \
-output "build/pkg/{{.OS}}_{{.Arch}}/tendermint" \
-tags="${BUILD_TAGS}" \
github.com/tendermint/tendermint/cmd/tendermint


+ 1
- 0
test/docker/Dockerfile View File

@ -17,6 +17,7 @@ WORKDIR $REPO
ADD glide.yaml glide.yaml
ADD glide.lock glide.lock
ADD Makefile Makefile
RUN make tools
RUN make get_vendor_deps
# Install the apps


+ 4
- 3
version/version.go View File

@ -5,15 +5,16 @@ const Min = "12"
const Fix = "1"
var (
// The full version string
// Version is the current version of Tendermint
// Must be a string because scripts like dist.sh read this file.
Version = "0.12.1"
// GitCommit is set with --ldflags "-X main.gitCommit=$(git rev-parse HEAD)"
// GitCommit is the current HEAD set using ldflags.
GitCommit string
)
func init() {
if GitCommit != "" {
Version += "-" + GitCommit[:8]
Version += "-" + GitCommit
}
}

Loading…
Cancel
Save