Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 866bf94

Browse files
authoredMar 2, 2023
e2e: fix Makefile to produce commit_hash for builtin (celestiaorg#432)
* e2e: fix Makefile to produce commit_hash for builtin * Added changelog * Revert "Added changelog" This reverts commit 6c9a6835c43118f03bbfb032f3482884c354c2c7.
1 parent 06eeaaa commit 866bf94

File tree

3 files changed

+50
-43
lines changed

3 files changed

+50
-43
lines changed
 

‎Makefile

+2-42
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,12 @@
1+
include common.mk
2+
13
PACKAGES=$(shell go list ./...)
24
BUILDDIR?=$(CURDIR)/build
35
OUTPUT?=$(BUILDDIR)/cometbft
46

5-
BUILD_TAGS?=cometbft
6-
7-
COMMIT_HASH := $(shell git rev-parse --short HEAD)
8-
LD_FLAGS = -X github.com/cometbft/cometbft/version.TMGitCommitHash=$(COMMIT_HASH)
9-
BUILD_FLAGS = -mod=readonly -ldflags "$(LD_FLAGS)"
107
HTTPS_GIT := https://github.com/cometbft/cometbft.git
118
CGO_ENABLED ?= 0
129

13-
# handle nostrip
14-
ifeq (,$(findstring nostrip,$(COMETBFT_BUILD_OPTIONS)))
15-
BUILD_FLAGS += -trimpath
16-
LD_FLAGS += -s -w
17-
endif
18-
19-
# handle race
20-
ifeq (race,$(findstring race,$(COMETBFT_BUILD_OPTIONS)))
21-
CGO_ENABLED=1
22-
BUILD_FLAGS += -race
23-
endif
24-
25-
# handle cleveldb
26-
ifeq (cleveldb,$(findstring cleveldb,$(COMETBFT_BUILD_OPTIONS)))
27-
CGO_ENABLED=1
28-
BUILD_TAGS += cleveldb
29-
endif
30-
31-
# handle badgerdb
32-
ifeq (badgerdb,$(findstring badgerdb,$(COMETBFT_BUILD_OPTIONS)))
33-
BUILD_TAGS += badgerdb
34-
endif
35-
36-
# handle rocksdb
37-
ifeq (rocksdb,$(findstring rocksdb,$(COMETBFT_BUILD_OPTIONS)))
38-
CGO_ENABLED=1
39-
BUILD_TAGS += rocksdb
40-
endif
41-
42-
# handle boltdb
43-
ifeq (boltdb,$(findstring boltdb,$(COMETBFT_BUILD_OPTIONS)))
44-
BUILD_TAGS += boltdb
45-
endif
46-
47-
# allow users to pass additional flags via the conventional LDFLAGS variable
48-
LD_FLAGS += $(LDFLAGS)
49-
5010
# Process Docker environment varible TARGETPLATFORM
5111
# in order to build binary with correspondent ARCH
5212
# by default will always build for linux/amd64

‎common.mk

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# This contains Makefile logic that is common to several makefiles
2+
3+
BUILD_TAGS ?= cometbft
4+
5+
COMMIT_HASH := $(shell git rev-parse --short HEAD)
6+
LD_FLAGS = -X github.com/cometbft/cometbft/version.TMGitCommitHash=$(COMMIT_HASH)
7+
BUILD_FLAGS = -mod=readonly -ldflags "$(LD_FLAGS)"
8+
# allow users to pass additional flags via the conventional LDFLAGS variable
9+
LD_FLAGS += $(LDFLAGS)
10+
11+
# handle nostrip
12+
ifeq (,$(findstring nostrip,$(COMETBFT_BUILD_OPTIONS)))
13+
BUILD_FLAGS += -trimpath
14+
LD_FLAGS += -s -w
15+
endif
16+
17+
# handle race
18+
ifeq (race,$(findstring race,$(COMETBFT_BUILD_OPTIONS)))
19+
CGO_ENABLED=1
20+
BUILD_FLAGS += -race
21+
endif
22+
23+
# handle cleveldb
24+
ifeq (cleveldb,$(findstring cleveldb,$(COMETBFT_BUILD_OPTIONS)))
25+
CGO_ENABLED=1
26+
BUILD_TAGS += cleveldb
27+
endif
28+
29+
# handle badgerdb
30+
ifeq (badgerdb,$(findstring badgerdb,$(COMETBFT_BUILD_OPTIONS)))
31+
BUILD_TAGS += badgerdb
32+
endif
33+
34+
# handle rocksdb
35+
ifeq (rocksdb,$(findstring rocksdb,$(COMETBFT_BUILD_OPTIONS)))
36+
CGO_ENABLED=1
37+
BUILD_TAGS += rocksdb
38+
endif
39+
40+
# handle boltdb
41+
ifeq (boltdb,$(findstring boltdb,$(COMETBFT_BUILD_OPTIONS)))
42+
BUILD_TAGS += boltdb
43+
endif

‎test/e2e/Makefile

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
COMETBFT_BUILD_OPTIONS += badgerdb,boltdb,cleveldb,rocksdb
2+
3+
include ../../common.mk
4+
15
all: docker generator runner
26

37
docker:
@@ -10,7 +14,7 @@ docker:
1014
# order to build a binary with a CometBFT node in it (for built-in
1115
# ABCI testing).
1216
node:
13-
go build -o build/node -tags badgerdb,boltdb,cleveldb,rocksdb ./node
17+
go build $(BUILD_FLAGS) -tags '$(BUILD_TAGS)' -o build/node ./node
1418

1519
generator:
1620
go build -o build/generator ./generator

0 commit comments

Comments
 (0)
Please sign in to comment.