From 8417af947856847a0c38565a78ee636594b106eb Mon Sep 17 00:00:00 2001 From: wenyuzifang Date: Wed, 17 Sep 2025 19:29:26 +0800 Subject: [PATCH] Update code from upstream --- gd.spec | 25 +++++++++++++++++++++--- libgd-flip.patch | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 libgd-flip.patch diff --git a/gd.spec b/gd.spec index 5bc37c0..4fd756b 100644 --- a/gd.spec +++ b/gd.spec @@ -1,4 +1,4 @@ -%define anolis_release 6 +%define anolis_release 7 %bcond_with liq %bcond_with raqm %bcond_with avif @@ -6,14 +6,15 @@ Summary: A graphics library for quick creation of PNG or JPEG images Name: gd -Version: 2.3.3 +Version: 2.3.3 Release: %{anolis_release}%{?dist} License: MIT URL: http://libgd.github.io/ -Source0: https://github.com/libgd/libgd/releases/download/gd-%{version}/libgd-%{version}.tar.xz +Source0: https://github.com/libgd/libgd/releases/download/gd-2.3.3/libgd-2.3.3.tar.xz # Missing header see https://github.com/libgd/libgd/pull/766 Patch0: libgd-iostream.patch +Patch1: libgd-flip.patch BuildRequires: pkgconfig(fontconfig) BuildRequires: pkgconfig(freetype2) >= 9.8.3 @@ -40,6 +41,22 @@ BuildRequires: perl-generators BuildRequires: perl(FindBin) # for fontconfig/basic test BuildRequires: cmake +BuildRequires: fontconfig-devel +BuildRequires: freetype-devel +BuildRequires: gettext-devel +BuildRequires: libX11-devel +BuildRequires: libXpm-devel +BuildRequires: libavif-devel +BuildRequires: liberation-sans-fonts +BuildRequires: libimagequant-devel +BuildRequires: libjpeg-devel +BuildRequires: libpng-devel +BuildRequires: libtiff-devel +BuildRequires: libtool +BuildRequires: libwebp-devel +BuildRequires: make +BuildRequires: pkgconfig +BuildRequires: zlib-devel %description @@ -144,6 +161,8 @@ rm -fr %{buildroot}%{_datadir}/doc/* %doc CHANGELOG.md CONTRIBUTORS CONTRIBUTING.md README.md %changelog +* Wed Sep 17 2025 wenyuzifang - 2.3.3-7 +- Preserve backward compatibility with PHP GD extension by restoring and protecting essential flip direction macros. * Wed Apr 19 2023 Jing Zhang - 2.3.3-6 - Remove libgd-flip.patch diff --git a/libgd-flip.patch b/libgd-flip.patch new file mode 100644 index 0000000..4fa964f --- /dev/null +++ b/libgd-flip.patch @@ -0,0 +1,50 @@ +From f4bc1f5c26925548662946ed7cfa473c190a104a Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Mon, 13 Sep 2021 14:57:52 +0200 +Subject: [PATCH 1/2] Revert "Fix #318, these macros are not used as planed, we + have separate functions for each" + +This reverts commit bdc281eadb1d58d5c0c7bbc1125ee4674256df08. +--- + src/gd.h | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/gd.h b/src/gd.h +index 30560395..1ad9e637 100644 +--- a/src/gd.h ++++ b/src/gd.h +@@ -1604,6 +1604,11 @@ BGD_DECLARE(void) gdImageFlipHorizontal(gdImagePtr im); + BGD_DECLARE(void) gdImageFlipVertical(gdImagePtr im); + BGD_DECLARE(void) gdImageFlipBoth(gdImagePtr im); + ++#define GD_FLIP_HORINZONTAL 1 /* typo, kept for BC */ ++#define GD_FLIP_HORIZONTAL 1 ++#define GD_FLIP_VERTICAL 2 ++#define GD_FLIP_BOTH 3 ++ + /** + * Group: Crop + * + +From e47c619d792455aad23708d2ec2947455394427e Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Mon, 13 Sep 2021 14:59:47 +0200 +Subject: [PATCH 2/2] add comment to not remove these macros + +--- + src/gd.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/gd.h b/src/gd.h +index 1ad9e637..71f5a89c 100644 +--- a/src/gd.h ++++ b/src/gd.h +@@ -1604,6 +1604,8 @@ BGD_DECLARE(void) gdImageFlipHorizontal(gdImagePtr im); + BGD_DECLARE(void) gdImageFlipVertical(gdImagePtr im); + BGD_DECLARE(void) gdImageFlipBoth(gdImagePtr im); + ++/* Macros still used in gd extension up to PHP 8.0 ++ so please keep these unused macros for now */ + #define GD_FLIP_HORINZONTAL 1 /* typo, kept for BC */ + #define GD_FLIP_HORIZONTAL 1 + #define GD_FLIP_VERTICAL 2 -- Gitee