scripts: Allow skipping windres when WINDRES= (empty string)

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
Brian Goff 2021-04-13 18:23:52 +00:00 committed by Tibor Vass
parent 2c40960ba1
commit 83e9eeb8a0
1 changed files with 15 additions and 11 deletions

View File

@ -55,6 +55,10 @@ if [ -n "$GO_STRIP" ]; then
fi
if [ "$(go env GOOS)" = "windows" ]; then
: "${WINDRES=$($(go env CC) --print-prog-name=windres)}"
if [ -z "$WINDRES" ]; then
>&2 echo "Empty WINDRES detected, skipping manifesting binary"
else
# Generate a Windows file version of the form major,minor,patch,build
VERSION_QUAD=$(printf "%s" "$VERSION" | sed -re 's/^([0-9.]*).*$/\1/' | tr . , | sed -re 's/,$//' | sed -re 's/^[0-9]+$/\0,0/' | sed -re 's/^[0-9]+,[0-9]+$/\0,0/' | sed -re 's/^[0-9]+,[0-9]+,[0-9]+$/\0,0/')
@ -65,10 +69,10 @@ if [ "$(go env GOOS)" = "windows" ]; then
target="$(dirname "$0")/../../cli/winresources/rsrc_$(go env GOARCH).syso"
mkdir -p "$(dirname "${target}")"
: ${WINDRES:="$($(go env CC) --print-prog-name=windres)"}
"$WINDRES" -i "$(dirname "$0")/../winresources/docker.rc" -o "$target" --use-temp-file "$@"
echo "package winresources" > "$(dirname "${target}")/stub_windows.go"
fi
fi
echo "Building $GO_LINKMODE $(basename "${TARGET}")"