Subject: | Patched Makefile.PL to detect GD version below 2.0.28 |
I have GD 2.0.15 and that version already provides gdlib-config. The
current Makefile.PL reads the version but does not check that it matches the
minimum required version as in the README. This allows the build to proceed
further than it should, and since the tests don't check for the version,
they fail oddly on various missing symbols.
I have attached a patch that enhances Makefile.PL to check for 2.0.28 and
die if an older version is found. This honors the --ignore-missing-gd
option.
I tested my patch by running 'perl Makefile.PL' with my old libgd 2.0.15 to
watch the install die with the new error. I also did this with the --ignore-
missing-gd option, which built but failed its tests, as expected.
Then I installed libgd 2.0.35 and ran 'perl Makefile.PL', which succeeded.
And an FYI, the gd-2.0.35.tar.gz unpacks into directory gd-2.0.35, but it
failed to make until I created an empty configure.in file, and then it
built. However, the library installed reports its internal version as
2.0.34, so the libgd folks need to tweak the 2.0.35 build. The libgd
website shows a fix for the version issue, but not the build issue I
experienced.
Subject: | add_GD_version_test.patch |
diff --git a/Makefile.PL b/Makefile.PL
index 4365139..cd99053 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -21,7 +21,7 @@ my ($options,$lib_gd_path,$lib_ft_path,$lib_png_path,$lib_jpeg_path,$lib_xpm_pat
use Getopt::Long;
GetOptions("ignore_missing_gd" => \$force);
-unless (try_to_autoconfigure(\$options,\$lib_gd_path,\@INC,\@LIBPATH,\@LIBS) || $force) {
+unless (try_to_autoconfigure(\$options,\$lib_gd_path,\@INC,\@LIBPATH,\@LIBS, $force) || $force) {
die <<END;
**UNRECOVERABLE ERROR**
Could not find gdlib-config in the search path. Please install libgd 2.0.28 or higher.
@@ -255,7 +255,7 @@ WriteMakefile(
exit 0;
sub try_to_autoconfigure {
- my ($options,$lib_gd_path,$INC,$LIBPATH,$LIBS) = @_;
+ my ($options,$lib_gd_path,$INC,$LIBPATH,$LIBS,$force) = @_;
my $config = `gdlib-config --all`;
return unless $config;
$AUTOCONFIG++;
@@ -280,7 +280,8 @@ sub try_to_autoconfigure {
$$options = $features;
my ($major, $middle, $minor) = $version =~ /^(\d+)\.(\d+)\.(\d+)$/;
- if ( !$force && (( $major < 2 ) or ( "$major.middle" eq "2.0" && $minor < 28 ) )) {
+ $DB::single=1;
+ if ( !$force && (( $major < 2 ) or ( "$major.$middle" eq "2.0" && $minor < 28 ) )) {
die <<END;
**UNRECOVERABLE ERROR**
Your GD library version $version is too old. Please install libgd 2.0.28 or higher.