-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.PL
More file actions
91 lines (89 loc) · 2.84 KB
/
Makefile.PL
File metadata and controls
91 lines (89 loc) · 2.84 KB
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
use 5.006;
use strict;
use ExtUtils::MakeMaker;
my $mm_ver = $ExtUtils::MakeMaker::VERSION;
if ($mm_ver =~ /_/) { # dev version
$mm_ver = eval $mm_ver;
die $@ if $@;
}
my %WriteMakefile=(
NAME => 'Docbook::Convert',
VERSION_FROM => 'lib/Docbook/Convert.pm',
ABSTRACT_FROM => 'lib/Docbook/Convert.pm',,
EXE_FILES => [
'bin/docbook-convert',
'bin/docbook2md',
'bin/docbook2pod'
],
LICENSE => 'perl',
AUTHOR => 'Andrew Speer <andrew.speer@isolutions.com.au>',
MIN_PERL_VERSION => '5.006',
PREREQ_PM => {
'Test::Simple' => '0.44',
'XML::Twig' => '3.40',
'Text::Table' => 0,
'HTML::Entities'=> 0,
},
META_MERGE => {
'meta-spec' => {
version => 2
},
resources => {
homepage => 'https://github.com/aspeer/Docbook-Convert',
repository => {
type => 'git',
url => 'https://github.com/aspeer/Docbook-Convert.git',
web => 'https://github.com/aspeer/Docbook-Convert'
}
}
},
'depend' => {
Makefile => '$(VERSION_FROM)',
},
'dist' => {
COMPRESS => 'gzip -9f',
SUFFIX => '.gz'
},
);
my %MM_Compat=(
'6.31' => [q(LICENSE)],
'6.46' => [q(META_MERGE)],
'6.48' => [q(MIN_PERL_VERSION)],
'6.52' => [q(CONFIGURE_REQUIRES)],
'6.5503' => [q(BUILD_REQUIRES)],
'6.64' => [q(TEST_REQUIRES)],
);
while (my($mm_ver_test, $ar)=each %MM_Compat) {
if (version->parse($mm_ver) < version->parse($mm_ver_test)) {
delete @WriteMakefile{@{$ar}};
}
}
WriteMakefile(%WriteMakefile);
package MY;
sub post_initialize {
# Add license file, other support files here
#
my $mm_or=shift();
$mm_or->{'PM'}{'LICENSE'}='$(INST_LIBDIR)/$(BASEEXT)/LICENSE';
$mm_or->SUPER::post_initialize;
};
sub postamble {
my $mm_or=shift();
my $postamble;
eval { ExtUtils::Git->import(); $postamble=&MY::postamble($mm_or) };
$postamble.=<<'END';
doc_xml:
@echo Generating doc
$(PERL) -I./lib bin/docbook-convert --markdown -o .md *.xml
$(PERL) -I./lib bin/docbook-convert --markdown --recursedir=./bin -o .md
$(PERL) -I./lib bin/docbook-convert --markdown --recursedir=./lib -o .md
$(PERL) -I./lib bin/docbook-convert --pod --recursedir=./bin --merge
$(PERL) -I./lib bin/docbook-convert --pod --recursedir=./lib --merge
pandoc --defaults=plain -f docbook -t plain README.xml > README
XML_TIDY = sh -c 'xmlstarlet fo "$$1" | sponge "$$1"'
doc_xml_tidy:
find bin -type f -name '*.xml' -exec $(XML_TIDY) _ {} \;
find lib -type f -name '*.xml' -exec $(XML_TIDY) _ {} \;
END
return $postamble;
}