Makefile.PL

filter: Statementstmt n/a Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« lib/CPANPLUS/Internals/Source/SQLite.pm ↑ Summary /dev/null »
1 #!/usr/bin/perl
2  
3 ### we /need/ perl5.6.1 or higher -- we use coderefs in @INC,
4 ### and 5.6.0 is just too buggy
5 use 5.006001;
6  
7 use strict;
8 use warnings;
9  
10 BEGIN {
11 ### chdir to the makefile.pl dir
12 use FindBin;
13 use lib $FindBin::Bin;
14  
15 use File::Spec;
16 use lib File::Spec->catdir( $FindBin::Bin, qw[lib] ); # cpanplus modules
17  
18 ### add the directory to our bundled modules
19 use vars qw[@ORIG_INC];
20 @ORIG_INC = @INC; # store for later use
21 lib->import( File::Spec->catdir( $FindBin::Bin, qw[inc bundle]) );
22 }
23  
24  
25 ### there's issues with redhat 9.0's stock perl -- they applied some
26 ### custom patches on their 5.8.0 and it breaks use constant a => sub {};
27 if( $^O eq 'linux' and -e '/etc/redhat-release' and
28 $] == '5.008' and (grep /Red Hat, Inc/, values %Config::Config)
29 ) {
30 print qq(
31 ### IMPORTANT! ######################################################
32  
33 You are using perl $] supplied by RedHat, who have applied custom
34 patches that break various perl modules, including this one.
35  
36 You will have to migrate to a perl without these flaws. You could
37 do this for example by building a perl installation by hand.
38 You can obtain the sources from www.cpan.org.
39  
40 We're sorry for the inconvenience.
41  
42 #####################################################################
43  
44 ) . $/;
45  
46 require 5.008001;
47 }
48  
49 ### it spews warnings though, so grep those out
50 ### also grep out the warnings we get from using Module::Loaded
51 BEGIN {
52 $SIG{__WARN__} = sub {
53 print STDERR "@_" if
54 "@_" !~ /^CPANPLUS::inc/ and
55 "@_" !~ /Constant subroutine/;
56 };
57 }
58  
59 use inc::Module::Install;
60 use Getopt::Long;
61 use CPANPLUS::Backend;
62 use CPANPLUS::Configure;
63 use CPANPLUS::Configure::Setup;
64 use CPANPLUS::Internals::Constants;
65 use Locale::Maketext::Simple Class => 'CPANPLUS', Style => 'gettext';
66  
67  
68 use constant BASIC_TESTS => qq[t/00_CPANPLUS-Internals-Utils.t];
69  
70  
71 my $Tests;
72 my $RunSetup;
73 GetOptions( 'setup' => \$RunSetup );
74  
75 my $Backend = CPANPLUS::Backend->new;
76 my $Config = CPANPLUS::Configure->new;
77  
78 ### no setup? this is easy.. print the message and move a long
79 unless( $RunSetup ) {
80 print qq[
81 ### IMPORTANT! ######################################################
82  
83  
84 As of CPANPLUS 0.070, configuration during 'perl Makefile.PL'
85 is no longer required. A default config is now shipped that
86 should work out of the box on most machines, for priviliged
87 and unprivileged users.
88  
89 If you wish to configure CPANPLUS to your environment, you can
90 either do that from the interactive shell after installation:
91  
92 \$ cpanp
93 CPAN Terminal> s reconfigure
94  
95 Or you can invoke this program as follows, to do it now:
96  
97 \$ $^X Makefile.PL --setup
98  
99 This also means that any config created by any CPANPLUS older
100 than 0.070 will no longer work, and you are required to
101 reconfigure. See the ChangeLog file for details.
102  
103 We appologize for the inconvenience.
104 ] . $/;
105  
106 ### ok, we're asked to run the setup stuff, let's do it
107 } else {
108  
109 my $setup = CPANPLUS::Configure::Setup->new(
110 backend => $Backend,
111 configure_object => $Config,
112 );
113  
114 $setup->init;
115 }
116  
117 { print loc("
118 ### PLEASE NOTE ###################################################
119  
120 CPANPLUS also ships a 'boxed' cpanp client, so you can run it
121 out of it's extraction dir, by typing:
122  
123 \$ perl bin/cpanp-boxed
124  
125 This may help you with bootstrap issues, or other situations
126 where you need to use CPANPLUS but can not use a system installation.
127  
128 You can install all of CPANPLUS' dependencies like this, before
129 installing CPANPLUS itself by running:
130  
131 \$ perl bin/cpanp-boxed -s selfupdate dependencies
132  
133 All the modules bundled are found in the 'inc/bundle' directory. If
134 you, for whatever reason, wish to not install these from cpan, you
135 could include them into your environment as such (using tcsh):
136  
137 \$ setenv PERL5LIB $FindBin::Bin/inc/bundle
138  
139 ###################################################################
140  
141 " );
142 print "\n";
143 }
144  
145 _check_site_bin();
146  
147 ### toss out the old source files, they might be compiled
148 ### in an incompatilbe format (rt #18121)
149 ### use 'can', because it might be different backend now
150 { my $pat = File::Spec->catfile(
151 $Config->get_conf('base'),
152 $Config->_get_source('stored') .'*'. STORABLE_EXT,
153 );
154  
155 for my $file( glob($pat) ) {
156 1 while $file && unlink $file;
157 }
158 }
159  
160 ### write the makefile.pl
161 { my $su = $Backend->selfupdate_object;
162 my %prereq = ( %{ $su->list_core_dependencies( 'AS_HASH' ) },
163 map { ### might not need anything -- make sure we
164 ### place an empty hash ref there
165 %{ $su->modules_for_feature( $_, 'AS_HASH' ) || {} }
166 } $su->list_enabled_features
167 );
168  
169 my $buildclean;
170 if ( $prereq{'CPANPLUS::Dist::Build'} ) {
171 delete $prereq{'CPANPLUS::Dist::Build'};
172 $prereq{'Module::Build'} = '0.32';
173 require File::Path; require File::Copy;
174 File::Path::mkpath( File::Spec->catdir(qw[lib CPANPLUS Dist Build]) ) or die "$!\n";
175 File::Copy::copy( File::Spec->catfile('bundled', 'Build.pm'), File::Spec->catfile(qw[lib CPANPLUS Dist], 'Build.pm') );
176 File::Copy::copy( File::Spec->catfile('bundled', 'Constants.pm'), File::Spec->catfile(qw[lib CPANPLUS Dist Build], 'Constants.pm' ) );
177 $buildclean = ' lib/CPANPLUS/Dist/Build*';
178 }
179  
180 my @scripts = _scripts();
181 my $extraclean .= join ' ', grep { /\d$/ } @scripts;
182  
183 ### restore the original @INC, so proper probing of missing
184 ### prereqs can be done
185 @INC = @ORIG_INC;
186 name ('CPANPLUS');
187 author ('Jos Boumans <kane@cpan.org>');
188 abstract ('Ameliorated interface to the CPAN');
189 version_from ('lib/CPANPLUS/Internals.pm');
190 license ('perl');
191 no_index ( directory => 'bundled' );
192 installdirs ( $] >= 5.009005 && $] < 5.012 ? 'perl' : 'site' ),
193 install_script ($_) for @scripts;
194 #install_script ($_) for grep { $_ !~ /cpanp-boxed/ } glob('bin/*');
195 requires (%prereq);
196 makemaker_args ( test => { TESTS => $Tests } ) if $Tests;
197 makemaker_args ( clean => { FILES =>
198 '.cpanplus t/.*.output t/*.rpt ' .
199 't/dummy-cpanplus/* t/dummy-cpanplus/.cpanplus '.
200 't/dummy-localmirror/* ' . 't/dummy-perl/arch ' .
201 't/dummy-perl/bin/* ' . 't/dummy-perl/lib/* ' .
202 't/dummy-perl/man/man1/* ' . 't/dummy-perl/man/man3/*'.
203 ( $extraclean ? " $extraclean" : '' ) .
204 ( $buildclean ? $buildclean : '' )
205 } );
206 repository ('https://github.com/jib/cpanplus-devel');
207  
208 ### write the makefile
209 ### this makes all prereqs rediscovered
210 { use Module::Loaded;
211 for ( keys %prereq ) {
212 mark_as_unloaded( $_ ) if is_loaded( $_ );
213 }
214  
215 ### silence warnings about redefines...
216 ### this will still warn about redefine of CONSTANTS subs...
217 no warnings; local $^W;
218 &WriteAll( check_nmake => 1 );
219 }
220 }
221  
222 sub _scripts {
223 my @scripts = grep { $_ !~ /cpanp-boxed/ } glob('bin/*');
224 if ( $] >= 5.009005 && $] < 5.019000 ) {
225 require Config;
226 my $version = sprintf("%vd",$^V);
227 if ( $Config::Config{versiononly} and
228 $Config::Config{startperl} =~ /\Q$version\E$/ ) {
229 require File::Copy;
230 File::Copy::copy( $_, "$_$version" ) for @scripts;
231 @scripts = glob("bin/*$version");
232 }
233 }
234 return @scripts;
235 }
236  
237 sub _check_site_bin
238 {
239 require Config;
240 return if $] < 5.012;
241 return if $Config::Config{installscript} eq $Config::Config{installsitescript};
242 print qq(
243 ### IMPORTANT! ######################################################
244  
245 Your site and core script locations are different. We will be put the
246 scripts provided by this distribution in the site location.
247  
248 Please ensure that the site location is in your PATH.
249  
250 #####################################################################
251  
252 ) . $/;
253 }
« lib/CPANPLUS/Internals/Source/SQLite.pm ↑ Summary /dev/null »