Skip to content

Commit

Permalink
move Types.pm.PL to Basic/lib/
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Nov 8, 2024
1 parent 95d838a commit eb1477a
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 18 deletions.
1 change: 1 addition & 0 deletions Basic/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
script/pdl
lib/PDL/Types.pm
1 change: 0 additions & 1 deletion Basic/Core/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
Core.c
Types.pm
pdl.h
pdlperl.h
11 changes: 5 additions & 6 deletions Basic/Core/Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use warnings;
eval { require Devel::CheckLib; Devel::CheckLib->import; };
use ExtUtils::MakeMaker::Config;
use ExtUtils::MakeMaker;
use File::Spec::Functions;

my $pthread_include = $ENV{POSIX_THREADS_INC} // '';
my $pthread_library = $ENV{POSIX_THREADS_LIBS} // '-lpthread';
Expand All @@ -20,13 +21,12 @@ if (!$pthread_library) {
}
my $pthread_define = $pthread_library ? ' -DPDL_PTHREAD ' : '';

sub nopl { my $txt = shift; $txt =~ s/[.]PL$//; return $txt}

my $libs_string = "$pthread_library -lm";

undef &MY::postamble; # suppress warning
*MY::postamble = sub {
my $text = join '', map "$_ :: $_.PL Types.pm\n\t\$(PERLRUN) $_.PL $_\n",
my $typespm = catfile(updir, qw(lib PDL Types.pm));
my $text = join '', map "$_ :: $_.PL $typespm\n\t\$(PERLRUN) $_.PL $_\n",
qw(pdl.h pdlperl.h);
$text;
};
Expand All @@ -37,18 +37,17 @@ WriteMakefile(
NAME => 'PDL::Core',
VERSION_FROM => '../lib/PDL.pm',
PM => {
(map +($_,'$(INST_LIBDIR)/'.$_), qw/Core.pm Types.pm/),
(map +($_,'$(INST_LIBDIR)/'.$_), qw/Core.pm/),
(map +($_,'$(INST_LIBDIR)/Core/'.$_),
qw/pdl.h pdlperl.h pdlcore.h pdlmagic.h
pdlbroadcast.h ppport.h/
),
},
PL_FILES => {map +($_ => nopl $_), 'Types.pm.PL'},
OBJECT => 'Core$(OBJ_EXT) ' . $cobj,
DEFINE => $pthread_define,
LIBS => [$libs_string],
clean => {'FILES' =>
"pdl.h pdlperl.h Types.pm Core.c"
"pdl.h pdlperl.h Core.c"
},
INC => join(' ',
PDL::Core::Dev::PDL_INCLUDE(),
Expand Down
2 changes: 1 addition & 1 deletion Basic/Core/pdl.h.PL
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use strict;
use warnings;

require './Types.pm';
require '../lib/PDL/Types.pm';

my $file = shift @ARGV;
print "Extracting $file\n";
Expand Down
2 changes: 1 addition & 1 deletion Basic/Core/pdlperl.h.PL
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use strict;
use warnings;
use Config; # for ivsize

require './Types.pm';
require '../lib/PDL/Types.pm';

my $file = shift @ARGV;
print "Extracting $file\n";
Expand Down
22 changes: 16 additions & 6 deletions Basic/Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,22 @@ use File::Spec::Functions;
my $pdlroot = catfile qw(script pdl);
my @exe_files = map catfile('script', $_), qw(perldl pdldoc pptemplate);
push @exe_files, "$pdlroot$Config{exe_ext}" if $^O !~ /MSWin/;
my @cleanup = "$pdlroot$Config{exe_ext}";
my @cleanup = ("$pdlroot$Config{exe_ext}", catfile(qw(lib PDL Types.pm)));

undef &MY::postamble; # suppress warning
*MY::postamble = sub {
return '' if $^O =~ /MSWin/;
# Here, `pdl.c` is used directly because some makes (e.g., on Solaris) do not
# support the `$<` variable in explicit rules
<<EOT;
my $text = '';
$text .= <<EOT if $^O !~ /MSWin/;
${pdlroot}$::Config{exe_ext} : ${pdlroot}.c
\t\$(CC) \$(CFLAGS) \$(LDFLAGS) \$(CCCDLFLAGS) ${pdlroot}.c -o \$\@
EOT
$text;
};

WriteMakefile(
NAME => 'PDL',
VERSION_FROM => 'lib/PDL.pm',
DIR => [qw(
DIR => [qw(
Core Bad Ops Ufunc Primitive Slices Math MatrixOps
IO-Misc IO-Pnm IO-Storable
Lib-Compression Lib-FFT Lib-ImageND Lib-ImageRGB
Expand All @@ -46,3 +45,14 @@ sub clean {
# print STDERR "processed list :\n$inherited\n";
$inherited;
}

sub _nopl { $_[0] =~ s/[.]PL$//r }

sub init_PM {
my ($self) = @_;
$self->SUPER::init_PM;
my ($pm, $plf) = @$self{qw(PM PL_FILES)};
for my $f (grep /\.PL$/, keys %$pm) {
$pm->{ $plf->{$f} = _nopl($f) } = _nopl(delete $pm->{$f});
}
}
2 changes: 1 addition & 1 deletion Basic/lib/PDL/Core/Dev.pm
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ sub _pp_list_functions {
my $abs_src = File::Spec::Functions::rel2abs($src);
if (!$flist_cache{$abs_src}) {
my $w = whereami_any();
my $typespm = catfile($w, $internal ? ((updir())x2, qw(Core)) : (), qw(Types.pm));
my $typespm = catfile($w, 'Types.pm');
system $^X, "$typespm.PL", $typespm and die "Failed to create Types.pm from '$typespm.PL'"
if $internal and !-f $typespm;
require $typespm;
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ Basic/Core/pdlmagic.h
Basic/Core/pdlperl.h.PL
Basic/Core/pdlutil.c
Basic/Core/ppport.h
Basic/Core/Types.pm.PL
Basic/examples/Benchmark/Bench.pm
Basic/examples/Benchmark/Bench.xs
Basic/examples/Benchmark/Makefile.PL
Expand Down Expand Up @@ -144,6 +143,7 @@ Basic/lib/PDL/Reduce.pm
Basic/lib/PDL/Scilab.pod
Basic/lib/PDL/Tips.pod
Basic/lib/PDL/Tutorials.pod
Basic/lib/PDL/Types.pm.PL
Basic/lib/PDLdb.pl
Basic/lib/Test/Deep/PDL.pm
Basic/lib/Test/PDL.pm
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.SKIP
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ RCS
\b_eumm/
^Basic/Bad/Bad\..*
^Basic/Core/Core\.c$
^Basic/Core/Types\.pm$
^Basic/Core/pdl\.h$
^Basic/Core/pdlperl\.h$
^Basic/Gen/PP/Dump\.pm$
Expand All @@ -50,6 +49,7 @@ RCS
^Basic/IO-Misc/Misc\..*
^Basic/IO-Pnm/Pnm\..*
^Basic/IO-Storable/Storable\..*
^Basic/lib/PDL/Types\.pm$
^Basic/Lib-Compression/Compression\..*
^Basic/Lib-FFT/FFT\.*
^Basic/Lib-ImageND/ImageND\..*
Expand Down

0 comments on commit eb1477a

Please sign in to comment.