Skip to content

Commit

Permalink
Makefile: simpily ledger build tags (#2449)
Browse files Browse the repository at this point in the history
In the process of working on the `goreleaser` PR I discovered that how
we are building the `BUILD_TAGS` is overly verbose and unnecessary.

Ultimately we are just trying to add `ledger` to `-tags`. Hardcoding it
and adding a note in the README for the 2 distributions that aren't
supported seemed easier to maintain.

(cherry picked from commit 67241f9)

# Conflicts:
#	specs/src/SUMMARY.md
  • Loading branch information
MSevey authored and mergify[bot] committed Oct 4, 2023
1 parent 9791d95 commit 75de1bc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 39 deletions.
40 changes: 1 addition & 39 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,52 +5,14 @@ DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bu
IMAGE := ghcr.io/tendermint/docker-build-proto:latest
DOCKER_PROTO_BUILDER := docker run -v $(shell pwd):/workspace --workdir /workspace $(IMAGE)
PROJECTNAME=$(shell basename "$(PWD)")
LEDGER_ENABLED ?= true


# process build tags
build_tags =
ifeq ($(LEDGER_ENABLED),true)
ifeq ($(OS),Windows_NT)
GCCEXE = $(shell where gcc.exe 2> NUL)
ifeq ($(GCCEXE),)
$(error gcc.exe not installed for ledger support, please install or set LEDGER_ENABLED=false)
else
build_tags += ledger
endif
else
UNAME_S = $(shell uname -s)
ifeq ($(UNAME_S),OpenBSD)
$(warning OpenBSD detected, disabling ledger support (https://github.com/cosmos/cosmos-sdk/issues/1988))
else
GCC = $(shell command -v gcc 2> /dev/null)
ifeq ($(GCC),)
$(error gcc not installed for ledger support, please install or set LEDGER_ENABLED=false)
else
build_tags += ledger
endif
endif
endif
endif
build_tags := $(strip $(build_tags))

empty :=
whitespace := $(empty) $(empty)
comma := ,

# convert build_tags from a whitespace seperated list to a comma seperated list
build_tags_comma_sep := $(subst $(whitespace),$(comma),$(build_tags))


# process linker flags
ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=celestia-app \
-X github.com/cosmos/cosmos-sdk/version.AppName=celestia-appd \
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \
-X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)"
ldflags += $(LDFLAGS)

BUILD_FLAGS := -tags "$(build_tags)" -ldflags '$(ldflags)'
BUILD_FLAGS := -tags "ledger" -ldflags '$(ldflags)'

## help: Get more info on make commands.
help: Makefile
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ node | | | |
make install
```

### Ledger Support

Ledger is not supported on Windows and OpenBSD.

## Usage

```sh
Expand Down
9 changes: 9 additions & 0 deletions specs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,19 @@
- [Data Square Layout](./specs/data_square_layout.md)
- [Resource Pricing](./specs/resource_pricing.md)
- [State Machine Modules](./specs/state_machine_modules.md)
<<<<<<< HEAD
- [blob](https://github.com/celestiaorg/celestia-app/blob/v1.x/x/blob/README.md)
- [qgb](https://github.com/celestiaorg/celestia-app/blob/v1.x/x/qgb/README.md)
- [mint](https://github.com/celestiaorg/celestia-app/blob/v1.x/x/mint/README.md)
- [paramfilter](https://github.com/celestiaorg/celestia-app/blob/v1.x/x/paramfilter/README.md)
- [upgrade](https://github.com/celestiaorg/celestia-app/blob/v1.x/x/upgrade/README.md)
- [tokenfilter](https://github.com/celestiaorg/celestia-app/blob/v1.x/x/tokenfilter/README.md)
=======
- [blob](https://github.com/celestiaorg/celestia-app/blob/main/x/blob/README.md)
- [qgb](https://github.com/celestiaorg/celestia-app/blob/main/x/qgb/README.md)
- [mint](https://github.com/celestiaorg/celestia-app/blob/main/x/mint/README.md)
- [paramfilter](https://github.com/celestiaorg/celestia-app/blob/main/x/paramfilter/README.md)
- [upgrade](https://github.com/celestiaorg/celestia-app/blob/main/x/upgrade/README.md)
- [tokenfilter](https://github.com/celestiaorg/celestia-app/blob/main/x/tokenfilter/README.md)
>>>>>>> 67241f9 (Makefile: simpily ledger build tags (#2449))
- [Mainnet Parameters](./specs/params.md)

0 comments on commit 75de1bc

Please sign in to comment.