xref: /openbsd-src/gnu/usr.bin/perl/dist/XSLoader/Makefile.PL (revision eac174f2741a08d8deb8aae59a7f778ef9b5d770)
1# A template for Makefile.PL.
2# - Set the $PACKAGE variable to the name of your module.
3# - Set $LAST_API_CHANGE to reflect the last version you changed the API
4#   of your module.
5# - Fill in your dependencies in PREREQ_PM
6# Alternatively, you can say the hell with this and use h2xs.
7
8use strict;
9use warnings;
10
11use v5.6;
12
13use ExtUtils::MakeMaker;
14use ExtUtils::MM_Unix;
15
16eval 'use ExtUtils::MakeMaker::Coverage';
17
18my $PACKAGE = 'XSLoader';
19(my $PACKAGE_FILE = $PACKAGE) =~ s|::|/|g;
20my $LAST_API_CHANGE = 0;
21
22my $CURRENT_VERSION;
23{
24    no strict 'refs';
25    $CURRENT_VERSION = ${$PACKAGE.'::VERSION'};
26}
27my $NEW_VERSION     = ExtUtils::MM_Unix->parse_version("XSLoader_pm.PL");
28
29eval "require $PACKAGE";
30
31unless ($@) { # Make sure we did find the module.
32    print <<"CHANGE_WARN" if $CURRENT_VERSION < $LAST_API_CHANGE;
33
34NOTE: There have been API changes between this version and any older
35than version $LAST_API_CHANGE!  Please read the Changes file if you
36are upgrading from a version older than $LAST_API_CHANGE.
37
38CHANGE_WARN
39}
40
41# In case the empty lib/ directory was not created.
42mkdir 'lib', 0755 unless $ENV{PERL_CORE};
43
44# starting with Perl 5.11, "site" and "vendor" directories finally are
45# before "perl" (core) in @INC, thus allowing dual-life modules to be
46# updated without the need to overwrite the old version
47my $installdirs = $] < 5.011 ? "perl" : "site";
48
49WriteMakefile(
50    NAME            => $PACKAGE,
51    LICENSE         => 'perl',
52    AUTHOR          => 'Sebastien Aperghis-Tramoni <sebastien@aperghis.net>',
53    VERSION_FROM    => 'XSLoader_pm.PL',
54    ABSTRACT_FROM   => 'XSLoader_pm.PL',
55    INSTALLDIRS     => $installdirs,
56    PL_FILES        => { 'XSLoader_pm.PL'  => 'XSLoader.pm' },
57    PM              => { 'XSLoader.pm' => '$(INST_ARCHLIB)/XSLoader.pm' },
58    PREREQ_PM       => {
59        # NOTE: If we should require a Test::More version higher than 0.98
60        # (that included with perl 5.14), we need to remove the meta-spec
61        # entry below for EUMM 6.57_02 to 6.57_06 (the buggy versions
62        # included with perl 5.14).  Otherwise installation will break.
63        # See https://github.com/Perl-Toolchain-Gang/CPAN-Meta/issues/118
64        # for details.
65        'Test::More' => '0.47',
66    },
67    META_MERGE      => {
68        'meta-spec'     => { version => 2 },
69        dynamic_config  => 0,
70        resources       => {
71            repository  => {
72                type        => 'git',
73                url         => 'git://perl5.git.perl.org/perl.git',
74            },
75            homepage    => 'https://metacpan.org/module/XSLoader',
76            x_IRC       => 'irc://irc.perl.org/#p5p',
77            x_MailingList => 'http://lists.perl.org/list/perl5-porters.html',
78            bugtracker => {
79                web         => 'https://github.com/Perl/perl5/issues',
80            },
81        },
82        provides    => {
83            'XSLoader'  => {
84                file        => 'XSLoader_pm.PL',
85                version     => $NEW_VERSION,
86            },
87        },
88    },
89    dist            => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
90    clean           => { FILES => 'XSLoader-* XSLoader.pm' },
91);
92
93# Unlink the .pm file included with the distribution
941 while unlink "XSLoader.pm";
95
96{
97    package MY;
98
99    sub test_via_harness {
100        my($self, $orig_perl, $tests) = @_;
101
102        my @perls = ($orig_perl);
103        push @perls, qw(bleadperl
104                        perl5.6.1
105                        perl5.6.0)
106          if $ENV{PERL_TEST_ALL};
107
108        my $out;
109        foreach my $perl (@perls) {
110            $out .= $self->SUPER::test_via_harness($perl, $tests);
111        }
112
113        return $out;
114    }
115}
116