|
@@ -20,44 +20,40 @@ const (
|
|
|
DVEOF
|
|
|
|
|
|
# Compile the Windows resources into the sources
|
|
|
-mkdir -p autogen/winresources
|
|
|
-cat > autogen/winresources/resources.go <<WREOF
|
|
|
-// Package winresources is auto-generated at build-time
|
|
|
-// AUTOGENERATED FILE; see $BASH_SOURCE
|
|
|
-package winresources
|
|
|
-
|
|
|
-/*
|
|
|
-
|
|
|
-This package is for embedding a manifest file and an icon into docker.exe.
|
|
|
-The benefit of this is that a manifest file does not need to be alongside
|
|
|
-the .exe, and there is an icon when docker runs, or viewed through Windows
|
|
|
-explorer.
|
|
|
-
|
|
|
-When make binary is run, the Dockerfile prepares the build environment by:
|
|
|
-
|
|
|
- - Cloning github.com/akavel/rsrc
|
|
|
-
|
|
|
- - Go-installing the rsrc executable
|
|
|
-
|
|
|
-make.sh invokes hack/make/.go-autogen to:
|
|
|
-
|
|
|
- - Run rsrc to create a binary file (autogen/winresources/rsrc.syso) that
|
|
|
- contains the manifest and icon. This file is automatically picked up by
|
|
|
- 'go build', so no post-processing steps are required. The sources for
|
|
|
- rsrc.syso are under hack/make/.resources-windows.
|
|
|
-
|
|
|
-*/
|
|
|
-WREOF
|
|
|
-if [ "$(go env GOOS)" = 'windows' ]; then
|
|
|
- rsrc \
|
|
|
- -manifest hack/make/.resources-windows/docker.exe.manifest \
|
|
|
- -ico hack/make/.resources-windows/docker.ico \
|
|
|
- -arch "amd64" \
|
|
|
- -o autogen/winresources/rsrc_amd64.syso > /dev/null
|
|
|
-
|
|
|
- rsrc \
|
|
|
- -manifest hack/make/.resources-windows/docker.exe.manifest \
|
|
|
- -ico hack/make/.resources-windows/docker.ico \
|
|
|
- -arch "386" \
|
|
|
- -o autogen/winresources/rsrc_386.syso > /dev/null
|
|
|
+if [ "$(go env GOOS)" = "windows" ]; then
|
|
|
+ mkdir -p autogen/winresources/tmp autogen/winresources/docker autogen/winresources/dockerd
|
|
|
+ cp hack/make/.resources-windows/resources.go autogen/winresources/docker/
|
|
|
+ cp hack/make/.resources-windows/resources.go autogen/winresources/dockerd/
|
|
|
+
|
|
|
+ if [ "$(go env GOHOSTOS)" == "windows" ]; then
|
|
|
+ WINDRES=windres
|
|
|
+ else
|
|
|
+ # Cross compiling
|
|
|
+ WINDRES=x86_64-w64-mingw32-windres
|
|
|
+ fi
|
|
|
+
|
|
|
+ # Generate a Windows file version of the form major,minor,patch,build (with any part optional)
|
|
|
+ VERSION_QUAD=$(echo -n $VERSION | sed -re 's/^([0-9.]*).*$/\1/' | tr . ,)
|
|
|
+
|
|
|
+ # Pass version and commit information into the resource compiler
|
|
|
+ defs=
|
|
|
+ [ ! -z $VERSION ] && defs="$defs -D DOCKER_VERSION=\"$VERSION\""
|
|
|
+ [ ! -z $VERSION_QUAD ] && defs="$defs -D DOCKER_VERSION_QUAD=$VERSION_QUAD"
|
|
|
+ [ ! -z $GITCOMMIT ] && defs="$defs -D DOCKER_COMMIT=\"$GITCOMMIT\""
|
|
|
+
|
|
|
+ function makeres {
|
|
|
+ $WINDRES \
|
|
|
+ -i hack/make/.resources-windows/$1 \
|
|
|
+ -o $3 \
|
|
|
+ -F $2 \
|
|
|
+ --use-temp-file \
|
|
|
+ -I autogen/winresources/tmp \
|
|
|
+ $defs
|
|
|
+ }
|
|
|
+
|
|
|
+ makeres docker.rc pe-x86-64 autogen/winresources/docker/rsrc_amd64.syso
|
|
|
+ makeres docker.rc pe-i386 autogen/winresources/docker/rsrc_386.syso
|
|
|
+ makeres dockerd.rc pe-x86-64 autogen/winresources/dockerd/rsrc_amd64.syso
|
|
|
+
|
|
|
+ rm -r autogen/winresources/tmp
|
|
|
fi
|