diff --git a/.gitignore b/.gitignore index 0a16c45..b95fae7 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,6 @@ gd-2.0.35.tar.bz2 /libgd-2.2.4.tar.xz /libgd-2.2.5.tar.xz /libgd-2.3.0.tar.xz +/libgd-2.3.1.tar.xz +/libgd-2.3.2.tar.xz +/libgd-2.3.3.tar.xz diff --git a/gd-bug615.patch b/gd-bug615.patch deleted file mode 100644 index 74192e8..0000000 --- a/gd-bug615.patch +++ /dev/null @@ -1,188 +0,0 @@ -From 3dd0e308cbd2c24fde2fc9e9b707181252a2de95 Mon Sep 17 00:00:00 2001 -From: "Christoph M. Becker" -Date: Tue, 5 May 2020 12:02:45 +0200 -Subject: [PATCH] Fix #615: gdImageStringFT() fails for empty strings as of - libgd 2.3.0 (#633) - -We change the return type of `textLayout()` to `ssize_t`, and signal -failure by returning `-1`, so that laying out an empty string is no -longer handled as failure. We make sure that no overflow occurs, -assuming that all `int` values can be fully represented as `ssize_t`. ---- - src/gdft.c | 18 +++++++++--------- - tests/gdimagestringft/.gitignore | 1 + - tests/gdimagestringft/CMakeLists.txt | 1 + - tests/gdimagestringft/Makemodule.am | 1 + - tests/gdimagestringft/bug00615.c | 25 +++++++++++++++++++++++++ - 5 files changed, 37 insertions(+), 9 deletions(-) - create mode 100644 tests/gdimagestringft/bug00615.c - -diff --git a/src/gdft.c b/src/gdft.c -index b483b383..186eefff 100644 ---- a/src/gdft.c -+++ b/src/gdft.c -@@ -441,7 +441,7 @@ typedef struct { - uint32_t cluster; - } glyphInfo; - --static size_t -+static ssize_t - textLayout(uint32_t *text, int len, - FT_Face face, gdFTStringExtraPtr strex, - glyphInfo **glyph_info) -@@ -459,19 +459,19 @@ textLayout(uint32_t *text, int len, - !raqm_set_par_direction (rq, RAQM_DIRECTION_DEFAULT) || - !raqm_layout (rq)) { - raqm_destroy (rq); -- return 0; -+ return -1; - } - - glyphs = raqm_get_glyphs (rq, &count); - if (!glyphs) { - raqm_destroy (rq); -- return 0; -+ return -1; - } - - info = (glyphInfo*) gdMalloc (sizeof (glyphInfo) * count); - if (!info) { - raqm_destroy (rq); -- return 0; -+ return -1; - } - - for (i = 0; i < count; i++) { -@@ -489,7 +489,7 @@ textLayout(uint32_t *text, int len, - FT_Error err; - info = (glyphInfo*) gdMalloc (sizeof (glyphInfo) * len); - if (!info) { -- return 0; -+ return -1; - } - for (count = 0; count < len; count++) { - /* Convert character code to glyph index */ -@@ -508,7 +508,7 @@ textLayout(uint32_t *text, int len, - err = FT_Load_Glyph (face, glyph_index, FT_LOAD_DEFAULT); - if (err) { - gdFree (info); -- return 0; -+ return -1; - } - info[count].index = glyph_index; - info[count].x_offset = 0; -@@ -527,7 +527,7 @@ textLayout(uint32_t *text, int len, - #endif - - *glyph_info = info; -- return count; -+ return count <= SSIZE_MAX ? count : -1; - } - - /********************************************************************/ -@@ -1108,7 +1108,7 @@ BGD_DECLARE(char *) gdImageStringFTEx (gdImage * im, int *brect, int fg, const c - char *tmpstr = 0; - uint32_t *text; - glyphInfo *info = NULL; -- size_t count; -+ ssize_t count; - int render = (im && (im->trueColor || (fg <= 255 && fg >= -255))); - FT_BitmapGlyph bm; - /* 2.0.13: Bob Ostermann: don't force autohint, that's just for testing -@@ -1409,7 +1409,7 @@ BGD_DECLARE(char *) gdImageStringFTEx (gdImage * im, int *brect, int fg, const c - - count = textLayout (text , i, face, strex, &info); - -- if (!count) { -+ if (count < 0) { - gdFree (text); - gdFree (tmpstr); - gdCacheDelete (tc_cache); -diff --git a/tests/gdimagestringft/CMakeLists.txt b/tests/gdimagestringft/CMakeLists.txt -index f46b9006..42868a27 100644 ---- a/tests/gdimagestringft/CMakeLists.txt -+++ b/tests/gdimagestringft/CMakeLists.txt -@@ -1,5 +1,6 @@ - IF(FREETYPE_FOUND) - LIST(APPEND TESTS_FILES -+ bug00615 - gdimagestringft_bbox - ) - ENDIF(FREETYPE_FOUND) -diff --git a/tests/gdimagestringft/Makemodule.am b/tests/gdimagestringft/Makemodule.am -index 0dfe26fb..a62081f4 100644 ---- a/tests/gdimagestringft/Makemodule.am -+++ b/tests/gdimagestringft/Makemodule.am -@@ -1,5 +1,6 @@ - if HAVE_LIBFREETYPE - libgd_test_programs += \ -+ gdimagestringft/bug00615 \ - gdimagestringft/gdimagestringft_bbox - endif - -diff --git a/tests/gdimagestringft/bug00615.c b/tests/gdimagestringft/bug00615.c -new file mode 100644 -index 00000000..0da51dae ---- /dev/null -+++ b/tests/gdimagestringft/bug00615.c -@@ -0,0 +1,25 @@ -+/** -+ * Test that rendering an empty string does not fail -+ * -+ * Rendering an empty string with gdImageStringFT() is not supposed to fail; -+ * it is just a no-op. -+ * -+ * See -+ */ -+ -+#include "gd.h" -+#include "gdtest.h" -+ -+int main() -+{ -+ gdImagePtr im = gdImageCreate(100, 100); -+ -+ int rect[8]; -+ int fg = gdImageColorAllocate(im, 255, 255, 255); -+ char *path = gdTestFilePath("freetype/DejaVuSans.ttf"); -+ char *res = gdImageStringFT(im, rect, fg, path, 12, 0, 10, 10, ""); -+ -+ gdTestAssert(res == NULL); -+ -+ return gdNumFailures(); -+} -From 0be6aec0fe11dce8b8a5674eea5ee23bc700042e Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Wed, 15 Jul 2020 08:56:08 +0200 -Subject: [PATCH] Fix #615 using libraqm and avoid unneeded free - ---- - src/gdft.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/src/gdft.c b/src/gdft.c -index 186eefff..7eb97077 100644 ---- a/src/gdft.c -+++ b/src/gdft.c -@@ -449,6 +449,10 @@ textLayout(uint32_t *text, int len, - size_t count; - glyphInfo *info; - -+ if (!len) { -+ return 0; -+ } -+ - #ifdef HAVE_LIBRAQM - size_t i; - raqm_glyph_t *glyphs; -@@ -1566,7 +1570,9 @@ BGD_DECLARE(char *) gdImageStringFTEx (gdImage * im, int *brect, int fg, const c - } - - gdFree(text); -- gdFree(info); -+ if (info) { -+ gdFree(info); -+ } - - /* Save the (unkerned) advance from the last character in the xshow vector */ - if (strex && (strex->flags & gdFTEX_XSHOW) && strex->xshow) { diff --git a/gd.spec b/gd.spec index 3041471..7f22720 100644 --- a/gd.spec +++ b/gd.spec @@ -1,12 +1,25 @@ -%global with_liq 1 -%global with_raqm 1 +%if 0%{?rhel} +%bcond_with liq +%bcond_with raqm +%bcond_with avif +%else +# Enabled by default +%bcond_without liq +%bcond_without avif +%endif +# disabled as breaks vertical text +# See https://bugzilla.redhat.com/2022957 +%bcond_with raqm +# Not available in Fedora, only in rpmfusion +# Also see https://github.com/libgd/libgd/issues/678 segfault +%bcond_with heif Summary: A graphics library for quick creation of PNG or JPEG images Name: gd -Version: 2.3.0 -Release: 3%{?prever}%{?short}%{?dist} -License: MIT +Version: 2.3.3 +Release: 20%{?prever}%{?short}%{?dist} +License: GD URL: http://libgd.github.io/ %if 0%{?commit:1} # git clone https://github.com/libgd/libgd.git; cd gd-libgd @@ -15,10 +28,11 @@ Source0: libgd-%{version}-%{commit}.tgz %else Source0: https://github.com/libgd/libgd/releases/download/gd-%{version}/libgd-%{version}.tar.xz %endif -# Missing, temporary workaround, fixed upstream for next version -Source1: https://raw.githubusercontent.com/libgd/libgd/gd-%{version}/config/getlib.sh -Patch0: gd-bug615.patch +# Needed by PHP see https://github.com/libgd/libgd/pull/766 +Patch0: libgd-flip.patch +# Missing header see https://github.com/libgd/libgd/pull/766 +Patch1: libgd-iostream.patch BuildRequires: freetype-devel BuildRequires: fontconfig-devel @@ -27,12 +41,18 @@ BuildRequires: libjpeg-devel BuildRequires: libpng-devel BuildRequires: libtiff-devel BuildRequires: libwebp-devel -%if %{with_liq} +%if %{with liq} BuildRequires: libimagequant-devel %endif -%if %{with_raqm} +%if %{with raqm} BuildRequires: libraqm-devel %endif +%if %{with avif} +BuildRequires: libavif-devel +%endif +%if %{with heif} +BuildRequires: libheif-devel +%endif BuildRequires: libX11-devel BuildRequires: libXpm-devel BuildRequires: zlib-devel @@ -43,6 +63,7 @@ BuildRequires: perl-generators BuildRequires: perl(FindBin) # for fontconfig/basic test BuildRequires: liberation-sans-fonts +BuildRequires: make %description @@ -75,12 +96,18 @@ Requires: libwebp-devel%{?_isa} Requires: libX11-devel%{?_isa} Requires: libXpm-devel%{?_isa} Requires: zlib-devel%{?_isa} -%if %{with_liq} +%if %{with liq} Requires: libimagequant-devel%{?_isa} %endif -%if %{with_raqm} +%if %{with raqm} Requires: libraqm-devel %endif +%if %{with avif} +Requires: libavif-devel +%endif +%if %{with heif} +Requires: libheif-devel +%endif %description devel @@ -90,8 +117,8 @@ files for gd, a graphics library for creating PNG and JPEG graphics. %prep %setup -q -n libgd-%{version}%{?prever:-%{prever}} -%patch0 -p1 -install -m 0755 %{SOURCE1} config/ +%patch -P0 -p1 +%patch -P1 -p1 : $(perl config/getver.pl) @@ -106,7 +133,7 @@ fi %build # Provide a correct default font search path -CFLAGS="$RPM_OPT_FLAGS -DDEFAULT_FONTPATH='\"\ +CFLAGS="-std=gnu17 $RPM_OPT_FLAGS -DDEFAULT_FONTPATH='\"\ /usr/share/fonts/bitstream-vera:\ /usr/share/fonts/dejavu:\ /usr/share/fonts/default/Type1:\ @@ -118,12 +145,13 @@ CFLAGS="$RPM_OPT_FLAGS -DDEFAULT_FONTPATH='\"\ CFLAGS="$CFLAGS -msse -mfpmath=sse" %endif -%ifarch aarch64 ppc64 ppc64le s390 s390x +%ifarch aarch64 ppc64 ppc64le s390 s390x x86_64 riscv64 # workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1359680 export CFLAGS="$CFLAGS -ffp-contract=off" %endif %configure \ + --enable-gd-formats \ --with-tiff=%{_prefix} \ --disable-rpath make %{?_smp_mflags} @@ -136,13 +164,8 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/libgd.a %check -# minor diff in size -XFAIL_TESTS="gdimagestringft/gdimagestringft_bbox" -%ifarch s390x -XFAIL_TESTS="gdimagestring16/gdimagestring16 gdimagestringup16/gdimagestringup16 $XFAIL_TESTS" -%endif - -export XFAIL_TESTS +# Workaround to https://github.com/libgd/libgd/issues/763 +export TMPDIR=/tmp : Upstream test suite make check @@ -169,6 +192,105 @@ grep %{version} $RPM_BUILD_ROOT%{_libdir}/pkgconfig/gdlib.pc %changelog +* Tue Sep 09 2025 Sandro Mani - 2.3.3-20 +- Rebuild (libimagequant) + +* Wed Jul 23 2025 Fedora Release Engineering - 2.3.3-19 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + +* Thu Jan 16 2025 Fedora Release Engineering - 2.3.3-18 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + +* Thu Jul 18 2024 Fedora Release Engineering - 2.3.3-17 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Wed Mar 06 2024 Richard W.M. Jones - 2.3.3-16 +- Bump and rebuild package (for riscv64) + +* Wed Jan 31 2024 František Zatloukal - 2.3.3-15 +- Rebuilt for libavif 1.0.3 + +* Wed Jan 24 2024 Fedora Release Engineering - 2.3.3-14 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Fri Jan 19 2024 Fedora Release Engineering - 2.3.3-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Wed Jul 19 2023 Fedora Release Engineering - 2.3.3-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Sat Mar 04 2023 Sandro Mani - 2.3.3-11 +- Rebuild (libimagequant) + +* Thu Jan 19 2023 Fedora Release Engineering - 2.3.3-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Thu Dec 01 2022 Kalev Lember - 2.3.3-9 +- Rebuild for new libavif + +* Sun Oct 23 2022 Robert-André Mauchin - 2.3.3-8 +- Rebuild for new libavif + +* Sun Oct 23 2022 Robert-André Mauchin - 2.3.3-7 +- Rebuild for new libavif + +* Thu Jul 21 2022 Fedora Release Engineering - 2.3.3-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Thu Jan 20 2022 Fedora Release Engineering - 2.3.3-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Mon Nov 29 2021 Robert-André Mauchin - 2.3.3-4 +- Rebuild for libavif soname bump + +* Fri Nov 19 2021 Remi Collet - 2.3.3-3 +- disable libraqm usage, see #2022957 + +* Mon Sep 20 2021 Paul Howarth - 2.3.3-2 +- Explicitly enable gd/gd2 formats, wanted by perl bindings (#2005916) + +* Mon Sep 13 2021 Remi Collet - 2.3.3-1 +- update to 2.3.3 +- open https://github.com/libgd/libgd/pull/766 missing macros +- open https://github.com/libgd/libgd/pull/767 missing headers + +* Tue Jul 27 2021 Florian Weimer - 2.3.2-9 +- Rebuild again for libavif soname bump + +* Thu Jul 22 2021 Robert-André Mauchin - 2.3.2-8 +- Rebuild for libavif soname bump + +* Wed Jul 21 2021 Fedora Release Engineering - 2.3.2-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Mon Jul 19 2021 Robert-André Mauchin - 2.3.2-6 +- Rebuild for libavif soname bump + +* Sun May 23 2021 Robert-André Mauchin - 2.3.2-5 +- Rebuild for libavif soname bump + +* Mon Mar 29 2021 Robert-André Mauchin - 2.3.2-4 +- Rebuild for libavif soname bump + +* Wed Mar 17 2021 Filip Januš - 2.3.2-3 +- Add condition if fedora for packages not available in RHEL + +* Mon Mar 8 2021 Remi Collet - 2.3.2-2 +- enable avif support +- use bcond + +* Mon Mar 08 2021 Ondrej Dubaj - 2.3.2-1 +- rebase to version 2.3.2 + +* Wed Feb 3 2021 Filip Januš - 2.3.1-1 +- Upstream released new version 2.3.1 +- patch bug615 is no more needed - fixed by upstream in release +- gdimagestring16/gdimagestring16 gdimagestringup16/gdimagestringup16 passed on + x390s - XFAIL_TEST definition for x390s is no more necessary + +* Tue Jan 26 2021 Fedora Release Engineering - 2.3.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + * Mon Jul 27 2020 Fedora Release Engineering - 2.3.0-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild 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 diff --git a/libgd-iostream.patch b/libgd-iostream.patch new file mode 100644 index 0000000..c80b3ec --- /dev/null +++ b/libgd-iostream.patch @@ -0,0 +1,35 @@ +From 01bcbdcae35b90de082012e639094c711a7aa2b3 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Mon, 13 Sep 2021 15:05:18 +0200 +Subject: [PATCH] install missing header, used by gdpp.h + +--- + src/CMakeLists.txt | 1 + + src/Makefile.am | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 3839bc78..c1eea100 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -194,6 +194,7 @@ install(FILES + gdfontt.h + gdfx.h + gdpp.h ++ gd_io_stream.h + DESTINATION include) + + CONFIGURE_FILE(../config/gdlib.pc.cmake gdlib.pc @ONLY) +diff --git a/src/Makefile.am b/src/Makefile.am +index dbe9243c..c8c779f1 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -52,7 +52,7 @@ EXTRA_DIST = \ + msinttypes/inttypes.h \ + msinttypes/stdint.h + +-include_HEADERS = gd.h gdfx.h gd_io.h gdcache.h gdfontg.h gdfontl.h gdfontmb.h gdfonts.h gdfontt.h gd_color_map.h gd_errors.h gdpp.h ++include_HEADERS = gd.h gdfx.h gd_io.h gdcache.h gdfontg.h gdfontl.h gdfontmb.h gdfonts.h gdfontt.h gd_color_map.h gd_errors.h gdpp.h gd_io_stream.h + + lib_LTLIBRARIES = libgd.la + diff --git a/sources b/sources index 7b35316..4bad33c 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (libgd-2.3.0.tar.xz) = 5b201d22560e147a3d5471010b898ad0268c3a2453b870d1267b6ba92e540cf9f75099336c1ab08217e41827ac86fe04525726bf29ad117e5dcbaef9a8d0622a +SHA512 (libgd-2.3.3.tar.xz) = aa49d4381d604a4360d556419d603df2ffd689a6dcc10f8e5e1d158ddaa3ab89912f6077ca77da4e370055074007971cf6d356ec9bf26dcf39bcff3208bc7e6c