Skip to content

Use Windows symlinks when available - #13494

Merged
dra27 merged 3 commits into
ocaml:trunkfrom
dra27:windows-ln
Jan 9, 2025
Merged

dra27 merged 3 commits into
ocaml:trunkfrom
dra27:windows-ln

Conversation

@dra27

@dra27 dra27 commented Sep 28, 2024

Copy link
Copy Markdown
Member

The impact of this is not as profound as it was prior to #11993, but it still saves in >60MiB on current trunk installations on Windows.

The mechanism used for creating native Windows symlinks is as introduced in #12198 - Cygwin will create native symlinks if winsymlinks:native is included in the CYGWIN environment variable (the MSYS2 fork of Cygwin uses the MSYS environment variable instead). The behaviour under this setting is to use native symlinks if available and fallback to emulation otherwise. If instead of :native, :nativestrict is used, then ln -s fails if native symlinks cannot be created. This creates a simple test in configure, and we fallback to the previous cp -pf otherwise.

@dra27
dra27 force-pushed the windows-ln branch 5 times, most recently from 4ac7efa to 43ac4e3 Compare September 28, 2024 23:25

@gasche gasche left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The code looks reasonable to me, approved.

@dra27
dra27 marked this pull request as draft September 30, 2024 13:21
@dra27

dra27 commented Sep 30, 2024

Copy link
Copy Markdown
Member Author

Chatting to @MisterDA, I realise there's a slight error with the configuration for Cygwin/MSYS2 here which I'll fix shortly. The change in Makefile.common remains fine.

@dra27
dra27 force-pushed the windows-ln branch 2 times, most recently from 81193c9 to e265efa Compare October 3, 2024 13:40
@dra27
dra27 marked this pull request as ready for review October 3, 2024 13:41

@nojb nojb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

dra27 added 3 commits January 8, 2025 15:08
Previously Windows unconditionally uses `cp`, doubling the size required
for the OCaml binaries. `configure` now determines if `ln` creates
native symlinks and only uses `cp` if that fails. Users of the compiler
are simply required to enable Developer Mode (or build OCaml using an
elevated shell).
Slightly easier detection, and a somewhat hardened implementation.
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.

4 participants