git: 34ab3bea8aa2 - main - graphics/gd: update to 2.3.3

From: Dirk Meyer <dinoex_at_FreeBSD.org>
Date: Tue, 22 Feb 2022 11:45:05 UTC
The branch main has been updated by dinoex:

URL: https://cgit.FreeBSD.org/ports/commit/?id=34ab3bea8aa25b1e994a7da9a4653d558585e5d2

commit 34ab3bea8aa25b1e994a7da9a4653d558585e5d2
Author:     Dirk Meyer <dinoex@FreeBSD.org>
AuthorDate: 2022-02-22 11:44:38 +0000
Commit:     Dirk Meyer <dinoex@FreeBSD.org>
CommitDate: 2022-02-22 11:44:38 +0000

    graphics/gd: update to 2.3.3
    
    - remove perfomance patch
    - fix tests
    - new options HEIF AVIF
---
 graphics/gd/Makefile                |  25 +++++--
 graphics/gd/distinfo                |   6 +-
 graphics/gd/files/patch-Makefile.am |  11 +++
 graphics/gd/files/patch-Makefile.in |  11 +++
 graphics/gd/files/patch-bdftogd     |   4 +-
 graphics/gd/files/patch-gd.c        | 136 ------------------------------------
 graphics/gd/files/patch-gd.h        |  14 ++++
 graphics/gd/files/patch-gd_png.c    |   4 +-
 graphics/gd/files/patch-gdtest.c    |  19 ++---
 graphics/gd/pkg-plist               |   4 +-
 10 files changed, 75 insertions(+), 159 deletions(-)

diff --git a/graphics/gd/Makefile b/graphics/gd/Makefile
index 28722c59e71b..b5f93cd554c0 100644
--- a/graphics/gd/Makefile
+++ b/graphics/gd/Makefile
@@ -1,7 +1,7 @@
 # Created by: jeff@cetlink.net
 
 PORTNAME=	libgd
-PORTVERSION=	2.3.1
+PORTVERSION=	2.3.3
 PORTREVISION=	0
 PORTEPOCH=	1
 CATEGORIES+=	graphics
@@ -13,17 +13,20 @@ COMMENT?=	Graphics library for fast creation of images
 LICENSE=	MIT
 LICENSE_FILE=	${WRKSRC}/COPYING
 
-CONFLICTS_INSTALL=	libgd ??-libgd mummer # bin/bdftogd bin/gd2copypal bin/gd2togif bin/gd2topng bin/gdcmpgif bin/gdlib-config bin/gdparttopng bin/gdtopng bin/giftogd2
+CONFLICTS_INSTALL=	libgd ??-libgd
 
 USES=		cpe tar:xz pkgconfig pathfix libtool:keepla shebangfix
 SHEBANG_FILES=	${WRKSRC}/src/bdftogd
 GNU_CONFIGURE=	yes
+CONFIGURE_ARGS=	--enable-gd-formats
+TMPDIR?=	/tmp
+MAKE_ENV=	TMPDIR=${TMPDIR}
 SUB_FILES=	gdlib-config
 USE_LDCONFIG=	yes
 TEST_TARGET=	check
 
-OPTIONS_DEFINE=	PNG JPEG WEBP TIFF FREETYPE FONTCONFIG RAQM XPM ICONV
-OPTIONS_DEFAULT=PNG JPEG WEBP TIFF FREETYPE FONTCONFIG ICONV
+OPTIONS_DEFINE=	PNG JPEG WEBP HEIF AVIF TIFF FREETYPE FONTCONFIG RAQM XPM ICONV
+OPTIONS_DEFAULT=PNG JPEG WEBP HEIF AVIF TIFF FREETYPE FONTCONFIG ICONV
 NO_OPTIONS_SORT=yes
 OPTIONS_SUB=	yes
 PNG_LIB_DEPENDS=	libpng.so:graphics/png
@@ -35,6 +38,13 @@ JPEG_CPPFLAGS=		-I${LOCALBASE}/include
 WEBP_LIB_DEPENDS=	libwebp.so:graphics/webp
 WEBP_CONFIGURE_OFF=	--without-webp
 WEBP_CPPFLAGS=		-I${LOCALBASE}/include
+HEIF_LIB_DEPENDS=	libheif.so:graphics/libheif
+HEIF_CONFIGURE_OFF=	--without-heif
+HEIF_CPPFLAGS=		-I${LOCALBASE}/include
+AVIF_LIB_DEPENDS=	libavif.so:graphics/libavif
+AVIF_CONFIGURE_OFF=	--without-avif
+AVIF_CPPFLAGS=		-I${LOCALBASE}/include
+AVIF_USES=		autoreconf
 TIFF_LIB_DEPENDS=	libtiff.so:graphics/tiff
 TIFF_CONFIGURE_OFF=	--without-tiff
 TIFF_CPPFLAGS=		-I${LOCALBASE}/include
