Explicitly load PerlIO::encoding when testing it.
[p5sagit/p5-mst-13.2.git] / ext / Errno / Makefile.PL
1 use ExtUtils::MakeMaker;
2 use Config;
3
4 @VMS = ($^O eq 'VMS') ? (MAN3PODS => {}) : ();
5
6 my $arch = "$Config{'archname'}-$Config{'osvers'}";
7 my $got = "";
8 if (-e 'arch.txt') {
9     open my $in, "<", "arch.txt" or die "Can't read 'arch.txt': $!";
10     $got = <$in>;
11     close $in;
12 }
13 if ($got ne $arch) {
14     if (-e "Errno.pm") {
15         print "Removing old 'Errno.pm'\n";
16         unlink "Errno.pm" 
17             or die "Failed to remove out of date 'Errno.pm': $!";
18     }
19     open my $out, ">", "arch.txt" or die "Can't write 'arch.txt': $!";
20     print $out $arch;
21     close $out;
22 }
23
24 WriteMakefile(
25     NAME         => 'Errno',
26     VERSION_FROM => 'Errno_pm.PL',
27     MAN3PODS     => {},         # Pods will be built by installman.
28     PL_FILES     => {'Errno_pm.PL'=>'Errno.pm'},
29     PM           => {'Errno.pm' => '$(INST_LIBDIR)/Errno.pm'},
30     'clean'      => {FILES => 'Errno.pm arch.txt'},
31     'dist'       => {
32         COMPRESS => 'gzip -9f',
33         SUFFIX   => '.gz', 
34         DIST_DEFAULT => 'd/Errno.pm tardist',
35     },
36     @VMS,
37 );
38
39 sub MY::postamble {
40     my $TARG = MM->catfile('d','Errno.pm');
41 qq!$TARG : Makefile
42         echo '#This is a dummy file so CPAN will find a VERSION' > $TARG
43         echo 'package Errno;' >> $TARG
44         echo '\$\$VERSION = "\$(VERSION)";' >>$TARG
45         echo '#This is to make sure require will return an error' >>$TARG
46         echo '0;' >>$TARG
47
48 !
49 }