2017-02-13 14:01:54 -05:00
|
|
|
#!/usr/bin/env bash
|
2015-02-04 16:22:38 -05:00
|
|
|
|
2020-01-30 18:31:44 -05:00
|
|
|
rm -rf autogen/*
|
2015-03-03 14:41:26 -05:00
|
|
|
|
2018-02-16 13:51:30 -05:00
|
|
|
source hack/dockerfile/install/runc.installer
|
|
|
|
source hack/dockerfile/install/tini.installer
|
|
|
|
source hack/dockerfile/install/containerd.installer
|
2016-10-24 18:18:58 -04:00
|
|
|
|
2020-01-17 06:39:56 -05:00
|
|
|
LDFLAGS="${LDFLAGS} \
|
2020-01-17 18:40:06 -05:00
|
|
|
-X \"github.com/docker/docker/dockerversion.Version=${VERSION}\" \
|
|
|
|
-X \"github.com/docker/docker/dockerversion.GitCommit=${GITCOMMIT}\" \
|
|
|
|
-X \"github.com/docker/docker/dockerversion.BuildTime=${BUILDTIME}\" \
|
|
|
|
-X \"github.com/docker/docker/dockerversion.IAmStatic=${IAMSTATIC:-true}\" \
|
|
|
|
-X \"github.com/docker/docker/dockerversion.PlatformName=${PLATFORM}\" \
|
|
|
|
-X \"github.com/docker/docker/dockerversion.ProductName=${PRODUCT}\" \
|
|
|
|
-X \"github.com/docker/docker/dockerversion.DefaultProductLicense=${DEFAULT_PRODUCT_LICENSE}\" \
|
|
|
|
-X \"github.com/docker/docker/dockerversion.InitCommitID=${TINI_COMMIT}\" \
|
2019-10-16 20:04:58 -04:00
|
|
|
"
|
2015-05-06 11:41:17 -04:00
|
|
|
|
|
|
|
# Compile the Windows resources into the sources
|
2019-01-09 20:23:38 -05:00
|
|
|
if [ "$(go env GOOS)" = "windows" ]; then
|
2019-09-11 03:31:28 -04:00
|
|
|
mkdir -p autogen/winresources/tmp autogen/winresources/dockerd
|
2016-04-23 18:11:08 -04:00
|
|
|
cp hack/make/.resources-windows/resources.go autogen/winresources/dockerd/
|
|
|
|
|
|
|
|
if [ "$(go env GOHOSTOS)" == "windows" ]; then
|
|
|
|
WINDRES=windres
|
2016-04-22 20:16:14 -04:00
|
|
|
WINDMC=windmc
|
2016-04-23 18:11:08 -04:00
|
|
|
else
|
|
|
|
# Cross compiling
|
|
|
|
WINDRES=x86_64-w64-mingw32-windres
|
2016-04-22 20:16:14 -04:00
|
|
|
WINDMC=x86_64-w64-mingw32-windmc
|
2016-04-23 18:11:08 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Generate a Windows file version of the form major,minor,patch,build (with any part optional)
|
2019-11-04 20:16:06 -05:00
|
|
|
if [ ! -v VERSION_QUAD ]; then
|
|
|
|
VERSION_QUAD=$(echo -n $VERSION | sed -re 's/^([0-9.]*).*$/\1/' | tr . ,)
|
|
|
|
fi
|
2016-04-23 18:11:08 -04:00
|
|
|
|
|
|
|
# Pass version and commit information into the resource compiler
|
|
|
|
defs=
|
2019-01-09 20:23:38 -05:00
|
|
|
[ ! -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\""
|
2016-04-23 18:11:08 -04:00
|
|
|
|
|
|
|
function makeres {
|
2019-01-09 20:50:47 -05:00
|
|
|
${WINDRES} \
|
2016-04-23 18:11:08 -04:00
|
|
|
-i hack/make/.resources-windows/$1 \
|
|
|
|
-o $3 \
|
|
|
|
-F $2 \
|
|
|
|
--use-temp-file \
|
|
|
|
-I autogen/winresources/tmp \
|
|
|
|
$defs
|
|
|
|
}
|
|
|
|
|
2019-01-09 20:50:47 -05:00
|
|
|
${WINDMC} \
|
2016-04-22 20:16:14 -04:00
|
|
|
hack/make/.resources-windows/event_messages.mc \
|
|
|
|
-h autogen/winresources/tmp \
|
|
|
|
-r autogen/winresources/tmp
|
|
|
|
|
2016-04-23 18:11:08 -04:00
|
|
|
makeres dockerd.rc pe-x86-64 autogen/winresources/dockerd/rsrc_amd64.syso
|
|
|
|
|
|
|
|
rm -r autogen/winresources/tmp
|
2015-05-06 11:41:17 -04:00
|
|
|
fi
|