1#!/usr/bin/perl -w
2################################################################################
3#
4#  mktodo -- generate baseline and todo files by running mktodo.pl
5#
6# It calls plain 'mktodo' on each perl version it finds based on the input
7# parameters.
8#
9################################################################################
10#
11#  Version 3.x, Copyright (C) 2004-2013, Marcus Holland-Moritz.
12#  Version 2.x, Copyright (C) 2001, Paul Marquess.
13#  Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
14#
15#  This program is free software; you can redistribute it and/or
16#  modify it under the same terms as Perl itself.
17#
18################################################################################
19
20use strict;
21use Getopt::Long;
22
23require './devel/devtools.pl';
24require './parts/ppptools.pl';
25
26our %opt = (
27  base    => 0,     # If specified, this will generate base files, not todo ones
28  check   => 1,     # Do extra checking
29  verbose => 0,
30  install => '/tmp/perl/install/default',
31  blead   => 'bleadperl-debug',
32  debug   => 0,
33 'debug-start' => "",   # build an incomplete output, starting with the
34                        # specified perl of the form perl5.xxxyyy
35);
36
37# The way this works, is it expects to find perl binaries for a bunch of
38# different versions in a given directory.  This defaults to the 'install' one
39# listed above, but is overriddable by the --install parameter.  Comma
40# separating --install allows multiple source directories.
41# It also uses blead, again with an overridable default.
42#
43# It first verifies that the test file works properly for blead.
44#
45# Then it goes through the list of perl binaries sorted in decreasing order of
46# version number.  If something works in version n, but not in version n-1,
47# that means it was introduced (or perhaps fixed) in version n, and adds that
48# thing to the version n list.
49#
50# After everything is done, we have lists of what got added when.  The --base
51# parameter tells it to not use ppport.h when computing this.  Thus we get
52# what the official perls added when.  Without this parameter, we do use
53# ppport.h, so we get, as patched by ppport.h, what gets added when
54
55GetOptions(\%opt, qw( base check! verbose install=s blead=s blead-version=s
56                      debug=i debug-start=s skip-devels)) or die;
57
58identify();
59
60my $perls_ref = get_and_sort_perls(\%opt);
61
62# Go through all the perls, creating a todo file for it.
63for (my $i = 0; $i < @$perls_ref; $i++) {
64  my $this_perl = @{$perls_ref}[$i];
65  my @args = ('--perl',     $this_perl->{path},
66              '--version',  $this_perl->{version},
67              '--todo-dir', (($opt{base}) ? 'parts/base' : 'parts/todo')
68             );
69
70  push @args, '--blead' if $i == 0; # First one is blead
71  push @args, '--todo', $this_perl->{'todo'};
72  push @args, '--base' if $opt{base};
73  push @args, "--debug=$opt{debug}" if $opt{debug};
74  push @args, '--verbose' if $opt{verbose};
75  push @args, '--nocheck' unless $opt{check};
76  push @args, '--final', $this_perl->{'final'} if $this_perl->{'final'};
77  runperl('devel/mktodo.pl', @args)
78     or die "error running mktodo.pl [$!] [$?] " . join(" ", @args) . "\n";
79}
80