Skip to content

Commit

Permalink
bug 2074
Browse files Browse the repository at this point in the history
svn path=/bioperl-ext/trunk/; revision=678
  • Loading branch information
cjfields committed Oct 23, 2007
1 parent 40a63c2 commit c4d2c0a
Show file tree
Hide file tree
Showing 15 changed files with 676 additions and 247 deletions.
1 change: 1 addition & 0 deletions Bio/SeqIO/staden/CHANGES
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
071022 - changed from Inline::C to standard xs module
15 changes: 15 additions & 0 deletions Bio/SeqIO/staden/MANIFEST
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
CHANGES
Makefile.PL
MANIFEST This list of files
META.yml Module meta-data (added by MakeMaker)
read.pm
read.xs
README
t/staden/data/readtest.abi
t/staden/data/readtest.ctf
t/staden/data/readtest.exp
t/staden/data/readtest.pln
t/staden/data/readtest.ztr
t/staden/data/readtestabi.fa
t/staden/data/readtestref.scf
t/staden_read.t
11 changes: 11 additions & 0 deletions Bio/SeqIO/staden/META.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- #YAML:1.0
name: Bio-SeqIO-staden-read
version: 1.51
abstract: ~
license: ~
generated_by: ExtUtils::MakeMaker version 6.36
distribution_type: module
requires:
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.2.html
version: 1.2
179 changes: 116 additions & 63 deletions Bio/SeqIO/staden/Makefile.PL
Original file line number Diff line number Diff line change
@@ -1,76 +1,129 @@
use Inline::MakeMaker;
use ExtUtils::MakeMaker;
use Config;
use Cwd qw(realpath);
use strict;

WriteInlineMakefile(
'NAME' => 'Bio::SeqIO::staden::read',
'VERSION_FROM' => './read.pm', # finds $VERSION,
'PREREQ_PM' => { 'Inline::C' => 0.0,
'Bio::SeqIO::abi' => 0.0,
}, # e.g., Module::Name => 1.1,
test => { TESTS => 'test.pl' },
);

sub MY::test_via_script {
package MY;
my $self = shift;
return ''; # prevent double-run of test.pl
}
my $default_staden_location = '/usr/local/staden/io_lib';

