Commit | Line | Data |
eab60bb1 |
1 | use ExtUtils::MakeMaker; |
90ec05ce |
2 | use Config; |
eab60bb1 |
3 | |
69158f75 |
4 | @VMS = ($^O eq 'VMS') ? (MAN3PODS => {}) : (); |
eab60bb1 |
5 | |
90ec05ce |
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 | |
eab60bb1 |
24 | WriteMakefile( |
25 | NAME => 'Errno', |
26 | VERSION_FROM => 'Errno_pm.PL', |
69158f75 |
27 | MAN3PODS => {}, # Pods will be built by installman. |
eab60bb1 |
28 | PL_FILES => {'Errno_pm.PL'=>'Errno.pm'}, |
29 | PM => {'Errno.pm' => '$(INST_LIBDIR)/Errno.pm'}, |
55612000 |
30 | 'clean' => {FILES => 'Errno.pm arch.txt'}, |
eab60bb1 |
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 | } |