Alien-Build
Alien-Build copied to clipboard
MSYS / cygwin symlinks
This fixes issue #213 on my machine.
Also note that MSYS2 can emulate symbolic links in at least three ways (see this blog for more information). For example:
$ touch a.txt
# Create a symbolic link:
$ MSYS=winsymlinks:nativestrict ln -s a.txt b.txt
# Create a .lnk shortcut file:
$ MSYS=winsymlinks ln -s a.txt c.txt
# Emulate symbolic links by copying the file:
$ MSYS= ln -s a.txt d.txt
$ ls -l
total 4.0K
-rw-r--r-- 1 hakon hakon 0 Jan 22 20:54 a.txt
lrwxrwxrwx 1 hakon hakon 5 Jan 22 20:54 b.txt -> a.txt
lrwxrwxrwx 1 hakon hakon 5 Jan 22 20:55 c.txt -> a.txt
-rw-r--r-- 1 hakon hakon 0 Jan 22 20:54 d.txt
Maybe we also need to check the content of the MSYS environment variable to distinguish between the cases?
MSYS=winsymlinks:nativestrict ln -s a.txt b.txt
I added a new commit that I hope is more accurate, in that it tests for this case specifically on Cygwin and MSYS2
This patch seems invasive for a $^O eq 'msys' which is an unofficial fork of Perl which as far as I can tell is only really useful for running autoconf.
I think this is close. Aside from a couple of very minor nits mentioned above, I would like to keep the original simple one-statement call to symlink on UNIX and only delve into the msys/cygwin logic if we are on that platform.
Thanks for the comments! In the meantime I have found some more accurate information about the behavior of symlinks on Windows when working on this issue. Unfortunately it is quite complicated. The plan is to come back to this PR later and update it..