1use ExtUtils::MakeMaker;
2
3# See lib/ExtUtils/MakeMaker.pm for details of how to influence
4# the contents of the Makefile that is written.
5
6# the package requires modern perl
7require 5.005_03;
8
9my $version = ExtUtils::MM_Unix->parse_version('lib/PerlPoint/Converters.pm');
10
11$ok=WriteMakefile(
12    'NAME'	=> 'PerlPoint-Converters',
13    'VERSION_FROM' => 'lib/PerlPoint/Converters.pm',
14     PREREQ_PM     => {
15                         PerlPoint::Parser => 0.40,
16                         Getopt::ArgvFile => 1.01,
17                      },
18    dist           => {
19                         COMPRESS => 'gzip -9',
20                         SUFFIX   => 'tgz',
21                      },
22    depend         => { Makefile => '$(VERSION_FROM)' },
23
24    EXE_FILES      => [
25                         "pp2html", "pp2latex"
26                      ],
27    clean => {FILES => "t/*.htm .*.ppcache doc/.*.ppcache" .
28                      " *.aux *.dvi *.tex *.ilg ppdoc.ps"
29                      },
30);
31
32# Replace 'perl' in ./doc/Makefile with current perl version:
33system("$^X -pi -e 's#^(PERL=)(\\S+)(.*)\$#\$1$^X\$3#' doc/Makefile");
34
35# Fix packet version number in pp2html and pp2latex
36# (... if I missed to do it manually :-)
37fix_version( 'pp2html', $version);
38fix_version( 'pp2latex', $version);
39
40# Provide additional informations
41warn <<EOM if $ok;
42
43Welcome to the PerlPoint-Converters package, version $version!
44
45The installation is well prepared now, and you 
46might run "make test" and "make install".
47
48Documentation is available in the ./doc subdirectory. 
49Start a "make" there and then have a look into the 
50./doc/PPDOC directory.
51
52EOM
53
54exit 0;
55
56#----------------------------------------------------------------------
57sub fix_version {
58  my ($file, $version) = @_;
59
60  rename $file, "$file.bak";
61
62  open(D, "$file.bak") or die "cannot open $file.bak for reading: $!\n";
63  open(W, ">$file") or die "cannot open $file for writing: $!\n";
64
65  while(<D>){
66    if (/^from PerlPoint::Converters Package/){
67      print W "from PerlPoint::Converters Package $version\n";
68      next;
69    }
70
71    print W $_;
72  }
73  close D;
74  close W;
75  unlink "$file.bak";
76  if ($^O =~ /linux/i){
77    system "chmod +x $file";
78  }
79}
80
81