File: Makefile.PL

package info (click to toggle)
pgbadger 11.6-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 7,452 kB
  • sloc: javascript: 22,274; perl: 20,588; sh: 4; makefile: 2
file content (83 lines) | stat: -rw-r--r-- 2,171 bytes parent folder | download | duplicates (2)
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
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.

use strict;

my @ALLOWED_ARGS = ('INSTALLDIRS','DESTDIR');

# Parse command line arguments and store them as environment variables
while ($_ = shift) {
	my ($k,$v) = split(/=/, $_, 2);
	if (grep(/^$k$/, @ALLOWED_ARGS)) {
		$ENV{$k} = $v;
	}
}
$ENV{DESTDIR} =~ s/\/$//;

# Default install path
my $DESTDIR = $ENV{DESTDIR} || '';
my $INSTALLDIRS = $ENV{INSTALLDIRS} || 'site';
my %merge_compat = ();

if ($ExtUtils::MakeMaker::VERSION >= 6.46) {
	%merge_compat = (
		'META_MERGE'   => {
			resources  => {
				homepage => 'http://pgbadger.darold.net/',
				repository  => {
					type => 'git',
					git => 'git@github.com:darold/pgbadger.git',
					web => 'https://github.com/darold/pgbadger',
				},
			},
		}
	);
}

sub MY::postamble {
    return <<'EOMAKE';
USE_MARKDOWN=$(shell which pod2markdown)

README: doc/pgBadger.pod
	pod2text $^ > $@
ifneq ("$(USE_MARKDOWN)", "")
	cat doc/pgBadger.pod | grep "=head1 " | sed 's/^=head1 \(.*\)/- [\1](#\1)/' | sed 's/ /-/g' | sed 's/--/- /' > $@.md
	sed -i '1s/^/### TABLE OF CONTENTS\n\n/' $@.md
	echo >> $@.md
	pod2markdown $^ | sed 's/^## /#### /' | sed 's/^# /### /' >> $@.md
endif

.INTERMEDIATE: doc/synopsis.pod
doc/synopsis.pod: Makefile pgbadger
	echo "=head1 SYNOPSIS" > $@
	./pgbadger --help >> $@
	echo "=head1 DESCRIPTION" >> $@
	sed -i.bak 's/ +$$//g' $@
	rm $@.bak

.PHONY: doc/pgBadger.pod
doc/pgBadger.pod: doc/synopsis.pod Makefile
	sed -i.bak '/^=head1 SYNOPSIS/,/^=head1 DESCRIPTION/d' $@
	sed -i.bak '4r $<' $@
	rm $@.bak
EOMAKE
}

WriteMakefile(
	'DISTNAME'	=> 'pgbadger',
	'NAME'		=> 'pgBadger',
	'VERSION_FROM'	=> 'pgbadger',
	'dist'  => {
			'COMPRESS'=>'gzip -9f', 'SUFFIX' => 'gz',
			'ZIP'=>'/usr/bin/zip','ZIPFLAGS'=>'-rl'
		   },
	'AUTHOR'       => 'Gilles Darold (gilles@darold.net)',
	'ABSTRACT'     => 'pgBadger - PostgreSQL log analysis report',
	'EXE_FILES'    => [ qw(pgbadger) ],
	'MAN1PODS'     => { 'doc/pgBadger.pod' => 'blib/man1/pgbadger.1p' },
	'DESTDIR'      => $DESTDIR,
	'INSTALLDIRS'  => $INSTALLDIRS,
	'clean'	       => {},
	%merge_compat
);