#
# Conditional build:
-%bcond_without fontconfig # without fontconfig support
-%bcond_without xpm # without XPM support (requires X11 libs)
-%bcond_without tests
+%bcond_without avif # AVIF support via libavif
+%bcond_without fontconfig # fontconfig support
+%bcond_without heif # HEIF support via libheif
+%bcond_with libimagequant # LIQ quantization method support (breaks transparency in TrueColor->palette conversion)
+%bcond_without raqm # RAQM complex text layout support
+%bcond_with sse # SSE math on ix86
+%bcond_without xpm # XPM support (requires X11 libs)
+%bcond_without tests # "make check"
#
+%ifarch pentium3 pentium4
+%define with_sse 1
+%endif
Summary: Library for PNG, JPEG creation
Summary(es.UTF-8): Biblioteca para manipulación de imágenes
Summary(pl.UTF-8): Biblioteka do tworzenia grafiki w formacie PNG, JPEG
Summary(pt_BR.UTF-8): Biblioteca para manipulação de imagens
Name: gd
-Version: 2.1.0
+Version: 2.3.3
Release: 2
License: BSD-like
Group: Libraries
-Source0: https://bitbucket.org/libgd/gd-libgd/downloads/libgd-%{version}.tar.xz
-# Source0-md5: 03588159bf4faab9079849c8d709acc6
+#Source0Download: https://github.com/libgd/libgd/releases
+Source0: https://github.com/libgd/libgd/releases/download/%{name}-%{version}/lib%{name}-%{version}.tar.xz
+# Source0-md5: 7a58b54d375eda236414201252a0ee3c
Patch0: %{name}-fontpath.patch
-Patch1: %{name}-2.0.33-BoxBound.patch
-Patch2: %{name}-loop.patch
-URL: http://www.libgd.org/
+Patch1: %{name}-loop.patch
+Patch2: api-breakage.patch
+URL: https://libgd.github.io/
BuildRequires: autoconf >= 2.54
BuildRequires: automake
%{?with_fontconfig:BuildRequires: fontconfig-devel}
-BuildRequires: freetype-devel >= 2.1.10
-BuildRequires: gettext-devel
+BuildRequires: freetype-devel >= 1:2.1.10
+BuildRequires: gettext-tools
+%{?with_avif:BuildRequires: libavif-devel >= 0.8.2}
+%{?with_heif:BuildRequires: libheif-devel >= 1.7.0}
+%{?with_libimagequant:BuildRequires: libimagequant-devel}
BuildRequires: libjpeg-devel
BuildRequires: libpng-devel >= 2:1.4.0
+%{?with_raqm:BuildRequires: libraqm-devel}
BuildRequires: libtiff-devel >= 4
BuildRequires: libtool >= 2:2
-BuildRequires: libvpx-devel
+BuildRequires: libwebp-devel
BuildRequires: pkgconfig
BuildRequires: sed >= 4
BuildRequires: tar >= 1:1.22
%{?with_xpm:BuildRequires: xorg-lib-libXpm-devel}
BuildRequires: xz
BuildRequires: zlib-devel
-Requires: freetype >= 2.1.10
+Requires: freetype >= 1:2.1.10
+%{?with_avif:Requires: libavif >= 0.8.2}
+%{?with_heif:Requires: libheif >= 1.7.0}
Provides: gd(gif) = %{version}-%{release}
# versioned by php version rotate_from_php code comes from
Provides: gd(imagerotate) = 5.2.0
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Requires: fontconfig-devel
-Requires: freetype-devel >= 2.1.10
+Requires: freetype-devel >= 1:2.1.10
+%{?with_avif:Requires: libavif-devel >= 0.8.2}
+%{?with_heif:Requires: libheif-devel >= 1.7.0}
+%{?with_libimagequant:Requires: libimagequant-devel}
Requires: libjpeg-devel
Requires: libpng-devel
+%{?with_raqm:Requires: libraqm-devel}
Requires: libtiff-devel >= 4
-Requires: libvpx-devel
+Requires: libwebp-devel
%{?with_xpm:Requires: xorg-lib-libXpm-devel}
Requires: zlib-devel
Provides: gd-devel(gif) = %{version}-%{release}
%patch1 -p1
%patch2 -p1
-# hack to avoid inclusion of -s in --ldflags
-%{__sed} -i -e 's,@LDFLAGS@,,g' config/gdlib-config.in
-# disable error caused by subdir-objects warning in automake 1.14
-%{__sed} -i -e '/AM_INIT_AUTOMAKE/s/-Werror//' configure.ac
-
%build
%{__libtoolize}
-%{__aclocal}
+%{__aclocal} -I m4
%{__automake}
%{__autoheader}
%{__autoconf}
+%ifarch %{ix86}
+%if %{with sse}
+CFLAGS="%{rpmcflags} -msse -mfpmath=sse"
+%endif
+%endif
%configure \
+ %{!?with_avif:--without-avif} \
%{!?with_fontconfig:--without-fontconfig} \
+ %{!?with_heif:--without-heif} \
+ %{!?with_libimagequant:--without-liq} \
+ %{!?with_raqm:--without-raqm} \
%{!?with_xpm:--without-xpm}
%{__make}
%if %{with tests}
-# https://bitbucket.org/libgd/gd-libgd/issue/72/gdimagestringft_bbox-test-fails-on-old
-export XFAIL_TESTS=gdimagestringft/gdimagestringft_bbox
+%ifarch %{ix86}
+# https://github.com/libgd/libgd/issues/359
+XFAIL_TESTS="$XFAIL_TESTS gdimagegrayscale/basic"
+%if %{without sse}
+# 387 arithmetic is inexact, https://github.com/libgd/libgd/issues/242
+XFAIL_TESTS="$XFAIL_TESTS gdimagecopyresampled/bug00201"
+%endif
+%endif
+%if %{with raqm}
+# https://github.com/libgd/libgd/issues/613
+XFAIL_TESTS="$XFAIL_TESTS gdimagestringft/gdimagestringft_bbox"
+%endif
+export XFAIL_TESTS
%{__make} check
%endif
%files
%defattr(644,root,root,755)
-%doc COPYING ChangeLog NEWS
+%doc CONTRIBUTORS COPYING README.md
%attr(755,root,root) %{_libdir}/libgd.so.*.*.*
%attr(755,root,root) %ghost %{_libdir}/libgd.so.3
%files devel
%defattr(644,root,root,755)
-%attr(755,root,root) %{_bindir}/gdlib-config
%attr(755,root,root) %{_libdir}/libgd.so
%{_libdir}/libgd.la
-%{_includedir}/entities.h
%{_includedir}/gd*.h
%{_pkgconfigdir}/gdlib.pc