sub MY::post_initialize {
package MY;
my $self = shift;
my %options = %{
{
'NAME' => 'Bio::SeqIO::staden::read',
'VERSION' => '1.51'
}
};

my ($iolibinc, $ioliblib) = @ENV{qw(IOLIB_INC IOLIB_LIB)};
my ($staden_libs_opts, $staden_include_opts );

unless ($ioliblib) {
($ioliblib) = grep { defined } map { m/^IOLIB_LIB\=(\S+)/o ? $1 : undef } @ARGV;
}
unless ($iolibinc) {
($iolibinc) = grep { defined } map { m/^IOLIB_INC\=(\S+)/o ? $1 : undef } @ARGV;
}
#
# see if io_lib-config from staden is on the path.
#
#
print "Let's see if io_lib-config is on your path\n";
system("io_lib-config --version");

# guess wildly!!
unless ($ioliblib) {
my @d;
for my $test (split(/\s+/, $main::Config{libpth}), $self->{LIB}) {
next unless $test;
eval { local $SIG{__WARN__} = sub { }; @d = $self->ext("-L$test -lread") };
if ($d[3] eq $test) {
$ioliblib = $test;
warn "Found Staden io_lib \"libread\" in $ioliblib ...\n";
unless ($iolibinc) {
$iolibinc = $test;
$iolibinc =~ s/lib$/include/;
$iolibinc = $self->catdir($iolibinc, "io_lib");
unless (-e $self->catfile($iolibinc, "Read.h")) {
undef $iolibinc;
} else {
warn "Automatically using the Read.h found in $iolibinc ...\n";
}
}
last;
}
}
}
if ( $? ) { # no io_lib-config on path
print "Nope, couldn't find io_lib-config on the path\n";

# try the environment

unless ($ioliblib) {
$ioliblib = ExtUtils::MakeMaker::prompt("Please tell us where your Staden io_lib \"read\" library is installed: ", "/usr/local/lib");
my ($iolibinc, $ioliblib) = @ENV{qw(IOLIB_INC IOLIB_LIB)};

# try the command line
unless ($ioliblib) {
($ioliblib) = grep { defined } map { m/^IOLIB_LIB\=(\S+)/o ? $1 : undef } @ARGV;
}
unless ($iolibinc) {
($iolibinc) = grep { defined } map { m/^IOLIB_INC\=(\S+)/o ? $1 : undef } @ARGV;
}

# guess wildly!
unless( $ioliblib ) {
my @d;
for my $test (split(/\s+/, $main::Config{libpth} ) ) {
next unless $test;
eval { local $SIG{__WARN__} = sub { }; @d = ExtUtils::Liblist->ext("-L$test -lread") };
my ($dir) = split /\s+/, $d[2];
if ($dir eq "-L$test") {
$ioliblib = $test;
warn "Found Staden io_lib \"libread\" in $ioliblib ...\n";
unless ($iolibinc) {
$iolibinc = $test;
$iolibinc =~ s/lib$/include/;
my $iolibinc_io_lib = File::Spec->catdir($iolibinc, 'io_lib');
unless (-e File::Spec->catfile($iolibinc_io_lib, 'Read.h')) {
undef $iolibinc;
} else {
warn "Found the Read.h found in $iolibinc but lets see what io_lib-config might think...\n";
}
}
last;
}
}
}

# try asking for help.

my $stadenloc;

unless ( $ioliblib ) {
$stadenloc = ExtUtils::MakeMaker::prompt("Please tell us where your Staden io_lib resides: ", $default_staden_location );
$stadenloc = realpath( $stadenloc );
}
#
# use the default if nothing was entered
#

unless ($iolibinc) {
my $prompt;
if ($ioliblib) {
$prompt = $ioliblib;
$prompt =~ s/lib$/include/;
$prompt = $self->catdir($prompt, "io_lib");
} else {
$prompt = "/usr/local/include/io_lib";
}
$iolibinc = ExtUtils::MakeMaker::prompt("Please tell us where your Staden io_lib \"Read.h\" header is installed: ", $prompt);
$stadenloc = $stadenloc ? $stadenloc
: $ioliblib ? realpath( File::Spec->catdir($ioliblib, '..' ) )
: $default_staden_location;

if ( ! -d $stadenloc ) {
warn "WARNING: directory $stadenloc not found";
}

if ( -x File::Spec->catfile( $stadenloc, 'bin', 'io_lib-config' ) ) {
($staden_libs_opts, $staden_include_opts )
= get_from_ioconfig( File::Spec->catfile( $stadenloc, 'bin', 'io_lib-config') );
}
else{
#
# no io_lib-config, try some defaults.
#

$ioliblib ||= File::Spec->catdir( $stadenloc,'lib' );
unless ( $iolibinc ) {
$iolibinc = $ioliblib;
$iolibinc =~ s/lib$/include/;
}

`perl -pi -e 's{(LIBS\\s*=>\\s*")([^"]+)}{\$1-L$ioliblib -lread -lz};' read.pm`;
`perl -pi -e 's{(INC\\s*=>\\s*")([^"]+)}{\$1-I$iolibinc};' read.pm`;
$staden_libs_opts = "-L$ioliblib -lz -lm -lread";
$staden_include_opts = "-I$iolibinc";
}
}
else {
print "Yes, found io_lib-config, using it to set flags for read.c\n";
($staden_libs_opts, $staden_include_opts )
= get_from_ioconfig('io_lib-config');
}

$options{INC} = $staden_include_opts;
$options{LIBS} = $staden_libs_opts;

WriteMakefile(%options);

return '';
# -- done --

sub get_from_ioconfig {
my ( $binary ) = @_;

my $libs = `$binary --libs`;
my $incs = `$binary --cflags`;

chomp $libs;
chomp $incs;

return( $libs, $incs );
}

# Remove the Makefile dependency. Causes problems on a few systems.
# sub MY::makefile { '' }
54 changes: 54 additions & 0 deletions Bio/SeqIO/staden/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
o Version

This version number is from Bioperl-ext version 1.5.1 from CVS HEAD.

o Summary

Bio::SeqIO::staden::read (Aaron Mackey <amackey@virginia.edu>)

o Installing

To install

perl Makefile.PL
make
make test
make install (may need root permissions)

This extension needs the rest of the main bioperl distribution to
function properly. It is only useful as a helper module for the SeqIO
system to read sequence trace files handled by the Staden package's
io_lib "read" library. You should have this library installed prior
to installing Bio::SeqIO::staden::read, it's currently available at:

https://sourceforge.net/project/showfiles.php?group_id=100316

Currently, the Bio::SeqIO::staden::read extension only works with io_lib
v. 1.8.11 or 1.8.12; v. 1.9 and higher have several prototype changes in the
"read" library which have broken compatibility in those versions for now.
It is possible these changes may be addressed in the future.

Many users have noted that the io_lib install process often forgets
to install the "os.h" file along with the rest of the include files;
you may have to do this manually. If so, you may also have to
install the "config.h" file for "os.h" to find all the information it
needs. Finally, you may also need to edit "os.h" to #include
<config.h> instead of #include "config.h" if you continue to get
undefined symbol errors during compilation. On some OSes you may in fact
have to do the OPPOSITE, meaning change <config.h> to "config.h".

The bioperl-ext make process will prompt you for the LIB and INCLUDE
locations (usually /usr/local/lib and usr/local/include/io_lib,
respectively) of the io_lib "libread" library and Read.h header files,
after trying to automatically find them. You may also specify these
via the environment variables "IOLIB_LIB" and "IOLIB_INC", or via
identically named options to perl Makefile.PL:

perl Makefile.PL IOLIB_LIB=/opt/lib IOLIB_INC=/opt/include/io_lib

Ignore any warnings about these options being unknown to MakeMaker.

A failed compilation is most likely due to an incomplete io_lib
installation; make sure that all the required io_lib ".h" files are in
place (see above regarding "os.h" and "config.h").

Loading

0 comments on commit c4d2c0a

Please sign in to comment.