Patch
Ian Grant <[email protected]> Fri, 24 Apr 2009 15:50:54 +0100
| Newsgroups | gmane.comp.lang.perl.modules.dbi.sybase |
|---|---|
| Organization | Computer Laboratory |
| Message-ID | <[email protected]> |
--MP_/.S1tZEuBd9XAPIfJ.fysgKZ
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Here is a patch to Makefile.PL from 1.09 which allows DBD::Sybase to build on systems with freetds libraries under /usr/lib or /usr/lib64. Hopefully it will work for Syabase libraries as well.
--MP_/.S1tZEuBd9XAPIfJ.fysgKZ
Content-Type: text/x-patch; name=DBD-Sybase-1.09-64bit-build.patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=DBD-Sybase-1.09-64bit-build.patch
--- Makefile.PL.orig 2009-04-24 15:37:54.000000000 +0100
+++ Makefile.PL 2009-04-24 15:38:01.000000000 +0100
@@ -14,10 +14,11 @@
use Getopt::Long;
use vars qw($SYBASE $inc_string $lib_string $LINKTYPE $written_pwd_file
- $newlibnames);
+ $newlibnames $libdir);
$LINKTYPE = 'dynamic';
$written_pwd_file = 'PWD';
+$libdir = 'lib';
my $file;
my $chained;
@@ -34,9 +35,9 @@
configPwd();
my $lddlflags = $Config{lddlflags};
-$lddlflags = "-L$SYBASE/lib $lddlflags" unless $^O eq 'VMS';
+$lddlflags = "-L$SYBASE/$libdir $lddlflags" unless $^O eq 'VMS';
my $ldflags = $Config{ldflags};
-$ldflags = "-L$SYBASE/lib $ldflags" unless $^O eq 'VMS';
+$ldflags = "-L$SYBASE/$libdir $ldflags" unless $^O eq 'VMS';
WriteMakefile('NAME' => 'DBD::Sybase',
@@ -114,11 +115,18 @@
$SYBASE .= "/$ENV{SYBASE_OCS}";
}
- if(! -d "$SYBASE/lib") {
- die "Can't find the lib directory under $SYBASE!";
+ my $lib_found = 0;
+ my $libsub = '';
+ foreach $libdir ('lib', 'lib64') {
+ if (-d "$SYBASE/$libdir") {
+ if (checkLib($SYBASE)) {
+ $lib_found = 1;
+ $libsub=$libdir;
+ }
+ }
}
- die "Can't find any Sybase libraries in $SYBASE/lib" unless checkLib($SYBASE);
+ die "Can't find any Sybase libraries in $SYBASE/lib or $SYBASE/lib64" unless $lib_found;
my $inc_found = 0;
if(-d "$SYBASE/include" && -f "$SYBASE/include/cspublic.h") {
@@ -133,7 +141,7 @@
}
die "Can't find the Client Library include files under $SYBASE" unless($inc_found);
- my $version = getLibVersion($SYBASE);
+ my $version = getLibVersion("$SYBASE/$libsub");
# if(!$version || $version lt '12') {
#print "FreeTDS or older Client Library. Enabling CS-Lib Callbacks\n";
#$inc_string .= " -DUSE_CSLIB_CB=1";
@@ -156,9 +164,9 @@
my $extra = getExtraLibs($SYBASE, $attr{EXTRA_LIBS}, $version);
if($file) {
- $lib_string = "-L$SYBASE/lib -lct -lcs -ltcl -lcomn -lintl -lblk $attr{EXTRA_LIBS} -ldl -lm";
+ $lib_string = "-L$SYBASE/$libdir -lct -lcs -ltcl -lcomn -lintl -lblk $attr{EXTRA_LIBS} -ldl -lm";
} else {
- $lib_string = "-L$SYBASE/lib -lct -lcs -ltcl -lcomn -lintl -lblk $extra -ldl -lm";
+ $lib_string = "-L$SYBASE/$libdir -lct -lcs -ltcl -lcomn -lintl -lblk $extra -ldl -lm";
}
if($newlibnames) {
foreach (qw(ct cs tcl comn intl blk)) {
@@ -170,7 +178,7 @@
my %libname;
- %libname = loadSybLibs("$SYBASE/lib");
+ %libname = loadSybLibs("$SYBASE/$libdir");
my $libtype = '';
@@ -280,9 +288,8 @@
}
sub getLibVersion {
- my $dir = shift;
+ my $lib = shift;
- my $lib = "$dir/lib";
opendir(DIR, $lib);
# reverse to pick up libsybct before libct...
my @files = reverse(grep(/lib(syb)?ct(64)?\./, readdir(DIR)));
@@ -317,8 +324,8 @@
my $cfg = shift;
my $version = shift;
- opendir(DIR, "$dir/lib") || die "Can't access $dir/lib: $!";
- my %files = map { $_ =~ s/lib([^\.]+)\..*/$1/; $_ => 1 } grep(/lib/ && -f "$dir/lib/$_", readdir(DIR));
+ opendir(DIR, "$dir/$libdir") || die "Can't access $dir/lib: $!";
+ my %files = map { $_ =~ s/lib([^\.]+)\..*/$1/; $_ => 1 } grep(/lib/ && -f "$dir/$libdir/$_", readdir(DIR));
closedir(DIR);
my %x = map {$_ => 1} split(' ', $cfg);
@@ -331,7 +338,7 @@
}
foreach my $f (qw(insck tli sdna dnet_stub tds skrb gss)) {
- $x{"-l$f"} = 1 if exists $files{$f} && -f "$dir/lib/lib$f.$dlext";
+ $x{"-l$f"} = 1 if exists $files{$f} && -f "$dir/$libdir/lib$f.$dlext";
}
if($version gt '11') {
delete($x{-linsck});
@@ -348,7 +355,7 @@
sub checkLib {
my $dir = shift;
- opendir(DIR, "$dir/lib") || die "Can't access $dir/lib: $!";
+ opendir(DIR, "$dir/$libdir") || die "Can't access $dir/$libdir: $!";
my @files = grep(/libct|libsybct/i, readdir(DIR));
closedir(DIR);
if(grep(/libsybct/, @files)) {
--MP_/.S1tZEuBd9XAPIfJ.fysgKZ--