Skip to content
Permalink
Browse files

Finalized support for explicit and autodetected nqp locations.

Make it build when nqp is defined with --with-nqp and it's location is
different from --prefix. Though since such setup seems to be
non-functional Configure.pl would produce a warning. It is not a error
condition because perl6 builds and installs anyway.

If there are neither --prefix nor --with-nqp defined then nqp would be
looked for in PATH. If found then the prefix would be set based on the
nqp binary location. Backends will be chosen based on what nqp-<backend>
binaries are exist in that location.

rakudo/rakudo#29119
  • Loading branch information...
vrurg committed May 27, 2019
1 parent 2b1e5ab commit 63a1b50a82e68b4eaea66cb4a36786b466cde0fd
Showing with 44 additions and 25 deletions.
  1. +1 −1 3rdparty/nqp-configure
  2. +43 −24 tools/lib/NQP/Config/Rakudo.pm
@@ -5,7 +5,7 @@ use v5.10.1;
package NQP::Config::Rakudo;
use strict;
use warnings;
use Cwd;
use Cwd qw<abs_path cwd>;
use POSIX qw<strftime>;
use Digest::SHA;
use NQP::Config qw<slurp read_config cmp_rev system_or_die run_or_die>;
@@ -22,15 +22,10 @@ sub configure_nqp {
defined( $self->opt('prefix') || $self->opt('sysroot') );

if ( $nqp_bin = $self->opt('with-nqp') ) {
$nqp_bin = can_run( $self->nfp($nqp_bin) );
$self->sorry( "Could not find nqp '" . $self->opt('with-nqp') . "' defined with --with-nqp" )
unless $nqp_bin;
}
elsif ( !$have_dir_opts ) {
$nqp_bin = can_run('nqp');
}

if ($nqp_bin) {
$self->sorry( "Could not find nqp '"
. $self->opt('with-nqp')
. "' defined with --with-nqp" )
unless -x $nqp_bin;
my $nqp_backend;
run(
command =>
@@ -46,17 +41,22 @@ sub configure_nqp {
"by the one infered by --with-nqp ($nqp_backend)"
);
}
$self->set( nqp_default => $nqp_bin );
}
elsif ( !$have_dir_opts ) {

# NQP from path would only be used to determine the implicit prefix.
$nqp_bin = can_run('nqp');
}

$self->set( nqp_default => $nqp_bin ) if $nqp_bin;
}

sub configure_backends {
my $self = shift;

my $prefix = $self->cfg('prefix');

#
unless ( $self->cfg('nqp_default') ) {
unless ( $self->active_backends ) {
### Consider what backends are to be built. ###
my $passed_backends = $self->opt('backends');
if ($passed_backends) {
@@ -119,18 +119,33 @@ sub configure_backends {
sub configure_refine_vars {
my $self = shift;

if ( !$self->cfg('prefix') && ( my $nqp_bin = $self->cfg('nqp_default') ) )
{
my $nqp_bin = $self->cfg('nqp_default');
if ($nqp_bin) {
my ( $vol, $dir, undef ) = File::Spec->splitpath($nqp_bin);
my $nqp_prefix = File::Spec->catpath( $vol,
File::Spec->catdir( $dir, File::Spec->updir ) );
$self->set( prefix => $nqp_prefix );
$self->note(
"ATTENTION",
"No --prefix supplied, ",
"building and installing to $nqp_prefix\n",
"Based on found executable $nqp_bin"
);

my $prefix = $self->cfg('prefix');

if ( !$prefix ) {
$self->set( prefix => $nqp_prefix );
$self->note(
"ATTENTION",
"No --prefix supplied, ",
"building and installing to $nqp_prefix\n",
"Based on found executable $nqp_bin"
);
}
elsif ( abs_path($prefix) ne abs_path($nqp_prefix) ) {
$self->note(
'WARNING!',
"Installation directory '$prefix' is different from '",
abs_path($nqp_prefix),
"' where nqp is installed.\n",
"This may result in non-functional perl6 binary.\n",
"Make sure this is REALLY intended."
);
}
}

$self->SUPER::configure_refine_vars(@_);
@@ -475,20 +490,24 @@ sub gen_nqp {
if ( $nqp_ok or $options->{'ignore-errors'} ) {
$impls->{$b}{ok} = 1;
}
elsif ( $self->opt('with-nqp') ) {
$self->sorry(
"$bin version $nqp_have is outdated, $nqp_want expected.");
}
else {
$need{$b} = 1;
}
}

return unless %need;

return unless defined($gen_nqp) || defined($gen_moar);

if ( defined $gen_nqp || defined $gen_moar ) {
my $user = $options->{'github-user'} // 'perl6';
$self->git_checkout( 'nqp', 'nqp', $nqp_git_spec || $nqp_want );
}

return unless defined($gen_nqp) || defined($gen_moar);

my @cmd = (
$^X, 'Configure.pl', qq{--prefix=$prefix}, "--make-install",
"--git-protocol=$git_protocol",

0 comments on commit 63a1b50

Please sign in to comment.
You can’t perform that action at this time.