From f1fd277f1e5df976a23f4ad7091536e96851865f Mon Sep 17 00:00:00 2001 From: Brian McKenna Date: Wed, 6 Nov 2024 00:04:41 +1100 Subject: [PATCH] msys2: make symbolic linking work in Meson --- src/libstore/meson.build | 2 ++ src/nix/meson.build | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/libstore/meson.build b/src/libstore/meson.build index c2aa5bff3..b10f3753c 100644 --- a/src/libstore/meson.build +++ b/src/libstore/meson.build @@ -34,6 +34,8 @@ subdir('build-utils-meson/subprojects') run_command('ln', '-s', meson.project_build_root() / '__nothing_link_target', meson.project_build_root() / '__nothing_symlink', + # native doesn't allow dangling symlinks, which the tests require + env : { 'MSYS' : 'winsymlinks:lnk' }, check : true, ) can_link_symlink = run_command('ln', diff --git a/src/nix/meson.build b/src/nix/meson.build index 55089d821..cc18aebbf 100644 --- a/src/nix/meson.build +++ b/src/nix/meson.build @@ -229,6 +229,8 @@ foreach linkname : nix_symlinks t = custom_target( command: ['ln', '-sf', fs.name(this_exe), '@OUTPUT@'], output: linkname + executable_suffix, + # native doesn't allow dangling symlinks, but the target executable often doesn't exist at this time + env : { 'MSYS' : 'winsymlinks:lnk' }, # TODO(Ericson2314): Don't do this once we have the `meson.override_find_program` working) build_by_default: true ) @@ -247,6 +249,8 @@ install_symlink( custom_target( command: ['ln', '-sf', fs.name(this_exe), '@OUTPUT@'], output: 'build-remote' + executable_suffix, + # native doesn't allow dangling symlinks, but the target executable often doesn't exist at this time + env : { 'MSYS' : 'winsymlinks:lnk' }, # TODO(Ericson2314): Don't do this once we have the `meson.override_find_program` working) build_by_default: true )