/
Makefile-5005.pm
140 lines (113 loc) · 2.74 KB
/
Makefile-5005.pm
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#!/usr/bin/perl
# $Id$
# rocco // vim: ts=2 sw=2 expandtab
use strict;
use ExtUtils::MakeMaker;
use lib qw(./mylib);
use PoeBuildInfo qw(
TEST_FILES
CLEAN_FILES
CORE_REQUIREMENTS
DIST_ABSTRACT
DIST_AUTHOR
RECOMMENDED_TIME_HIRES
);
### Touch files that will be generated at "make dist" time.
### ExtUtils::MakeMaker and Module::Build will complain about them if
### they aren't present now.
open(TOUCH, ">>CHANGES") and close TOUCH;
open(TOUCH, ">>META.yml") and close TOUCH;
### Some advisory dependency testing.
sub check_for_modules {
my ($dep_type, @modules) = @_;
my @failures;
while (@modules) {
my $module = shift @modules;
my $target = shift @modules;
my $version = eval "use $module (); return \$$module\::VERSION";
if ($@) {
push(
@failures,
"*** $module $target could not be loaded.\n"
);
}
elsif ($version < $target) {
push(
@failures,
"*** $module $target is $dep_type, " .
"but version $version is installed.\n"
);
}
}
if (@failures) {
warn(
"*** Some $dep_type features may not be available:\n",
@failures,
);
}
}
check_for_modules("required", CORE_REQUIREMENTS);
check_for_modules(
"optional",
"Compress::Zlib" => 1.33,
"Curses" => 1.08,
"Event" => 1.00,
"Gtk" => 0.7009,
"IO::Poll" => 0.01,
"IO::Pty" => 1.02,
"LWP" => 5.79,
"Socket6" => 0.14,
"Storable" => 2.12,
"Term::Cap" => 1.09,
"Term::ReadKey" => 2.21,
RECOMMENDED_TIME_HIRES,
"Tk" => 800.027,
"URI" => 1.30,
);
### Generate dynamic test files.
system($^X, "mylib/gen-tests.perl") and die "couldn't generate tests: $!";
### Generate Makefile.PL.
sub MY::postamble {
return <<EOF;
ppmdist: pm_to_blib
\cI\$(TAR) --exclude '*/man[13]*' -cvf \\
\cI\cI\$(DISTVNAME)-win32ppd.tar blib
\cI\$(COMPRESS) \$(DISTVNAME)-win32ppd.tar
ppddist: ppmdist
coverage: Makefile
\cI$^X mylib/coverage.perl
cover: coverage
EOF
}
WriteMakefile(
NAME => 'POE',
(
($^O eq 'MacOS')
? ()
: ( AUTHOR => DIST_AUTHOR,
ABSTRACT => DIST_ABSTRACT,
)
),
VERSION_FROM => 'lib/POE.pm',
dist => {
COMPRESS => 'gzip -9f',
SUFFIX => 'gz',
PREOP => (
'./mylib/svn-log.perl | ' .
'/usr/bin/tee ./$(DISTNAME)-$(VERSION)/CHANGES > ./CHANGES; ' .
"$^X mylib/gen-meta.perl; " .
'/bin/cp -f ./META.yml ./$(DISTNAME)-$(VERSION)/META.yml'
),
},
clean => {
FILES => CLEAN_FILES,
},
test => {
TESTS => TEST_FILES,
},
# More for META.yml than anything.
PL_FILES => { },
NO_META => 1,
PREREQ_PM => { CORE_REQUIREMENTS },
);
1;