@@ -7,26 +7,17 @@ use File::Copy qw(copy);
7
7
use base qw( Exporter) ;
8
8
our @EXPORT_OK = qw( sorry slurp system_or_die
9
9
cmp_rev
10
- read_parrot_config read_config
10
+ read_config
11
11
fill_template_file fill_template_text
12
12
git_checkout
13
13
verify_install gen_moar
14
14
github_url
15
15
probe_node
16
- gen_nqp gen_parrot ) ;
16
+ gen_nqp) ;
17
17
18
18
our $exe = $^O eq ' MSWin32' ? ' .exe' : ' ' ;
19
19
our $bat = $^O eq ' MSWin32' ? ' .bat' : ' ' ;
20
20
21
- our @required_parrot_files = qw(
22
- @bindir@/parrot@exe@
23
- @bindir@/pbc_to_exe@exe@
24
- @bindir@/@ops2c@@exe@
25
- @libdir@@versiondir@/tools/build/pmc2c.pl
26
- @srcdir@@versiondir@/pmc
27
- @includedir@@versiondir@/pmc
28
- ) ;
29
-
30
21
our @required_nqp_files = qw(
31
22
@bindir@/nqp-p@exe@
32
23
) ;
@@ -94,57 +85,6 @@ sub read_config {
94
85
}
95
86
96
87
97
- sub read_parrot_config {
98
- my @parrot_config_src = @_ ;
99
- my %config = ();
100
- open my $CONFIG_PIR , ' >' , ' parrot-config.pir'
101
- or die " Unable to write parrot-config.pir\n " ;
102
- print $CONFIG_PIR <<'END' ;
103
- .include 'iglobals.pasm'
104
- .sub "main" :main
105
- .local pmc interp, config_hash, config_iter
106
- interp = getinterp
107
- config_hash = interp[.IGLOBALS_CONFIG_HASH]
108
- config_iter = iter config_hash
109
- config_loop:
110
- unless config_iter goto config_done
111
- $P0 = shift config_iter
112
- print "parrot::"
113
- $S0 = $P0.'key'()
114
- print $S0
115
- print "="
116
- $S0 = $P0.'value'()
117
- print $S0
118
- print "\n"
119
- goto config_loop
120
- config_done:
121
- .return ()
122
- .end
123
- END
124
- close ($CONFIG_PIR );
125
-
126
- for my $file (@parrot_config_src ) {
127
- no warnings;
128
- if ($file =~ / .pir$ / && open my $PARROT_CONFIG , ' <' , $file ) {
129
- while (<$PARROT_CONFIG >) {
130
- if (/ P0\[ "(.*?)"\] , "(.*?)"/ ) { $config {" parrot::$1 " } = $2 }
131
- }
132
- close ($PARROT_CONFIG ) or die $! ;
133
- }
134
- elsif (open my $PARROT , ' -|' , " \" $file \" parrot-config.pir" ) {
135
- while (<$PARROT >) {
136
- if (/ ^([\w :]+)=(.*)/ ) { $config {$1 } = $2 }
137
- }
138
- close ($PARROT );
139
- }
140
- last if %config ;
141
- }
142
- unlink (' parrot-config.pir' );
143
- $config {' parrot::ops2c' } = ' ops2c' unless exists $config {' parrot::ops2c' };
144
- return %config ;
145
- }
146
-
147
-
148
88
sub fill_template_file {
149
89
my $infile = shift ;
150
90
my $outfile = shift ;
@@ -182,8 +122,8 @@ sub fill_template_text {
182
122
$str ;
183
123
};
184
124
185
- $text =~ s / @@([:\w ]+)@@/ $escape ->($config {$1 } || $config {"parrot:: $1 "} || '')/ ge ;
186
- $text =~ s / @([:\w ]+)@/ $config {$1 } || $config {"parrot:: $1 "} || ''/ ge ;
125
+ $text =~ s / @@([:\w ]+)@@/ $escape ->($config {$1 } || '')/ ge ;
126
+ $text =~ s / @([:\w ]+)@/ $config {$1 } || ''/ ge ;
187
127
if ($text =~ / nqp::makefile/ ) {
188
128
if ($^O eq ' MSWin32' ) {
189
129
$text =~ s { /} { \\ } g ;
@@ -272,7 +212,6 @@ sub gen_nqp {
272
212
273
213
my $backends = $options {' backends' };
274
214
my $gen_nqp = $options {' gen-nqp' };
275
- my $gen_parrot = $options {' gen-parrot' };
276
215
my $prefix = $options {' prefix' } || cwd().' /install' ;
277
216
my $startdir = cwd();
278
217
my $git_protocol = $options {' git-protocol' } || ' https' ;
@@ -281,26 +220,6 @@ sub gen_nqp {
281
220
282
221
my (%impls , %need );
283
222
284
- if ($backends =~ / parrot/ ) {
285
- my %c = read_parrot_config(" $prefix /bin/parrot" );
286
-
287
- if (%c ) {
288
- my $bin = fill_template_text(' @bindir@/nqp-p@ext@' , %c );
289
- $impls {parrot }{bin } = $bin ;
290
- %c = read_config($bin );
291
- my $nqp_have = $c {' nqp::version' };
292
- my $nqp_ok = $nqp_have && cmp_rev($nqp_have , $nqp_want ) >= 0;
293
- if ($nqp_ok ) {
294
- $impls {parrot }{config } = \%c ;
295
- }
296
- else {
297
- $need {parrot } = 1;
298
- }
299
- }
300
- else {
301
- $need {parrot } = 1;
302
- }
303
- }
304
223
for my $b (qw/ jvm moar/ ) {
305
224
if ($backends =~ / $b / ) {
306
225
my $postfix = substr $b , 0, 1;
@@ -320,7 +239,7 @@ sub gen_nqp {
320
239
321
240
return %impls unless %need ;
322
241
323
- if (defined $gen_nqp || defined $gen_parrot ) {
242
+ if (defined $gen_nqp ) {
324
243
git_checkout(
325
244
github_url($git_protocol , ' perl6' , ' nqp' ),
326
245
' nqp' , $nqp_want ,
@@ -330,15 +249,7 @@ sub gen_nqp {
330
249
);
331
250
}
332
251
333
- if ($need {parrot } && defined $gen_parrot ) {
334
- my ($par_want ) = split (' ' , slurp($PARROT_REVISION ));
335
- my $parrot = gen_parrot($par_want , %options , prefix => $prefix );
336
- my %c = read_parrot_config($parrot );
337
- $impls {parrot }{bin } = fill_template_text(' @bindir@/nqp-p@ext@' , %c );
338
- $impls {parrot }{config } = \%c ;
339
- }
340
-
341
- return %impls unless defined ($gen_nqp ) || defined ($gen_parrot );
252
+ return %impls unless defined ($gen_nqp );
342
253
343
254
my $backends_to_build = join ' ,' , sort keys %need ;
344
255
my @cmd = ($^X, ' Configure.pl' , " --prefix=$prefix " ,
@@ -357,81 +268,6 @@ sub gen_nqp {
357
268
return %impls ;
358
269
}
359
270
360
-
361
- sub gen_parrot {
362
- my $par_want = shift ;
363
- my %options = @_ ;
364
-
365
- my $prefix = $options {' prefix' } || cwd()." /install" ;
366
- my $gen_parrot = $options {' gen-parrot' };
367
- my @opts = @{ $options {' parrot-option' } || [] };
368
- push @opts , " --optimize" ;
369
- my $startdir = cwd();
370
- my $git_protocol = $options {' git-protocol' } || ' https' ;
371
-
372
- my $par_exe = " $options {'prefix'}/bin/parrot$exe " ;
373
- my %config = read_parrot_config($par_exe );
374
-
375
- my $par_have = $config {' parrot::git_describe' } || ' ' ;
376
- my $par_ok = $par_have && cmp_rev($par_have , $par_want ) >= 0;
377
- if ($gen_parrot ) {
378
- my $par_repo = git_checkout(
379
- github_url($git_protocol , ' parrot' , ' parrot' ),
380
- ' parrot' , $gen_parrot ,
381
- github_url(' ssh' , ' parrot' , ' parrot' ),
382
- $options {' git-depth' } ? " --depth=$options {'git-depth'}" : ' ' ,
383
- $options {' git-reference' } ? " --reference=$options {'git-reference'}/parrot" : ' ' ,
384
- );
385
- $par_ok = $par_have eq $par_repo ;
386
- }
387
- elsif (!$par_ok ) {
388
- git_checkout(
389
- github_url($git_protocol , ' parrot' , ' parrot' ),
390
- ' parrot' , $par_want ,
391
- github_url(' ssh' , ' parrot' , ' parrot' ),
392
- $options {' git-depth' } ? " --depth=$options {'git-depth'}" : ' ' ,
393
- $options {' git-reference' } ? " --reference=$options {'git-reference'}/parrot" : ' ' ,
394
- );
395
- }
396
-
397
- if ($par_ok ) {
398
- print " $par_exe is Parrot $par_have .\n " ;
399
- return $par_exe ;
400
- }
401
- chdir (" $startdir /parrot" ) or die $! ;
402
- if (-f ' Makefile' ) {
403
- %config = read_parrot_config(' config_lib.pir' );
404
- my $make = $config {' parrot::make' };
405
- if ($make ) {
406
- print " \n Performing '$make realclean' ...\n " ;
407
- system_or_die($make , ' realclean' );
408
- }
409
- }
410
-
411
- $prefix =~ s {\\ } { /} g ;
412
-
413
- print " \n Configuring Parrot ...\n " ;
414
- my @cmd = ($^X, " Configure.pl" , @opts , " --prefix=$prefix " );
415
- print " @cmd \n " ;
416
- system_or_die(@cmd );
417
-
418
- print " \n Building Parrot ...\n " ;
419
- %config = read_parrot_config(' config_lib.pir' );
420
- my $make = $config {' parrot::make' } or
421
- die " Unable to determine value for 'make' from parrot config\n " ;
422
- system_or_die($make , ' install-dev' );
423
- chdir ($startdir );
424
-
425
- # That is a hack to get the import-lib in place. Parrot seems unpatchable because
426
- # its static build shares the same libname as the import-lib.
427
- if (-e " $startdir /parrot/libparrot.lib" && !-e " $startdir /install/bin/libparrot.lib" ) {
428
- copy(" $startdir /parrot/libparrot.lib" , " $startdir /install/bin/libparrot.lib" );
429
- }
430
-
431
- print " Parrot installed.\n " ;
432
- return fill_template_text(' @bindir@/parrot@exe@' , %config );
433
- }
434
-
435
271
sub gen_moar {
436
272
my $moar_want = shift ;
437
273
my %options = @_ ;
0 commit comments