This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove unused %errno and $AUTOLOAD from the generated Errno.pm
[perl5.git] / ext / Errno / Makefile.PL
1 use ExtUtils::MakeMaker;
2 use Config;
3
4 my $arch = "$Config{'archname'}-$Config{'osvers'}";
5 my $got = "";
6 if (-e 'arch.txt') {
7     open my $in, "<", "arch.txt" or die "Can't read 'arch.txt': $!";
8     $got = <$in>;
9     close $in;
10 }
11 if ($got ne $arch) {
12     if (-e "Errno.pm") {
13         print "Removing old 'Errno.pm'\n";
14         unlink "Errno.pm" 
15             or die "Failed to remove out of date 'Errno.pm': $!";
16     }
17     open my $out, ">", "arch.txt" or die "Can't write 'arch.txt': $!";
18     print $out $arch;
19     close $out;
20 }
21
22 WriteMakefile(
23     NAME         => 'Errno',
24     VERSION_FROM => 'Errno_pm.PL',
25     PL_FILES     => {'Errno_pm.PL'=>'Errno.pm'},
26     PM           => {'Errno.pm' => '$(INST_LIBDIR)/Errno.pm'},
27     'clean'      => {FILES => 'Errno.pm arch.txt'},
28     'dist'       => {
29         COMPRESS => 'gzip -9f',
30         SUFFIX   => '.gz', 
31         DIST_DEFAULT => 'd/Errno.pm tardist',
32     },
33 );
34
35 sub MY::postamble {
36     my $TARG = MM->catfile('d','Errno.pm');
37 qq!$TARG : Makefile
38         echo '#This is a dummy file so CPAN will find a VERSION' > $TARG
39         echo 'package Errno;' >> $TARG
40         echo '\$\$VERSION = "\$(VERSION)";' >>$TARG
41         echo '#This is to make sure require will return an error' >>$TARG
42         echo '0;' >>$TARG
43
44 !
45 }