Skip to content

Commit 040914a

Browse files
authored
Merge pull request #215 from zigbee-alliance/ledger-nano-support
Ledger Nano Support
2 parents 635aaad + b292700 commit 040914a

File tree

2 files changed

+71
-4
lines changed

2 files changed

+71
-4
lines changed

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ COPY docs/static ./docs/static/
3737

3838
ARG DCL_VERSION
3939
ARG DCL_COMMIT
40-
RUN make
40+
RUN LEDGER_ENABLED=false make
4141

4242
############################
4343
# STEP 2 build an image

Makefile

+70-3
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,80 @@ ifndef DCL_COMMIT
88
DCL_COMMIT := $(shell git log -1 --format='%H')
99
endif
1010

11+
NAME ?= dcl
12+
APPNAME ?= $(NAME)d
13+
LEDGER_ENABLED ?= true
14+
15+
OUTPUT_DIR ?= build
16+
17+
### Process ld flags
18+
1119
ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=DcLedger \
12-
-X github.com/cosmos/cosmos-sdk/version.App=dcld \
20+
-X github.com/cosmos/cosmos-sdk/version.AppName=$(APPNAME) \
1321
-X github.com/cosmos/cosmos-sdk/version.Version=$(DCL_VERSION) \
1422
-X github.com/cosmos/cosmos-sdk/version.Commit=$(DCL_COMMIT)
1523

16-
BUILD_FLAGS := -ldflags '$(ldflags)'
17-
OUTPUT_DIR ?= build
24+
# DB backend selection
25+
ifeq (cleveldb,$(findstring cleveldb,$(COSMOS_BUILD_OPTIONS)))
26+
ldflags += -X github.com/cosmos/cosmos-sdk/types.DBBackend=cleveldb
27+
endif
28+
29+
30+
### Process build tags
31+
build_tags = netgo
32+
ifeq ($(LEDGER_ENABLED),true)
33+
ifeq ($(OS),Windows_NT)
34+
GCCEXE = $(shell where gcc.exe 2> NUL)
35+
ifeq ($(GCCEXE),)
36+
$(error gcc.exe not installed for ledger support, please install or set LEDGER_ENABLED=false)
37+
else
38+
build_tags += ledger
39+
endif
40+
else
41+
UNAME_S = $(shell uname -s)
42+
ifeq ($(UNAME_S),OpenBSD)
43+
$(warning OpenBSD detected, disabling ledger support (https://github.com/cosmos/cosmos-sdk/issues/1988))
44+
else
45+
GCC = $(shell command -v gcc 2> /dev/null)
46+
ifeq ($(GCC),)
47+
$(error gcc not installed for ledger support, please install or set LEDGER_ENABLED=false)
48+
else
49+
build_tags += ledger
50+
endif
51+
endif
52+
endif
53+
endif
54+
55+
ifeq (cleveldb,$(findstring cleveldb,$(COSMOS_BUILD_OPTIONS)))
56+
build_tags += gcc
57+
endif
58+
59+
whitespace :=
60+
whitespace += $(whitespace)
61+
comma := ,
62+
build_tags_comma_sep := $(subst $(whitespace),$(comma),$(build_tags))
63+
64+
65+
ldflags += $(LDFLAGS)
66+
ldflags := $(strip $(ldflags))
67+
68+
build_tags += $(BUILD_TAGS)
69+
build_tags := $(strip $(build_tags))
70+
71+
72+
### Resulting build flags
73+
BUILD_FLAGS := -tags "$(build_tags)" -ldflags '$(ldflags)'
74+
75+
# Check for nostrip option
76+
ifeq (,$(findstring nostrip,$(COSMOS_BUILD_OPTIONS)))
77+
BUILD_FLAGS += -trimpath
78+
endif
79+
80+
# Check for debug option
81+
ifeq (debug,$(findstring debug,$(COSMOS_BUILD_OPTIONS)))
82+
BUILD_FLAGS += -gcflags "all=-N -l"
83+
endif
84+
1885

1986
LICENSE_TYPE = "apache"
2087
COPYRIGHT_YEAR = "2020"

0 commit comments

Comments
 (0)