Repository navigation
create-sdk-artifact: ship unpacked DLLs and hard-link identical files - #777
Merged
Merged
Conversation
The `git-sdk-64` and `git-sdk-arm64` repositories store large DLLs such as `libLLVM-NN.dll` UPX-packed so that they stay below GitHub's 100MB file size limit. A clean/smudge filter, `.large-dll-filter.sh`, unpacks them on checkout. It wraps `upx.exe` because `upx` can neither read from stdin nor write to stdout. The sparse worktrees that `create-sdk-artifact` uses for the minimal-sdk, build-installers and makepkg-git artifacts do not have that filter, so these artifacts end up with the packed DLLs. That has two costs. Packed DLLs have to be decompressed every time they are loaded. They also compress worse in the zstd-compressed CI artifacts: with `zstd -10`, the packed libLLVM-23.dll (59,118,592 bytes) shrinks to 41,589,197 bytes, while the unpacked one (149,887,488 bytes) shrinks to 38,354,366 bytes. Therefore, when the SDK revision provides the filter, configure it in the new worktree before the first checkout. The script and `upx.exe` go into the worktree's private gitdir, so they do not end up in the artifact and disappear along with the worktree. The script's own `setup` mode is not used. It writes to the local config, which all worktrees of the SDK repository share, and its filter commands point to the script by a worktree-relative path. Worktree-specific config avoids both problems. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
The Git for Windows SDK repositories contain many byte-identical files (`clang.exe` and its aliases, for example). Git stores each such blob only once, but a checkout writes a separate copy for every path, which inflates the artifacts produced by `please.sh create-sdk-artifact`. Turning those copies into hard links recovers some of that space. In a minimal-sdk artifact including Rust, 129 groups of identical files accounted for 21,126,354 duplicate bytes uncompressed. Archived with Windows' `tar.exe` (bsdtar) at zstd level 10, the archive shrank from 200,956,866 to 196,312,913 bytes, about 2.3%. Both bsdtar and MSYS tar store the extra names as hard-link entries and recreate them as hard links on extraction. Only files that are unmodified relative to the index and have the regular mode 100644 are linked. Files this function deliberately rewrites, such as the minimal `etc/profile`, therefore never end up linked to pristine copies. This logic was first proven as an interim step in git-sdk-arm64's ci-artifacts workflow, in git-for-windows/git-sdk-arm64#67. Doing it here benefits every caller. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
dscho
added a commit
to git-for-windows/git-sdk-arm64
that referenced
this pull request
Nov 25, 2026
Upstream Git plans to make its Rust parts mandatory with v3.0, and Git for Windows will enable them already after v2.56. Let's include what is needed to build them in the minimal SDK, which is what Git's CI uses. Since the `git-sdk-aarch64-build-installers` artifact is the minimal SDK plus the `makepkg-git` sparse checkout, it gets them, too. The ARM64 Rust package uses the `aarch64-pc-windows-gnullvm` target provided by the Clang/LLVM subsystem. Cargo's default linker for that target is `aarch64-w64-mingw32-clang`. Without it, the build fails with "error: linker `aarch64-w64-mingw32-clang` not found". Linking also needs `libsynchronization.a`. Shipping the prefixed name means nobody has to override Cargo's linker in every environment. The file is byte-identical to `clang.exe`, and `please.sh create-sdk-artifact` hard-links identical files (see git-for-windows/build-extra#777), so the extra name costs practically nothing in the archive. This does make the artifact substantially larger: the zstd-compressed (level 10) minimal-sdk CI artifact grew from 121.41 MiB to 191.65 MiB, i.e. by 70.24 MiB (+57.85%). That was measured before build-extra#777's hard-linking and DLL unpacking, which shave off some of that. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
dscho
added a commit
to dscho/git-sdk-64
that referenced
this pull request
Nov 25, 2026
Upstream Git plans to make its Rust parts mandatory with v3.0, and Git for Windows will enable them already after v2.56. Let's include what is needed to build them in the minimal SDK, which is what Git's CI uses. Since the `git-sdk-x86_64-build-installers` artifact is the minimal SDK plus the `makepkg-git` sparse checkout, it gets them, too. The UCRT64 Rust package targets `x86_64-pc-windows-gnu`, and Cargo's default linker for that target is `x86_64-w64-mingw32-gcc`. Without it, the build fails with "error: linker `x86_64-w64-mingw32-gcc` not found". `libsynchronization.a` is included as well because the ARM64 counterpart (git-for-windows#67) needed it to link, and the Rust standard library is the same on both architectures. Shipping the prefixed name means nobody has to set `CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=gcc` in every environment. The file is byte-identical to `gcc.exe`, and `please.sh create-sdk-artifact` hard-links identical files (see git-for-windows/build-extra#777), so the extra name costs practically nothing in the archive. This does make the artifact substantially larger. For reference, the ARM64 counterpart grew the zstd-compressed (level 10) build-installers artifact from ~243MB to ~317MB, and the minimal SDK from ~121MB to ~194MB. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
dscho
added a commit
to dscho/git-sdk-64
that referenced
this pull request
Nov 25, 2026
Upstream Git plans to make its Rust parts mandatory with v3.0, and Git for Windows will enable them already after v2.56. Let's include what is needed to build them in the minimal SDK, which is what Git's CI uses. Since the `git-sdk-x86_64-build-installers` artifact is the minimal SDK plus the `makepkg-git` sparse checkout, it gets them, too. The UCRT64 Rust package targets `x86_64-pc-windows-gnu`, and Cargo's default linker for that target is `x86_64-w64-mingw32-gcc`. Without it, the build fails with "error: linker `x86_64-w64-mingw32-gcc` not found". `libsynchronization.a` is included as well because the ARM64 counterpart (git-for-windows#67) needed it to link, and the Rust standard library is the same on both architectures. Shipping the prefixed name means nobody has to set `CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=gcc` in every environment. The file is byte-identical to `gcc.exe`, and `please.sh create-sdk-artifact` hard-links identical files (see git-for-windows/build-extra#777), so the extra name costs practically nothing in the archive. This does make the artifact substantially larger. For reference, the ARM64 counterpart grew the zstd-compressed (level 10) build-installers artifact from ~243MB to ~317MB, and the minimal SDK from ~121MB to ~194MB. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
git-sdk-64andgit-sdk-arm64repositories store their largest DLLs packed with UPX, merely to stay below GitHub's 100MB file size limit. The SDK artifacts should not inherit that workaround: UPX-packed DLLs need to be decompressed every single time they are loaded, and they even compress worse: with zstd level 10,libLLVM-23.dlltakes up 41,589,197 bytes when packed, but only 38,354,366 bytes when unpacked.So let's install the large-DLL filter in the worktree from which the artifacts are generated. The filter script and
upx.exeare written into the worktree's gitdir, so that they don't end up in the artifacts.While at it, let's also hard-link identical files: Git stores each blob only once, but a checkout writes every copy, whereas
tarstores hard-linked files only once. That shaves another ~2.3% off the minimal SDK (with Rust).This was prototyped in git-for-windows/git-sdk-arm64#67.