1#! /usr/bin/perl -w
2# Makefile.PL: Installation configuration for ExtUtils::MakeMaker
3use 5.008;
4use strict;
5use warnings;
6use Config qw(%Config);
7use ExtUtils::MakeMaker;
8
9# Check if there is any old file
10use vars qw(%old_version);
11%old_version = qw();
12foreach (qw(/usr/sbin/arclog.pl
13            /usr/sbin/arclog
14            /usr/share/man/man8/arclog.pl.8
15            /usr/share/man/man8/arclog.8
16            /usr/local/sbin/arclog.pl
17            /usr/local/sbin/arclog
18            /usr/local/share/man/man8/arclog.pl.8
19            /usr/local/share/man/man8/arclog.8)) {
20    $old_version{$_} = 1 if -e $_;
21}
22foreach my $cnf (qw(installman1dir installsiteman1dir installvendorman1dir
23                    man1dir man1direxp siteman1dir siteman1direxp sysman
24                    vendorman1dir vendorman1direxp)) {
25    next unless defined $Config{$cnf} && -d $Config{$cnf};
26    $_ = $Config{$cnf};
27    s/\/man1$/\/man8/;
28    $old_version{"$_/arclog.8"} = 1 if -e "$_/arclog.8";
29    $old_version{"$_/arclog.pl.8"} = 1 if -e "$_/arclog.pl.8";
30}
31foreach my $cnf (qw(installscript installsitescript installvendorscript
32                    scriptdir scriptdirexp sitescript sitescriptexp
33                    vendorscript vendorscriptexp
34                    bin binexp installbin installsitebin installvendorbin
35                    sitebin sitebinexp vendorbin vendorbinexp)) {
36    next unless defined $Config{$cnf} && -d $Config{$cnf};
37    $_ = $Config{$cnf};
38    s/\/bin$/\/sbin/;
39    $old_version{"$_/arclog"} = 1 if -e "$_/arclog";
40    $old_version{"$_/arclog.pl"} = 1 if -e "$_/arclog.pl";
41}
42if (keys %old_version > 0) {
43    $_ = join " ", sort keys %old_version;
44    warn << "EOT";
45-- Old Files Found
46You may remove the following old files after "make install":
47  $_
48EOT
49}
50
51# Optional prerequisite modules
52use vars qw(%OPT_PREREQ);
53%OPT_PREREQ = (
54    "File::MMagic"	=> 0,
55    "Compress::Zlib"	=> 0,
56    "Compress::Bzip2"	=> 2,
57    "Term::ReadKey"	=> 0,
58);
59delete $OPT_PREREQ{$_}
60    foreach grep eval "use $_ $OPT_PREREQ{$_}; 1;", sort keys %OPT_PREREQ;
61if (keys %OPT_PREREQ > 0) {
62    $_ = join " ", sort keys %OPT_PREREQ;
63    warn << "EOT";
64-- Optional Prerequisites
65You may wish to install these modules altogether.
66  $_
67EOT
68}
69
70WriteMakefile(
71    NAME		=> "arclog",
72    VERSION_FROM	=> "arclog",
73    ABSTRACT		=> "Archive log files monthly",
74    AUTHOR		=> "imacat <imacat\@mail.imacat.idv.tw>",
75    LICENSE		=> "gpl",
76    PREREQ_PM		=> {
77        "Date::Parse"		=> 0,
78    },
79    SIGN		=> 1,
80
81    EXE_FILES		=> [ "arclog" ],
82    dist		=> {
83        COMPRESS	=> "gzip -9",
84        SUFFIX		=> ".gz",
85    },
86    clean		=> {
87        FILES		=> "t/logs*",
88    },
89);
90
91__END__
92