Skip to content

Commit

Permalink
Merge pull request ocaml#13494 from dra27/windows-ln
Browse files Browse the repository at this point in the history
Use Windows symlinks when available
  • Loading branch information
dra27 authored Jan 9, 2025
2 parents c756870 + e24eacc commit b204bc4
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ META.in typo.missing-header
# Github templates and scripts lack headers, have long lines
/.github/** typo.missing-header typo.long-line=may typo.very-long-line=may
/.github/workflows/build-cross.yml typo.non-ascii
/.github/workflows/build-msvc.yml typo.utf8

/.mailmap typo.long-line typo.missing-header typo.non-ascii
/CONTRIBUTING.md typo.non-ascii=may
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/build-msvc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,12 @@ jobs:
CC: ${{ matrix.cc }}
run: >-
eval $(tools/msvs-promote-path) ;
if ! ./configure --cache-file=config.cache --host=$HOST CC=$CC ; then
if ! ./configure --cache-file=config.cache --host=$HOST CC=$CC
--prefix "$PROGRAMFILES/Бактріан🐫"; then
rm -rf config.cache ;
failed=0 ;
./configure --cache-file=config.cache --host=$HOST CC=$CC \
./configure --cache-file=config.cache --host=$HOST CC=$CC
--prefix "$PROGRAMFILES/Бактріан🐫"
|| failed=$?;
if ((failed)) ; then cat config.log ; exit $failed ; fi ;
fi ;
Expand Down Expand Up @@ -136,3 +138,7 @@ jobs:
run: >-
eval $(tools/msvs-promote-path) ;
make -j tests ;
- name: Install the compiler
shell: bash
run: make install
4 changes: 4 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ Working version
team.
(Nathan Rebours, review by Florian Angeletti)

- #13494: Use native symlinks on Windows for the OCaml installation, reducing
disk usage considerably.
(David Allsopp, review by Nicolás Ojeda Bär and Gabriel Scherer)

* #13526: Simplify the build of cross compilers
This replaces the configure `--with-target-bindir` option by an equivalent
`TARGET_BINDIR` variable
Expand Down
9 changes: 9 additions & 0 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -467,3 +467,12 @@ endef # INSTALL_STRIPPED_BYTE_PROG
# boot/ as part of coldstart. See read_runtime_launch_info in
# bytecomp/bytelink.ml for further details.
HEADER_NAME = runtime-launch-info

ifeq "$(UNIX_OR_WIN32)" "win32"
# Ensure that no command can create Cygwin symbolic links by ensuring that
# symlink(2) will fail if native NTFS symlinks aren't available.
export CYGWIN := $(strip \
$(filter-out winsymlinks winsymlinks:%, $(CYGWIN)) winsymlinks:nativestrict)
export MSYS := $(strip \
$(filter-out winsymlinks winsymlinks:%, $(MSYS)) winsymlinks:nativestrict)
endif
11 changes: 11 additions & 0 deletions aclocal.m4
Original file line number Diff line number Diff line change
Expand Up @@ -545,3 +545,14 @@ AC_DEFUN([OCAML_CC_SUPPORTS_LABELS_AS_VALUES], [
[Define if the C compiler supports the labels as values extension.])
fi
])

AC_DEFUN([OCAML_CHECK_LN_ON_WINDOWS], [
AC_MSG_CHECKING([for a workable solution for ln -sf])
AS_IF([m4_normalize(MSYS=winsymlinks:nativestrict
CYGWIN=winsymlinks:nativestrict
ln -sf configure conftestLink 2>/dev/null)],
[ln='ln -sf'],
[ln='cp -pf']
)
AC_MSG_RESULT([$ln])
])
14 changes: 13 additions & 1 deletion configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ ocamlsrcdir=${ocamlsrcdir%X}

AS_CASE([$host],
[*-*-mingw32*|*-pc-windows],
[ln='cp -pf'
[OCAML_CHECK_LN_ON_WINDOWS
ocamlsrcdir="$(LC_ALL=C.UTF-8 cygpath -w -- "$ocamlsrcdir")"],
[ln='ln -sf'])

Expand Down

0 comments on commit b204bc4

Please sign in to comment.