Skip to content

Commit

Permalink
Build.PL picks up libcdio's CFLAGS now. Correct 07.iso.t test. These …
Browse files Browse the repository at this point in the history
…changes from Jerry G Geiger.

Remove code for pre libcdio 0.77. Versions this far back are hopeless.
  • Loading branch information
R. Bernstein committed Aug 10, 2011
1 parent 40bd065 commit 7bbe2cb
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 72 deletions.
48 changes: 24 additions & 24 deletions Build.PL
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ my $class = Module::Build->subclass( class => 'MyModuleBuild',
my $pmfile = File::Spec->catfile($lib,"$basename.pm");
if($self->up_to_date($swigdeps->{$file}, $cfile)) {
next if $self->up_to_date($file, $cfile) &&
$self->up_to_date($cfile, $pmfile);
$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');
Expand Down Expand Up @@ -120,8 +121,7 @@ my $class = Module::Build->subclass( class => 'MyModuleBuild',

my $builder = $class->new(
module_name => 'Device::Cdio',
add_to_cleanup => [ 'Device-Cdio-*', 'tmp*', 'cover_db',
'lib/perl*.pm', '*.so', '*.c', '*.o' ],
add_to_cleanup => [ 'Device-Cdio-*', 'tmp*', 'cover_db'],
create_makefile_pl => 'passthrough',
dist_abstract =>
'Perl bindings for CD Input and control library (libcdio)',
Expand All @@ -131,13 +131,14 @@ my $builder = $class->new(
needs_compiler => 1,
release_status => 'testing',
requires => {
'ExtUtils::PkgConfig' => '1.03',
'ExtUtils::PkgConfig' => '1.03',
'Test::More' => 0,
'version' => 0,
'ExtUtils::CBuilder' => '0.28',
},
sign => 1,
swig_files => ['./']);
sign => 1);

$builder->config(swig_files => './');
$builder->config(swig_source => { # with dependencies as hash value
'swig/perlcdio.swg' =>
['swig/audio.swg', 'swig/device.swg',
Expand All @@ -159,15 +160,16 @@ if($builder->have_c_compiler()) {
verbose => $builder->config('verbose'));
$builder->notes(swig_installed => $swig_installed);
my ($ccflags, $ldflags,$swig_flags) = check_c_compiler(
$builder->config('cc'));
$builder->config('cc'), $builder->config('ccflags'));
$builder->config(extra_linker_flags => $ldflags);
$builder->config(extra_compiler_flags=> $ccflags);
$builder->config(extra_compiler_flags => $ccflags);
if($swig_installed) {
$builder->config(swig_flags => $swig_flags);
$builder->config(swig_flags => $swig_flags);
$builder->add_build_element('swig');
$builder->add_to_cleanup('lib/perl*.pm','*.c');
}
$builder->add_build_element('c');
$builder->add_to_cleanup('*.o','*_wrap.so','tmp*');
$builder->add_to_cleanup('*.o','*.so','tmp*',);
# better: $builder->config('dlext') $builder->config('obj_ext')
#add a cleanup build_element ??
#rearrange order of the build process
Expand All @@ -177,12 +179,12 @@ if($builder->have_c_compiler()) {
@el = @{$builder->build_elements};
$i = grep {$el[$_] eq 'swig'} 0..$#el;
unshift @el, splice @el, $i, 1;
if ($builder->config('verbose')) {
foreach my $i (@el) {
print " $i ";
}
print "\n";
}
#if ($builder->config('verbose')) {
# foreach my $i (@el) {
# print " $i ";
# }
# print "\n";
#}
}
#distclean : unlink lib/perliso9660.pm, lib/perlmmc.pm lib/perlcdio.pm
# c files?
Expand Down Expand Up @@ -273,21 +275,19 @@ if ($?) {

sub check_c_compiler {
my $cc= shift;

my $ccflags = $libcdio_pkgcfg{cflags}; #this doesn't wokt at all??
#FIXME
$ccflags = "-fPIC -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 ";
$ccflags = "-I/usr/include -D_GNU_SOURCE "; #that seems enough
my $ccflags = shift;
$ccflags .= ' '. $libcdio_pkgcfg{cflags};
## Swig produces a number of GCC warnings. Turn them off if we can.
$ccflags .= try_cflags("-Wno-strict-aliasing");
$ccflags .= try_cflags("-Wno-unused-function");
$ccflags .= try_cflags("-Wno-unused-value");
$ccflags .= try_cflags("-Wno-unused-function");
$ccflags .= try_cflags("-Wno-unused-variable");

my %libiso9660_pkgcfg = ExtUtils::PkgConfig->find ('libiso9660');
my $ldflags = "$libcdio_pkgcfg{libs} $libiso9660_pkgcfg{libs} -lcdio";
my $swig_flags='';
my %libiso9660_pkgcfg = ExtUtils::PkgConfig->find ('libiso9660');
my $ldflags = "$libcdio_pkgcfg{libs} $libiso9660_pkgcfg{libs} -lcdio";
my $swig_flags='';

if ('cygwin' eq $Config{osname} &&
$Config{shrpenv} =~ m{\Aenv LD_RUN_PATH=(.*)\Z} ) {
$ldflags .= " -L$1 -lperl";
Expand Down
34 changes: 16 additions & 18 deletions META.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
---
abstract: 'Perl bindings for CD Input and control library (libcdio)'
name: Device-Cdio
version: v0.3.0
author:
- 'Rocky Bernstein <rocky@cpan.org>'
build_requires:
ExtUtils::CBuilder: 0
configure_requires:
Module::Build: 0.36
generated_by: 'Module::Build version 0.3607'
abstract: Perl bindings for CD Input and control library (libcdio)
license: gpl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
name: Device-Cdio
resources:
license: http://opensource.org/licenses/gpl-license.php
requires:
ExtUtils::CBuilder: 0.28
ExtUtils::PkgConfig: 1.03
Test::More: 0
version: 0
configure_requires:
Module::Build: 0.340201
provides:
Device::Cdio:
file: lib/Device/Cdio.pm
Expand Down Expand Up @@ -48,11 +50,7 @@ provides:
version: 0
perlmmcc:
file: lib/perlmmc.pm
requires:
ExtUtils::CBuilder: 0.28
ExtUtils::PkgConfig: 1.03
Test::More: 0
version: 0
resources:
license: http://opensource.org/licenses/gpl-license.php
version: v0.3.0
generated_by: Module::Build version 0.340201
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
14 changes: 4 additions & 10 deletions t/06.bincue.t
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,8 @@ $result = Device::Cdio::is_device($cuefile);
ok(!$result, "is_device(tocfile)");
$result = $device->get_media_changed();
ok(!$result, "bincue: get_media_changed");
if ($perlcdio::VERSION_NUM >= 77) {
# There's a bug in libcdio 0.76 that causes these to crash
$drc = $device->set_blocksize(2048);
ok($perlcdio::DRIVER_OP_UNSUPPORTED == $drc, "set blocksize");
$drc = $device->set_speed(5);
ok($perlcdio::DRIVER_OP_UNSUPPORTED == $drc, "set speed");
} else {
ok(1, "skip set blocksize");
ok(1, "skip set speed");
}
$drc = $device->set_blocksize(2048);
ok($perlcdio::DRIVER_OP_UNSUPPORTED == $drc, "set blocksize");
$drc = $device->set_speed(5);
ok($perlcdio::DRIVER_OP_UNSUPPORTED == $drc, "set speed");
$device->close();
31 changes: 11 additions & 20 deletions t/07.iso.t
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use lib '../lib';
use blib;

use perliso9660;
use Test::More tests => 14;
use Test::More tests => 15;
note 'Test low-level ISO9660 routines';

sub is_eq($$) {
Expand Down Expand Up @@ -159,25 +159,7 @@ ok($bad==0, 'perliso9660::pathname_isofy');
my @tm = localtime(0);
my $dtime = perliso9660::set_dtime($tm[0], $tm[1], $tm[2], $tm[3], $tm[4],
$tm[5]);
my ($bool, @new_tm) = perliso9660::get_dtime($dtime, 1);

### FIXME Don't know why the discrepancy, but there is an hour
### difference, perhaps daylight savings time.
### Versions before 0.77 have other bugs.
## if ($perliso9660::VERSION_NUM < 77) {
$new_tm[2] = $tm[2];
## }

# print "tm: \n";
# foreach my $tm_i (@tm) {
# print $tm_i, " ";
# }
# print "\n";
# print "new tm: \n";
# foreach my $tm_i (@new_tm) {
# print $tm_i, " ";
# }
# print "\n";
my ($bool, @new_tm) = perliso9660::get_dtime($dtime, 0);

ok(is_eq(\@new_tm, \@tm), 'get_dtime(set_dtime())');

Expand All @@ -187,4 +169,13 @@ ok(is_eq(\@new_tm, \@tm), 'get_dtime(set_dtime())');
# ($bool, @new_tm) = perliso9660::get_ltime($ltime);
# ok(is_eq(\@new_tm, \@tm), 'get_ltime(set_ltime())');

@tm = gmtime();
my $ltime = perliso9660::set_ltime($tm[0], $tm[1], $tm[2], $tm[3], $tm[4],
$tm[5]);
($bool, @new_tm) = perliso9660::get_ltime($ltime);
if($new_tm[8] =! $tm[8]) { #isdst flag
diag(' isdst flags differ '. $new_tm[8]. ' '.$tm[8]);
$new_tm[8] = $tm[8];
}
ok(is_eq(\@new_tm, \@tm), 'get_ltime(set_ltime())');

0 comments on commit 7bbe2cb

Please sign in to comment.