Debian Codegraph @

engine/hack/make/.mkwinres

raw symbols SCIP
1 #!/usr/bin/env sh
2
3 quadVersionNum() {
4 num=$(echo "${1:-0}" | cut -d. -f"$2")
5 if [ "$num" != "0" ]; then
6 echo "${num#0}"
7 else
8 echo "$num"
9 fi
10 }
11
12 # Create version quad for Windows of the form major.minor.patch.build
13 VERSION_QUAD=$(printf "%s" "$VERSION" | sed -re 's/^([0-9.]*).*$/\1/' | 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/')
14
15 # Generate winres.json to be able to create a syso file which contains
16 # Microsoft Windows Version Information and an icon using go-winres.
17 # https://docs.microsoft.com/en-us/windows/win32/menurc/stringfileinfo-block
18 # https://github.com/tc-hib/go-winres#json-format
19 cat > "./cli/winresources/${BINARY_NAME}/winres.json" << EOL
20 {
21 "RT_GROUP_ICON": {
22 "#1": {
23 "0409": "../../winresources/docker.ico"
24 }
25 },
26 "RT_MANIFEST": {
27 "#1": {
28 "0409": {
29 "identity": {},
30 "description": "Docker Engine",
31 "minimum-os": "vista",
32 "execution-level": "",
33 "ui-access": false,
34 "auto-elevate": false,
35 "dpi-awareness": "unaware",
36 "disable-theming": false,
37 "disable-window-filtering": false,
38 "high-resolution-scrolling-aware": false,
39 "ultra-high-resolution-scrolling-aware": false,
40 "long-path-aware": false,
41 "printer-driver-isolation": false,
42 "gdi-scaling": false,
43 "segment-heap": false,
44 "use-common-controls-v6": false
45 }
46 }
47 },
48 "RT_MESSAGETABLE": {
49 "#1": {
50 "0409": "../../winresources/event_messages.bin"
51 }
52 },
53 "RT_VERSION": {
54 "#1": {
55 "0409": {
56 "fixed": {
57 "file_version": "$(quadVersionNum "$VERSION_QUAD" 1).$(quadVersionNum "$VERSION_QUAD" 2).$(quadVersionNum "$VERSION_QUAD" 3).$(quadVersionNum "$VERSION_QUAD" 4)",
58 "product_version": "$(quadVersionNum "$VERSION_QUAD" 1).$(quadVersionNum "$VERSION_QUAD" 2).$(quadVersionNum "$VERSION_QUAD" 3).$(quadVersionNum "$VERSION_QUAD" 4)",
59 "type": "Unknown"
60 },
61 "info": {
62 "0000": {
63 "CompanyName": "${PACKAGER_NAME}",
64 "FileVersion": "${VERSION}",
65 "LegalCopyright": "Copyright © 2015-$(date +'%Y') Docker Inc.",
66 "OriginalFileName": "$(basename "${BINARY_FULLNAME}")",
67 "ProductName": "${PRODUCT}",
68 "ProductVersion": "${VERSION}",
69 "SpecialBuild": "${GITCOMMIT}"
70 }
71 }
72 }
73 }
74 }
75 }
76 EOL
77 (
78 set -x
79 cat "./cli/winresources/${BINARY_NAME}/winres.json"
80 )
81
82 # Create winresources package stub if removed while using tmpfs in Dockerfile
83 if [ ! -f "./cli/winresources/${BINARY_NAME}/winresources.go" ]; then
84 echo "package winresources" > "./cli/winresources/${BINARY_NAME}/winresources.go"
85 fi