1#!/usr/bin/perl -w
2
3use 5.006;
4use strict;
5
6use lib ".";
7
8use lib qw(lib);    # build ourself with ourself
9
10use File::Spec;
11use ExtUtils::MakeMaker 6.50;
12
13my $BUILDING_AS_PACKAGE = $ENV{BUILDING_AS_PACKAGE} || ( grep { m!^\-\-release$! } @ARGV );
14
15my $Is_VMS = $^O eq 'VMS';
16
17check_environment();
18
19my (%Extra_Params, %Extra_Prereqs, %Extra_Test_Prereqs);
20
21# Special case for MakeMaker being built as a vendor package
22if( $BUILDING_AS_PACKAGE ) {
23    # Some of these are lower than what we bundle.  That's ok, we
24    # bundle the latest because we might as well, but we don't want to
25    # burden vendors with having to update everything.
26    %Extra_Prereqs = (
27        'CPAN::Meta'               => '2.143240', # compat with CMR 2.130
28        'ExtUtils::Install'        => '1.52',
29        'ExtUtils::Manifest'       => '1.70',
30        'version'                  => '0',
31    );
32    $Extra_Prereqs{'JSON::PP::Compat5006'} = '1.09' if "$]" < 5.008;
33
34    %Extra_Test_Prereqs = (
35        'File::Temp'               => '0.22',
36        'Scalar::Util'             => '1.13',
37    );
38}
39else {
40   eval {
41      require ExtUtils::Manifest;
42      require ExtUtils::Install;
43   }
44   or do {
45     $Extra_Params{PERL} = "$^X -Iinc";
46   };
47
48}
49
50# Test::Harnesses prior to 2.00 shoved all of @INC onto the command line
51# when a test had -T.  This made it too long.  So we need a Test::Harness
52# > 2.00 on VMS for t/testlib.t
53$Extra_Prereqs{'Test::Harness'} = 2.00 if $^O eq 'VMS';
54
55my $MM = WriteMakefile(
56    NAME          => 'ExtUtils::MakeMaker',
57    VERSION_FROM  => "lib/ExtUtils/MakeMaker.pm",
58    ABSTRACT_FROM => "lib/ExtUtils/MakeMaker.pm",
59
60    PREREQ_PM => {
61        %Extra_Prereqs,
62        'File::Spec'     => 0.8,               # splitpath(), rel2abs()
63        'Pod::Man'       => 0,                 # manifypods needs Pod::Man
64        'File::Basename' => 0,
65        'Data::Dumper'   => 0,
66        ("$]" > 5.008 ? (Encode => 0) : ()),
67    },
68    TEST_REQUIRES    => \%Extra_Test_Prereqs,
69
70    MIN_PERL_VERSION => '5.006',
71    PMLIBDIRS        => [qw(lib inc)],
72    PMLIBPARENTDIRS  => [qw(lib inc)],         # PMLIBPARENTDIRS is an experimental feature
73
74    META_MERGE => {
75        no_index => {
76            # Module::Metadata is inferring version from $version::VERSION
77            # "in" is a PAUSE misparse.
78            package   => [ qw(DynaLoader in version) ],
79            directory => [ qw(bundled my) ],
80        },
81        resources => {
82            license     => 'https://dev.perl.org/licenses/',
83            homepage    => 'https://metacpan.org/release/ExtUtils-MakeMaker',
84            bugtracker  => 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker',
85            repository  => 'https://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker',
86            MailingList => 'makemaker@perl.org',
87        },
88    },
89
90    CONFIGURE_REQUIRES => {},                  # We don't need ourself to install ourself.
91    BUILD_REQUIRES     => {},                  # We don't need ourself to build ourself.
92    INSTALLDIRS        => ( "$]" < 5.012 ? 'perl' : 'site' ),
93    LICENSE            => 'perl',
94    AUTHOR             => 'Michael G Schwern <schwern@pobox.com>',
95
96    realclean              => {
97        FILES   => "inc"
98    },
99
100    %Extra_Params,
101
102    $^O =~ /win/i
103    ? (
104        dist => {
105            TAR      => 'ptar',
106            TARFLAGS => '-c -C -f',
107        },
108      )
109    : (),
110);
111
112# Display warnings about the environment.
113sub check_environment {
114    if ( $Is_VMS && $ENV{bin} ) {
115        print <<BIN_WARN;
116
117The logical name BIN may be present.  This may interfere with MakeMaker's
118tests and operations.  GNV is the prime suspect for setting this.
119
120BIN_WARN
121
122        sleep 2;
123    }
124}
125
126{
127    package MY;
128
129    # Make sure PERLRUN uses the MakeMaker about to be installed
130    # and not the currently installed one.
131    sub init_PERL {
132        my ( $self ) = shift;
133        $self->SUPER::init_PERL;
134
135        $self->{$_} .= q[ "-I$(INST_ARCHLIB)" "-I$(INST_LIB)"] for qw( PERLRUN FULLPERLRUN ABSPERLRUN );
136    }
137
138    sub special_targets {
139      my ( $self ) = shift;
140      my $make_frag = $self->SUPER::special_targets(@_);
141      return $make_frag if $Is_VMS or $self->is_make_type('dmake'); # not supported in MMS, MMK or by `dmake`
142      $make_frag .= <<'MAKE_FRAG';
143.NOTPARALLEL: pure_all
144
145MAKE_FRAG
146      return $make_frag;
147    }
148
149}
150