Skip to content

Commit cad2b39

Browse files
committed
Be more specific.
Be more specific/accurate when testing the cases that cannot create broken symlinks.
1 parent 585acd0 commit cad2b39

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

compilet-Y7gS9.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
int boot_compilet() { return 1; }

lib/Alien/Build/Util.pm

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,19 @@ sub _mirror
6666
my $target = readlink "$src";
6767
Alien::Build->log("ln -s $target $dst") if $opt->{verbose};
6868
if (path($target)->is_relative) {
69+
my $nativesymlink =
70+
(($^O eq "msys" && defined $ENV{MSYS} && $ENV{MSYS} eq "winsymlinks:nativestrict")
71+
|| ($^O eq "cygwin" && defined $ENV{CYGWIN} && $ENV{CYGWIN} eq "winsymlinks:nativestrict"));
6972
if (!$src->parent->child($target)->exists) {
70-
die "cannot create symlink to nonexistent file $target on MSYS2";
73+
if ($nativesymlink) {
74+
# NOTE: On linux, it is OK to create broken symlinks, but it is not allowed on
75+
# windows MSYS2/Cygwin when nativestrict is used.
76+
die "cannot create native symlink to nonexistent file $target on $^O";
77+
}
78+
}
79+
if ($nativesymlink) {
80+
$dst->parent->child($target)->touchpath;
7181
}
72-
# NOTE: On linux, it is OK to create broken symlinks, but it is not allowed on
73-
# windows MSYS2, so make sure the target exists.
74-
$dst->parent->child($target)->touchpath;
7582
}
7683
my $curdir = Path::Tiny->cwd;
7784
# CD into the directory, such that symlink will work on MSYS2

0 commit comments

Comments
 (0)