-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile.PL
218 lines (196 loc) · 7.24 KB
/
Makefile.PL
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
use strict;
use warnings FATAL => 'all';
my %META = (
name => 'local-lib',
license => 'perl_5',
prereqs => {
configure => { requires => {
} },
build => { requires => {
} },
test => { requires => {
'Test::More' => 0,
} },
runtime => { requires => {
'perl' => 5.006,
'ExtUtils::MakeMaker' => '7.00', # version INSTALL_BASE taken as string, not shell
'ExtUtils::Install' => '1.43', # version INSTALL_BASE was added
'Module::Build' => '0.36', # PERL_MB_OPT
'CPAN' => '1.82', # sudo support + CPAN::HandleConfig
} },
develop => {
requires => {
'Module::Build' => '0.36',
'Test::EOL' => 0,
'Test::NoTabs' => 0,
'Test::Pod' => 0,
'Capture::Tiny' => 0,
'Test::More' => 0.81_01,
'Test::CPAN::Changes' => 0,
},
},
},
resources => {
repository => {
url => 'git://github.com/Perl-Toolchain-Gang/local-lib',
web => 'https://github.com/Perl-Toolchain-Gang/local-lib',
type => 'git',
},
x_IRC => 'irc://irc.perl.org/#local-lib',
bugtracker => {
web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=local-lib',
mailto => '[email protected]',
},
license => [ 'http://dev.perl.org/licenses/' ],
},
);
my %MM_ARGS = ();
##############################################################################
# Solaris (and possibly other Unices) have a tar in /usr/bin that, among
# other things, does not understand @LongLink. This can cause
# extraction to look like it succeeded, but it actually failed (because
# the error message for the @LongLink failure scrolled offscreen).
# Therefore, given the fact that GNU tar is the most widespread tar available,
# and it actually supports the feature we want (I'd bet it originated in GNU
# tar, but I digress), we'll look for GNU tar. If we don't find it, and the
# user hasn't pointed us to a suitable tar, we'll bomb and tell them what to
# do.
#
require File::Spec;
unless (exists $ENV{PERL_LL_TAR} ? -x $ENV{PERL_LL_TAR}
: $^O eq 'solaris'
? (grep -x,
map File::Spec->catfile($_, 'gtar'),
File::Spec->path)
: 1) {
die <<'DEATH';
You are using Solaris (or another traditional Unix) that does not provide a sane
tar, capable of dealing with the output of GNU tar. Please either set the
PERL_LL_TAR environment variable to the location of a version of tar that
understands the @LongLink convention or put a binary named gtar somewhere on
your PATH.
DEATH
}
# watch out for fancy dashes. these can wind up in our @ARGV if the user is
# copypasting the bootstrap command from the POD displayed e.g. by perldoc
# on a Mac OS X terminal. since no software recognizes and handles these
# dashes, it's better to die loudly telling the user exactly what happened
# so they don't make the same mistake again rather than being the only
# program in the universe that works with them.
# the fancy dash is U+2212 or \xE2\x88\x92
if(grep { /\xE2\x88\x92/ || /\x{2212}/ } @ARGV) {
die <<'DEATH';
WHOA THERE! It looks like you've got some fancy dashes in your commandline!
These are *not* the traditional -- dashes that software recognizes. You
probably got these by copy-pasting from the perldoc for this module as
rendered by a UTF8-capable formatter. This most typically happens on an OS X
terminal, but can happen elsewhere too. Please try again after replacing the
dashes with normal minus signs.
DEATH
}
my $disable_manpages;
if(my ($x) = grep { /^--no-manpages$/ } @ARGV) {
$disable_manpages = 1;
@ARGV = grep { !/^--no-manpages/ } @ARGV;
}
my $bootstrapping;
if (my ($x) = grep { /^--bootstrap(?:=.*)?$/ } @ARGV) {
@ARGV = grep { !/^--bootstrap(?:=.*)?$/ } @ARGV;
my ($path) = $x =~ /^--bootstrap(?:=(.*))?$/;
{
local @INC = @INC;
unshift(@INC, 'lib');
require local::lib;
}
local::lib->import($path || ());
$bootstrapping = 1;
}
my $requires = $MM_ARGS{PREREQ_PM} = { %{$META{prereqs}{runtime}{requires}} };
if ($ENV{PERL5_CPANM_IS_RUNNING}) {
$requires->{CPAN} = undef;
}
for my $module (grep { $_ ne 'perl' } keys %$requires) {
my $need_v = $requires->{$module} or next;
my $res = system($^X, '-Iinc', '-MCheckVersion', '-', $module, $need_v);
$res >>= 8;
if ($res == 0 || $res == 1) {
$requires->{$module} = undef;
}
}
if ($disable_manpages) {
$ENV{PERL_MM_OPT} = ($ENV{PERL_MM_OPT}||'') . ' INSTALLMAN1DIR=none INSTALLMAN3DIR=none';
$ENV{PERL_MB_OPT} = ($ENV{PERL_MB_OPT}||'') . ' --install_path libdoc="" --install_path bindoc=""';
$MM_ARGS{INSTALLMAN1DIR} = 'none';
$MM_ARGS{INSTALLMAN3DIR} = 'none';
}
if ($bootstrapping) {
my @modules = grep $requires->{$_},
qw(ExtUtils::MakeMaker ExtUtils::Install Module::Build CPAN);
{
no warnings 'once';
package MY;
*init_PERL = sub {
my $self = shift;
$self->SUPER::init_PERL(@_);
$self->{PERL} .= ' "-I$(INSTALLPRIVLIB)"';
$self->{FULLPERL} .= ' "-I$(INSTALLPRIVLIB)"';
};
}
local $ENV{PERL_AUTOINSTALL_PREFER_CPAN} = 1;
local $ENV{PERL_MM_USE_DEFAULT} = 1;
if (@modules || $disable_manpages) {
system($^X, '-Iinc', '-MCPANBootstrapper=init_config');
}
if (@modules) {
system($^X, '-Iinc', '-MCPANBootstrapper=install', '-', $_)
for @modules;
}
if (grep { $_ eq 'CPAN' } @modules ) {
system($^X, '-MCPAN', '-e', 'CPAN::Config->load;CPAN::Config->commit;');
}
if ($disable_manpages) {
system($^X, '-Iinc', '-MCPANBootstrapper=disable_manpages');
}
}
if (!$ENV{PERL5_CPANM_IS_RUNNING}) {
my $status = system $^X, '-Iinc', '-MCPANBootstrapper=check', '-',
$META{prereqs}{runtime}{requires}{CPAN};
exit $status
if $status;
}
## BOILERPLATE ###############################################################
require ExtUtils::MakeMaker;
(do './maint/Makefile.PL.include' or die $@) unless -f 'META.yml';
# have to do this since old EUMM dev releases miss the eval $VERSION line
my $eumm_version = eval $ExtUtils::MakeMaker::VERSION;
my $mymeta = $eumm_version >= 6.57_02;
my $mymeta_broken = $mymeta && $eumm_version < 6.57_07;
($MM_ARGS{NAME} = $META{name}) =~ s/-/::/g;
($MM_ARGS{VERSION_FROM} = "lib/$MM_ARGS{NAME}.pm") =~ s{::}{/}g;
$META{license} = [ $META{license} ]
if $META{license} && !ref $META{license};
$MM_ARGS{LICENSE} = $META{license}[0]
if $META{license} && $eumm_version >= 6.30;
$MM_ARGS{NO_MYMETA} = 1
if $mymeta_broken;
$MM_ARGS{META_ADD} = { 'meta-spec' => { version => 2 }, %META }
unless -f 'META.yml';
for (qw(configure build test runtime)) {
my $key = $_ eq 'runtime' ? 'PREREQ_PM' : uc $_.'_REQUIRES';
my $r = $MM_ARGS{$key} = {
%{$META{prereqs}{$_}{requires} || {}},
%{delete $MM_ARGS{$key} || {}},
};
defined $r->{$_} or delete $r->{$_} for keys %$r;
}
$MM_ARGS{MIN_PERL_VERSION} = delete $MM_ARGS{PREREQ_PM}{perl} || 0;
delete $MM_ARGS{MIN_PERL_VERSION}
if $eumm_version < 6.47_01;
$MM_ARGS{BUILD_REQUIRES} = {%{$MM_ARGS{BUILD_REQUIRES}}, %{delete $MM_ARGS{TEST_REQUIRES}}}
if $eumm_version < 6.63_03;
$MM_ARGS{PREREQ_PM} = {%{$MM_ARGS{PREREQ_PM}}, %{delete $MM_ARGS{BUILD_REQUIRES}}}
if $eumm_version < 6.55_01;
delete $MM_ARGS{CONFIGURE_REQUIRES}
if $eumm_version < 6.51_03;
ExtUtils::MakeMaker::WriteMakefile(%MM_ARGS);
## END BOILERPLATE ###########################################################