Skip to content

Instantly share code, notes, and snippets.

@amontalban
Created March 13, 2017 21:15
Show Gist options
  • Save amontalban/9f94bf26cb3768f28b693c4c849906ee to your computer and use it in GitHub Desktop.
Save amontalban/9f94bf26cb3768f28b693c4c849906ee to your computer and use it in GitHub Desktop.
GD Patch to support optional features included in libgd > 2.0.33
diff -urN GD-2.56.orig/Build.PL GD-2.56/Build.PL
--- GD-2.56.orig/Build.PL 2014-10-27 23:34:54.000000000 -0200
+++ GD-2.56/Build.PL 2017-03-13 18:03:07.000000000 -0300
@@ -261,7 +261,7 @@
return unless $config;
$AUTOCONFIG++;
- my ($version) = $config =~ /^GD library\s+(\S+)/m;
+ my ($version) = $config =~ /^GD library\s+([0-9.]+)/m;
warn "Configuring for libgd version $version.\n";
my ($cflags) = $config =~ /^cflags:\s+(.+)/m;
@@ -280,8 +280,10 @@
($$lib_gd_path = $libdir) =~ s!/[^/]+$!!;
$$options = $features;
- my ($minor) = $version =~ /^2\.\d+\.(\d+)$/;
- $$options .= " GD_UNCLOSEDPOLY GD_ANIMGIF GD_FTCIRCLE VERSION_33" if defined($minor) && $minor >= 33;
+ my ($release, $major, $minor) = $version =~ /^(\d+)\.(\d+)\.(\d+)$/;
+ if (defined($minor) && ($release > 2 || ($release == 2 && $major > 0) || ($release == 2 && $major == 0 && $minor >= 33))) {
+ $$options .= " GD_UNCLOSEDPOLY GD_ANIMGIF GD_FTCIRCLE VERSION_33";
+ }
my @correct_inc = map {s/^-I// && $_} split /\s+/,$cflags;
check_for_stray_headers($includedir,@correct_inc);
diff -urN GD-2.56.orig/Makefile.PL GD-2.56/Makefile.PL
--- GD-2.56.orig/Makefile.PL 2014-10-27 23:34:54.000000000 -0200
+++ GD-2.56/Makefile.PL 2017-03-13 18:03:55.000000000 -0300
@@ -280,7 +280,7 @@
return unless $config;
$AUTOCONFIG++;
- my ($version) = $config =~ /^GD library\s+(\S+)/m;
+ my ($version) = $config =~ /^GD library\s+([0-9.]+)/m;
warn "Configuring for libgd version $version.\n";
my ($cflags) = $config =~ /^cflags:\s+(.+)/m;
@@ -299,8 +299,10 @@
($$lib_gd_path = $libdir) =~ s!/[^/]+$!!;
$$options = $features;
- my ($minor) = $version =~ /^2\.\d+\.(\d+)$/;
- $$options .= " GD_UNCLOSEDPOLY GD_ANIMGIF GD_FTCIRCLE VERSION_33" if defined($minor) && $minor >= 33;
+ my ($release, $major, $minor) = $version =~ /^(\d+)\.(\d+)\.(\d+)$/;
+ if (defined($minor) && ($release > 2 || ($release == 2 && $major > 0) || ($release == 2 && $major == 0 && $minor >= 33))) {
+ $$options .= " GD_UNCLOSEDPOLY GD_ANIMGIF GD_FTCIRCLE VERSION_33";
+ }
my @correct_inc = map {s/^-I// && $_} split /\s+/,$cflags;
check_for_stray_headers($includedir,@correct_inc);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment