Skip to content

Commit

Permalink
[Master][DFI-924] Ledger cross build (#229)
Browse files Browse the repository at this point in the history
* [DFI-924] Ledger cross-OS build using XGO

* go mod tidy
  • Loading branch information
Mikhail Kornilov authored Oct 26, 2020
1 parent 56604f0 commit bb5eb26
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 113 deletions.
18 changes: 12 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include Makefile.ledger

git_tag=$(shell git describe --tags $(git rev-list --tags --max-count=1))
git_tag=$(shell git describe --tags --abbrev=0)
git_commit=$(shell git rev-list -1 HEAD)
tags = -X github.com/cosmos/cosmos-sdk/version.Name=dfinance \
-X github.com/cosmos/cosmos-sdk/version.ServerName=dnode \
Expand Down Expand Up @@ -82,9 +82,15 @@ swagger-ui-build:

## binaries builds (xgo required: https://github.com/karalabe/xgo)
binaries: go.sum
@echo ${git_tag}
@echo "Prepare XGO dependencies"
mkdir -p ./builds
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 GO111MODULE=on go build --ldflags "$(tags)" -tags "$(build_tags)" -o ./builds/dncli-${git_tag}-darwin-amd64 ${dncli}
#GOOS=linux GOARCH=386 CGO_ENABLED=0 GO111MODULE=on go build --ldflags "$(tags)" -tags "$(build_tags)" -o ./builds/dncli-${git_tag}-linux-386 ${dncli}
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 GO111MODULE=on go build --ldflags "$(tags)" -tags "$(build_tags)" -o ./builds/dncli-${git_tag}-linux-amd64 ${dncli}
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 GO111MODULE=on go build --ldflags "$(tags)" -tags "$(build_tags)" -o ./builds/dncli-${git_tag}-windows-amd64.exe ${dncli}
#GOOS=windows GOARCH=386 CGO_ENABLED=0 GO111MODULE=on go build --ldflags "$(tags)" -tags "$(build_tags)" -o ./builds/dncli-${git_tag}-windows-386.exe ${dncli}
go get github.com/crazy-max/xgo

@echo "Build targets (Go 1.14): windows/amd64, linux/amd64, darwin/amd64"
xgo -go 1.14.x --ldflags='$(tags)' --tags='ledger' --out='./builds/dncli-${git_tag}' -targets='windows/amd64,linux/amd64,darwin/amd64' ${dncli}

## Legacy builds (as a reference)
#GOOS=darwin GOARCH=amd64 GO111MODULE=on go build --ldflags "$(tags)" -tags "$(build_tags)" -o ./builds/dncli-${git_tag}-darwin-amd64 ${dncli}
#GOOS=linux GOARCH=amd64 GO111MODULE=on go build --ldflags "$(tags)" -tags "$(build_tags)" -o ./builds/dncli-${git_tag}-linux-amd64 ${dncli}
#GOOS=windows GOARCH=amd64 GO111MODULE=on go build --ldflags "$(tags)" -tags "$(build_tags)" -o ./builds/dncli-${git_tag}-windows-amd64.exe ${dncli}
12 changes: 0 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,21 @@ require (
github.com/99designs/keyring v1.1.3
github.com/OneOfOne/xxhash v1.2.7
github.com/atlassian/go-sentry-api v0.0.0-20200117001222-a9ccec16c98b
github.com/blang/semver v3.1.0+incompatible // indirect
github.com/cosmos/cosmos-sdk v0.0.1
github.com/dfinance/dvm-proto/go v0.0.0-20201007122036-27be7297df4e
github.com/dfinance/glav v0.0.0-20200814081332-c4701f6c12a6
github.com/dfinance/lcs v0.1.7-big
github.com/fsouza/go-dockerclient v1.6.6-0.20200910033347-214a51d9a1e5
github.com/g3co/go-swagger-merger v0.0.0-20200916115803-70f050d0cb09 // indirect
github.com/getsentry/sentry-go v0.5.1
github.com/ghodss/yaml v1.0.0
github.com/gin-gonic/gin v1.6.3 // indirect
github.com/go-openapi/spec v0.19.10 // indirect
github.com/go-openapi/swag v0.19.10 // indirect
github.com/gofrs/uuid v3.3.0+incompatible // indirect
github.com/gogo/protobuf v1.3.1
github.com/gorilla/handlers v1.4.2
github.com/gorilla/mux v1.8.0
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/kr/pty v1.1.5 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/olekukonko/tablewriter v0.0.4
github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39 // indirect
github.com/pelletier/go-toml v1.6.0
github.com/pkg/errors v0.9.1
github.com/rakyll/statik v0.1.7 // indirect
github.com/satori/go.uuid v1.2.0 // indirect
github.com/shopspring/decimal v1.2.0
github.com/spf13/afero v1.2.2 // indirect
github.com/spf13/cobra v1.0.0
Expand All @@ -50,7 +39,6 @@ require (
github.com/stretchr/testify v1.6.1
github.com/swaggo/http-swagger v0.0.0-20200308142732-58ac5e232fba
github.com/swaggo/swag v1.6.7
github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8 // indirect
github.com/tendermint/go-amino v0.15.1
github.com/tendermint/tendermint v0.33.7
github.com/tendermint/tm-db v0.5.1
Expand Down
Loading

0 comments on commit bb5eb26

Please sign in to comment.