Dev.pm (PDL-2.082) | : | Dev.pm (PDL-2.083) | ||
---|---|---|---|---|
skipping to change at line 70 | skipping to change at line 70 | |||
#include <pdlcore.h> | #include <pdlcore.h> | |||
static Core* $symname; /* Structure holds core C functions */ | static Core* $symname; /* Structure holds core C functions */ | |||
EOR | EOR | |||
} | } | |||
sub PDL_BOOT { | sub PDL_BOOT { | |||
my ($symname, $module) = @_; | my ($symname, $module) = @_; | |||
$symname ||= 'PDL'; | $symname ||= 'PDL'; | |||
$module ||= 'The code'; | $module ||= 'The code'; | |||
return << "EOR"; | return << "EOR"; | |||
perl_require_pv ("PDL/Core.pm"); /* make sure PDL::Core is loaded */ | perl_require_pv ("PDL/Core.pm"); /* make sure PDL::Core is loaded */ | |||
#ifndef aTHX_ | #ifndef aTHX_ | |||
#define aTHX_ | #define aTHX_ | |||
#endif | #endif | |||
if (SvTRUE (ERRSV)) Perl_croak(aTHX_ "%s",SvPV_nolen (ERRSV)); | if (SvTRUE (ERRSV)) Perl_croak(aTHX_ "%s",SvPV_nolen (ERRSV)); | |||
SV* CoreSV = perl_get_sv("PDL::SHARE",FALSE); /* var with core structure */ | SV* CoreSV = perl_get_sv("PDL::SHARE",FALSE); /* var with core structure */ | |||
if (!CoreSV) | if (!CoreSV) | |||
Perl_croak(aTHX_ "We require the PDL::Core module, which was not found"); | Perl_croak(aTHX_ "We require the PDL::Core module, which was not found"); | |||
if (!($symname = INT2PTR(Core*,SvIV( CoreSV )))) /* Core* value */ | if (!($symname = INT2PTR(Core*,SvIV( CoreSV )))) /* Core* value */ | |||
Perl_croak(aTHX_ "Got NULL pointer for $symname"); | Perl_croak(aTHX_ "Got NULL pointer for $symname"); | |||
if ($symname->Version != PDL_CORE_VERSION) | if ($symname->Version != PDL_CORE_VERSION) | |||
Perl_croak(aTHX_ "[$symname->Version: \%ld PDL_CORE_VERSION: \%ld XS_VERSIO N: \%s] $module needs to be recompiled against the newly installed PDL", (long i nt)$symname->Version, (long int)PDL_CORE_VERSION, XS_VERSION); | Perl_croak(aTHX_ "[$symname->Version: \%ld PDL_CORE_VERSION: \%ld XS_VERSIO N: \%s] $module needs to be recompiled against the newly installed PDL", (long i nt)$symname->Version, (long int)PDL_CORE_VERSION, XS_VERSION); | |||
EOR | EOR | |||
} | } | |||
use Cwd qw/abs_path/; | use Cwd qw/abs_path/; | |||
my $MY_FILE = abs_path(__FILE__); # capture at load-time because EUMM chdirs | my $MY_FILE = abs_path(__FILE__); # capture at load-time because EUMM chdirs | |||
my $MY_DIR2 = dirname(dirname($MY_FILE)); | my $MY_DIR2 = dirname(dirname($MY_FILE)); | |||
my $IS_INST = $MY_DIR2 =~ /PDL\W*$/i; | my $IS_INST = $MY_DIR2 =~ /PDL\W*$/i; | |||
sub whereami_any { $MY_DIR2 } # something containing "Core/Dev.pm" | sub whereami_any { $MY_DIR2 } # something containing "Core/Dev.pm" | |||
# To access PDL's configuration use %PDL::Config. Makefile.PL has been set up | # To access PDL's configuration use %PDL::Config. Makefile.PL has been set up | |||
skipping to change at line 261 | skipping to change at line 259 | |||
} | } | |||
# pdlpp_mkgen($dir) | # pdlpp_mkgen($dir) | |||
# - scans $dir/MANIFEST for all *.pd files and creates corresponding *.pm files | # - scans $dir/MANIFEST for all *.pd files and creates corresponding *.pm files | |||
# in $dir/GENERATED/ subdir; needed for proper doc rendering at metacpan.org | # in $dir/GENERATED/ subdir; needed for proper doc rendering at metacpan.org | |||
# - it is used in Makefile.PL like: | # - it is used in Makefile.PL like: | |||
# dist => { PREOP=>'$(PERL) -MPDL::Core::Dev -e pdlpp_mkgen $(DISTVNAME)' } | # dist => { PREOP=>'$(PERL) -MPDL::Core::Dev -e pdlpp_mkgen $(DISTVNAME)' } | |||
# so all the magic *.pm generation happens during "make dist" | # so all the magic *.pm generation happens during "make dist" | |||
# - it is intended to be called as a one-liner: | # - it is intended to be called as a one-liner: | |||
# perl -MPDL::Core::Dev -e pdlpp_mkgen DirName | # perl -MPDL::Core::Dev -e pdlpp_mkgen DirName | |||
# - it relies on finding "=head1 NAME" and the module name in *.pd, though can b e in comment | ||||
# | # | |||
sub pdlpp_mkgen { | sub pdlpp_mkgen { | |||
require File::Spec::Functions; | require File::Spec::Functions; | |||
require File::Copy; | require File::Copy; | |||
my $dir = @_ > 0 ? $_[0] : $ARGV[0]; | my $dir = @_ > 0 ? $_[0] : $ARGV[0]; | |||
die "pdlpp_mkgen: unspecified directory" unless defined $dir && -d $dir; | die "pdlpp_mkgen: unspecified directory" unless defined $dir && -d $dir; | |||
my $file = "$dir/MANIFEST"; | my $file = "$dir/MANIFEST"; | |||
die "pdlpp_mkgen: non-existing '$file\'" unless -f $file; | die "pdlpp_mkgen: non-existing '$file\'" unless -f $file; | |||
my @pairs = (); | my @pairs = (); | |||
my $manifest = ExtUtils::Manifest::maniread($file); | my $manifest = ExtUtils::Manifest::maniread($file); | |||
skipping to change at line 289 | skipping to change at line 288 | |||
for (@pairs) { | for (@pairs) { | |||
my ($pd, $mod) = @$_; | my ($pd, $mod) = @$_; | |||
(my $prefix = $mod) =~ s|::|/|g; | (my $prefix = $mod) =~ s|::|/|g; | |||
my $basename = (split '/', $prefix)[-1]; | my $basename = (split '/', $prefix)[-1]; | |||
my $basefile = "$basename.pm"; | my $basefile = "$basename.pm"; | |||
my $outfile = File::Spec::Functions::rel2abs("$dir/GENERATED/$prefix.pm"); | my $outfile = File::Spec::Functions::rel2abs("$dir/GENERATED/$prefix.pm"); | |||
File::Path::mkpath(dirname($outfile)); | File::Path::mkpath(dirname($outfile)); | |||
my $old_cwd = Cwd::cwd(); | my $old_cwd = Cwd::cwd(); | |||
chdir dirname($pd); | chdir dirname($pd); | |||
#there is no way to use PDL::PP from perl code, thus calling via system() | #there is no way to use PDL::PP from perl code, thus calling via system() | |||
my $pp_call_arg = _pp_call_arg($mod, $mod, $basename, '', 1); | my $pp_call_arg = _pp_call_arg($mod, $mod, $basename, '', 0); # 0 so guarant ee not create pp-*.c | |||
my $rv = system($^X, @in, $pp_call_arg, File::Spec::Functions::abs2rel(basen ame($pd))); | my $rv = system($^X, @in, $pp_call_arg, File::Spec::Functions::abs2rel(basen ame($pd))); | |||
die "pdlpp_mkgen: cannot convert '$pd'\n" unless $rv == 0 && -f $basefile; | die "pdlpp_mkgen: cannot convert '$pd'\n" unless $rv == 0 && -f $basefile; | |||
File::Copy::copy($basefile, $outfile) or die "$outfile: $!"; | File::Copy::copy($basefile, $outfile) or die "$outfile: $!"; | |||
unlink $basefile; # Transform::Proj4.pm is wrong without GIS::Proj built | unlink $basefile; # Transform::Proj4.pm is wrong without GIS::Proj built | |||
unlink "$basename.xs"; # since may have been recreated wrong | ||||
chdir $old_cwd or die "chdir $old_cwd: $!"; | chdir $old_cwd or die "chdir $old_cwd: $!"; | |||
$added{"GENERATED/$prefix.pm"} = "mod=$mod pd=$pd (added by pdlpp_mkgen)"; | $added{"GENERATED/$prefix.pm"} = "mod=$mod pd=$pd (added by pdlpp_mkgen)"; | |||
} | } | |||
if (scalar(keys %added) > 0) { | if (scalar(keys %added) > 0) { | |||
#maniadd works only with this global variable | #maniadd works only with this global variable | |||
local $ExtUtils::Manifest::MANIFEST = $file; | local $ExtUtils::Manifest::MANIFEST = $file; | |||
ExtUtils::Manifest::maniadd(\%added); | ExtUtils::Manifest::maniadd(\%added); | |||
} | } | |||
} | } | |||
skipping to change at line 428 | skipping to change at line 428 | |||
# check if MakeMaker should be used to preprocess the libs | # check if MakeMaker should be used to preprocess the libs | |||
for my $key(keys %$opt) {$opt->{lc $key} = $opt->{$key}} | for my $key(keys %$opt) {$opt->{lc $key} = $opt->{$key}} | |||
my $mmprocess = exists $opt->{makemaker} && $opt->{makemaker}; | my $mmprocess = exists $opt->{makemaker} && $opt->{makemaker}; | |||
my $hide = exists $opt->{hide} ? $opt->{hide} : | my $hide = exists $opt->{hide} ? $opt->{hide} : | |||
exists $PDL::Config{HIDE_TRYLINK} ? $PDL::Config{HIDE_TRYLINK} : 1; | exists $PDL::Config{HIDE_TRYLINK} ? $PDL::Config{HIDE_TRYLINK} : 1; | |||
my $clean = exists $opt->{clean} ? $opt->{clean} : 1; | my $clean = exists $opt->{clean} ? $opt->{clean} : 1; | |||
if ($mmprocess) { | if ($mmprocess) { | |||
require ExtUtils::MakeMaker; | require ExtUtils::MakeMaker; | |||
require ExtUtils::Liblist; | require ExtUtils::Liblist; | |||
my $self = new ExtUtils::MakeMaker {DIR => [],'NAME' => 'NONE'}; | my $self = ExtUtils::MakeMaker->new({DIR => [],'NAME' => 'NONE'}); | |||
my @libs = $self->ext($libs, 0); | my @libs = $self->ext($libs, 0); | |||
print "processed LIBS: $libs[0]\n" unless $hide; | print "processed LIBS: $libs[0]\n" unless $hide; | |||
$libs = $libs[0]; # replace by preprocessed libs | $libs = $libs[0]; # replace by preprocessed libs | |||
} | } | |||
print " Trying $txt...\n " unless $txt =~ /^\s*$/; | print " Trying $txt...\n " unless $txt =~ /^\s*$/; | |||
my $HIDE = !$hide ? '' : '>/dev/null 2>&1'; | my $HIDE = !$hide ? '' : '>/dev/null 2>&1'; | |||
End of changes. 6 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added |