mklink: Do not needlessly overwrite linked files...
authorOrgad Shaneh <orgads@gmail.com>
Sun, 31 Jul 2016 06:18:22 +0000 (09:18 +0300)
committerOrgad Shaneh <orgads@gmail.com>
Wed, 16 Nov 2016 07:08:27 +0000 (09:08 +0200)
... on systems without symlinks.

Overwriting all the headers on each Configure causes full rebuild even if
nothing has changed.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1370)

util/mklink.pl

index 61db12c68f3156475f4f44e2dde2e01d8be001ee..2df0453a17a3a1e9e6bfe74101240a831867743d 100755 (executable)
@@ -57,7 +57,7 @@ foreach $file (@files) {
     if ($symlink_exists) {
        unlink "$from/$file";
        symlink("$to/$file", "$from/$file") or $err = " [$!]";
-    } else {
+    } elsif (-d "$from" && (!-f "$from/$file" || ((stat("$file"))[9] > (stat("$from/$file"))[9]))) {
        unlink "$from/$file"; 
        open (OLD, "<$file") or die "Can't open $file: $!";
        open (NEW, ">$from/$file") or die "Can't open $from/$file: $!";