Skip to content

Commit e056406

Browse files
authored
br: Fix build on arm64 (#426)
Signed-off-by: Ping Yu <yuping@pingcap.com>
1 parent 49dcd72 commit e056406

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

br/Makefile

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,23 @@ TLS_CA ?=
3737
TLS_CERT ?=
3838
TLS_KEY ?=
3939

40-
LDFLAGS += -X "github.com/tikv/migration/br/pkg/version/build.ReleaseVersion=$(shell git describe --tags --dirty --always)"
40+
RELEASE_VERSION ?=
41+
ifeq ($(RELEASE_VERSION),)
42+
RELEASE_VERSION := br-v1.1-master
43+
release_version_regex := ^br-v[0-9]\..*$$
44+
release_branch_regex := "^br-[0-9]\.[0-9].*$$|^HEAD$$|^.*/*tags/br-v[0-9]\.[0-9]\..*$$"
45+
ifneq ($(shell git rev-parse --abbrev-ref HEAD | egrep $(release_branch_regex)),)
46+
# If we are in release branch, try to use tag version.
47+
ifneq ($(shell git describe --tags --dirty | egrep $(release_version_regex)),)
48+
RELEASE_VERSION := $(shell git describe --tags --dirty)
49+
endif
50+
else ifneq ($(shell git status --porcelain),)
51+
# Add -dirty if the working tree is dirty for non release branch.
52+
RELEASE_VERSION := $(RELEASE_VERSION)-dirty
53+
endif
54+
endif
55+
56+
LDFLAGS += -X "github.com/tikv/migration/br/pkg/version/build.ReleaseVersion=$(RELEASE_VERSION)"
4157
LDFLAGS += -X "github.com/tikv/migration/br/pkg/version/build.BuildTS=$(shell date -u '+%Y-%m-%d %H:%M:%S')"
4258
LDFLAGS += -X "github.com/tikv/migration/br/pkg/version/build.GitHash=$(shell git rev-parse HEAD)"
4359
LDFLAGS += -X "github.com/tikv/migration/br/pkg/version/build.GitBranch=$(shell git rev-parse --abbrev-ref HEAD)"
@@ -94,10 +110,10 @@ tools/bin/failpoint-ctl: tools/check/go.mod
94110
cd tools/check && $(GO) build -o ../bin/failpoint-ctl github.com/pingcap/failpoint/failpoint-ctl
95111

96112
build:
97-
CGO_ENABLED=1 $(GO) build -tags codes -gcflags "all=-N -l" -ldflags '$(LDFLAGS)' -o $(BR_BIN_PATH) cmd/br/*.go
113+
CGO_ENABLED=0 $(GO) build -tags codes -gcflags "all=-N -l" -ldflags '$(LDFLAGS)' -o $(BR_BIN_PATH) cmd/br/*.go
98114

99115
release:
100-
CGO_ENABLED=1 GOOS=$(TARGET_OS) GOARCH=$(TARGET_ARCH) $(GO) build -tags codes -ldflags '$(LDFLAGS)' -o $(BR_BIN_PATH) cmd/br/*.go
116+
CGO_ENABLED=0 GOOS=$(TARGET_OS) GOARCH=$(TARGET_ARCH) $(GO) build -tags codes -ldflags '$(LDFLAGS)' -o $(BR_BIN_PATH) cmd/br/*.go
101117

102118
build/rawkv-integration-test:
103119
cd tests/rawkv && $(GO) build -mod=mod -o ../../bin/rawkv_test *.go

cdc/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ FAILPOINT_DISABLE := $$(echo $(FAILPOINT_DIR) | xargs $(FAILPOINT) disable >/dev
4545

4646
RELEASE_VERSION ?=
4747
ifeq ($(RELEASE_VERSION),)
48-
RELEASE_VERSION := v1.3-master
48+
RELEASE_VERSION := cdc-v1.3-master
4949
release_version_regex := ^cdc-v[0-9]\..*$$
5050
release_branch_regex := "^cdc-[0-9]\.[0-9].*$$|^HEAD$$|^.*/*tags/cdc-v[0-9]\.[0-9]\..*$$"
5151
ifneq ($(shell git rev-parse --abbrev-ref HEAD | egrep $(release_branch_regex)),)

0 commit comments

Comments
 (0)