Makefile: simplify and clean-up (#7453)
The simd target is removed in favor of build/install targets: - build runs go build ./... with all appropriate flags and args. - install runs go install ./... with all approriate flags and args. localnet-start now depends on build-linux [1]. [1] This should hopefully put a smile on @alexanderbez's face! Remove unused install scripts and snapcraft build files.
This commit is contained in:
parent
cdf9bd2a4f
commit
6c1c2cce04
|
@ -23,7 +23,7 @@ WORKDIR /go/src/github.com/cosmos/cosmos-sdk
|
|||
COPY . .
|
||||
|
||||
# install simapp, remove packages
|
||||
RUN make simd-linux
|
||||
RUN make build-linux
|
||||
|
||||
|
||||
# Final image
|
||||
|
|
42
Makefile
42
Makefile
|
@ -97,15 +97,17 @@ include contrib/devtools/Makefile
|
|||
### Build ###
|
||||
###############################################################################
|
||||
|
||||
build: go.sum
|
||||
go build -mod=readonly ./...
|
||||
BUILD_TARGETS := build install
|
||||
|
||||
simd:
|
||||
mkdir -p $(BUILDDIR)
|
||||
go build -mod=readonly $(BUILD_FLAGS) -o $(BUILDDIR) ./simapp/simd
|
||||
build: BUILD_ARGS=-o $(BUILDDIR)/
|
||||
build-linux:
|
||||
GOOS=linux GOARCH=amd64 LEDGER_ENABLED=false $(MAKE) build
|
||||
|
||||
simd-linux: go.sum
|
||||
$(MAKE) simd GOOS=linux GOARCH=amd64 LEDGER_ENABLED=false
|
||||
$(BUILD_TARGETS): go.sum $(BUILDDIR)/
|
||||
go $@ -mod=readonly $(BUILD_FLAGS) $(BUILD_ARGS) ./...
|
||||
|
||||
$(BUILDDIR)/:
|
||||
mkdir -p $(BUILDDIR)/
|
||||
|
||||
build-simd-all: go.sum
|
||||
$(if $(shell docker inspect -f '{{ .Id }}' cosmossdk/rbuilder 2>/dev/null),$(info found image cosmossdk/rbuilder),docker pull cosmossdk/rbuilder:latest)
|
||||
|
@ -119,7 +121,7 @@ build-simd-all: go.sum
|
|||
--name latest-build cosmossdk/rbuilder:latest
|
||||
docker cp -a latest-build:/home/builder/artifacts/ $(CURDIR)/
|
||||
|
||||
build-simd-linux: go.sum
|
||||
build-simd-linux: go.sum $(BUILDDIR)/
|
||||
$(if $(shell docker inspect -f '{{ .Id }}' cosmossdk/rbuilder 2>/dev/null),$(info found image cosmossdk/rbuilder),docker pull cosmossdk/rbuilder:latest)
|
||||
docker rm latest-build || true
|
||||
docker run --volume=$(CURDIR):/sources:ro \
|
||||
|
@ -130,13 +132,12 @@ build-simd-linux: go.sum
|
|||
--env LEDGER_ENABLED=false \
|
||||
--name latest-build cosmossdk/rbuilder:latest
|
||||
docker cp -a latest-build:/home/builder/artifacts/ $(CURDIR)/
|
||||
mkdir -p $(BUILDDIR)
|
||||
cp artifacts/simd-*-linux-amd64 $(BUILDDIR)/simd
|
||||
|
||||
cosmovisor:
|
||||
$(MAKE) -C cosmovisor cosmovisor
|
||||
|
||||
.PHONY: build simd simd-linux build-simd-all build-simd-linux cosmovisor
|
||||
.PHONY: build build-linux build-simd-all build-simd-linux cosmovisor
|
||||
|
||||
mocks: $(MOCKS_DIR)
|
||||
mockgen -source=client/account_retriever.go -package mocks -destination tests/mocks/account_retriever.go
|
||||
|
@ -152,13 +153,7 @@ mocks: $(MOCKS_DIR)
|
|||
$(MOCKS_DIR):
|
||||
mkdir -p $(MOCKS_DIR)
|
||||
|
||||
distclean: clean
|
||||
rm -rf \
|
||||
gitian-build-darwin/ \
|
||||
gitian-build-linux/ \
|
||||
gitian-build-windows/ \
|
||||
.gitian-builder-cache/
|
||||
|
||||
distclean: clean tools-clean
|
||||
clean:
|
||||
rm -rf \
|
||||
$(BUILDDIR)/ \
|
||||
|
@ -171,15 +166,10 @@ clean:
|
|||
### Tools & Dependencies ###
|
||||
###############################################################################
|
||||
|
||||
go-mod-cache: go.sum
|
||||
@echo "--> Download go modules to local cache"
|
||||
@go mod download
|
||||
.PHONY: go-mod-cache
|
||||
|
||||
go.sum: go.mod
|
||||
@echo "--> Ensure dependencies have not been modified"
|
||||
@go mod verify
|
||||
@go mod tidy
|
||||
echo "Ensure dependencies have not been modified ..." >&2
|
||||
go mod verify
|
||||
go mod tidy
|
||||
|
||||
###############################################################################
|
||||
### Documentation ###
|
||||
|
@ -459,7 +449,7 @@ proto-update-deps:
|
|||
###############################################################################
|
||||
|
||||
# Run a 4-node testnet locally
|
||||
localnet-start: $(BUILDDIR)/simd localnet-stop
|
||||
localnet-start: build-linux localnet-stop
|
||||
$(if $(shell docker inspect -f '{{ .Id }}' cosmossdk/simd-env 2>/dev/null),$(info found image cosmossdk/simd-env),$(MAKE) -C contrib/images simd-env)
|
||||
if ! [ -f build/node0/simd/config/genesis.json ]; then docker run --rm \
|
||||
--user $(shell id -u):$(shell id -g) \
|
||||
|
|
2
build.sh
2
build.sh
|
@ -24,7 +24,7 @@ for os in ${TARGET_OS} ; do
|
|||
for arch in ${archs} ; do
|
||||
make clean
|
||||
GOOS="${os}" GOARCH="${arch}" GOROOT_FINAL="$(go env GOROOT)" \
|
||||
make ${APP} \
|
||||
make build \
|
||||
LDFLAGS=-buildid=${VERSION} \
|
||||
VERSION=${VERSION} \
|
||||
COMMIT=${COMMIT} \
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# change this to a specific release or branch
|
||||
BRANCH=master
|
||||
REPO=github.com/cosmos/cosmos-sdk
|
||||
|
||||
GO_VERSION=1.12.5
|
||||
|
||||
sudo apt-get update -y
|
||||
sudo apt-get upgrade -y
|
||||
sudo apt-get install -y make
|
||||
|
||||
# get and unpack golang
|
||||
curl -O https://dl.google.com/go/go$GO_VERSION.linux-armv6l.tar.gz
|
||||
tar -xvf go$GO_VERSION.linux-armv6l.tar.gz
|
||||
|
||||
# move go binary and add to path
|
||||
sudo mv go /usr/local
|
||||
echo "export PATH=\$PATH:/usr/local/go/bin" >> ~/.profile
|
||||
|
||||
# create the go directory, set GOPATH, and put it on PATH
|
||||
mkdir go
|
||||
echo "export GOPATH=$HOME/go" >> ~/.profile
|
||||
echo "export PATH=\$PATH:\$GOPATH/bin" >> ~/.profile
|
||||
echo "export GO111MODULE=on" >> ~/.profile
|
||||
source ~/.profile
|
||||
|
||||
# get the code and move into repo
|
||||
go get $REPO
|
||||
cd $GOPATH/src/$REPO
|
||||
|
||||
# build & install master
|
||||
git checkout $BRANCH
|
||||
LEDGER_ENABLED=false make tools
|
||||
LEDGER_ENABLED=false make install
|
||||
|
||||
source ~/.profile
|
|
@ -1,52 +0,0 @@
|
|||
#!/usr/bin/tcsh
|
||||
|
||||
# Just run tcsh install_sdk_bsd.sh
|
||||
# XXX: this script is intended to be run from
|
||||
# a fresh Digital Ocean droplet with FreeBSD
|
||||
|
||||
# upon its completion, you must either reset
|
||||
# your terminal or run `source ~/.tcshrc`
|
||||
|
||||
# This assumes your installing it through tcsh as root.
|
||||
# Change the relevant lines from tcsh to csh if your
|
||||
# installing as a different user, along with changing the
|
||||
# gopath.
|
||||
|
||||
# change this to a specific release or branch
|
||||
set BRANCH=master
|
||||
set REPO=github.com/cosmos/cosmos-sdk
|
||||
|
||||
set GO_VERSION=1.12.5
|
||||
|
||||
sudo pkg update
|
||||
|
||||
sudo pkg upgrade -y
|
||||
sudo pkg install -y gmake
|
||||
sudo pkg install -y git
|
||||
|
||||
# get and unpack golang
|
||||
curl -O https://storage.googleapis.com/golang/go$GO_VERSION.freebsd-amd64.tar.gz
|
||||
tar -xvf go$GO_VERSION.freebsd-amd64.tar.gz
|
||||
|
||||
# move go binary and add to path
|
||||
mv go /usr/local
|
||||
set path=($path /usr/local/go/bin)
|
||||
|
||||
|
||||
# create the go directory, set GOPATH, and put it on PATH
|
||||
mkdir go
|
||||
echo "setenv GOPATH /root/go" >> ~/.tcshrc
|
||||
setenv GOPATH /root/go
|
||||
echo "set path=($path $GOPATH/bin)" >> ~/.tcshrc
|
||||
|
||||
source ~/.tcshrc
|
||||
|
||||
# get the code and move into repo
|
||||
go get $REPO
|
||||
cd $GOPATH/src/$REPO
|
||||
|
||||
# build & install master
|
||||
git checkout $BRANCH
|
||||
gmake tools
|
||||
gmake install
|
||||
gmake install_examples
|
|
@ -1,40 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# XXX: this script is intended to be run from
|
||||
# a fresh Digital Ocean droplet with Ubuntu
|
||||
|
||||
# change this to a specific release or branch
|
||||
BRANCH=master
|
||||
REPO=github.com/cosmos/cosmos-sdk
|
||||
|
||||
GO_VERSION=1.12.5
|
||||
|
||||
sudo apt-get update -y
|
||||
sudo apt-get upgrade -y
|
||||
sudo apt-get install -y make
|
||||
|
||||
# get and unpack golang
|
||||
curl -O https://dl.google.com/go/go$GO_VERSION.linux-amd64.tar.gz
|
||||
tar -xvf go$GO_VERSION.linux-amd64.tar.gz
|
||||
|
||||
# move go binary and add to path
|
||||
mv go /usr/local
|
||||
echo "export PATH=\$PATH:/usr/local/go/bin" >> ~/.profile
|
||||
|
||||
# create the go directory, set GOPATH, and put it on PATH
|
||||
mkdir go
|
||||
echo "export GOPATH=$HOME/go" >> ~/.profile
|
||||
echo "export PATH=\$PATH:\$GOPATH/bin" >> ~/.profile
|
||||
echo "export GO111MODULE=on" >> ~/.profile
|
||||
source ~/.profile
|
||||
|
||||
# get the code and move into repo
|
||||
go get $REPO
|
||||
cd $GOPATH/src/$REPO
|
||||
|
||||
# build & install master
|
||||
git checkout $BRANCH
|
||||
LEDGER_ENABLED=false make tools
|
||||
LEDGER_ENABLED=false make install
|
||||
|
||||
source ~/.profile
|
|
@ -1,46 +0,0 @@
|
|||
name: gaia
|
||||
version: git
|
||||
summary: Gaia Daemon # 79 char long summary
|
||||
description: |
|
||||
This snap provides the Gaia daemon gaiad and the command line
|
||||
tool gaiacli.
|
||||
grade: stable
|
||||
confinement: strict
|
||||
|
||||
apps:
|
||||
gaiad:
|
||||
command: bin/gaiad
|
||||
plugs: [home,network,network-bind]
|
||||
gaiacli:
|
||||
command: bin/gaiacli
|
||||
plugs: [home,network,network-bind,raw-usb]
|
||||
|
||||
parts:
|
||||
gaia:
|
||||
plugin: dump
|
||||
source: ./
|
||||
override-pull: |
|
||||
rootdir=$(pwd)
|
||||
gitroot=$(git rev-parse --show-toplevel)
|
||||
cd ${gitroot} && git archive \
|
||||
-o ${rootdir}/gaia-git.tar.gz \
|
||||
--format tar.gz -9 --prefix gaia-git/ HEAD
|
||||
cd ${rootdir}
|
||||
tar xf gaia-git.tar.gz ; rm -f gaia-git.tar.gz
|
||||
mkdir -p go/src/github.com/cosmos bin
|
||||
mv gaia-git/ go/src/github.com/cosmos/cosmos-sdk/
|
||||
|
||||
build-snaps: [go]
|
||||
override-build: |
|
||||
base=`pwd`
|
||||
export GO111MODULE=on
|
||||
export GOPATH=`pwd`/go
|
||||
export GOBIN=$GOPATH/bin
|
||||
export PATH=$GOBIN:$PATH
|
||||
cd $GOPATH/src/github.com/cosmos/cosmos-sdk
|
||||
make go-mod-cache
|
||||
make tools
|
||||
make install
|
||||
mkdir $SNAPCRAFT_PART_INSTALL/bin
|
||||
cp $GOPATH/bin/gaiad $SNAPCRAFT_PART_INSTALL/bin
|
||||
cp $GOPATH/bin/gaiacli $SNAPCRAFT_PART_INSTALL/bin
|
|
@ -1,35 +0,0 @@
|
|||
name: gaia # you probably want to 'snapcraft register <name>'
|
||||
# base: core18 # the base snap is the execution environment for this snap
|
||||
version: '@VERSION@' # just for humans, typically '1.2+git' or '1.3.2'
|
||||
summary: Gaia Daemon # 79 char long summary
|
||||
description: |
|
||||
This snap provides the Gaia daemon gaiad and the command line
|
||||
tool gaiacli.
|
||||
grade: devel # must be 'stable' to release into candidate/stable channels
|
||||
confinement: strict # use 'strict' once you have the right plugs and slots
|
||||
|
||||
apps:
|
||||
gaiad:
|
||||
command: bin/gaiad
|
||||
plugs: [home,network,network-bind]
|
||||
gaiacli:
|
||||
command: bin/gaiacli
|
||||
plugs: [home,network,network-bind]
|
||||
|
||||
parts:
|
||||
gaia:
|
||||
plugin: dump
|
||||
source: ./
|
||||
override-pull: |
|
||||
echo "Installing files from $GOBIN ..."
|
||||
|
||||
# Use the following instructions to build a package from a release.
|
||||
# wget https://github.com/cosmos/cosmos-sdk/archive/v@VERSION@.tar.gz
|
||||
# tar xvf v@VERSION@.tar.gz
|
||||
# rm v@VERSION@.tar.gz
|
||||
|
||||
build-snaps: [go]
|
||||
override-build: |
|
||||
mkdir -p $SNAPCRAFT_PART_INSTALL/bin
|
||||
cp $GOBIN/gaiad $SNAPCRAFT_PART_INSTALL/bin
|
||||
cp $GOBIN/gaiacli $SNAPCRAFT_PART_INSTALL/bin
|
Loading…
Reference in New Issue