Skip to content

Commit

Permalink
PDL::Transform::Proj4 switch to new lib/*.pd scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Nov 21, 2024
1 parent 094dd3b commit 8fd98a0
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 21 deletions.
4 changes: 3 additions & 1 deletion Basic/lib/PDL/Core/Dev.pm
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ sub pdlpp_eumm_update_deep {
my $macro = $eumm->{macro} ||= {};
my $xsb = $eumm->{XSBUILD}{xs} ||= {};
$eumm->{clean}{FILES} ||= '';
$eumm->{OBJECT} ||= '';
my $xs = $eumm->{XS} ||= {};
my $global_version = $eumm->parse_version($eumm->{VERSION_FROM});
my @pd_srcs;
Expand All @@ -197,6 +198,7 @@ sub pdlpp_eumm_update_deep {
$pm->{$pmfile} = "\$(INST_LIB)/$nolib.pm";
my @macro_vars = pdlpp_mod_vars(my $mod = join '::', split /\//, $nolib);
@$macro{@macro_vars} = pdlpp_mod_values(1, $f, $base, 1, 1);
$eumm->{OBJECT} .= " $base\$(OBJ_EXT)";
$xsb->{$base}{OBJECT} = "\$($macro_vars[1])";
$xsb->{$base}{OBJECT} .= $EXTRAS{$f}{OBJECT} if $EXTRAS{$f}{OBJECT};
$eumm->{DEFINE} .= $EXTRAS{$f}{DEFINE} if $EXTRAS{$f}{DEFINE}; # global
Expand All @@ -206,7 +208,7 @@ sub pdlpp_eumm_update_deep {
print $fh "package $mod;\nour \$VER"."SION = '$global_version';\n1;\n"; # break is so cpanm doesn't try to parse as version
close $fh;
utime $mtime - 120, $mtime - 120, $pmfile; # so is out of date
push @pd_srcs, [$f, $base, $mod, '', 1];
push @pd_srcs, [$f, $base, $mod, '', 1, 1];
$eumm->{clean}{FILES} .= join ' ', '', $pmfile, map "\$($_)", @macro_vars;
$eumm->{clean}{FILES} .= $EXTRAS{$f}{OBJECT} if $EXTRAS{$f}{OBJECT};
}
Expand Down
6 changes: 3 additions & 3 deletions Libtmp/Transform-Proj4/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Proj4.c
Proj4.pm
Proj4.xs
lib/PDL/Transform/Proj4.c
lib/PDL/Transform/Proj4.pm
lib/PDL/Transform/Proj4.xs
38 changes: 23 additions & 15 deletions Libtmp/Transform-Proj4/Makefile.PL
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
use strict;
use warnings;
use ExtUtils::MakeMaker;

my $package_name = "PDL::Transform::Proj4";
my $lib_name = "Proj4";
use PDL::Core::Dev;

eval { require Alien::proj };
if ($@) {
write_dummy_make("Will skip build of $package_name on this system - no Alien::proj");
write_dummy_make("Will skip build of PDL::Transform::Proj4 on this system - no Alien::proj");
return;
}

my $ppfile = "proj4.pd";
my $package = [$ppfile, 'Proj4', $package_name];
my %hash = pdlpp_stdargs_int($package);
$hash{VERSION_FROM} = $ppfile;
$hash{LIBS}[0] .= ' ' . Alien::proj->libs;
$hash{INC} .= ' ' . Alien::proj->cflags;
$hash{realclean} ||= { FILES => '' };
$hash{realclean}{FILES} .= ' _Inline';
$hash{PM}{'Demo.pm'} = '$(INST_LIB)/PDL/Demos/Proj4_demo.pm';
my @pd_srcs;
undef &MY::init_PM; # suppress warning
*MY::init_PM = sub {
package MY; # so that "SUPER" works right
my ($self) = @_;
$self->SUPER::init_PM;
@pd_srcs = ::pdlpp_eumm_update_deep($self);
};

undef &MY::postamble; # suppress warning
*MY::postamble = sub { pdlpp_postamble_int( $package ); };
WriteMakefile(%hash);
*MY::postamble = sub { pdlpp_postamble_int(@pd_srcs); };

WriteMakefile(
NAME => 'PDL',
VERSION_FROM => 'lib/PDL/Transform/Proj4.pd',
MIN_PERL_VERSION => '5.014',
XSMULTI => 1,
INC => PDL::Core::Dev::PDL_INCLUDE() . ' ' . Alien::proj->cflags,
TYPEMAPS => [PDL::Core::Dev::PDL_TYPEMAP()],
LIBS => [Alien::proj->libs],
clean => { FILES => join ' ', qw(MANIFEST.bak) },
NO_MYMETA => 1,
);
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -593,9 +593,9 @@ Libtmp/Slatec/t/lm.t
Libtmp/Slatec/t/slatec-polyfit-weight.t
Libtmp/Slatec/t/slatec.t
Libtmp/t/func.t
Libtmp/Transform-Proj4/Demo.pm
Libtmp/Transform-Proj4/lib/PDL/Demos/Proj4_demo.pm
Libtmp/Transform-Proj4/lib/PDL/Transform/Proj4.pd
Libtmp/Transform-Proj4/Makefile.PL
Libtmp/Transform-Proj4/proj4.pd
Libtmp/Transform-Proj4/t/gis_proj.t
Libtmp/Transform-Proj4/t/proj_transform.t
Makefile.PL
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.SKIP
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ RCS
^Libtmp/Slatec/Slatec..*
^Libtmp/Slatec/slatec/.*\.c$
^Libtmp/Transform-Proj4/Proj4\..*
^Libtmp/Transform-Proj4/lib/PDL/Transform/Proj4(\.(pm|xs|c)$|-pp-)
^Perldl2/logo3d.pdl
^Perldl2/pdl2.pod$
^Perldl2/tctrl-c.pl
Expand Down

0 comments on commit 8fd98a0

Please sign in to comment.