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
|
# Build the whole PDL distribtuion
$::PP_VERBOSE = 0; # =1 makes PP waffle a lot
# Version test.
BEGIN{
eval "use 5.004";
die "PDL requires Perl v5.004 or later\n" if $@ ne "";
}
$seen_pdlconf = 0;
# Scan ARGV for config file argument
@ARGV = map {
if(/^PDLCONF=(.*)$/) {
$seen_pdlconf=1;
$pdl_conf_file = $1; ();
} else {
$_
}
} @ARGV;
if(!$seen_pdlconf) {
my $defname = "$ENV{HOME}/.perldl.conf";
if(-f $defname) {
$pdl_conf_file = $defname;
}
}
# First read in distribution config file
require './perldl.conf';
%PDL_CONFIG_DIST = %PDL_CONFIG; # Save standard values
# Now read in the users config file if specified
if (-f $pdl_conf_file) {
warn "\nINFORMATION: using file $pdl_conf_file to set configuration defaults\n\n";
require $pdl_conf_file;
}
# Sanity checking of user supplied keys (look for ones not defined in dist)
for(keys %PDL_CONFIG) {
if(!exists($PDL_CONFIG_DIST{$_})) {
die("Invalid key $_ found in user supplied $pdl_conf_file - this key appears to be no longer in use. Please review configuration options");
}
}
# Merge in default options where not supplied in users file
for(keys %PDL_CONFIG_DIST) {
$PDL_CONFIG{$_} = $PDL_CONFIG_DIST{$_} unless exists $PDL_CONFIG{$_};
}
# Get Version from Basic/PDL.pm and generated Basic/Core/Version.pm from it
require 'Basic/PDL.pm';
my $versionFile = 'Basic/Core/Version.pm';
open(VERSIONFILE, ">$versionFile") or die("Can't Open '$versionFile' for Writing!\n");
print VERSIONFILE "package PDL::Version;\n\n";
print VERSIONFILE "\# This File was autogenerated by MakeFile.PL from the version\n";
print VERSIONFILE "\# number in PDL.pm. It is used by PDL::Lite and others as\n";
print VERSIONFILE "\# a single, consistent place to get the current PDL version.\n\n";
print VERSIONFILE "\$VERSION='".$PDL::VERSION."';\n";
print VERSIONFILE "1;\n";
close VERSIONFILE;
use ExtUtils::MakeMaker;
WriteMakefile(
'PREREQ_PM' => { 'ExtUtils::F77' => 1.10, 'File::Spec' => 0.6 },
'NAME' => 'PDL',
'VERSION_FROM' => 'Basic/Core/Version.pm',
'EXE_FILES' => ['perldl'],
# If you want speed, remove this
'linkext' => {LINKTYPE => ''}, # No linking required in this directory
'dist' => { COMPRESS => 'gzip', SUFFIX => 'gz'},
'clean' => {'FILES' => 'perldl pdldoc.db tbyte.tif tmp0 tmp0.hdr tushort.tif MANIFEST.bak tmp1* tmpraw* t/tmpraw* t/tmp1*'},
'realclean' => {'FILES' => 'Basic/Core/Config.pm'},
);
print STDERR "Writing Basic/Core/Config.pm\n";
open OUT, ">Basic/Core/Config.pm" or die "Couldn't open Config.pm for writing";
print OUT "# AUTOMATICALLY GENERATED BY THE PDL TOPLEVEL Makefile.PL.
# DO NOT HAND-EDIT - CHANGES WILL BE LOST UPON YOUR NEXT
# 'perl Makefile.PL'!!!
package PDL;
\%PDL::Config = (
";
for(keys %PDL_CONFIG) {
print OUT "\t$_\t=>\t";
if(defined $PDL_CONFIG{$_}) {
print OUT '"',quotemeta($PDL_CONFIG{$_}),'"';
} else {
print OUT "undef";
}
print OUT ",\n";
}
print OUT ");\n1;";
# Extra build target to build the doc database
sub MY::postamble {
my $text =
'
doctest ::
@echo "doctest: Building PDL documentation database in blib ..."
@$(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) \
Doc/scantree.pl
@$(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) \
Doc/mkhtmldoc.pl
doc_site_install ::
@echo "doc_site_install: Building PDL documentation database ..."
@$(PERL) -Mblib Doc/scantree.pl $(INSTALLSITEARCH)
@$(PERL) Doc/mkhtmldoc.pl $(INSTALLSITEARCH)/PDL
doc_perl_install ::
@echo "doc_perl_install: Building PDL documentation database ..."
@$(PERL) -Mblib Doc/scantree.pl $(INSTALLARCHLIB)
@$(PERL) Doc/mkhtmldoc.pl $(INSTALLARCHLIB)/PDL
';
if( $] < 5.005 ){ # for perl5.004, docs go into INSTALLSITELIB
$text =~ s/INSTALLSITEARCH/INSTALLSITELIB/g;
}
return $text
}
sub MY::test {
package MY; # so that "SUPER" works right
my $inherited = shift->SUPER::test(@_);
my @lines = split "\n", $inherited;
my @new = ();
my $pass = 1;
foreach (@lines) {
if ($pass) {
push @new, $_;
$pass = 0 if /^test\b/;
} else {
if (/^\s*$/) {
push @new, '';
$pass = 1;
}
}
}
return join("\n", @new,"\n");
}
|