This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
new perldelta
[perl5.git] / ext / Errno / Makefile.PL
CommitLineData
eab60bb1 1use ExtUtils::MakeMaker;
90ec05ce 2use Config;
eab60bb1 3
90ec05ce
YO
4my $arch = "$Config{'archname'}-$Config{'osvers'}";
5my $got = "";
6if (-e 'arch.txt') {
7 open my $in, "<", "arch.txt" or die "Can't read 'arch.txt': $!";
8 $got = <$in>;
9 close $in;
10}
11if ($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
eab60bb1
GS
22WriteMakefile(
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'},
55612000 27 'clean' => {FILES => 'Errno.pm arch.txt'},
eab60bb1
GS
28 'dist' => {
29 COMPRESS => 'gzip -9f',
30 SUFFIX => '.gz',
31 DIST_DEFAULT => 'd/Errno.pm tardist',
32 },
eab60bb1
GS
33);
34
35sub MY::postamble {
36 my $TARG = MM->catfile('d','Errno.pm');
37qq!$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}