From 6d091596bc866974a6af5f4683f9699609bf15dd Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Mon, 1 Feb 2016 16:48:33 -0800 Subject: [PATCH 1/2] adding additional 'make static' command to create static builds of server and signer Signed-off-by: David Lawrence (github: endophage) --- Makefile | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Makefile b/Makefile index 949d79864a..26721e6ceb 100644 --- a/Makefile +++ b/Makefile @@ -71,6 +71,14 @@ ${PREFIX}/bin/notary-signer: NOTARY_VERSION $(shell find . -type f -name '*.go') @echo "+ $@" @godep go build -tags ${NOTARY_BUILDTAGS} -o $@ ${GO_LDFLAGS} ./cmd/notary-signer +${PREFIX}/bin/static/notary-server: NOTARY_VERSION $(shell find . -type f -name '*.go') + @echo "+ $@" + @godep go build -tags ${NOTARY_BUILDTAGS} -o $@ ${GO_LDFLAGS_STATIC} ./cmd/notary-server + +${PREFIX}/bin/static/notary-signer: NOTARY_VERSION $(shell find . -type f -name '*.go') + @echo "+ $@" + @godep go build -tags ${NOTARY_BUILDTAGS} -o $@ ${GO_LDFLAGS_STATIC} ./cmd/notary-signer + vet: go_version @echo "+ $@" ifeq ($(shell uname -s), Darwin) @@ -153,6 +161,9 @@ clean-protos: binaries: go_version ${PREFIX}/bin/notary-server ${PREFIX}/bin/notary ${PREFIX}/bin/notary-signer @echo "+ $@" +static: go_version ${PREFIX}/bin/static/notary-server ${PREFIX}/bin/static/notary-signer + @echo "+ $@" + define template mkdir -p ${PREFIX}/cross/$(1)/$(2); GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 go build -o ${PREFIX}/cross/$(1)/$(2)/notary -a -tags "static_build netgo" -installsuffix netgo ${GO_LDFLAGS_STATIC} ./cmd/notary; From 18ab95c65f577173dbdeaf9bac0824d8d2e99c8b Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Wed, 3 Feb 2016 17:55:04 -0800 Subject: [PATCH 2/2] add check for darwin (doesn't support static builds) Signed-off-by: David Lawrence (github: endophage) --- Makefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 26721e6ceb..14f8dc61c0 100644 --- a/Makefile +++ b/Makefile @@ -71,13 +71,21 @@ ${PREFIX}/bin/notary-signer: NOTARY_VERSION $(shell find . -type f -name '*.go') @echo "+ $@" @godep go build -tags ${NOTARY_BUILDTAGS} -o $@ ${GO_LDFLAGS} ./cmd/notary-signer +ifeq ($(shell uname -s),Darwin) +${PREFIX}/bin/static/notary-server: + @echo "notary-server: static builds not supported on OS X" + +${PREFIX}/bin/static/notary-signer: + @echo "notary-signer: static builds not supported on OS X" +else ${PREFIX}/bin/static/notary-server: NOTARY_VERSION $(shell find . -type f -name '*.go') @echo "+ $@" @godep go build -tags ${NOTARY_BUILDTAGS} -o $@ ${GO_LDFLAGS_STATIC} ./cmd/notary-server - + ${PREFIX}/bin/static/notary-signer: NOTARY_VERSION $(shell find . -type f -name '*.go') @echo "+ $@" @godep go build -tags ${NOTARY_BUILDTAGS} -o $@ ${GO_LDFLAGS_STATIC} ./cmd/notary-signer +endif vet: go_version @echo "+ $@"