Device-Cdio
view release on metacpan or search on metacpan
$libcdio_pkgcfg{'modversion'} =~ m{\A((?:\d+)(?:\.\d+))};
my $libcdio_version = $1;
if (defined($libcdio_version)) {
if ($libcdio_version < MIN_LIBCDIO_VERSION) {
printf STDERR "
***
*** You need to have libcdio %s or greater installed. (You have $lv).
*** Get libcdio from http://www.gnu.org/software/libcdio/download.html
", MIN_LIBCDIO_VERSION;
die "OS unsupported - or maybe it is. This message is here to appease testing services like CPANTS that look for messages like this";
} else {
print "Good, I found libcdio version $lv installed.\n";
}
} else {
print STDERR "
***
*** Can't parse libcdio version $lv.
";
exit 1;
}
} else {
print STDERR "
***
*** Can't find libcdio configuration info. Is libcdio installed?
*** Get libcdio from http://www.gnu.org/software/libcdio/download.html
";
die "OS unsupported - or maybe it is. This message is here to appease testing services like CPANTS that look for messages like this";
}
my $class = Module::Build->subclass( class => 'MyModuleBuild',
code => q!
use File::Basename;
use Data::Dumper;
sub process_swig_files {
my $self = shift;
my $verb = $self->runtime_params('verbose');
$verb = 0 if $self->runtime_params('quiet');
#my @p = @_;
print "process swig files\n" if $verb;
my $swigdeps = $self->config('swig_source');
my @swig_flags = $self->split_like_shell($self->config('swig_flags'));
my @swigsource = keys %$swigdeps;
my $lib = 'lib';
#my $blib_lib = File::Spec->catfile('blib', 'lib');
foreach my $file (@swigsource) {
#FIXME add dir $self->config('swig_files')
my $basename = basename($file, '.swg');
my $cfile = $basename."_wrap.c";
my $pmfile = File::Spec->catfile($lib,"$basename.pm");
if ($self->up_to_date($swigdeps->{$file}, $cfile) &&
$self->up_to_date($swigdeps->{$file}, $pmfile)) {
next if $self->up_to_date($file, $cfile) &&
$self->up_to_date($cfile, $pmfile);
}
print "swig: $file -> $cfile\n" if $verb;
$self->do_system('swig', '-o', $cfile, '-perl', '-outdir',
$lib, @swig_flags, $file);
$self->copy_if_modified(from => $pmfile, to_dir => 'blib');
}
return 1;
}
sub process_c_files {
my $self = shift;
my $verb = $self->runtime_params('verbose');
$verb = 0 if $self->runtime_params('quiet');
#my @p = @_;
print "process c files\n" if $verb;
my $cfiles = $self->rscan_dir('./',qr/\.c$/);
# if none return
#set $self->quiet() for CBuilder->new
$self->quiet($verb?0:1);
my $cb = $self->cbuilder(); # get a ExtUtils::CBuilder object
print " CBuilder: ",$cb->VERSION,"\n" if $verb;
#setenv TMPDIR for cc ??
foreach my $file (@$cfiles) {
my $basename = basename($file, '_wrap.c');
$basename = basename($file, '.c') if not defined $basename;
my $libname = $basename.".".$self->config('dlext');
$libname = File::Spec->catfile('blib', 'arch',$libname);
next if $self->up_to_date($file,$libname);
print "(CC) $file -> $basename.so\n" if $verb;
my $obj = $cb->compile(source => $file,
## include_dirs => $self->config('include_dirs'),
extra_compiler_flags => $self->config('extra_compiler_flags'));
print "CB compiled: $obj\n" if $verb;
my $lib = $cb->link(objects => $obj,
extra_linker_flags => $self->config('extra_linker_flags'));
print "CB generated: $lib\n" if $verb;
$self->copy_if_modified(from => $lib, to => $libname);
}
return 1;
}
!);
#
my $builder = $class->new(
module_name => 'Device::Cdio',
add_to_cleanup => [ 'Device-Cdio-*', 'tmp*', 'cover_db'],
configure_requires => { 'Module::Build' => 0.38 },
create_makefile_pl => 'small',
dist_abstract =>
'Perl bindings for CD Input and control library (libcdio)',
dist_author => 'Rocky Bernstein <rocky@cpan.org>',
dist_version_from => 'lib/Device/Cdio.pm',
license => 'gpl',
needs_compiler => 1,
release_status => 'stable', # or 'testing' which will append TRIAL to tarball
meta_merge => {
resources => {
bugtracker => 'https://github.com/rocky/Perl-Device-Cdio/issues',
repository => 'http://github.com/rocky/Perl-Device-Cdio'
}
},
requires => {
'ExtUtils::PkgConfig' => '1.03',
'Test::More' => 0,
'version' => 0,
'ExtUtils::CBuilder' => '0.28',
},
sign => 1);
$builder->config(swig_files => './');
$builder->config(swig_source => { # with dependencies as hash value
'swig/perlcdio.swg' =>
['swig/audio.swg', 'swig/device.swg',
'swig/disc.swg', 'swig/device_const.swg', 'swig/disc.swg',
'swig/read.swg', 'swig/track.swg', 'swig/types.swg'],
'swig/perliso9660.swg' => ['swig/types.swg'],
'swig/perlmmc.swg', => ['swig/types.swg']} );
if($builder->have_c_compiler()) {
$builder->notes('c_compiler' => 1);
print "C compiler found - check swig\n" if $builder->config('verbose');
if(!$builder->config('obj_ext')) {
$builder->config('obj_ext','.o');
}
if(!$builder->config('dlext')) {
$builder->config('dlext','so');
}
my $swig_installed = check_swig(
verbose => $builder->config('verbose'));
$builder->notes(swig_installed => $swig_installed);
my ($ccflags, $ldflags,$swig_flags) = check_c_compiler(
$builder->config('cc'), $builder->config('ccflags'));
$builder->config(extra_linker_flags => $ldflags);
$builder->config(extra_compiler_flags => $ccflags);
if($swig_installed) {
$builder->config(swig_flags => $swig_flags);
( run in 0.511 second using v1.01-cache-2.11-cpan-39bf76dae61 )