Skip to content

Fixes to windows scripts#3048

Merged
tiborvass merged 3 commits intodocker:masterfrom
tiborvass:win_script_fixes
Apr 13, 2021
Merged

Fixes to windows scripts#3048
tiborvass merged 3 commits intodocker:masterfrom
tiborvass:win_script_fixes

Conversation

@tiborvass
Copy link
Copy Markdown
Collaborator

@tiborvass tiborvass commented Apr 13, 2021

  • scripts: fix VERSION_QUAD corner case in windows resource

When the git checkout is dirty on top of a git tag (i.e., v20.10.6.m),
the VERSION_QUAD was keeping a trailing comma.
Now the trailing comma is stripped.

  • scripts: use WINDRES env var if set

This allows setting WINDRES to mingw's windres.

For the record, mingw's windres needs --use-temp-file for a weird reason:
in that case, it keeps preprocessor arguments intact (including quotes),
without it, mingw's windres calls popen, which happens to pass the entire
command to sh -c, stripping quotes after evaluation and causing a syntax
error in mingw's windres.

To use mingw's windres, set WINDRES to:

  • x86_64-w64-mingw32-windres on 64 bit
  • i686-w64-mingw32-windres on 32 bit
  • scripts: Allow skipping windres when WINDRES= (empty string)

@tiborvass tiborvass requested a review from tonistiigi April 13, 2021 16:18
@tiborvass tiborvass force-pushed the win_script_fixes branch 2 times, most recently from dcd1e42 to 8e4d12e Compare April 13, 2021 16:40
Comment thread scripts/build/binary Outdated
Comment thread scripts/build/binary Outdated
When the git checkout is dirty on top of a git tag (i.e., v20.10.6.m),
the VERSION_QUAD was keeping a trailing comma.
Now the trailing comma is stripped.

Signed-off-by: Tibor Vass <[email protected]>
Comment thread scripts/build/binary Outdated
This allows setting WINDRES to mingw's windres.

For the record, mingw's windres needs --use-temp-file for a weird reason:
in that case, it keeps preprocessor arguments intact (including quotes),
without it, mingw's windres calls popen, which happens to pass the entire
command to sh -c, stripping quotes after evaluation and causing a syntax
error in mingw's windres.

To use mingw's windres, set WINDRES to:
- `x86_64-w64-mingw32-windres` on 64 bit
- `i686-w64-mingw32-windres` on 32 bit

Signed-off-by: Tibor Vass <[email protected]>
@codecov-io
Copy link
Copy Markdown

codecov-io commented Apr 13, 2021

Codecov Report

Merging #3048 (63e0c2c) into master (a32cd16) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #3048   +/-   ##
=======================================
  Coverage   57.06%   57.06%           
=======================================
  Files         299      299           
  Lines       18689    18689           
=======================================
  Hits        10665    10665           
  Misses       7157     7157           
  Partials      867      867           

@cpuguy83
Copy link
Copy Markdown
Collaborator

I pushed an extra commit which makes it so we do not error out if windres isn't available (e.g. cross compiling for armhf which doesn't have a mingw CC target).

@tiborvass
Copy link
Copy Markdown
Collaborator Author

Reworked @cpuguy83's commit to still fail if windres command is not found, but instead provide a way to opt out of windres-ing by setting WINDRES to an empty string. PTAL

Copy link
Copy Markdown
Collaborator

@cpuguy83 cpuguy83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tiborvass tiborvass merged commit 04dad42 into docker:master Apr 13, 2021
@thaJeztah thaJeztah added this to the 21.xx milestone Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants