Skip to content

Commit

Permalink
Merge pull request #2956 from patzim/rm-stale-nqp-files
Browse files Browse the repository at this point in the history
Remove harmful stale files during build
  • Loading branch information
patrickbkr committed Jun 12, 2019
2 parents 95a7866 + f8ced49 commit b3cceac
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Configure.pl
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ BEGIN
$cfg->gen_nqp;
$cfg->configure_active_backends;

$cfg->clean_old_p6_libs;

$cfg->expand_template;

unless ( $cfg->opt('expand') ) {
Expand Down
26 changes: 26 additions & 0 deletions tools/lib/NQP/Config/Rakudo.pm
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,32 @@ sub opts_for_configure {
return wantarray ? @opts : join( " ", @opts );
}

sub clean_old_p6_libs {
my $self = shift;
my $is_moar = $self->active_backend('moar');
if ( $is_moar ) {
my $nqp_config = $self->{impls}{moar}->{config};
my $lib_dir = File::Spec->rel2abs(File::Spec->catdir( $nqp_config->{'nqp::prefix'}, 'share', 'nqp', 'lib', 'Perl6' ));

return if !-d $lib_dir;

my @files = qw(Actions.moarvm BOOTSTRAP.moarvm Compiler.moarvm Grammar.moarvm Metamodel.moarvm ModuleLoader.moarvm Ops.moarvm Optimizer.moarvm Pod.moarvm World.moarvm);

my @notes;
for ( @files ) {
my $file = File::Spec->catdir( $lib_dir, $_ );
next unless -f $file;
push @notes, "Will remove: $file\n";
$self->{config}->{clean_old_p6_libs} .= "\t\$(RM_F) $file\n";
}
$self->note('NOTICE',
"Found stale files in $lib_dir.\n",
"These files were left by a previous install and cause breakage\n",
"in this Rakudo version. The files will be removed during install.\n",
"\n", @notes) if @notes;
}
}

# Returns all active language specification entries except for .c
sub perl6_specs {
my $self = shift;
Expand Down
2 changes: 1 addition & 1 deletion tools/templates/moar/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ m-install: m-all @@script(install-core-dist.p6)@@ $(SETTING_MOAR)
@nfpq($(BASE_DIR)/$(M_BAT_RUNNER))@ @shquot(@script(upgrade-repository.p6)@)@ @nfpq($(DESTDIR)$(PERL6_HOME)/vendor)@
@nfpq($(BASE_DIR)/$(M_BAT_RUNNER))@ @shquot(@script(upgrade-repository.p6)@)@ @nfpq($(DESTDIR)$(PERL6_HOME)/site)@
@nfpq($(BASE_DIR)/$(M_BAT_RUNNER))@ @shquot(@script(install-core-dist.p6)@)@ @q($(DESTDIR)$(PERL6_HOME))@
@expand(@m_install@)@
@clean_old_p6_libs@@expand(@m_install@)@

m-runner-default-install: m-install
$(CP) @nfpq($(DESTDIR)$(PREFIX)/bin/perl6-m@moar::exe@)@ @nfpq($(DESTDIR)$(PREFIX)/bin/perl6@moar::exe@)@
Expand Down

0 comments on commit b3cceac

Please sign in to comment.