Skip to content

Commit

Permalink
fix(Makefile): better convention for installing ag-chain-cosmos
Browse files Browse the repository at this point in the history
We run the symlink command in the `install` rule after the
`go install` for `ag-cosmos-helper` succeeded.

Notably, we use the binary directory corresponding to the
description of `go help install`:

1. use `$GOBIN` if GOBIN is defined
2. use `$GOPATH/bin` if GOPATH is defined
3. use `$HOME/go/bin` otherwise
  • Loading branch information
michaelfig committed Feb 3, 2020
1 parent ab72ca5 commit b27426a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/cosmic-swingset/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ COPY cmd/ cmd/
COPY lib/*.go lib/
COPY lib/daemon/ lib/daemon/
COPY lib/helper/ lib/helper/
RUN make compile-go install
RUN make
2 changes: 1 addition & 1 deletion packages/cosmic-swingset/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ docker-install: docker-pull
compile-go: go.sum
go build -v $(MOD_READONLY) $(BUILD_FLAGS) -buildmode=c-shared -o lib/libagcosmosdaemon.so lib/agcosmosdaemon.go
test "`uname -s 2>/dev/null`" != Darwin || install_name_tool -id `pwd`/lib/libagcosmosdaemon.so lib/libagcosmosdaemon.so
-eval `go env` && ln -sf $$PWD/lib/ag-chain-cosmos $$GOPATH/bin/ag-chain-cosmos

build-cosmos: compile-go node-compile-gyp

Expand All @@ -149,6 +148,7 @@ compile-gyp:

install: go.sum
go install -v $(MOD_READONLY) $(BUILD_FLAGS) ./cmd/ag-cosmos-helper
bindir="$${GOBIN-$${GOPATH-$$HOME/go}/bin}"; ln -sf "$$PWD/lib/ag-chain-cosmos" "$$bindir/ag-chain-cosmos"

go.sum: go.mod
@echo "--> Ensure dependencies have not been modified"
Expand Down

0 comments on commit b27426a

Please sign in to comment.