@@ -57,6 +67,11 @@ ICONV_CONFIGURE_ON=	${ICONV_CONFIGURE_ARG}
 
 .include <bsd.port.options.mk>
 
+.if ${PORT_OPTIONS:MFREETYPE}
+# bin/annotate
+CONFLICTS_INSTALL+=	mummer
+.endif
+
 # force gdlib-config --ldflags
 LDFLAGS+=	-L${LOCALBASE}/lib
 
@@ -92,7 +107,7 @@ pre-configure:
 	# bump shlib version
 	${REINPLACE_CMD} \
 		-e 's|^GDLIB_LT_CURRENT=3|GDLIB_LT_CURRENT=6|' \
-		${WRKSRC}/configure
+		${WRKSRC}/configure ${WRKSRC}/config/getlib.sh
 
 pre-configure-ICONV-off:
 	${REINPLACE_CMD} \
diff --git a/graphics/gd/distinfo b/graphics/gd/distinfo
index c82be508530b..8a41b89cbfa9 100644
--- a/graphics/gd/distinfo
+++ b/graphics/gd/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1613146049
-SHA256 (libgd-2.3.1.tar.xz) = 9767917d9f818faec4ddd763fe4a4ad9f6322c3d25da290ab2ea3e2ce4b52a7b
-SIZE (libgd-2.3.1.tar.xz) = 2632076
+TIMESTAMP = 1644860754
+SHA256 (libgd-2.3.3.tar.xz) = 3fe822ece20796060af63b7c60acb151e5844204d289da0ce08f8fdf131e5a61
+SIZE (libgd-2.3.3.tar.xz) = 2809056
diff --git a/graphics/gd/files/patch-Makefile.am b/graphics/gd/files/patch-Makefile.am
new file mode 100644
index 000000000000..5d7a8b192026
--- /dev/null
+++ b/graphics/gd/files/patch-Makefile.am
@@ -0,0 +1,11 @@
+--- src/Makefile.am.orig	2022-02-14 17:43:45 UTC
++++ 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/graphics/gd/files/patch-Makefile.in b/graphics/gd/files/patch-Makefile.in
new file mode 100644
index 000000000000..51ecacb7cb0e
--- /dev/null
+++ b/graphics/gd/files/patch-Makefile.in
@@ -0,0 +1,11 @@
+--- src/Makefile.in.orig	2021-09-11 05:12:11 UTC
++++ src/Makefile.in
+@@ -561,7 +561,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
+ libgd_la_SOURCES = \
+ 	bmp.h \
diff --git a/graphics/gd/files/patch-bdftogd b/graphics/gd/files/patch-bdftogd
index 450d1a048ded..3aadfbf6e5ad 100644
--- a/graphics/gd/files/patch-bdftogd
+++ b/graphics/gd/files/patch-bdftogd
@@ -1,6 +1,6 @@
---- src/bdftogd.orig	2017-01-29 09:45:57 UTC
+--- src/bdftogd.orig	2021-09-11 04:41:44 UTC
 +++ src/bdftogd
-@@ -24,6 +24,9 @@ $gdname = 'gd' . $gdname unless $gdname 
+@@ -24,6 +24,9 @@ $gdname = 'gd' . $gdname unless $gdname =~ /^gd/i;
  my $filename = shift;
  $filename = 'gd' . $filename unless $filename =~ /^gd/i;
  
