Subject: | [PATCH] libtiff detection fails if using non-standard lib dir |
Date: | Sat, 15 May 2010 14:22:58 -0700 |
To: | bug-Imager [...] rt.cpan.org |
From: | Justin Davis <jrcd83 [...] gmail.com> |
I have installed my libtiff, libjpeg etc library in a non-standard
location. This way I won't break my websites when I do system
upgrades, etc. All the libraries are detected except libtiff, which
uses Devel::CheckLib. Very funky stuff, but I found out it fails
because the compiled test (C) program won't run. It won't run because
it can't find the libraries! So I created a patch to set
LD_LIBRARY_PATH if we are running linux. I don't know how to fix this
with other OSes.
I added a WARNING because Devel::CheckLib does not run the compiled
test file anymore, it seems. If it still did I would submitted a bug
report to them instead.
I also used the 3-arg form of open, since you already have the file
path in a variable... and it's nicer looking.
diff --git a/Makefile.PL b/Makefile.PL
index 0b71b80..d71440b 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1026,6 +1026,11 @@ sub postcheck_tiff {
$lib = "tiff";
}
+ # Fix our non-standard lib paths for runtime as well.
+ local $ENV{'LD_LIBRARY_PATH'} = join q{:},
+ ( @{ $format->{libdir} }, ( $ENV{'LD_LIBRARY_PATH'} || qw// ))
+ if $^O eq 'linux';
+
my $good =
eval {
assert_lib
@@ -1047,12 +1052,13 @@ sub postcheck_tiff {
return 0;
}
FUNCTION
- );
+ ); # WARNING: Devel::CheckLib might not execute this in newer versions!
+ # v0.699_002 only checks if it compiles and links properly.
1;
};
unless ($good && -s $tiffver_name
- && open(VERS, "< probe/tiffver.txt")) {
+ && open(VERS, '<', $tiffver_name)) {
unlink $tiffver_name unless $KEEP_FILES;
print <<EOS;
**tiff: cannot determine libtiff version number