From 3dfe334a7a203efb0c7866d6590e98b9402aa08e Mon Sep 17 00:00:00 2001 From: Andrew Hsu Date: Mon, 22 May 2017 13:22:42 -0700 Subject: [PATCH] allow version number to be set in builds Signed-off-by: Andrew Hsu --- docker.Makefile | 5 +++-- scripts/build/osx | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docker.Makefile b/docker.Makefile index b82d0e6e62..9877124991 100644 --- a/docker.Makefile +++ b/docker.Makefile @@ -8,6 +8,7 @@ DEV_DOCKER_IMAGE_NAME = docker-cli-dev LINTER_IMAGE_NAME = docker-cli-lint CROSS_IMAGE_NAME = docker-cli-cross MOUNTS = -v `pwd`:/go/src/github.com/docker/cli +VERSION = $(shell cat VERSION) # build docker image (dockerfiles/Dockerfile.build) .PHONY: build_docker_image @@ -26,7 +27,7 @@ build_cross_image: # build executable using a container binary: build_docker_image - docker run --rm $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make binary + docker run --rm -e VERSION=$(VERSION) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make binary build: binary @@ -43,7 +44,7 @@ test: build_docker_image # build the CLI for multiple architectures using a container .PHONY: cross cross: build_cross_image - docker run --rm $(MOUNTS) $(CROSS_IMAGE_NAME) make cross + docker run --rm -e VERSION=$(VERSION) $(MOUNTS) $(CROSS_IMAGE_NAME) make cross .PHONY: watch watch: build_docker_image diff --git a/scripts/build/osx b/scripts/build/osx index b993a8e0c8..a5e7d9432c 100755 --- a/scripts/build/osx +++ b/scripts/build/osx @@ -11,7 +11,7 @@ export CGO_ENABLED=1 export GOOS=darwin export GOARCH=amd64 export CC=o64-clang -export LDFLAGS='-linkmode external -s' +export LDFLAGS="$LDFLAGS -linkmode external -s" export LDFLAGS_STATIC_DOCKER='-extld='${CC} # Override TARGET