Skip to content

Commit

Permalink
Converted config var source_digest to macro.
Browse files Browse the repository at this point in the history
Fix for incorrect digest calculation
  • Loading branch information
vrurg committed May 2, 2019
1 parent 141bd4e commit da6d90e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 27 deletions.
61 changes: 36 additions & 25 deletions tools/lib/NQP/Config/Rakudo.pm
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -118,11 +118,6 @@ sub configure_misc {


$config->{builddate} = strftime( '%Y-%m-%dT%H:%M:%SZ', gmtime ); $config->{builddate} = strftime( '%Y-%m-%dT%H:%M:%SZ', gmtime );


my $sha = Digest::SHA->new;
find( sub { $sha->addfile($_) if /\.(nqp|pm6)\z/ }, "src" );
$sha->addfile('gen/nqp-version');
$config->{source_digest} = $sha->hexdigest;

# NQP_LIB # NQP_LIB
$config->{set_nqp_lib} = 'NQP_LIB=blib '; $config->{set_nqp_lib} = 'NQP_LIB=blib ';
if ( $self->is_win ) { if ( $self->is_win ) {
Expand Down Expand Up @@ -226,7 +221,8 @@ sub configure_moar_backend {
# . $nqp_config->{'moar::moar'} # . $nqp_config->{'moar::moar'}
# . ' $(PREFIX)' # . ' $(PREFIX)'
# . $slash . 'bin'; # . $slash . 'bin';
$config->{m_install} = "\t" . q<$(CP) @nfpq(@moar::libdir@/@moar::moar@) @nfpq($(DESTDIR)$(PREFIX)/bin)@>; $config->{m_install} = "\t"
. q<$(CP) @nfpq(@moar::libdir@/@moar::moar@) @nfpq($(DESTDIR)$(PREFIX)/bin)@>;
} }
if ( $nqp_config->{'moar::os'} eq 'mingw32' ) { if ( $nqp_config->{'moar::os'} eq 'mingw32' ) {
$config->{'mingw_unicode'} = '-municode'; $config->{'mingw_unicode'} = '-municode';
Expand All @@ -238,23 +234,24 @@ sub configure_moar_backend {
" \$(M_GDB_RUNNER) \\\n \$(M_LLDB_RUNNER) \\\n \$(M_VALGRIND_RUNNER)"; " \$(M_GDB_RUNNER) \\\n \$(M_LLDB_RUNNER) \\\n \$(M_VALGRIND_RUNNER)";
$config->{'m_all'} = $config->{'m_all'} =
'$(M_GDB_RUNNER) $(M_LLDB_RUNNER) $(M_VALGRIND_RUNNER)'; '$(M_GDB_RUNNER) $(M_LLDB_RUNNER) $(M_VALGRIND_RUNNER)';
#$config->{'m_install'} = "\t"
# . '$(M_RUN_PERL6) ' #$config->{'m_install'} = "\t"
# . $self->nfp("tools/build/create-moar-runner.p6") # . '$(M_RUN_PERL6) '
# . ' perl6 $(M_RUNNER) $(DESTDIR)$(PREFIX)' # . $self->nfp("tools/build/create-moar-runner.p6")
# . $self->nfp("/bin/perl6-gdb-m") # . ' perl6 $(M_RUNNER) $(DESTDIR)$(PREFIX)'
# . ' "gdb" "" "" ""' . "\n\t" # . $self->nfp("/bin/perl6-gdb-m")
# . '$(M_RUN_PERL6) ' # . ' "gdb" "" "" ""' . "\n\t"
# . $self->nfp("tools/build/create-moar-runner.p6") # . '$(M_RUN_PERL6) '
# . ' perl6 $(M_RUNNER) $(DESTDIR)$(PREFIX)' # . $self->nfp("tools/build/create-moar-runner.p6")
# . $self->nfp("/bin/perl6-lldb-m") # . ' perl6 $(M_RUNNER) $(DESTDIR)$(PREFIX)'
# . ' "lldb" "" "" ""' . "\n\t" # . $self->nfp("/bin/perl6-lldb-m")
# . '$(M_RUN_PERL6) ' # . ' "lldb" "" "" ""' . "\n\t"
# . $self->nfp("tools/build/create-moar-runner.p6") # . '$(M_RUN_PERL6) '
# . ' perl6 $(M_RUNNER) $(DESTDIR)$(PREFIX)' # . $self->nfp("tools/build/create-moar-runner.p6")
# . $self->nfp("/bin/perl6-valgrind-m") # . ' perl6 $(M_RUNNER) $(DESTDIR)$(PREFIX)'
# . ' "valgrind" "" "" ""'; # . $self->nfp("/bin/perl6-valgrind-m")
$config->{m_install} = '@insert(Makefile-install)@'; # . ' "valgrind" "" "" ""';
$config->{m_install} = '@insert(Makefile-install)@';
} }
$config->{c_runner_libs} = join( " ", @c_runner_libs ); $config->{c_runner_libs} = join( " ", @c_runner_libs );
$config->{moar_lib} = sprintf( $config->{moar_lib} = sprintf(
Expand Down Expand Up @@ -547,8 +544,22 @@ sub _m_for_specmods {
return _m_for_specs( $self, $text, with_mods => 1 ); return _m_for_specs( $self, $text, with_mods => 1 );
} }


NQP::Macros->register_macro( 'for_specs', \&_m_for_specs ); sub _m_source_digest {
NQP::Macros->register_macro( 'for_specmods', \&_m_for_specmods ); my $self = shift;
my $sha = Digest::SHA->new;
find(
sub {
$sha->addfile($_) if /\.(nqp|pm6)\z/;
},
File::Spec->catdir( $self->cfg->cfg('base_dir'), "src" )
);
$sha->addfile('gen/nqp-version');
return $sha->hexdigest;
}

NQP::Macros->register_macro( 'for_specs', \&_m_for_specs );
NQP::Macros->register_macro( 'for_specmods', \&_m_for_specmods );
NQP::Macros->register_macro( 'source_digest', \&_m_for_specmods );


1; 1;


Expand Down
2 changes: 1 addition & 1 deletion tools/templates/main-version.in
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ sub hll-config($config) {
:= nqp::list( '6.c'@for_specmods(, '6.@spec_with_mod@')@ ); := nqp::list( '6.c'@for_specmods(, '6.@spec_with_mod@')@ );
$config<prefix> := '@prefix@'; $config<prefix> := '@prefix@';
$config<libdir> := '@libdir@'; $config<libdir> := '@libdir@';
$config<source-digest> := '@source_digest@'; $config<source-digest> := '@source_digest()@';
} }


2 changes: 1 addition & 1 deletion tools/templates/moar/Makefile.in
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ $(PERL6_DEBUG_MOAR): @nfp(src/perl6-debug.nqp)@ $(PERL6_MOAR)
@perl( @perl(
for my $toolchain (qw<gdb lldb valgrind>) { for my $toolchain (qw<gdb lldb valgrind>) {
my $scope = $cfg->push_config( toolchain => $toolchain ); my $scope = $cfg->push_config( toolchain => $toolchain );
$out .= $macros->expand(<<'@insert(Makefile-gen-runner)@'); $out .= $macros->expand('@insert(Makefile-gen-runner)@');
} }
)@ )@
$(M_BAT_RUNNER): @@configure_script@@ $(M_C_RUNNER) $(PERL6_MOAR) $(SETTING_MOAR) $(M_BAT_RUNNER): @@configure_script@@ $(M_C_RUNNER) $(PERL6_MOAR) $(SETTING_MOAR)
Expand Down

0 comments on commit da6d90e

Please sign in to comment.