Skip to content

Commit 016196c

Browse files
committed
Be more specific.
Be more specific/accurate when testing the cases that cannot create broken symlinks.
1 parent 4387b4a commit 016196c

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

compilet-Y7gS9.c

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
int boot_compilet() { return 1; }

lib/Alien/Build/Util.pm

+11-4
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,19 @@ sub _mirror
7777
my $target = readlink "$src";
7878
Alien::Build->log("ln -s $target $dst") if $opt->{verbose};
7979
if (path($target)->is_relative) {
80+
my $nativesymlink =
81+
(($^O eq "msys" && defined $ENV{MSYS} && $ENV{MSYS} eq "winsymlinks:nativestrict")
82+
|| ($^O eq "cygwin" && defined $ENV{CYGWIN} && $ENV{CYGWIN} eq "winsymlinks:nativestrict"));
8083
if (!$src->parent->child($target)->exists) {
81-
die "cannot create symlink to nonexistent file $target on MSYS2";
84+
if ($nativesymlink) {
85+
# NOTE: On linux, it is OK to create broken symlinks, but it is not allowed on
86+
# windows MSYS2/Cygwin when nativestrict is used.
87+
die "cannot create native symlink to nonexistent file $target on $^O";
88+
}
89+
}
90+
if ($nativesymlink) {
91+
$dst->parent->child($target)->touchpath;
8292
}
83-
# NOTE: On linux, it is OK to create broken symlinks, but it is not allowed on
84-
# windows MSYS2, so make sure the target exists.
85-
$dst->parent->child($target)->touchpath;
8693
}
8794
my $curdir = Path::Tiny->cwd;
8895
# CD into the directory, such that symlink will work on MSYS2

0 commit comments

Comments
 (0)