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
« blib/lib/PDL/Graphics/PGPLOT/Window.pm ↑ Summary blib/lib/PDL/PP/Struct.pm »
1 use strict;
2 use warnings;
3  
4 # using absolute path to make it valid also for Makefile.PL files in subdirectories
5 use Cwd;
6 use lib Cwd::abs_path('inc');
7  
8 eval { require Devel::CheckLib; Devel::CheckLib->import; };
9 use 5.010_000;
10 use ExtUtils::MakeMaker 6.56; # for CONFIGURE_REQUIRES support
11 use Config;
12 use File::Spec;
13  
14 $::PP_VERBOSE = $::PP_VERBOSE = 0; # =1 makes PP waffle a lot
15  
16 # file globals(!)
17 my ($pdl_f77conf, $forcebuild);
18 my ($seen_pdlconf, $seen_f77conf);
19 my $pdl_conf_file = ''; # apparently for users to change
20  
21 # build-system globals
22 our ($usenan, $bvalflag, $bvalPerPdl);
23  
24 sub checkbuggysetup {
25 # detect buggy Perl setups
26 if (!$forcebuild &&
27 $Config{osname} eq 'solaris' &&
28 ($Config{cc} =~ /gcc/ || $Config{gccversion} ne '') &&
29 $Config{usemymalloc} eq 'y'
30 ) {
31 die <<'EOM';
32  
33 FATAL BUG IN YOUR PERL SETUP DETECTED. BUILD TERMINATED.
34  
35 On this platform the combination of gcc and the Perl malloc
36 are buggy. The optimizations lead to random coredumps
37 and make PDL essentially unusable.
38  
39 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
40 WORKAROUND: YOU MUST RECOMPILE PERL WITH 'usemymalloc=n' !!!
41 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
42  
43 You may override and force the build by including the
44 'FORCE' switch:
45  
46 perl Makefile.PL FORCE
47  
48 However, you will most likely end up with an unusable
49 PDL build unless *all* optimizations are disabled!
50 YOU HAVE BEEN WARNED!!
51  
52 EOM
53 }
54  
55 my($dot);
56 for(@INC) {$dot += $_ eq '.'}
57 $dot-- if($INC[-1] eq '.');
58 if($dot) {
59 $INC = join(":",@INC);
60 warn << "EOM"
61  
62 **********************************************************************
63 Your Perl \@INC path is:
64  
65 $INC
66  
67 That seems to include the directory '.' before the last entry in the
68 path. Configurations like that might be broken, because they may
69 prevent strict division of hierarchy in the module name space.
70 In particular, adding a module Foo::Bar::Baz can cause trouble
71 if Baz exists in the top level elsewhere, and if you run from the
72 Foo/Bar directory.
73  
74 This happens with the PDL::Config and some other modules. You may
75 not be able to build PDL with this \@INC setup.
76  
77 If you strike trouble, you may need to fix your \@INC.
78 **********************************************************************
79  
80  
81 EOM
82 unless $ENV{PDL_INC_OK};
83 }
84  
85 }
86  
87 # The user specifies configuration options using the PDL_CONFIG
88 # array in perldl.conf - or ~/.perldl.conf or via the PDLCONF command-line
89 # argument.
90 #
91 # We need to use this information during the 'perl Makefile.PL' process,
92 # and historically this has been done by directly accessing %PDL_CONFIG
93 # (or %::PDL_CONFIG) variable. However, there are times that this information
94 # is also needed during the actual build (ie 'make' cycle), at which point
95 # the variable is not available. However Basic/Core/Config.pm is available,
96 # but this uses the %PDL::Config variable to access the data.
97 #
98 # So, we try to avoid this dichotomy by creating a %PDL::Config during
99 # the 'perl Makefile.PL' stage and then making sure that PDL_CONFIG
100 # is destroyed (so it can't be used by accident).
101 #
102 # Do we need to worry about Makefile.PL's hacking PDL_CONFIG?
103 # Probably...
104 #
105 %PDL::Config = ();
106  
107 sub getpdl_config {
108 my ($pdl_conf_file) = @_;
109  
110 # First read in distribution config file
111 #
112 our %PDL_CONFIG;
113 require './perldl.conf';
114  
115 # Add BAD_VAL tests if CPAN testers
116 #
117 if ($ENV{AUTOMATED_TESTING}) {
118 # warn "Makefile.PL: Automated testing environment: enabling USE_POGL config option\n";
119 # $PDL_CONFIG{USE_POGL} = 1;
120 }
121  
122 # Save standard values
123 #
124 my %PDL_CONFIG_DIST = %PDL_CONFIG;
125  
126 # Now read in the users config file if specified
127 # and convert y/n to 1/0
128 #
129 if (-f $pdl_conf_file) {
130 warn "\nINFORMATION: using file $pdl_conf_file to set configuration defaults\n\n";
131 require $pdl_conf_file;
132 }
133  
134 # Sanity checking of user supplied keys (look for ones not defined in dist)
135  
136 for(keys %PDL_CONFIG) {
137 if(!exists($PDL_CONFIG_DIST{$_})) {
138 die << "EOD";
139 Invalid key $_ found in user supplied $pdl_conf_file
140 - this key appears to be no longer in use.
141 Please review configuration options and check the comments in
142 the file perldl.conf that came with this distribution
143 EOD
144 }
145 }
146  
147 # Merge in default options where not supplied in users file
148 #
149 for(keys %PDL_CONFIG_DIST) {
150 $PDL_CONFIG{$_} = $PDL_CONFIG_DIST{$_} unless exists $PDL_CONFIG{$_};
151 }
152  
153 # Set up the default TEMPDIR if it has not been set by the user
154 #
155 # set up the default directory we use for temporary files throughout
156 # PDL. These are mainly for files created during the build of PDL itself,
157 # but it can also invovle files created whilst building an external
158 # module that uses PDL (e.g. the trylink() function of PDL::Dev needs
159 # a temporary file) or when a module is actually being used (e.g.
160 # PDL::IO::Dumper may need a temporary file).
161 #
162 # We have no policy about what directory to use - the following is
163 # an amalgam of the different choices that have been used within PDL
164 # up to (and including) v2.4.1
165 #
166  
167 $PDL_CONFIG{PDL_BUILD_DIR} = File::Spec->rel2abs(File::Spec->curdir());
168  
169 $PDL_CONFIG{TEMPDIR} = $^O =~ /MSWin32/i ? 'File::Spec->tmpdir()' : File::Spec->tmpdir()
170 unless exists $PDL_CONFIG{TEMPDIR} and defined $PDL_CONFIG{TEMPDIR};
171  
172 # set up the default MALLOCDBG information (if not specified by the user)
173 #
174 if ( exists $PDL_CONFIG{MALLOCDBG} and defined $PDL_CONFIG{MALLOCDBG} ) {
175 my $val = $PDL_CONFIG{MALLOCDBG};
176 my $rval = ref($val);
177 die "ERROR: MALLOCDBG must be set to an associative array, not to a " .
178 ( $rval ? $rval : "SCALAR" ) unless $rval eq "HASH";
179 } else {
180 $PDL_CONFIG{MALLOCDBG} = undef; # exists but undef
181 }
182 foreach my $item ( qw( libs include ) ) {
183 $PDL_CONFIG{MALLOCDBG}->{$item} = ""
184 unless exists $PDL_CONFIG{MALLOCDBG}->{$item};
185 }
186  
187 # filter out incompatible options for the 'bad' code.
188 # At present we can not have the experimental per-piddle
189 # code turned on (the BADVAL_PER_PDL option) and use
190 # NaN's for floating-point bad values (the BADVAL_USENAN
191 # option).
192 #
193 my $flag_bad = $PDL_CONFIG{WITH_BADVAL} || 0;
194 my $flag_per_pdl = $PDL_CONFIG{BADVAL_PER_PDL} || 0;
195 my $flag_use_nan = $PDL_CONFIG{BADVAL_USENAN} || 0;
196 if ( $flag_bad and $flag_per_pdl and $flag_use_nan ) {
197 print "WARNING: Setting BADVAL_USENAN=0 as BADVAL_PER_PDL option is set!\n\n";
198 $PDL_CONFIG{BADVAL_USENAN} = 0;
199 }
200  
201 # create a PDL::Config variable matching the PDL_CONFIG structure
202 # and convert yes/no answers to 1/0
203 #
204 for my $key ( keys %PDL_CONFIG ) {
205 my $val = $PDL_CONFIG{$key};
206 $val =~ s/^y.*/1/i if defined $val;
207 $val =~ s/^n.*/0/i if defined $val;
208 $PDL::Config{$key} = $val;
209 }
210  
211 # destroy PDL_CONFIG/PDL_CONFIG_DIST so that we can catch any accesses
212 # to them in other Makefile.PL's
213 #
214 %PDL_CONFIG = ();
215 }
216  
217 sub check_f77conf {
218 my ($seenyet) = @_;
219 return 0 unless $seenyet;
220  
221 my $pdl_f77conf = File::Spec->rel2abs($pdl_f77conf)
222 unless File::Spec->file_name_is_absolute($pdl_f77conf);
223 $PDL::Config{F77CONF} = $pdl_f77conf;
224 return 1;
225 }
226  
227 sub make_Version_pm {
228 # Get Version from Basic/PDL.pm and generated Basic/Core/Version.pm from it
229 require './Basic/PDL.pm';
230 # keep version info in $PDL::Config
231 $PDL::Config{PDL_BUILD_VERSION} = "$PDL::VERSION";
232  
233 my $versionFile = 'Basic/Core/Version.pm';
234 open my $fh, ">", $versionFile or
235 die("Can't Open '$versionFile' for Writing!\n");
236 print $fh <<"EOVF";
237 package PDL::Version;
238 # This File was autogenerated by MakeFile.PL from the version
239 # number in PDL.pm. It is used by PDL::Lite and others as
240 # a single, consistent place to get the current PDL version.
241 our \$VERSION='$PDL::VERSION';
242 \$VERSION = eval \$VERSION;
243 1;
244 EOVF
245 close $fh;
246 }
247  
248 sub make_Types_pm {
249 # make sure we have Types.pm ready for prime time
250 die "Types.pm.PL not found in Basic/Core"
251 unless -f 'Basic/Core/Types.pm.PL';
252 my $usebvals = $PDL::Config{WITH_BADVAL} ? "BADVALS=1" : "";
253 system( $Config{perlpath}, 'Basic/Core/Types.pm.PL', $usebvals);
254 unless ( -f 'Basic/Core/Types.pm' ) {
255 warn "system( $Config{perlpath}, 'Basic/Core/Types.pm.PL', $usebvals) was run...\n";
256 die "error creating Basic/Core/Types.pm";
257 }
258 }
259  
260 # very simple formatter, assumes structures are *not* nested
261 # used by make_PDL_Config_pm
262 sub myformat {
263 my $entry = shift;
264 if (ref $entry eq 'ARRAY') {
265 my $list = join ',', (map {('"'.quotemeta($_).'"')} @$entry);
266 return "[$list]";
267 } elsif (ref $entry eq 'HASH') {
268 my $list = join ",\n", (map {('"'.quotemeta($_).'" => "'.
269 quotemeta($entry->{$_}).'"')} sort keys %$entry);
270 $list = "\n$list\n\t\t" unless $list =~ /^\s*$/;
271 return "{$list}";
272 } else {
273 return join '', '"',quotemeta($PDL::Config{$_}),'"';
274 }
275 }
276  
277 sub make_PDL_Config_pm {
278 print "Writing Basic/Core/Config.pm\n";
279  
280 my $versionFile = "Basic/Core/Config.pm";
281 open my $fh, ">", $versionFile
282 or die "Couldn't open $versionFile for writing";
283 print $fh "
284 # AUTOMATICALLY GENERATED BY THE PDL TOPLEVEL Makefile.PL.
285 # DO NOT HAND-EDIT - CHANGES WILL BE LOST UPON YOUR NEXT
286 # 'perl Makefile.PL'!!!
287 package PDL;
288 use File::Spec;
289 \%PDL::Config = (\n";
290 for (sort keys %PDL::Config) {
291 $fh->print( "\t$_\t=>\t" );
292 if(defined $PDL::Config{$_}) {
293 if($PDL::Config{$_} eq 'File::Spec->tmpdir()') {$fh->print( $PDL::Config{$_} )}
294 else {$fh->print( myformat($PDL::Config{$_}) )}
295 } else {
296 $fh->print( "undef" );
297 }
298 $fh->print(",\n");
299 }
300 $fh->print( ");\n1;" );
301 $fh->close();
302 }
303  
304 # test for critical modules
305 my @hasnt = ();
306 my @test = (
307 ['Filter::Util::Call','Filter'],
308 ['Filter::Simple','Filter::Simple'],
309 ## ['Module::Compile','Module::Compile'], # don't do this, fails (why?)
310 ['Text::Balanced','Text::Balanced'],
311 );
312 ## $DB::single = 1; # uncomment to have debugger stop here
313 for my $mod (@test) {
314 eval "use $mod->[0]";
315 push @hasnt, $mod->[1] if $@;
316 }
317  
318 # Scan ARGV for config file argument
319 @ARGV = map {
320 if(/^PDLCONF=(.*)$/) {
321 $seen_pdlconf=1;
322 $pdl_conf_file = $1; ();
323 } elsif (/^F77CONF=(.*)$/) {
324 $seen_f77conf=1;
325 $pdl_f77conf=$1; ();
326 } elsif (/^FORCE$/i) {
327 $forcebuild=1;
328 ();
329 } else {
330 $_
331 }
332 } @ARGV;
333  
334 warn "WARNING: forcing build...\n" if $forcebuild;
335  
336 checkbuggysetup(); # check for buggy Perl setups
337  
338 unless ( $seen_pdlconf ) {
339 my $defname = "$ENV{HOME}/.perldl.conf";
340 $pdl_conf_file = $defname if -f $defname;
341 }
342  
343 # needs to be called before any of the make_XX routines
344 getpdl_config($pdl_conf_file);
345 $seen_f77conf = check_f77conf($seen_f77conf);
346  
347 # Check environment for SKIP_KNOWN_PROBLEMS
348 if (!defined($PDL::Config{SKIP_KNOWN_PROBLEMS}) and defined($ENV{SKIP_KNOWN_PROBLEMS})) {
349 $PDL::Config{SKIP_KNOWN_PROBLEMS} = $ENV{SKIP_KNOWN_PROBLEMS};
350 warn "Makefile.PL: setting SKIP_KNOWN_PROBLEMS Config from environment value: $ENV{SKIP_KNOWN_PROBLEMS}";
351 }
352 # Add check for POGL if USE_POGL is enabled
353 if (!defined($PDL::Config{USE_POGL}) or +$PDL::Config{USE_POGL}) {
354 eval "use OpenGL $PDL::Config{POGL_VERSION} qw();";
355 if ($@) {
356 if (defined($PDL::Config{USE_POGL})) {
357 warn "Makefile.PL: DEPENDENCY ERROR: USE_POGL requires at least OpenGL version $PDL::Config{POGL_VERSION}!\n";
358 exit 0;
359 } else {
360 warn "Makefile.PL: OpenGL-$PDL::Config{POGL_VERSION} not found, setting \$PDL::Config{USE_POGL} => 0\n";
361 $PDL::Config{USE_POGL} = 0;
362 }
363 } else {
364 # Have OpenGL so set USE_POGL option if needed
365 warn "Makefile.PL: Found required OpenGL version, setting USE_POGL => 1\n" unless defined($PDL::Config{USE_POGL});
366 $PDL::Config{USE_POGL} ||= 1;
367 }
368 } else {
369 warn "Makefile.PL: Have \$PDL::Config{USE_POGL} => 0 so skipping TriD build with POGL\n";
370 }
371  
372 make_Version_pm();
373  
374 make_Types_pm();
375  
376 # this will make PDL::Core::Dev's functions available
377 # in Makefile.PL files in all subdirectories
378 # IMPORTANT: it has to be after make_Types_pm()
379 require "./Basic/Core/Dev.pm"; PDL::Core::Dev->import();
380  
381 # only perform one test if required modules are missing
382 # the test will print an informational message and fail
383 my %notestsifmodulesmissing = @hasnt ? # are any required modules missing ?
384 (test => {TESTS => 't/requiredmods.t'}) : ();
385  
386 my @podpms = map { $_.".pod", '$(INST_LIBDIR)/PDL/' . $_ .".pod"}
387 qw/Bugs perldl pdldoc/;
388  
389 my @prereq = (
390 'Astro::FITS::Header' => 0,
391 'Carp' => 0, # Need to run
392 'Config' => 0, #
393 'Convert::UU' => 0, # for PDL::IO::Dumper
394 'Data::Dumper' => 2.121, # for PDL::IO::Dumper
395 'English' => 0,
396 'ExtUtils::MakeMaker' => 6.56, # for CONFIGURE_REQUIRES support
397 'ExtUtils::Manifest' => 0,
398 'Fcntl' => 0,
399 'File::Basename' => 0,
400 'File::Find' => 0,
401 'File::Map' => 0.57, # test new mmap implementation
402 'File::Path' => 0,
403 'File::Spec' => 0.6,
404 'File::Temp' => 0,
405 'Filter::Util::Call' => 0, # for PDL::NiceSlice
406 'Filter::Simple' => 0.88, # for new PDL::NiceSlice
407 'Inline' => 0.68,
408 'Inline::C' => 0.62,
409 'List::MoreUtils' => 0, # for PDL::IO::GD
410 'Module::Compile' => 0.23, # for new PDL::NiceSlice
411 'Pod::Parser' => 0, # version TBD for PDL::Doc
412 'Pod::Select' => 0, # version TBD for PDL::Doc
413 'Scalar::Util' => 0,
414 'Storable' => 1.03, # for PDL::IO::Storable
415 'Text::Balanced' => 1.89, # for PDL::NiceSlice
416 );
417  
418 # add OpenGL version dependency for CPAN to follow
419 push @prereq, ('OpenGL' => $PDL::Config{POGL_VERSION}) if $PDL::Config{USE_POGL};
420  
421 # push @prereq, ('ExtUtils::F77' => 1.10) unless $seen_f77conf;
422  
423 my @exe_files = qw(perldl pdldoc);
424 push @exe_files, "pdl$Config{exe_ext}" if $^O !~ /MSWin/;
425 my @cleanup = ("pdl$Config{exe_ext}", qw(
426 pdldoc.db pdldoc.pod perldl.pod Changes.new
427 t/callext$(OBJ_EXT) t/callext.$(DLEXT)
428 ));
429  
430 ##############################
431 # Hack to include fPIC on x86_64 systems -
432 # use similar mods to affect CCFLAGS on other systems as needed...
433  
434 my $ccflags = $Config{ccflags};
435 if($Config{archname}=~m/x86_64/) {
436 $ccflags .= " -fPIC";
437 }
438  
439 # create GENERATED subdir with *.pm files during 'make dist' (to make metacpan.org happy)
440 my $preop = '$(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -MPDL::Core::Dev -e pdlpp_mkgen $(DISTVNAME)';
441  
442 my %makefile_hash = (
443 'PREREQ_PM' => { @prereq },
444 'LICENSE' => 'perl',
445 'CONFIGURE_REQUIRES' => {
446 'Devel::CheckLib' => 1.01,
447 'Carp' => 1.20, # EU::MM seems to need this not to crash
448 'ExtUtils::MakeMaker' => 6.56,
449 'File::Path' => 0,
450 'ExtUtils::ParseXS' => 3.01, # avoids 2.21, known broken
451 },
452 TEST_REQUIRES => {
453 'CPAN::Meta' => '2.120900',
454 'IPC::Cmd' => 0.72,
455 'Test::Exception' => 0,
456 'Test::Warn' => 0, # for t/pptest.t
457 'Test::Deep' => 0,
458 },
459 BUILD_REQUIRES => {
460 'ExtUtils::MakeMaker' => 0,
461 'File::Path' => 0,
462 },
463 'MIN_PERL_VERSION' => '5.010',
464 'NAME' => 'PDL',
465 'VERSION_FROM' => 'Basic/Core/Version.pm',
466 'EXE_FILES' => \@exe_files,
467 'PM' => { @podpms }, #so that the script docs are picked up
468 'META_MERGE' => {
469 "meta-spec" => { version => 2 },
470 resources => {
471 homepage => 'http://pdl.perl.org/',
472 bugtracker => 'https://github.com/PDLPorters/pdl/issues',
473 repository => {
474 url => 'git://github.com/PDLPorters/pdl.git',
475 type => 'git',
476 web => 'https://github.com/PDLPorters/pdl',
477 },
478 },
479 no_index => { file => ['Doc/scantree.pl'] },
480 x_IRC => 'irc://irc.perl.org/#pdl',
481 },
482 'MAN1PODS' => { 'Bugs.pod' => '$(INST_MAN1DIR)/PDL::Bugs.$(MAN1EXT)',
483 'perldl' => '$(INST_MAN1DIR)/perldl.$(MAN1EXT)',
484 'pdldoc' => '$(INST_MAN1DIR)/pdldoc.$(MAN1EXT)' },
485 'MAN3PODS' => {}, # don't pick up the script pods again
486 'OPTIMIZE' => $PDL::Config{OPTIMIZE} || $Config{optimize},
487 'CCFLAGS' => $ccflags,
488 'dist' => { COMPRESS => 'gzip',
489 SUFFIX => 'gz',
490 PREOP => $preop },
491 'clean' => {
492 'FILES' => join ' ', @cleanup, qw(
493 tbyte.tif tmp0 tmp0.hdr tushort.tif
494 MANIFEST.bak tmp1* tmpraw* t/tmpraw* t/tmp1*
495 _Inline/ .inlinepdlpp/ .inlinewith/ *.xfig
496 ),
497 },
498 'realclean' => {'FILES' => 'Basic/Core/Config.pm'},
499 'AUTHOR' => 'PerlDL Developers (pdl-general@lists.sourceforge.net)',
500 'ABSTRACT' => 'Perl Data Language',
501 'BINARY_LOCATION' => 'PDL.tar.gz',
502  
503 %notestsifmodulesmissing,
504 );
505  
506 =begin comment
507  
508 print "makefile hash is:\n";
509 for $k(sort keys %makefile_hash) {
510 print "\t$k\t";
511 $v = $makefile_hash{$k};
512 unless(ref $v) {
513 print $v,"\n";
514 } elsif(ref $v eq 'HASH') {
515 print "HASH:\n";
516 for $vk(sort keys %$v) {
517 print "\t\t$vk\t$v->{$vk}\n";
518 }
519 } elsif(ref $v eq 'ARRAY') {
520 print "ARRAY:\n";
521 for $vv(@$v) {
522 print "\t\t$vv\n";
523 }
524 } else {print "$v\n";}
525  
526 }
527  
528 =end comment
529  
530 =cut
531  
532 WriteMakefile(%makefile_hash);
533  
534 # do *after* WriteMakefile since some options
535 # are set by the recursively called Makefile.PLs
536 make_PDL_Config_pm(); # write out config to PDL::Config
537  
538 # Extra build target to build the doc database
539 sub MY::postamble {
540 my ($self) = @_;
541 package MY;
542 my $text =
543 '
544 doctest ::
545 $(NOECHO) $(ECHO) "doctest: Building PDL documentation database in blib ..."
546 $(NOECHO) $(PERLRUNINST) Doc$(DFSEP)scantree.pl
547 %HTML% $(NOECHO) $(ECHO) "doctest: Building PDL documentation web pages in blib ..."
548 %HTML% $(NOECHO) $(PERLRUNINST) Doc$(DFSEP)mkhtmldoc.pl
549  
550 doc_site_install ::
551 $(NOECHO) $(ECHO) "doc_site_install: Building PDL documentation database ..."
552 $(NOECHO) $(PERLRUNINST) Doc$(DFSEP)scantree.pl "$(DESTDIR)$(INSTALLSITEARCH)"
553 %HTML% $(NOECHO) $(ECHO) "doc_site_install: Building PDL documentation web pages ..."
554 %HTML% $(NOECHO) $(PERL) Doc$(DFSEP)mkhtmldoc.pl "$(DESTDIR)$(INSTALLSITEARCH)$(DFSEP)PDL"
555  
556 doc_vendor_install ::
557 $(NOECHO) $(ECHO) "doc_vendor_install: Building PDL documentation database ..."
558 $(NOECHO) $(PERLRUNINST) Doc$(DFSEP)scantree.pl "$(DESTDIR)$(INSTALLVENDORARCH)"
559 %HTML% $(NOECHO) $(ECHO) "doc_vendor_install: Building PDL documentation web pages ..."
560 %HTML% $(NOECHO) $(PERL) Doc$(DFSEP)mkhtmldoc.pl "$(DESTDIR)$(INSTALLVENDORARCH)$(DFSEP)PDL"
561  
562 doc_perl_install ::
563 $(NOECHO) $(ECHO) "doc_perl_install: Building PDL documentation database ..."
564 $(NOECHO) $(PERLRUNINST) Doc$(DFSEP)scantree.pl "$(DESTDIR)$(INSTALLARCHLIB)"
565 %HTML% $(NOECHO) $(ECHO) "doc_perl_install: Building PDL documentation web pages ..."
566 %HTML% $(NOECHO) $(PERL) Doc$(DFSEP)mkhtmldoc.pl "$(DESTDIR)$(INSTALLARCHLIB)$(DFSEP)PDL"
567 ';
568  
569 if(defined $PDL::Config{HTML_DOCS} && !$PDL::Config{HTML_DOCS}){
570 $text=~ s/\%HTML\%[^\n]*\n//og; # Remove %HTML% lines
571 } else {
572 $text=~ s/\%HTML\%//og; # Remove just %HTML% markers
573 }
574  
575 $text .= << "EOPS" ;
576  
577 perldl.pod : perldl
578 \t\$(PERLRUN) -MPod::Select -e "podselect('perldl');" > perldl.pod
579  
580 pdldoc.pod : pdldoc
581 \t\$(PERLRUN) -MPod::Select -e "podselect('pdldoc');" > pdldoc.pod
582  
583 EOPS
584  
585 # Here, `pdl.c` is used directly because some makes (e.g., on Solaris) do not
586 # support the `$<` variable in explicit rules
587 $text .= <<EOT if $^O !~ /MSWin/;
588 pdl$Config::Config{exe_ext} : pdl.c
589 \$(CC) \$(CFLAGS) \$(CPPFLAGS) pdl.c -o \$\@
590 EOT
591  
592 $text .= << 'EOT' if $^O =~ /MSWin/;
593  
594 DISTWIN32NAME=$(DISTVNAME)-win32
595  
596 ppm : doctest ppd
597 $(MV) blib$(DFSEP)lib$(DFSEP)PDL$(DFSEP)HtmlDocs$(DFSEP)PDL blib$(DFSEP)html$(DFSEP)lib$(DFSEP)PDL
598 $(COMPRESS) -dc win32$(DFSEP)pbmwin32.tar.gz | $(TAR) xf -
599 $(MKPATH) $(DISTWIN32NAME)
600 $(CP) win32$(DFSEP)Readme $(DISTWIN32NAME)
601 $(CP) win32$(DFSEP)install.ppm .
602 $(PERL) -pe "s|<\x{2f}IMPLEMENTATION>|<INSTALL EXEC=\"perl\">install.ppm<\x{2f}INSTALL><\x{2f}IMPLEMENTATION>|" PDL.ppd > PDL.ppd.new
603 $(RM) PDL.ppd
604 $(MV) PDL.ppd.new PDL.ppd
605 $(CP) PDL.ppd $(DISTWIN32NAME)
606 $(TAR) cf $(DISTWIN32NAME)$(DFSEP)PDL.tar blib install.ppm
607 cd $(DISTWIN32NAME)
608 $(COMPRESS) PDL.tar
609 $(ZIP) $(DISTWIN32NAME).zip *
610 $(MV) $(DISTWIN32NAME).zip ..
611 cd ..
612 $(RM_RF) $(DISTWIN32NAME)
613 EOT
614  
615 $text .= "\n" . ::coretarget($self);
616 my $coretest = join ' ', map File::Spec->catfile('t', $_), qw(core.t ops.t);
617 $text .= <<EOF;
618  
619 coretest : core
620 prove -b $coretest
621 EOF
622  
623 return $text
624  
625 }
626  
627 sub coretarget {
628 my ($self) = @_;
629 # remember the fundamental ones end up far to right as much deps on them
630 # a "right" is either scalar (named target) or tuple of
631 # [ \@dir, \@targets, \@prereqs ]
632 # @dir is dir parts for use by File::Spec
633 # @targets is make targets within that dir
634 # @prereqs are named targets - undef=[]
635 # all a left's rights are made concurrently, no sequence - list ALL prereqs
636 my @up_blib = ((File::Spec->updir) x 2, qw(blib arch auto PDL));
637 my @left2rights = (
638 [
639 basics => [
640 [ [ qw(Basic) ], [ qw(pm_to_blib) ], ],
641 [ [ qw(Basic Core) ], [ qw(pm_to_blib) ], ],
642 [ [ qw(Basic Gen) ], [ qw(all) ], ],
643 ]
644 ],
645 [
646 core => [
647 [ [ qw(Basic SourceFilter) ], [ qw(pm_to_blib) ], ],
648 map { [
649 [ 'Basic', $_ ],
650 # this contortion is due to an intermittent failure of
651 # "cd;make" to actually build the SO in blib with
652 # gmake -j4, which doesn't happen if give actual
653 # path. E.g. in Core it often doesn't build pdlcore.o
654 # and sometimes not Core.o, then just stops and
655 # indicates success
656 [ 'pm_to_blib', File::Spec->catfile(@up_blib, $_, "$_.\$(DLEXT)") ],
657 [ 'basics' ],
658 # the modules in PDL::LiteF, used in t/core.t
659 ] } qw(Core Ops Primitive Ufunc Slices Bad Math MatrixOps),
660 ]
661 ],
662 );
663 join "\n", map flatten_parallel_target($self, $_), @left2rights;
664 }
665  
666 sub format_chunk {
667 my ($self, $left, $deps, $dir, $targets) = @_;
668 my @m = join ' ', $left, ':', @{$deps||[]};
669 my $fsdir = File::Spec->catdir(@$dir);
670 push @m, "\t" . $self->oneliner(
671 "die \$! unless chdir q($fsdir); exec q(\$(MAKE) @$targets)"
672 );
673 join '', map "$_\n", @m;
674 }
675  
676 # output: list of make chunks with target, deps, recipes
677 sub flatten_parallel_target {
678 my ($self, $left2rights) = @_;
679 my ($left, $rights) = @$left2rights;
680 my (@deps, @recipes, @otherchunks);
681 for my $right (@$rights) {
682 if (ref $right) {
683 # [ \@dir, \@targets, \@prereqs ]
684 # @dir is dir parts for use by File::Spec
685 # @targets is make targets within that dir
686 # @prereqs are named targets - undef=[]
687 my ($dir, $targets, $prereqs) = @$right;
688 my $target_name = parallel_target_mangle($self, $dir, $targets);
689 push @deps, $target_name;
690 push @otherchunks, format_chunk(
691 $self, $target_name, $prereqs, $dir, $targets
692 );
693 } else {
694 push @deps, $right;
695 }
696 }
697 (
698 join(' : ', $left, join ' ', @deps) . "\n",
699 @otherchunks,
700 );
701 }
702  
703 sub parallel_target_mangle {
704 my ($self, $dir, $targets) = @_;
705 my $target = join '_', @$dir, @$targets;
706 $target =~ s#[/\\]#_#g; # avoid ambiguity with filenames
707 $target;
708 }
709  
710 # remove pdl.c from making EUMM think this dir has XS in it
711 sub MY::init_dirscan {
712 package MY;
713 my ($self) = @_;
714 $self->SUPER::init_dirscan;
715 $self->{C} = [];
716 $self->{O_FILES} = [];
717 }
718  
719 ##############################
720 # processPL: generate Makefile lines for top-level components that are created by just perling a .PL file.
721 #EU::MM's processPL() is continually broken on Win32 ... hence:
722 ### This fix seems necessary with current versions of MM - otherwise it creates circular
723 ### dependencies to "pm_to_blib" for .PL files (!) -- CED 9-July-2008
724 sub MY::processPL {
725 package MY;
726 my ($self) = @_;
727 return $self->SUPER::processPL if 0; ## || $^O =~ /MSWin32/i && $Config{make} =~ /\b[dn]make/i
728 return "" unless $self->{PL_FILES};
729 my @m;
730 my $alltarget = $ExtUtils::MakeMaker::VERSION >= 7.05_06 ? 'pure_nolink' : 'all';
731 my $colon = $Config::Config{make} =~ /\bdmake/i ? ':' : '::';
732 foreach my $plfile (sort keys %{$self->{PL_FILES}}) {
733 my $list = ref($self->{PL_FILES}->{$plfile})
734 ? $self->{PL_FILES}->{$plfile}
735 : [$self->{PL_FILES}->{$plfile}];
736 foreach my $target (@$list) {
737 push @m,
738 "\n$alltarget :: $target\n\t\$(NOECHO) \$(NOOP)\n",
739 "\n$target $colon\n\t\$(PERLRUNINST) $plfile $target\n";
740 }
741 }
742 return join "", @m;
743 }
744  
745 # warn if vital modules are missing
746 END {
747 if (@hasnt) {
748 print << 'EOP';
749  
750 ********************************************************
751 * IMPORTANT: Your installation will not work since it *
752 * lacks critical modules. *
753 * ALL TESTS WILL FAIL UNLESS YOU IMMEDIATELY *
754 * INSTALL THE FOLLOWING MODULES [available from CPAN]: *
755 *
756 EOP
757  
758 for (@hasnt) { print "*\t$_\n" }
759  
760  
761 print << 'EOP';
762 * *
763 * Please install the missing module(s) and start the *
764 * PDL build process again (perl Makefile.PL; ....) *
765 * *
766 ********************************************************
767  
768 EOP
769  
770 }
771  
772 } # end of END block
« blib/lib/PDL/Graphics/PGPLOT/Window.pm ↑ Summary blib/lib/PDL/PP/Struct.pm »