Browse code

Windows: Build docker.exe manifested and with icon

Signed-off-by: John Howard <John.Howard@microsoft.com>

John Howard authored on 2015/05/07 00:41:17
Showing 6 changed files
... ...
@@ -176,6 +176,14 @@ COPY vendor /go/src/github.com/docker/docker/vendor
176 176
 RUN go install -v github.com/cpuguy83/go-md2man \
177 177
 	github.com/BurntSushi/toml/cmd/tomlv
178 178
 
179
+# Build/install the tool for embedding resources in Windows binaries
180
+ENV RSRC_COMMIT e48dbf1b7fc464a9e85fcec450dddf80816b76e0
181
+RUN set -x \
182
+    && git clone https://github.com/akavel/rsrc.git /go/src/github.com/akavel/rsrc \
183
+    && cd /go/src/github.com/akavel/rsrc \
184
+    && git checkout -q $RSRC_COMMIT \
185
+    && go install -v
186
+
179 187
 # Wrap all commands in the "docker-in-docker" script to allow nested containers
180 188
 ENTRYPOINT ["hack/dind"]
181 189
 
182 190
new file mode 100644
... ...
@@ -0,0 +1,5 @@
0
+package main
1
+
2
+import (
3
+	_ "github.com/docker/docker/autogen/winresources"
4
+)
... ...
@@ -3,7 +3,7 @@
3 3
 rm -rf autogen
4 4
 
5 5
 mkdir -p autogen/dockerversion
6
-cat > autogen/dockerversion/dockerversion.go <<EOF
6
+cat > autogen/dockerversion/dockerversion.go <<DVEOF
7 7
 // AUTOGENERATED FILE; see $BASH_SOURCE
8 8
 package dockerversion
9 9
 
... ...
@@ -15,4 +15,39 @@ var (
15 15
 	INITSHA1  string = "$DOCKER_INITSHA1"
16 16
 	INITPATH  string = "$DOCKER_INITPATH"
17 17
 )
18
-EOF
18
+DVEOF
19
+
20
+# Compile the Windows resources into the sources
21
+mkdir -p autogen/winresources
22
+cat > autogen/winresources/resources.go <<WREOF
23
+// AUTOGENERATED FILE; see $BASH_SOURCE
24
+package winresources
25
+
26
+/*
27
+
28
+This package is for embedding a manifest file and an icon into docker.exe.
29
+The benefit of this is that a manifest file does not need to be alongside
30
+the .exe, and there is an icon when docker runs, or viewed through Windows
31
+explorer.
32
+
33
+When make binary is run, the Dockerfile prepares the build environment by:
34
+
35
+ - Cloning github.com/akavel/rsrc
36
+
37
+ - Go-installing the rsrc executable
38
+
39
+make.sh invokes hack/make/.go-autogen to:
40
+
41
+ - Run rsrc to create a binary file (autogen/winresources/rsrc.syso) that 
42
+   contains the manifest and icon. This file is automatically picked up by 
43
+   'go build', so no post-processing steps are required. The sources for 
44
+   rsrc.syso are under hack/make/.resources-windows.
45
+
46
+*/
47
+WREOF
48
+if [ "$(go env GOOS)" = 'windows' ]; then
49
+	rsrc \
50
+		-manifest hack/make/.resources-windows/docker.exe.manifest \
51
+		-ico      hack/make/.resources-windows/docker.ico \
52
+		-o        autogen/winresources/rsrc.syso > /dev/null
53
+fi
19 54
new file mode 100644
... ...
@@ -0,0 +1,18 @@
0
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
1
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
2
+    <description>Docker</description>
3
+    <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> 
4
+        <application> 
5
+            <!-- Windows 10 -->
6
+            <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
7
+            <!-- Windows 8.1 -->
8
+            <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
9
+            <!-- Windows Vista -->
10
+            <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/> 
11
+            <!-- Windows 7 -->
12
+            <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
13
+            <!-- Windows 8 -->
14
+            <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
15
+        </application> 
16
+    </compatibility>
17
+</assembly>
0 18
\ No newline at end of file
1 19
new file mode 100644
2 20
Binary files /dev/null and b/hack/make/.resources-windows/docker.ico differ
3 21
new file mode 100644
4 22
Binary files /dev/null and b/hack/make/.resources-windows/docker.png differ