diff --git a/gd.spec b/gd.spec new file mode 100644 index 0000000000000000000000000000000000000000..323bfec30446bb4b0d34ef46ef6e409b430905a0 --- /dev/null +++ b/gd.spec @@ -0,0 +1,175 @@ +%define anolis_release 1 +%bcond_with liq +%bcond_with raqm +%bcond_with avif +%bcond_with raqm +%bcond_with heif + + +Summary: A graphics library for quick creation of PNG or JPEG images +Name: gd +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 + +# 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 +BuildRequires: gettext-devel +BuildRequires: libjpeg-devel +BuildRequires: libpng-devel +BuildRequires: libtiff-devel +BuildRequires: libwebp-devel +%if %{with liq} +BuildRequires: libimagequant-devel +%endif +%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 +BuildRequires: pkgconfig +BuildRequires: libtool +BuildRequires: perl-interpreter +BuildRequires: perl-generators +BuildRequires: perl(FindBin) +# for fontconfig/basic test +BuildRequires: liberation-sans-fonts +BuildRequires: make + + +%description +The gd graphics library allows your code to quickly draw images +complete with lines, arcs, text, multiple colors, cut and paste from +other images, and flood fills, and to write out the result as a PNG or +JPEG file. This is particularly useful in Web applications, where PNG +and JPEG are two of the formats accepted for inline images by most +browsers. Note that gd is not a paint program. + + +%package progs +Requires: %{name}%{?_isa} = %{version}-%{release} +Summary: Utility programs that use libgd + +%description progs +The gd-progs package includes utility programs supplied with gd, a +graphics library for creating PNG and JPEG images. + + +%package devel +Summary: The development libraries and header files for gd +Requires: %{name} = %{version}-%{release} +Requires: freetype-devel +Requires: fontconfig-devel +Requires: libjpeg-devel +Requires: libpng-devel +Requires: libtiff-devel +Requires: libwebp-devel +Requires: libX11-devel +Requires: libXpm-devel +Requires: zlib-devel +%if %{with liq} +Requires: libimagequant-devel +%endif +%if %{with raqm} +Requires: libraqm-devel +%endif +%if %{with avif} +Requires: libavif-devel +%endif +%if %{with heif} +Requires: libheif-devel +%endif + + +%description devel +The gd-devel package contains the development libraries and header +files for gd, a graphics library for creating PNG and JPEG graphics. + + +%prep +%setup -q -n libgd-%{version}%{?prever:-%{prever}} +%patch0 -p1 +%patch1 -p1 + +: $(perl config/getver.pl) + +: regenerate autotool stuff +if [ -f configure ]; then + libtoolize --copy --force + autoreconf -vif +else + ./bootstrap.sh +fi + + +%build +# Provide a correct default font search path +CFLAGS="$RPM_OPT_FLAGS -DDEFAULT_FONTPATH='\"\ +/usr/share/fonts/bitstream-vera:\ +/usr/share/fonts/dejavu:\ +/usr/share/fonts/default/Type1:\ +/usr/share/X11/fonts/Type1:\ +/usr/share/fonts/liberation\"'" + +%ifarch aarch64 +export CFLAGS="$CFLAGS -ffp-contract=off" +%endif + +%configure \ + --enable-gd-formats \ + --with-tiff=%{_prefix} \ + --disable-rpath +make %{?_smp_mflags} + + +%install +make install INSTALL='install -p' DESTDIR=$RPM_BUILD_ROOT +rm -f $RPM_BUILD_ROOT/%{_libdir}/libgd.la +rm -f $RPM_BUILD_ROOT/%{_libdir}/libgd.a + + +%check +# Workaround to https://github.com/libgd/libgd/issues/763 +export TMPDIR=/tmp + +: Upstream test suite +make check + +: Check content of pkgconfig +grep %{version} $RPM_BUILD_ROOT%{_libdir}/pkgconfig/gdlib.pc + + +%ldconfig_scriptlets + + +%files +%{!?_licensedir:%global license %%doc} +%license COPYING +%{_libdir}/*.so.* + +%files progs +%{_bindir}/* + +%files devel +%{_includedir}/* +%{_libdir}/*.so +%{_libdir}/pkgconfig/gdlib.pc + + +%changelog +* Tue Apr 26 2022 Chunmei Xu - 2.3.3-1 +- init from upstream diff --git a/libgd-2.3.3.tar.xz b/libgd-2.3.3.tar.xz new file mode 100644 index 0000000000000000000000000000000000000000..331aa23776cc38562108c1ef8d01febe5e0b6772 Binary files /dev/null and b/libgd-2.3.3.tar.xz differ diff --git a/libgd-flip.patch b/libgd-flip.patch new file mode 100644 index 0000000000000000000000000000000000000000..4fa964f8e566b27c94fc90c165683fa796fabf24 --- /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 0000000000000000000000000000000000000000..c80b3ec213c7f435afa73cc7715f04982fa51f31 --- /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 +