Skip to content

Commit

Permalink
comments and unify ldflags
Browse files Browse the repository at this point in the history
  • Loading branch information
gartnera committed Oct 1, 2024
1 parent a74625f commit 84981c2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
17 changes: 9 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ GOFLAGS := ""
GOLANG_CROSS_VERSION ?= v1.22.4
GOPATH ?= '$(HOME)/go'

# --allow-multiple-definitions need to be set when you are importing both cosmos-sdk
# and go-ethereum: https://github.com/cosmos/cosmos-sdk/tree/release/v0.47.x/crypto/keys/secp256k1/internal/secp256k1
ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=zetacore \
build_ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=zetacore \
-X github.com/cosmos/cosmos-sdk/version.ServerName=zetacored \
-X github.com/cosmos/cosmos-sdk/version.ClientName=zetaclientd \
-X github.com/cosmos/cosmos-sdk/version.Version=$(NODE_VERSION) \
Expand All @@ -25,16 +23,19 @@ ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=zetacore \
-X github.com/zeta-chain/node/pkg/constant.Version=$(NODE_VERSION) \
-X github.com/zeta-chain/node/pkg/constant.CommitHash=$(NODE_COMMIT) \
-X github.com/zeta-chain/node/pkg/constant.BuildTime=$(BUILDTIME) \
-X github.com/cosmos/cosmos-sdk/types.DBBackend=pebbledb \
-extldflags=-Wl,--allow-multiple-definition
-X github.com/cosmos/cosmos-sdk/types.DBBackend=pebbledb

# --allow-multiple-definitions need to be set when you are importing both cosmos-sdk
# and go-ethereum: https://github.com/cosmos/cosmos-sdk/tree/release/v0.47.x/crypto/keys/secp256k1/internal/secp256k1
all_ldflags = -extldflags=-Wl,--allow-multiple-definition

# enable libsecp256k1_sdk to bypass the btcec breaking change:
# https://github.com/btcsuite/btcd/issues/2243
BUILD_FLAGS := -ldflags '$(ldflags)' -tags pebbledb,ledger,libsecp256k1_sdk
BUILD_FLAGS := -ldflags '$(build_ldflags) $(all_ldflags)' -tags pebbledb,ledger,libsecp256k1_sdk

TEST_DIR ?= "./..."
TEST_BUILD_FLAGS := -ldflags=all="-extldflags=-Wl,--allow-multiple-definition" -tags pebbledb,ledger,libsecp256k1_sdk
HSM_BUILD_FLAGS := -ldflags=all="-extldflags=-Wl,--allow-multiple-definition" -tags pebbledb,ledger,hsm_test
TEST_BUILD_FLAGS := -ldflags='$(all_ldflags)' -tags pebbledb,ledger,libsecp256k1_sdk
HSM_BUILD_FLAGS := -ldflags='$(all_ldflags)' -tags pebbledb,ledger,libsecp256k1_sdk,hsm_test

export DOCKER_BUILDKIT := 1

Expand Down
7 changes: 6 additions & 1 deletion contrib/rpcimportable/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@ set -eo pipefail

cd "$(dirname "$0")"

go test -tags libsecp256k1_sdk -ldflags=all="-extldflags=-Wl,--allow-multiple-definition" ./...
# --allow-multiple-definitions need to be set when you are importing both cosmos-sdk
# and go-ethereum: https://github.com/cosmos/cosmos-sdk/tree/release/v0.47.x/crypto/keys/secp256k1/internal/secp256k1
#
# enable libsecp256k1_sdk to bypass the btcec breaking change:
# https://github.com/btcsuite/btcd/issues/2243
go test -tags libsecp256k1_sdk -ldflags="-extldflags=-Wl,--allow-multiple-definition" ./...

0 comments on commit 84981c2

Please sign in to comment.