Browse code

Revert "Use code generation to set IAMSTATIC instead of -X"

This reverts commit 3e10b93106dea94e5747ab32fe4ac765aa22f9bc.

Conflicts:
.gitignore
hack/make.sh
hack/make/dynbinary

Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)

Jessica Frazelle authored on 2014/10/29 08:25:50
Showing 4 changed files
... ...
@@ -27,6 +27,3 @@ docs/AWS_S3_BUCKET
27 27
 docs/GIT_BRANCH
28 28
 docs/VERSION
29 29
 docs/GITCOMMIT
30
-dockerversion/static.go
31
-dockerversion/details.go
32
-dockerversion/init.go
... ...
@@ -94,17 +94,6 @@ if [ -z "$DOCKER_CLIENTONLY" ]; then
94 94
 	DOCKER_BUILDTAGS+=" daemon"
95 95
 fi
96 96
 
97
-rm -f dockerversion/static.go dockerversion/details.go dockerversion/init.go
98
-cat > dockerversion/details.go <<EOF
99
-// AUTOGENERATED FILE; see hack/make.sh
100
-package dockerversion
101
-
102
-func init() {
103
-	GITCOMMIT = "$GITCOMMIT"
104
-	VERSION = "$VERSION"
105
-}
106
-EOF
107
-
108 97
 # Use these flags when compiling the tests and final binary
109 98
 LDFLAGS='-w'
110 99
 LDFLAGS_STATIC='-linkmode external'
... ...
@@ -122,6 +111,7 @@ TESTFLAGS+=" -test.timeout=${TIMEOUT}"
122 122
 EXTLDFLAGS_STATIC_DOCKER="$EXTLDFLAGS_STATIC -lpthread -Wl,--unresolved-symbols=ignore-in-object-files"
123 123
 LDFLAGS_STATIC_DOCKER="
124 124
 	$LDFLAGS_STATIC
125
+	-X $DOCKER_PKG/dockerversion.IAMSTATIC true
125 126
 	-extldflags \"$EXTLDFLAGS_STATIC_DOCKER\"
126 127
 "
127 128
 
... ...
@@ -3,17 +3,6 @@ set -e
3 3
 
4 4
 DEST=$1
5 5
 
6
-: ${IAMSTATIC:=true}
7
-
8
-cat > dockerversion/static.go <<EOF
9
-// AUTOGENERATED FILE; see hack/make/binary and hack/make/dynbinary
10
-package dockerversion
11
-
12
-func init() {
13
-	IAMSTATIC = $IAMSTATIC
14
-}
15
-EOF
16
-
17 6
 go build \
18 7
 	-o "$DEST/docker-$VERSION" \
19 8
 	"${BUILDFLAGS[@]}" \
... ...
@@ -5,14 +5,6 @@ DEST=$1
5 5
 
6 6
 if [ -z "$DOCKER_CLIENTONLY" ]; then
7 7
 	# dockerinit still needs to be a static binary, even if docker is dynamic
8
-	cat > dockerversion/static.go <<EOF
9
-// AUTOGENERATED FILE; see hack/make/binary and hack/make/dynbinary
10
-package dockerversion
11
-
12
-func init() {
13
-	IAMSTATIC = true
14
-}
15
-EOF
16 8
 	go build \
17 9
 		-o "$DEST/dockerinit-$VERSION" \
18 10
 		"${BUILDFLAGS[@]}" \
... ...
@@ -47,17 +39,7 @@ fi
47 47
 # exported so that "dyntest" can easily access it later without recalculating it
48 48
 
49 49
 (
50
-	export LDFLAGS_STATIC_DOCKER=""
51
-	cat > dockerversion/init.go <<EOF
52
-// AUTOGENERATED FILE; see hack/make/dynbinary, hack/make/dyntest-integration and dyntest-unit
53
-package dockerversion
54
-
55
-func init() {
56
-	INITSHA1 = "$DOCKER_INITSHA1"
57
-	INITPATH = "$DOCKER_INITPATH"
58
-}
59
-EOF
60
-	export IAMSTATIC=false
50
+	export LDFLAGS_STATIC_DOCKER="-X $DOCKER_PKG/dockerversion.INITSHA1 \"$DOCKER_INITSHA1\" -X $DOCKER_PKG/dockerversion.INITPATH \"$DOCKER_INITPATH\""
61 51
 	export BUILDFLAGS=( "${BUILDFLAGS[@]/netgo /}" ) # disable netgo, since we don't need it for a dynamic binary
62 52
 	source "$(dirname "$BASH_SOURCE")/binary"
63 53
 )