Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit a9519a6

Browse files
committed
ffi: avoid bumping config.sh/config.h mtimes
when adding valid libffi targets in configpm. This caused massive miniperl rebuilds, but it is only needed for perl-dependent targets much later
1 parent 1232de8 commit a9519a6

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

configpm

+7-3
Original file line numberDiff line numberDiff line change
@@ -1304,11 +1304,13 @@ sub ffi_targets {
13041304
$file = "$olddir\config.h";
13051305
}
13061306
my $content = read_file($file);
1307-
if ($content !~ m/^\/\* valid libffi targets/m) {
1307+
if ($content && $content !~ m/^\/\* valid libffi targets/m) {
13081308
$content =~ s{(\t+USE_FFI\t+/ ?\*\*/\n)}{$1$splice};
1309-
print "Updating $file\n"
1309+
print "Updating $file keeping its timestamp\n"
13101310
unless defined $ENV{MAKEFLAGS} and $ENV{MAKEFLAGS} =~ /\b(s|silent|quiet)\b/;
1311+
my ($a_time, $m_time) = (stat($file))[8,9];
13111312
write_file($file, $content);
1313+
utime($a_time, $m_time, $file);
13121314
}
13131315

13141316
# write_file('have_ffi.h', $splice);
@@ -1320,11 +1322,13 @@ sub update_ffi_targets_sh {
13201322
my $file = 'config.sh';
13211323
$file = '..\config.sh' if -d 'mini' and !-f $file;
13221324
if (-f $file) {
1323-
print "Updating $file with $ffi_target"
1325+
print "Updating $file with $ffi_target keeping its timestamp\n"
13241326
unless defined $ENV{MAKEFLAGS} and $ENV{MAKEFLAGS} =~ /\b(s|silent|quiet)\b/;
13251327
my $content = read_file($file);
13261328
$content =~ s{(useffi='define'\n)}{$1$ffi_target}m;
1329+
my ($a_time, $m_time) = (stat($file))[8,9];
13271330
write_file($file, $content);
1331+
utime($a_time, $m_time, $file);
13281332
}
13291333
}
13301334

pod/perlcdelta.pod

+3-1
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,9 @@ L</Platform Support> section, instead.
361361

362362
=item *
363363

364-
XXX
364+
Avoid bumping F<config.sh>/F<config.h> mtimes when adding valid libffi
365+
targets in F<configpm>. This caused massive miniperl rebuilds, but
366+
is only needed for perl-dependent targets much later.
365367

366368
=back
367369

0 commit comments

Comments
 (0)