diff --git a/graphics/gd/files/patch-gd.c b/graphics/gd/files/patch-gd.c
deleted file mode 100644
index a4e142c83b31..000000000000
--- a/graphics/gd/files/patch-gd.c
+++ /dev/null
@@ -1,136 +0,0 @@
-index d8eaf43..d852068 100644
---- src/gd.c
-+++ src/gd.c
-@@ -66,6 +66,9 @@ static const unsigned char gd_toascii[256] = {
- };
- #endif /*CHARSET_EBCDIC */
- 
-+/* 2.0.10: cast instead of floor() yields 35% performance improvement. Thanks to John Buckman. */
-+#define floor_cast(exp) ((long) exp)
-+
- extern const int gdCosT[];
- extern const int gdSinT[];
- 
-@@ -3452,50 +3455,51 @@ BGD_DECLARE(void) gdImageCopyResampled (gdImagePtr dst,
- 										int dstW, int dstH, int srcW, int srcH)
- {
- 	int x, y;
-+	double sy1, sy2, sx1, sx2;
-+
- 	if (!dst->trueColor) {
- 		gdImageCopyResized (dst, src, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH);
- 		return;
- 	}
- 	for (y = dstY; (y < dstY + dstH); y++) {
-+		sy1 = ((double) y - (double) dstY) * (double) srcH / (double) dstH;
-+		sy2 = ((double) (y + 1) - (double) dstY) * (double) srcH / (double) dstH;
- 		for (x = dstX; (x < dstX + dstW); x++) {
--			float sy1, sy2, sx1, sx2;
--			float sx, sy;
--			float spixels = 0.0;
--			float red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0;
--			float alpha_factor, alpha_sum = 0.0, contrib_sum = 0.0;
--			sy1 = ((float)(y - dstY)) * (float)srcH / (float)dstH;
--			sy2 = ((float)(y + 1 - dstY)) * (float) srcH / (float) dstH;
-+			double sx, sy;
-+			double spixels = 0;
-+			double red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0;
-+			double alpha_factor, alpha_sum = 0.0, contrib_sum = 0.0;
-+			sx1 = ((double) x - (double) dstX) * (double) srcW / dstW;
-+			sx2 = ((double) (x + 1) - (double) dstX) * (double) srcW / dstW;
- 			sy = sy1;
- 			do {
--				float yportion;
--				if (floorf(sy) == floorf(sy1)) {
--					yportion = 1.0 - (sy - floorf(sy));
-+				double yportion;
-+				if (floor_cast(sy) == floor_cast(sy1)) {
-+					yportion = 1.0f - (sy - floor_cast(sy));
- 					if (yportion > sy2 - sy1) {
- 						yportion = sy2 - sy1;
- 					}
--					sy = floorf(sy);
-+					sy = floor_cast(sy);
- 				} else if (sy == floorf(sy2)) {
--					yportion = sy2 - floorf(sy2);
-+					yportion = sy2 - floor_cast(sy2);
- 				} else {
--					yportion = 1.0;
-+					yportion = 1.0f;
- 				}
--				sx1 = ((float)(x - dstX)) * (float) srcW / dstW;
--				sx2 = ((float)(x + 1 - dstX)) * (float) srcW / dstW;
- 				sx = sx1;
- 				do {
--					float xportion;
--					float pcontribution;
-+					double xportion;
-+					double pcontribution;
- 					int p;
--					if (floorf(sx) == floorf(sx1)) {
--						xportion = 1.0 - (sx - floorf(sx));
-+					if (floorf(sx) == floor_cast(sx1)) {
-+						xportion = 1.0f - (sx - floor_cast(sx));
- 						if (xportion > sx2 - sx1) {
- 							xportion = sx2 - sx1;
- 						}
--						sx = floorf(sx);
-+						sx = floor_cast(sx);
- 					} else if (sx == floorf(sx2)) {
--						xportion = sx2 - floorf(sx2);
-+						xportion = sx2 - floor_cast(sx2);
- 					} else {
--						xportion = 1.0;
-+						xportion = 1.0f;
- 					}
- 					pcontribution = xportion * yportion;
- 					p = gdImageGetTrueColorPixel(src, (int) sx + srcX, (int) sy + srcY);
-@@ -3508,21 +3512,24 @@ BGD_DECLARE(void) gdImageCopyResampled (gdImagePtr dst,
- 					alpha_sum += alpha_factor;
- 					contrib_sum += pcontribution;
- 					spixels += xportion * yportion;
--					sx += 1.0;
-+					sx += 1.0f;
- 				}
- 				while (sx < sx2);
-+
- 				sy += 1.0f;
- 			}
-+
- 			while (sy < sy2);
- 
--			if (spixels != 0.0) {
-+			if (spixels != 0.0f) {
- 				red /= spixels;
- 				green /= spixels;
- 				blue /= spixels;
- 				alpha /= spixels;
-+				alpha += 0.5;
- 			}
--			if ( alpha_sum != 0.0) {
--				if( contrib_sum != 0.0) {
-+			if ( alpha_sum != 0.0f) {
-+				if( contrib_sum != 0.0f) {
- 					alpha_sum /= contrib_sum;
- 				}
- 				red /= alpha_sum;
-@@ -3530,14 +3537,14 @@ BGD_DECLARE(void) gdImageCopyResampled (gdImagePtr dst,
- 				blue /= alpha_sum;
- 			}
- 			/* Clamping to allow for rounding errors above */
--			if (red > 255.0) {
--				red = 255.0;
-+			if (red > 255.0f) {
-+				red = 255.0f;
- 			}
--			if (green > 255.0) {
--				green = 255.0;
-+			if (green > 255.0f) {
-+				green = 255.0f;
- 			}
- 			if (blue > 255.0f) {
--				blue = 255.0;
-+				blue = 255.0f;
- 			}
- 			if (alpha > gdAlphaMax) {
- 				alpha = gdAlphaMax;
diff --git a/graphics/gd/files/patch-gd.h b/graphics/gd/files/patch-gd.h
new file mode 100644
index 000000000000..6945b89b7167
--- /dev/null
+++ b/graphics/gd/files/patch-gd.h
@@ -0,0 +1,14 @@
+--- src/gd.h.orig	2021-09-11 04:52:47 UTC
++++ 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
+  *
diff --git a/graphics/gd/files/patch-gd_png.c b/graphics/gd/files/patch-gd_png.c
index ac3565d86808..a8d0a71e80cd 100644
--- a/graphics/gd/files/patch-gd_png.c
+++ b/graphics/gd/files/patch-gd_png.c
@@ -1,6 +1,6 @@
---- src/gd_png.c.orig	2016-10-12 08:13:44 UTC
+--- src/gd_png.c.orig	2021-09-11 04:43:11 UTC
 +++ src/gd_png.c
-@@ -277,6 +277,14 @@ BGD_DECLARE(gdImagePtr) gdImageCreateFro
+@@ -276,6 +276,14 @@ BGD_DECLARE(gdImagePtr) gdImageCreateFromPngCtx (gdIOC
  	png_read_info (png_ptr, info_ptr);	/* read all PNG info up to image data */
  
  	png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_type, NULL, NULL);
diff --git a/graphics/gd/files/patch-gdtest.c b/graphics/gd/files/patch-gdtest.c
index f2c9a0ff2ced..1d2ed4d70719 100644
--- a/graphics/gd/files/patch-gdtest.c
+++ b/graphics/gd/files/patch-gdtest.c
@@ -1,6 +1,6 @@
---- src/gdtest.c.orig	2015-09-16 11:34:29 UTC
+--- src/gdtest.c.orig	2021-09-11 04:43:11 UTC
 +++ src/gdtest.c
-@@ -35,6 +35,8 @@ main (int argc, char **argv)
+@@ -34,6 +34,8 @@ main (int argc, char **argv)
  	gdSink imgsnk;
  	int foreground;
  	int i;
@@ -9,7 +9,7 @@
  	if (argc != 2) {
  		fprintf(stderr, "Usage: gdtest filename.png\n");
  		exit (1);
-@@ -63,6 +65,35 @@ main (int argc, char **argv)
+@@ -62,7 +64,36 @@ main (int argc, char **argv)
  
  	CompareImages ("Initial Versions", ref, im);
  
@@ -20,7 +20,7 @@
 +        out = fopen(of, "wb");
 +        gdImageGif(im, out);
 +        fclose(out);
-+
+ 
 +        in = fopen(of, "rb");
 +        if (!in) {
 +                fprintf(stderr, "GIF Output file does not exist!\n");
@@ -42,17 +42,18 @@
 +
 +	gdImageDestroy(im2);
 +	ctx->gd_free(ctx);
- 
++
  	/* */
  	/* Send to PNG File then Ptr */
-@@ -334,6 +365,10 @@ main (int argc, char **argv)
+ 	/* */
+@@ -316,6 +347,10 @@ main (int argc, char **argv)
+ 	}
  	printf ("[Merged Image has %d colours]\n", im2->colorsTotal);
  	CompareImages ("Merged (gdtest.png, gdtest_merge.png)", im2, im3);
- 
++
 +	out = fopen ("test/gdtest_merge_out.png", "wb");
 +	gdImagePng(im2, out);
 +	fclose(out);
-+
+ 
  	gdImageDestroy (im2);
  	gdImageDestroy (im3);
- 
diff --git a/graphics/gd/pkg-plist b/graphics/gd/pkg-plist
index 33ea9e973102..8da22cc0f5e4 100644
--- a/graphics/gd/pkg-plist
+++ b/graphics/gd/pkg-plist
@@ -11,11 +11,11 @@ bin/giftogd2
 %%PNG%%bin/pngtogd
 %%PNG%%bin/pngtogd2
 %%PNG%%bin/webpng
-include/entities.h
 include/gd.h
 include/gd_color_map.h
 include/gd_errors.h
 include/gd_io.h
+include/gd_io_stream.h
 include/gdcache.h
 include/gdfontg.h
 include/gdfontl.h
@@ -29,5 +29,5 @@ lib/libgd.a
 lib/libgd.la
 lib/libgd.so
 lib/libgd.so.6
-lib/libgd.so.6.0.9
+lib/libgd.so.6.0.11
 libdata/pkgconfig/gdlib.pc