Skip to content

Commit

Permalink
Merge pull request #1191 from dedis/binDist
Browse files Browse the repository at this point in the history
A makefile rule for making binary distributions
  • Loading branch information
jeffallen authored Apr 19, 2018
2 parents f909dd9 + 5e6789c commit 3685669
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
23 changes: 23 additions & 0 deletions conode/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,26 @@ docker_stop:
docker_clean:
docker kill $(CONTAINER) || echo nothing to stop
docker image ls $(IMAGE_NAME) -q | xargs docker rmi -f || echo done

TAG=$(shell git describe --tags)
OUTPUT_DIR=conode-$(TAG)
# -s -w are for smaller binaries
# -X compiles the git tag into the binary
flags=-ldflags="-s -w -X main.gitTag=$(TAG) -X github.com/dedis/onet.gitTag=$(TAG)"

# The suffix on conode exe is the result from: echo `uname -s`.`uname -m`
# so that we can find the right one in the wrapper script.
bindist:
rm -rf $(OUTPUT_DIR)
mkdir $(OUTPUT_DIR)
GOOS=linux GOARCH=amd64 vgo build $(flags) -o $(OUTPUT_DIR)/conode.Linux.x86_64
GOOS=linux GOARCH=arm vgo build $(flags) -o $(OUTPUT_DIR)/conode.Linux.armv7l
GOOS=freebsd GOARCH=amd64 vgo build $(flags) -o $(OUTPUT_DIR)/conode.FreeBSD.amd64
echo "#!/bin/sh" > $(OUTPUT_DIR)/conode
echo "./conode.\`uname -s\`.\`uname -m\` \$$*" >> $(OUTPUT_DIR)/conode
chmod +x $(OUTPUT_DIR)/conode
LANG=C tar zcf $(OUTPUT_DIR).tar.gz $(OUTPUT_DIR)
rm -rf $(OUTPUT_DIR)

gitTag:
go build $(flags)
8 changes: 7 additions & 1 deletion conode/conode.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,18 @@ const (
Version = "2.0"
)

var gitTag = ""

func main() {

cliApp := cli.NewApp()
cliApp.Name = DefaultName
cliApp.Usage = "run a cothority server"
cliApp.Version = Version
if gitTag == "" {
cliApp.Version = Version
} else {
cliApp.Version = Version + "-" + gitTag
}

cliApp.Commands = []cli.Command{
{
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module "github.com/dedis/cothority"

require (
"github.com/bford/golang-x-crypto" v0.0.0-20160518072526-27db609c9d03
"github.com/dedis/onet" v0.0.0-20180417114521-19e8f239c08f
"github.com/dedis/onet" v0.0.0-20180419092102-f76674afd9f1
"github.com/qantik/qrgo" v0.0.0-20160917134849-0c6b902c59f6
"github.com/satori/go.uuid" v1.2.0
"github.com/stretchr/objx" v0.0.0-20180129172003-8a3f7159479f
Expand Down
1 change: 1 addition & 0 deletions go.modverify
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ github.com/dedis/kyber v0.0.0-20180404073306-83f872f4f2ee h1:4EDGoXvuPea5h8f5NIv
github.com/dedis/onet v0.0.0-20180404142611-b45aa4dcfaec h1:khV/qSxXZwjzm0JO6ZD0mTf94mPS84JQ7iNlVaBrEmg=
github.com/dedis/onet v0.0.0-20180410144522-645e84787422 h1:3gcWLjVyjE7myP02befKxQhlqKe/5fGTGXtNs8bRH5U=
github.com/dedis/onet v0.0.0-20180417114521-19e8f239c08f h1:lX5r7Ak4HIKG4nZd3OjLsFMfyAncOYbAxZ38a8UI6hs=
github.com/dedis/onet v0.0.0-20180419092102-f76674afd9f1 h1:2ya2J6HSMpbg7Z2ML92WmDMN14f6rjsMUvhjyQ3HNCM=
github.com/dedis/protobuf v1.0.3 h1:BVMOAxlT+nR/8JfmG+e8WfYGOXJnct4213mC8g2MQIM=
github.com/golangplus/bytes v0.0.0-20160111154220-45c989fe5450 h1:7xqw01UYS+KCI25bMrPxwNYkSns2Db1ziQPpVq99FpE=
github.com/golangplus/fmt v0.0.0-20150411045040-2a5d6d7d2995 h1:f5gsjBiF9tRRVomCvrkGMMWI8W1f2OBFar2c5oakAP0=
Expand Down

0 comments on commit 3685669

Please sign in to comment.