summaryrefslogtreecommitdiff
path: root/Makefile.PL
blob: 82e3948cb30bd0f4b121a3da66e5fa8a25e4e3bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# $Id: Makefile.PL 12712 2009-04-23 16:22:51Z turnstep $

use ExtUtils::MakeMaker qw/WriteMakefile/;
use Config;
use strict;
use warnings;
use 5.006001;

my $VERSION = '2.22.0';

if ($VERSION =~ /_/) {
    print "WARNING! This is a test version ($VERSION) and should not be used in production!\n";
}

if (grep { /help/ } @ARGV) {
    print qq{
Usage: perl $0

The usual steps to install check_postgres.pl:

1.   perl Makefile.PL
2.   make
3.   make test
4.   make install

Do steps 1 to 3 as a normal user, not as root!

See the README file for more help.

If all else fails, email check_postgres\@bucardo.org for help.

};

    exit 1;


}

my @cleanfiles = (
	'test_database_check_postgres/',
	'test_database_check_postgres2/',
	'test_database_check_postgres3/',
	'test_database_check_postgres4/',
	'test_database_check_postgres5/',
    '/tmp/cptesting_socket',
    '/tmp/cptesting_socket2',
    '/tmp/cptesting_socket3',
    '/tmp/cptesting_socket4',
    '/tmp/cptesting_socket5',
);

print "Configuring check_postgres $VERSION\n";

my %opts = (
    NAME           => 'check_postgres',
    ABSTRACT       => 'Postgres monitoring script',
    AUTHOR         => 'Greg Sabino Mullane <[email protected]>',
    PREREQ_PM      => {
        'ExtUtils::MakeMaker' => '6.11',
        'Test::More'          => '0.61',
        'version'             => '0',
    },
    NO_META        => 1,
    VERSION_FROM   => 'check_postgres.pl',
    EXE_FILES      => ['check_postgres.pl'],
    MAN1PODS       => { 'check_postgres.pl' => 'blib/man1/check_postgres.1p'},
    NEEDS_LINKING  => 0,
    NORECURS       => 1,
    PM             => {},
    clean          => { FILES => join ' ' => @cleanfiles },
);

WriteMakefile(%opts);

exit 0;

package MY;

sub postamble {
    return <<'HERE';

SEVERITY=4

critic: all critic-program critic-tests

critic-program:
	perlcritic --severity=$(SEVERITY) -profile perlcriticrc check_postgres.pl

critic-tests:
	perlcritic --severity=$(SEVERITY) -profile perlcriticrc t/*.t

HERE
}

sub clean { ## no critic (RequireArgUnpacking)
    my $string = shift->SUPER::clean(@_);
    $string =~ s{\t}{\tperl t/99_cleanup\.t\n\t};
    $string .= qq{\nsignature_asc : \n};
    $string .= qq{\t@ gpg --yes -ba check_postgres.pl\n};
    $string .= qq{\t@ gpg --verify check_postgres.pl.asc\n};
    $string .= qq{\n\nhtml : \n\t};
    $string .= <<'EOM';
	pod2html check_postgres.pl > check_postgres.pl.html
	@ perl -pi -e "s/<link.*?>//" check_postgres.pl.html
	@ perl -pi -e "s~ git clone.*~ git clone git://bucardo.org/check_postgres.git</pre>~" check_postgres.pl.html
	@ perl -pi -e "s~<title>\S+(.+)~<title>check_postgres.pl\\1~" check_postgres.pl.html
	@ perl -pi -e "s~\`\`(.+?)''~&quot;\\1&quot;~g" check_postgres.pl.html
	@ rm -f pod2htmd.tmp pod2htmi.tmp
EOM
    return $string;
}

# vim: expandtab tabstop=8 softtabstop=4 shiftwidth=4:
# end of Makefile.PL