0.006 unreleased
- - screenshot() on a non-toplevel Tk widget would crash when
- calling the frame method. Since this call appears to be
- unnecessary I've removed it, and plan to run tests on a few
- platforms to check I haven't broken anything.
- RT #32843 - thanks to Slaven Rezic.
+
+- screenshot() on a non-toplevel Tk widget would crash when
+ calling the frame method. Since this call appears to be
+ unnecessary I've removed it, and plan to run tests on a few
+ platforms to check I haven't broken anything.
+ RT #32843 - thanks to Slaven Rezic.
+
+- improved the error messages displayed when headers and libraries
+ can't be found
+ http://rt.cpan.org/Ticket/Display.html?id=32856
+
+- added --incpath and --libpath options to Makefile.PL and also look
+ in $ENV{IM_INCPATH} and $ENV{IM_LIBPATH} like Imager.
0.005 12 Mar 2007
- 0.005 release
use Imager::ExtUtils;
use Config;
use File::Spec;
+use Getopt::Long;
+
+my @incpaths; # places to look for headers
+my @libpaths; # places to look for libraries
+
+GetOptions("incpath=s", \@incpaths,
+ "libpath=s" => \@libpaths);
my @objs = qw/Screenshot.o/;
my @cflags;
my %seen_incdir;
my %seen_libdir;
my $X11_lib = $^O eq 'cygwin' ? 'X11.dll' : 'X11';
-if (find_header("X11/Xlib.h") and find_lib($X11_lib)) {
+if (find_header("X11/Xlib.h", "X11 header")
+ and find_lib($X11_lib, "X11 library")) {
push @objs, 'scx11.o';
push @cflags, '-DSS_X11';
push @lflags, '-l'.$X11_lib;
print "Found X11\n";
}
-if (find_header('windows.h') and find_lib('gdi32')) {
+if (find_header('windows.h', "Win32 header")
+ and find_lib('gdi32', "Win32 library")) {
push @objs, 'scwin32.o';
push @cflags, '-DSS_WIN32';
if ($^O eq 'cygwin') {
}
unless (@objs > 1) {
- die "NA: Sorry, I can't find headers or libraries for a supported GUI\n"
+ die <<DEAD;
+
+NA: Sorry, I can't find headers or libraries for a supported GUI
+You need to install development headers and libraries for your GUI
+For Win32: Platform SDK or a substitute
+For X11: X11 headers and libraries, eg. the libX11-dev package on Debian
+
+DEAD
}
+my $extra_meta = <<META;
+configure_requires:
+ Imager: 0.54
+build_requires:
+ Imager: 0.54
+ Test::More: 0.47
+META
+
my %opts =
(
NAME => 'Imager::Screenshot',
},
INC => Imager::ExtUtils->includes,
TYPEMAPS => [ Imager::ExtUtils->typemap ],
+ EXTRA_META => $extra_meta,
);
$opts{LIBS} = "@lflags" if @lflags;
sub header_search_path {
@incs and return @incs;
+ push @incs, map {; split /\Q$Config{path_sep}/ } @incpaths;
+ push @incs, split /\Q$Config{path_sep}/, $ENV{IM_INCPATH}
+ if defined $ENV{IM_INCPATH};
push @incs, '/usr/include', '/usr/X11R6/include'
unless $^O eq 'MSWin32' && $Config{cc} =~ /\bcl\b/;
push @incs, split /\Q$Config{path_sep}/, $ENV{INCLUDE}
sub library_search_path {
@libs and return @libs;
+ push @libs, map {; split /\Q$Config{path_sep}/ } @libpaths;
+ push @incs, split /\Q$Config{path_sep}/, $ENV{IM_LIBPATH}
+ if defined $ENV{IM_LIBPATH};
push @libs, '/usr/lib', '/usr/X11R6/lib'
unless $^O eq 'MSWin32' && $Config{cc} =~ /\bcl\b/;
push @libs, split /\Q$Config{path_sep}/, $ENV{LIB}
@libs;
}
-
sub _find_file {
my ($name, @where) = @_;
}
sub find_header {
+ my ($name, $description) = @_;
my @found = _find_file($_[0], header_search_path());
if (@found) {
- push @cflags, "-I$_" for grep !$seen_incdir{$_}, @found;
- @seen_incdir{@found} = (1) x @found;
+ push @cflags, "-I$_" for grep !$seen_incdir{$_}, @found;
+ @seen_incdir{@found} = (1) x @found;
+ }
+ else {
+ print STDERR "Could not find $name ($description)\n";
}
@found;
}
sub find_lib {
- my $name = shift;
+ my ($name, $description) = shift;
my @found;
+ my $libname;
if ($^O eq 'MSWin32' && $Config{_a} eq '.lib') {
- @found = _find_file($name . $Config{_a}, library_search_path());
+ $libname = $name . $Config{_a};
}
else {
- @found = _find_file("lib" . $name . $Config{_a}, library_search_path());
+ $libname = "lib" . $name . $Config{_a};
}
+ @found = _find_file($libname, library_search_path());
if (@found) {
push @lflags, "-L$_" for grep !$seen_libdir{$_}, @found;
@seen_libdir{@found} = (1) x @found;
}
+ else {
+ print STDERR "Could not find $libname ($description)\n";
+ }
+
@found;
}