Skip to content

Commit 41f6576

Browse files
committed
Merge branch 'master' into release-2019.11
2 parents 3e05931 + ba6378e commit 41f6576

File tree

9 files changed

+144
-104
lines changed

9 files changed

+144
-104
lines changed

3rdparty/nqp-configure

Configure.pl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ BEGIN
6969
'github-user=s', 'nqp-repo=s',
7070
'moar-repo=s', 'expand=s',
7171
'out=s', 'set-var=s@',
72-
'relocatable!', 'silent-build!'
72+
'relocatable!', 'silent-build!',
73+
'force-rebuild!'
7374
)
7475
or do {
7576
print_help();
@@ -149,6 +150,7 @@ sub print_help {
149150
--nqp-home=dir Directory to install NQP files to
150151
--backends=list Backends to use: $backends
151152
--gen-moar Download, build, and install a copy of MoarVM to use before writing the Makefile
153+
--force-rebuild Forces rebuild of moar if used with --gen-moar
152154
--moar-option='--option=value'
153155
Options to pass to MoarVM configuration for --gen-moar
154156
--with-moar='/path/to/moar'

docs/ops.markdown

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2247,6 +2247,16 @@ will be achieved via:
22472247

22482248
$lang.language('My::Lang');
22492249

2250+
## call
2251+
* `call()`
2252+
2253+
This method is not documented yet.
2254+
2255+
Example:
2256+
2257+
nqp::call(nqp::getlexcaller('&say'), 'foo')
2258+
2259+
22502260
## callmethod
22512261
* `callmethod(Mu $obj, str $methodname, *@pos, *%named --> Mu)`
22522262

tools/lib/NQP/Config/NQP.pm

Lines changed: 74 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
## Please see file perltidy.ERR
21
package NQP::Config::NQP;
32
use v5.10.1;
43
use strict;
54
use warnings;
65
use Cwd;
76
use IPC::Cmd qw<run>;
8-
use NQP::Config qw<slurp read_config_from_command cmp_rev system_or_die run_or_die>;
7+
use NQP::Config qw<slurp read_config_from_command cmp_rev system_or_die
8+
run_or_die>;
99

1010
use base qw<NQP::Config>;
1111

@@ -48,7 +48,7 @@ sub configure_backends {
4848
}
4949

5050
sub configure_refine_vars {
51-
my $self = shift;
51+
my $self = shift;
5252
my $config = $self->{config};
5353

5454
unless ( $self->cfg('prefix') ) {
@@ -70,14 +70,15 @@ sub configure_refine_vars {
7070

7171
$config->{nqp_home} = $self->nfp(
7272
File::Spec->rel2abs(
73-
$config->{nqp_home} ||
74-
File::Spec->catdir( $config->{'prefix'}, 'share', 'nqp' )
73+
$config->{nqp_home}
74+
|| File::Spec->catdir( $config->{'prefix'}, 'share', 'nqp' )
7575
)
7676
);
7777
}
7878

7979
sub configure_misc {
8080
my $self = shift;
81+
$self->SUPER::configure_misc(@_);
8182
my $config = $self->{config};
8283

8384
if ( $self->active_backend('moar') ) {
@@ -95,8 +96,8 @@ sub configure_misc {
9596
}
9697

9798
sub configure_moar_backend {
98-
my $self = shift;
99-
my $imoar = $self->{impls}{moar};
99+
my $self = shift;
100+
my $imoar = $self->{impls}{moar};
100101
my $config = $self->{config};
101102

102103
$self->gen_moar;
@@ -116,14 +117,17 @@ sub configure_moar_backend {
116117
my $qchar = $config->{quote};
117118
$imoar->{config}{static_nqp_home} = $config->{nqp_home};
118119
$imoar->{config}{static_nqp_home_define} =
119-
'-DSTATIC_NQP_HOME='
120-
. $qchar . $self->c_escape_string( $imoar->{config}{static_nqp_home} ) . $qchar;
120+
'-DSTATIC_NQP_HOME='
121+
. $qchar
122+
. $self->c_escape_string( $imoar->{config}{static_nqp_home} )
123+
. $qchar;
121124
}
122125

123126
# Strip rpath from ldflags so we can set it differently ourself.
124127
$imoar->{config}{ldflags} = $moar_config->{'moar::ldflags'};
125128
$imoar->{config}{ldflags} =~ s/\Q$moar_config->{'moar::ldrpath'}\E ?//;
126-
$imoar->{config}{ldflags} =~ s/\Q$moar_config->{'moar::ldrpath_relocatable'}\E ?//;
129+
$imoar->{config}{ldflags} =~
130+
s/\Q$moar_config->{'moar::ldrpath_relocatable'}\E ?//;
127131
if ( $self->cfg('prefix') ne '/usr' ) {
128132
$imoar->{config}{ldflags} .= ' '
129133
. (
@@ -146,7 +150,8 @@ sub configure_moar_backend {
146150
if ( $moar_config->{'moar::os'} eq 'mingw32' ) {
147151
$imoar->{config}{mingw_unicode} = '-municode';
148152
}
149-
push @c_runner_libs, sprintf( $moar_config->{'moar::ldusr'}, 'Shlwapi' );
153+
push @c_runner_libs,
154+
sprintf( $moar_config->{'moar::ldusr'}, 'Shlwapi' );
150155
}
151156
$imoar->{config}{c_runner_libs} = join( " ", @c_runner_libs );
152157
$imoar->{config}{moar_lib} = sprintf(
@@ -249,12 +254,12 @@ sub moar_config {
249254

250255
return $moar_config if $moar_config && keys %{$moar_config} > 2;
251256

252-
my $prefix = $self->cfg('prefix');
257+
my $prefix = $self->cfg('prefix');
253258
my $moar_prefix;
254259
my $moar_exe;
255260

256261
if ( $self->opt('with-moar') ) {
257-
$moar_exe = File::Spec->rel2abs($self->opt('with-moar'));
262+
$moar_exe = File::Spec->rel2abs( $self->opt('with-moar') );
258263
}
259264
else {
260265
if ($prefix) {
@@ -277,13 +282,16 @@ sub moar_config {
277282
}
278283

279284
my %c;
280-
if ( $self->is_executable($self->nfp($moar_exe)) ) {
281-
%c = read_config_from_command(
282-
'"' . $self->nfp( $moar_exe ) . '"'
283-
. ' --libpath=' . $self->nfp( 'src/vm/moar/stage0' ) . ' '
284-
. $self->nfp( 'src/vm/moar/stage0/nqp.moarvm' )
285-
. ' --bootstrap --show-config' );
286-
%c = map { rindex($_, 'moar::', 0) == 0 ? ($_ => $c{$_}) : () } keys %c;
285+
if ( $self->is_executable( $self->nfp($moar_exe) ) ) {
286+
%c =
287+
read_config_from_command( '"'
288+
. $self->nfp($moar_exe) . '"'
289+
. ' --libpath='
290+
. $self->nfp('src/vm/moar/stage0') . ' '
291+
. $self->nfp('src/vm/moar/stage0/nqp.moarvm')
292+
. ' --bootstrap --show-config' );
293+
%c = map { rindex( $_, 'moar::', 0 ) == 0 ? ( $_ => $c{$_} ) : () }
294+
keys %c;
287295
}
288296

289297
return $self->backend_config( 'moar',
@@ -302,10 +310,11 @@ sub gen_moar {
302310
my $moar_have;
303311
my @errors;
304312

305-
my $prefix = $config->{prefix};
306-
my $gen_moar = $options->{'gen-moar'};
307-
my $has_gen_moar = defined $gen_moar;
308-
my @opts = @{ $options->{'moar-option'} || [] };
313+
my $prefix = $config->{prefix};
314+
my $gen_moar = $options->{'gen-moar'};
315+
my $force_rebuild = $options->{'force-rebuild'};
316+
my $has_gen_moar = defined $gen_moar;
317+
my @opts = @{ $options->{'moar-option'} || [] };
309318
push @opts, "--optimize";
310319
push @opts, '--relocatable' if $options->{relocatable};
311320
my $startdir = $config->{base_dir};
@@ -314,6 +323,12 @@ sub gen_moar {
314323
my $moar_exe = $self->moar_config->{moar};
315324
my $moar_version_output = "";
316325

326+
if ( $force_rebuild && !$has_gen_moar ) {
327+
$self->note( "WARNING",
328+
"Command line option --force-rebuild is ineffective without --gen-moar"
329+
);
330+
}
331+
317332
if ( $self->is_executable($moar_exe) ) {
318333
$moar_version_output = run_or_die( [ $moar_exe, '--version' ] );
319334

@@ -325,37 +340,49 @@ sub gen_moar {
325340
$try_generate = $has_gen_moar;
326341
}
327342

328-
my $moar_ok =
329-
$moar_have && cmp_rev( $moar_have, $moar_want, "MoarVM" ) >= 0;
330-
if ($moar_ok) {
331-
$self->msg(
332-
"Found $moar_exe version $moar_have, which is new enough.\n");
333-
}
334-
elsif ($moar_have) {
335-
push @errors,
336-
"Found $moar_exe version $moar_have, which is too old. Wanted at least $moar_want\n";
337-
$try_generate = $has_gen_moar unless $options->{'ignore-errors'};
338-
}
339-
elsif ($moar_version_output
340-
&& $moar_version_output =~ /This is MoarVM version/i )
341-
{
342-
push @errors,
343-
"Found a MoarVM binary but was not able to get its version number.\n"
344-
. "If running `git describe` inside the MoarVM repository does not work,\n"
345-
. "you need to make sure to checkout tags of the repository and run \nConfigure.pl and make install again\n";
346-
$try_generate = $has_gen_moar;
343+
unless ($force_rebuild) {
344+
my $moar_ok =
345+
$moar_have && cmp_rev( $moar_have, $moar_want, "MoarVM" ) >= 0;
346+
if ($moar_ok) {
347+
$self->msg(
348+
"Found $moar_exe version $moar_have, which is new enough.\n");
349+
}
350+
elsif ($moar_have) {
351+
push @errors,
352+
"Found $moar_exe version $moar_have, which is too old. "
353+
. "Wanted at least $moar_want\n";
354+
$try_generate = $has_gen_moar unless $options->{'ignore-errors'};
355+
}
356+
elsif ($moar_version_output
357+
&& $moar_version_output =~ /This is MoarVM version/i )
358+
{
359+
push @errors,
360+
"Found a MoarVM binary "
361+
. " but was not able to get its version number.\n"
362+
. "If running `git describe` inside the MoarVM repository does not work,\n"
363+
. "you need to make sure to checkout tags of the repository and run \n"
364+
. "Configure.pl and make install again\n";
365+
$try_generate = $has_gen_moar;
366+
}
347367
}
348368

349369
if (@errors) {
350370
if ($try_generate) {
351-
$self->note("ATTENTION!", $_) foreach @errors;
371+
$self->note( "ATTENTION!", $_ ) foreach @errors;
352372
}
353373
else {
354374
$self->sorry(@errors);
355375
}
356376
}
357377

358-
if ( $try_generate ) {
378+
if ( $try_generate || ( $has_gen_moar && $force_rebuild ) ) {
379+
380+
# Don't expect any particular commit in MoarVM/ if the repo is already
381+
# checked out.
382+
my $expected_spec =
383+
-d File::Spec->catdir( $self->cfg('base_dir'), 'MoarVM', '.git' )
384+
? undef
385+
: $moar_want;
359386

360387
my $moar_repo =
361388
$self->git_checkout( 'moar', 'MoarVM', $gen_moar || $moar_want );
@@ -451,7 +478,7 @@ sub _m_stage_gencat {
451478
return $self->expand(<<TPL);
452479
$text
453480
\t\@echo(+++ Generating\t\$\@)@
454-
\t\@noecho\@\@bpm(\@ucstage\@_GEN_CAT)\@ \@prereqs\@ > \$\@
481+
\t\$(NOECHO)\@bpm(\@ucstage\@_GEN_CAT)\@ \@prereqs\@ > \$\@
455482
TPL
456483
}
457484

@@ -465,7 +492,7 @@ sub _m_stage_precomp {
465492
return $self->expand(<<TPL);
466493
$text
467494
\t\@echo(+++ Compiling\t\$\@)@
468-
\t\@noecho\@\@bpm(STAGE\@prev_stage\@_NQP)\@\@expand(\@setting_path_param\@\@module_path_param\@)\@ --no-regex-lib --target=\@btarget\@ --setting=\@nqp_setting\@ \@bpm(PRECOMP_\@ucstage\@_FLAGS)\@ --output=\$\@ \@prereqs\@
495+
\t\$(NOECHO)\@bpm(STAGE\@prev_stage\@_NQP)\@\@expand(\@setting_path_param\@\@module_path_param\@)\@ --no-regex-lib --target=\@btarget\@ --setting=\@nqp_setting\@ \@bpm(PRECOMP_\@ucstage\@_FLAGS)\@ --output=\$\@ \@prereqs\@
469496
TPL
470497
}
471498

tools/templates/MOAR_REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2019.11
1+
2019.07.1-321-g97615be0a

tools/templates/Makefile-backend-common.in

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
@backend_prefix@-dirs::
5757
@echo(+++ Preparing @uc(@backend@)@ build directories)@
58-
@noecho@$(MKPATH)@for_stages( @stage_dir@)@
58+
$(NOECHO)$(MKPATH)@for_stages( @stage_dir@)@
5959

6060
@backend_prefix@-stage0::
6161
@echo(++++++ BUILDING @uc(@backend@)@ BACKEND)@
@@ -120,21 +120,21 @@
120120

121121
@nfp(@stage_dir@/@bsm(NQP)@)@: @prev_stage_dir@ @nfp(@stage_dir@/@bsm(QAST)@)@ @nfp(@stage_dir@/@bsm(P6QREGEX)@)@ @bpm(SOURCES)@
122122
@echo(+++ Creating stage @stage@ NQP)@
123-
@noecho@$(PERL5) @shquot(@script(gen-version.pl)@)@ @q($(PREFIX))@ @q($(NQP_HOME))@ @q($(NQP_LIB_DIR))@ > @nfpq(@stage_dir@/nqp-config.nqp)@
124-
@noecho@@bpm(@ucstage@_GEN_CAT)@ @bpm(NQP_SOURCES)@ @nfpq(@stage_dir@/nqp-config.nqp)@ > @nfpq(@stage_dir@/$(NQP_COMBINED))@
125-
@noecho@@bpm(@ucprev_stage@_NQP)@ --module-path=@shquot(@stage_dir@)@ --setting-path=@shquot(@stage_dir@)@ \
123+
$(NOECHO)$(PERL5) @shquot(@script(gen-version.pl)@)@ @q($(PREFIX))@ @q($(NQP_HOME))@ @q($(NQP_LIB_DIR))@ > @nfpq(@stage_dir@/nqp-config.nqp)@
124+
$(NOECHO@nop())@@bpm(@ucstage@_GEN_CAT)@ @bpm(NQP_SOURCES)@ @nfpq(@stage_dir@/nqp-config.nqp)@ > @nfpq(@stage_dir@/$(NQP_COMBINED))@
125+
$(NOECHO@nop())@@bpm(@ucprev_stage@_NQP)@ --module-path=@shquot(@stage_dir@)@ --setting-path=@shquot(@stage_dir@)@ \
126126
--setting=NQPCORE --target=@btarget@ --no-regex-lib @bpm(PRECOMP_@ucstage@_FLAGS)@ @bpm(NQP_@ucstage@_FLAGS)@ \
127127
--output=@nfpq(@stage_dir@/@bsm(NQP)@)@ @nfpq(@stage_dir@/$(NQP_COMBINED))@
128128
)@
129129

130130
@bsm(NQP)@: @backend_prefix@-stage2 #@bpm(STAGE2_OUTPUT)@
131131
@echo(+++ Installing @uc(@backend@)@ stage 2 files locally)@
132-
@noecho@$(CP) @bpm(STAGE2_OUTPUT)@ .
132+
$(NOECHO)$(CP) @bpm(STAGE2_OUTPUT)@ .
133133

134134
@bsm(P5QREGEX)@: $(P5QREGEX_SOURCES) @bsm(NQP)@ @bpm(BUILD_RUNNER)@
135135
@echo(+++ Compiling $@)@
136-
@noecho@@bpm(GEN_CAT)@ stage2 $(P5QREGEX_SOURCES) > @nfpq(@bpm(STAGE2_DIR)@/$(P5QREGEX_COMBINED))@
137-
@noecho@@bpm(BUILD_RUNNER_BIN)@ --target=@btarget@ --output=@bsm(P5QREGEX)@ \
136+
$(NOECHO@nop())@@bpm(GEN_CAT)@ stage2 $(P5QREGEX_SOURCES) > @nfpq(@bpm(STAGE2_DIR)@/$(P5QREGEX_COMBINED))@
137+
$(NOECHO@nop())@@bpm(BUILD_RUNNER_BIN)@ --target=@btarget@ --output=@bsm(P5QREGEX)@ \
138138
@nfpq(@bpm(STAGE2_DIR)@/$(P5QREGEX_COMBINED))@
139139

140140
@bpv(CLEANUPS)@ = \
@@ -148,22 +148,22 @@
148148

149149
@backend_prefix@-clean::
150150
@echo(+++ Cleaning @uc(@backend@)@ backend)@
151-
@noecho@$(RM_RF) @bpm(CLEANUPS)@ @bpm(CLEANUPS_EXTRA)@
151+
$(NOECHO)$(RM_RF) @bpm(CLEANUPS)@ @bpm(CLEANUPS_EXTRA)@
152152

153153
@backend_prefix@-install-dirs::
154154
@echo(+++ Creating @uc(@backend@)@ installation directories)@
155-
@noecho@$(MKPATH) @q($(DESTDIR)$(BIN_DIR))@
156-
@noecho@$(MKPATH) @q($(DESTDIR)$(NQP_LIB_DIR))@
157-
@noecho@$(MKPATH) @q($(DESTDIR@nop())@@bsm(NQP_LIB_DIR)@)@
155+
$(NOECHO)$(MKPATH) @q($(DESTDIR)$(BIN_DIR))@
156+
$(NOECHO)$(MKPATH) @q($(DESTDIR)$(NQP_LIB_DIR))@
157+
$(NOECHO)$(MKPATH) @q($(DESTDIR@nop())@@bsm(NQP_LIB_DIR)@)@
158158

159159
@backend_prefix@-install:: @backend_prefix@-all @backend_prefix@-install-dirs @@configure_script@@
160160
@echo(+++ Installing into $(DESTDIR)$(PREFIX))@
161-
@noecho@$(CP) @bpm(STAGE2_OUTPUT)@ @q($(DESTDIR)$(NQP_LIB_DIR))@
162-
@noecho@$(CP) @bsm(P5QREGEX)@ @q($(DESTDIR)$(NQP_LIB_DIR))@
161+
$(NOECHO)$(CP) @bpm(STAGE2_OUTPUT)@ @q($(DESTDIR)$(NQP_LIB_DIR))@
162+
$(NOECHO)$(CP) @bsm(P5QREGEX)@ @q($(DESTDIR)$(NQP_LIB_DIR))@
163163

164164
@backend_prefix@-bootstrap-files: @bpm(STAGE2_OUTPUT)@
165165
@echo(+++ BOOTSTRAPPING into @bpm(STAGE0_DIR)@)@
166-
@noecho@$(CP) @bpm(STAGE2_OUTPUT)@ @bpm(STAGE0_DIR)@
166+
$(NOECHO)$(CP) @bpm(STAGE2_OUTPUT)@ @bpm(STAGE0_DIR)@
167167

168168
## testing
169169

tools/templates/Makefile-common.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# common definitions used by all backends
22

3+
@NOECHO_declaration@
34
COMMON_HLL_SOURCES = \
45
@nfp(src/HLL/Grammar.nqp)@ \
56
@nfp(src/HLL/Actions.nqp)@ \

0 commit comments

Comments
 (0)