| 1 |
use strict; |
| 2 |
use warnings; |
| 3 |
use ExtUtils::MakeMaker; |
| 4 |
use Config; |
| 5 |
use PDL::Core::Dev; |
| 6 |
|
| 7 |
############################## |
| 8 |
# Try to use Alien::FFTW3 - but if it's not present |
| 9 |
# fall back to pkg-config. This is so that |
| 10 |
# a Debian package won't have to include Alien::FFTW3. |
| 11 |
my $cflags; |
| 12 |
my $libs; |
| 13 |
|
| 14 |
if( eval "require Alien::FFTW3" ) { |
| 15 |
## Ensure at least version 3.3; die if we can't get it. |
| 16 |
Alien::FFTW3->VERSION(3.3); |
| 17 |
my $p = Alien::FFTW3->precision; |
| 18 |
unless($p->{'d'} and $p->{'f'}) { |
| 19 |
die "PDL::FFTW3 - needs both double-precision and single-precision fftw3 libraries\n\t(libfftw3 and libfftw3f). Alien::FFTW3 found only ".(join(",",keys %$p))."\n"; |
| 20 |
} |
| 21 |
$cflags = Alien::FFTW3->cflags; |
| 22 |
$libs = Alien::FFTW3->libs; |
| 23 |
} else { |
| 24 |
print "Alien::FFTW3 not found. Using pkg-config instead...\n"; |
| 25 |
|
| 26 |
require IPC::Run; |
| 27 |
$cflags = ''; |
| 28 |
$libs = ''; |
| 29 |
my $err = ''; |
| 30 |
IPC::Run::run( ['pkg-config', |
| 31 |
'--cflags', |
| 32 |
'fftw3f >= 3.3', 'fftw3 >= 3.3'], |
| 33 |
\undef, |
| 34 |
\$cflags, \$err ) or die "Couldn't get the fftw flags: '$err'"; |
| 35 |
|
| 36 |
IPC::Run::run( ['pkg-config', |
| 37 |
'--libs', |
| 38 |
'fftw3f >= 3.3', 'fftw3 >= 3.3'], |
| 39 |
\undef, |
| 40 |
\$libs, \$err ) or die "Couldn't get the fftw libs: '$err'"; |
| 41 |
|
| 42 |
chomp($cflags, $libs); |
| 43 |
} |
| 44 |
|
| 45 |
my @package = (qw(fftw3.pd FFTW3 PDL::FFTW3), undef, 1); |
| 46 |
my %descriptor = pdlpp_stdargs(\@package); |
| 47 |
|
| 48 |
$descriptor{VERSION_FROM} = 'fftw3.pd'; |
| 49 |
|
| 50 |
# I support single and double precision FFTW calls, so both fftw and fftw3f |
| 51 |
push @{$descriptor{LIBS} }, $libs; |
| 52 |
|
| 53 |
$descriptor{INC} = '' unless defined $descriptor{INC}; |
| 54 |
$descriptor{INC} .= " $cflags"; |
| 55 |
|
| 56 |
$descriptor{PREREQ_PM} = { |
| 57 |
'PDL' => '2.097', # fixed type-selecting |
| 58 |
}; |
| 59 |
$descriptor{CONFIGURE_REQUIRES} = { |
| 60 |
'PDL' => '2.097', |
| 61 |
'IPC::Run' =>0, |
| 62 |
# 'Alien::FFTW3' =>0, |
| 63 |
}; |
| 64 |
$descriptor{BUILD_REQUIRES} = {'PDL::PP'=>0}; |
| 65 |
$descriptor{TEST_REQUIRES} = {'Test::More'=>'0.88'}; |
| 66 |
$descriptor{AUTHOR} = "Dima Kogan <dima\@secretsauce.net>, Craig DeForest <deforest\@boulder.swri.edu>"; |
| 67 |
$descriptor{ABSTRACT} = "PDL interface to the Fastest Fourier Transform in the West"; |
| 68 |
$descriptor{LICENSE} = "perl"; |
| 69 |
$descriptor{MIN_PERL_VERSION} = "5.016"; |
| 70 |
|
| 71 |
$descriptor{META_MERGE} = { |
| 72 |
"meta-spec" => { version => 2 }, |
| 73 |
resources => { |
| 74 |
bugtracker => { web => 'https://github.com/PDLPorters/pdl-fftw3/issues' }, |
| 75 |
repository => { |
| 76 |
web => 'https://github.com/PDLPorters/pdl-fftw3', |
| 77 |
url => 'git://github.com/PDLPorters/pdl-fftw3.git', |
| 78 |
type => 'git', |
| 79 |
}, |
| 80 |
x_IRC => 'irc://irc.perl.org/#pdl', |
| 81 |
}, |
| 82 |
prereqs => { |
| 83 |
develop => { |
| 84 |
requires => { |
| 85 |
'CPAN::Changes' => 0, |
| 86 |
}, |
| 87 |
}, |
| 88 |
test => { |
| 89 |
requires => { |
| 90 |
'Test::More' => '0.98', |
| 91 |
}, |
| 92 |
}, |
| 93 |
}, |
| 94 |
}; |
| 95 |
|
| 96 |
WriteMakefile( %descriptor ); |
| 97 |
|
| 98 |
sub MY::postamble { pdlpp_postamble(\@package) } |