Index: Makefile =================================================================== --- Makefile (revision 418638) +++ Makefile (working copy) @@ -2,16 +2,17 @@ # $FreeBSD$ PORTNAME= libgd -PORTVERSION= 2.1.1 +PORTVERSION= 2.2.2 PORTREVISION?= 0 PORTEPOCH= 1 CATEGORIES+= graphics -MASTER_SITES= https://bitbucket.org/libgd/gd-libgd/downloads/ \ - http://cdn.bitbucket.org/libgd/gd-libgd/downloads/ +MASTER_SITES= https://github.com/${PORTNAME}/${PORTNAME}/releases/download/gd-${PORTVERSION}/ MAINTAINER?= dinoex@FreeBSD.org COMMENT?= Graphics library for fast creation of images +LICENSE= MIT + LIB_DEPENDS= libtiff.so:graphics/tiff \ libpng.so:graphics/png \ libfreetype.so:print/freetype2 @@ -23,7 +24,7 @@ GNU_CONFIGURE= yes USE_LDCONFIG= yes -OPTIONS_DEFINE= FONTCONFIG ICONV VPX XPM +OPTIONS_DEFINE= FONTCONFIG ICONV VPX XPM WEBP OPTIONS_DEFAULT=FONTCONFIG NO_OPTIONS_SORT=yes FONTCONFIG_LIB_DEPENDS+= libfontconfig.so:x11-fonts/fontconfig @@ -30,6 +31,8 @@ FONTCONFIG_CONFIGURE_OFF= --with-fontconfig=no ICONV_USES= iconv ICONV_CONFIGURE_ON= ${ICONV_CONFIGURE_ARG} +WEBP_LIB_DEPENDS= libwebp.so:graphics/webp +WEBP_CONFIGURE_OFF= --without-webp VPX_LIB_DEPENDS= libvpx.so:multimedia/libvpx VPX_CONFIGURE_OFF= --without-vpx XPM_USE= xorg=xpm,x11 @@ -99,6 +102,6 @@ post-install: ${INSTALL_DATA} ${WRKSRC}/src/gdhelpers.h \ ${STAGEDIR}${PREFIX}/include/ - ${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libgd.so.5 + ${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libgd.so.6.0.20202 .include Index: distinfo =================================================================== --- distinfo (revision 418638) +++ distinfo (working copy) @@ -1,3 +1,3 @@ -TIMESTAMP = 1468105350 -SHA256 (libgd-2.1.1.tar.xz) = 9ada1ed45594abc998ebc942cef12b032fbad672e73efc22bc9ff54f5df2b285 -SIZE (libgd-2.1.1.tar.xz) = 2039132 +TIMESTAMP = 1468712078 +SHA256 (libgd-2.2.2.tar.xz) = 489f756ce07f0c034b1a794f4d34fdb4d829256112cb3c36feb40bb56b79218c +SIZE (libgd-2.2.2.tar.xz) = 2105628 Index: files/patch-bdftogd =================================================================== --- files/patch-bdftogd (revision 418638) +++ files/patch-bdftogd (working copy) @@ -1,68 +0,0 @@ ---- src/bdftogd.orig 2013-06-25 11:58:23.000000000 +0200 -+++ src/bdftogd 2013-08-15 21:03:29.000000000 +0200 -@@ -24,6 +24,9 @@ - my $filename = shift; - $filename = 'gd' . $filename unless $filename =~ /^gd/i; - -+my $gdfunc = $gdname; -+$gdfunc =~ s/(.*Font)(.*)/$1Get$2/; -+ - if (-f "$filename.c") { die "File $filename.c already exists, won't overwrite\n"; } - if (-f "$filename.h") { die "File $filename.h already exists, won't overwrite\n"; } - -@@ -139,6 +142,10 @@ - - $info - -+#ifdef HAVE_CONFIG_H -+#include "config.h" -+#endif -+ - #include "$filename.h" - - char ${gdname}Data[] = { -@@ -177,28 +184,40 @@ - ${gdname}Data - }; - --gdFontPtr ${gdname} = &${gdname}Rep; -+BGD_EXPORT_DATA_PROT gdFontPtr ${gdname} = &${gdname}Rep; - --/* This file has not been truncated. */ -+BGD_DECLARE(gdFontPtr) -+$gdfunc (void) -+{ -+ return $gdname; -+} - -+/* This file has not been truncated. */ - EOF - - - close FILEC; - - print FILEH <<"EOF"; -- - #ifndef $capdef - #define $capdef 1 - -+#ifdef __cplusplus -+extern "C" { -+#endif -+ - $info - - #include "gd.h" - --extern gdFontPtr $gdname; -+extern BGD_EXPORT_DATA_PROT gdFontPtr $gdname; -+BGD_DECLARE(gdFontPtr) $gdfunc(void); - -+#ifdef __cplusplus -+} - #endif - -+#endif - EOF - - 1; Index: files/patch-gd_png.c =================================================================== --- files/patch-gd_png.c (revision 418638) +++ files/patch-gd_png.c (working copy) @@ -1,17 +0,0 @@ ---- src/gd_png.c.orig 2013-06-25 11:58:23.000000000 +0200 -+++ src/gd_png.c 2013-08-01 07:08:18.000000000 +0200 -@@ -196,6 +196,14 @@ - 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); -+ -+ if (overflow2(sizeof (int), width)) { -+ return NULL; -+ } -+ if (overflow2(sizeof (int) * width, height)) { -+ return NULL; -+ } -+ - if ((color_type == PNG_COLOR_TYPE_RGB) || (color_type == PNG_COLOR_TYPE_RGB_ALPHA) - || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) { - im = gdImageCreateTrueColor ((int) width, (int) height); Index: files/patch-gdtest.c =================================================================== --- files/patch-gdtest.c (revision 418638) +++ files/patch-gdtest.c (working copy) @@ -1,58 +0,0 @@ ---- src/gdtest.c.orig 2013-06-25 11:58:23.000000000 +0200 -+++ src/gdtest.c 2013-08-01 07:12:08.000000000 +0200 -@@ -35,6 +35,8 @@ - gdSink imgsnk; - int foreground; - int i; -+ gdIOCtx *ctx; -+ - if (argc != 2) { - fprintf(stderr, "Usage: gdtest filename.png\n"); - exit (1); -@@ -55,6 +57,35 @@ - - CompareImages ("Initial Versions", ref, im); - -+ /* */ -+ /* Send to GIF File then Ptr */ -+ /* */ -+ sprintf(of, "%s.gif", argv[1]); -+ out = fopen(of, "wb"); -+ gdImageGif(im, out); -+ fclose(out); -+ -+ in = fopen(of, "rb"); -+ if (!in) { -+ fprintf(stderr, "GIF Output file does not exist!\n"); -+ exit(1); -+ } -+ im2 = gdImageCreateFromGif(in); -+ fclose(in); -+ -+ CompareImages("GD->GIF File->GD", ref, im2); -+ -+ unlink(of); -+ gdImageDestroy(im2); -+ -+ iptr = gdImageGifPtr(im,&sz); -+ ctx = gdNewDynamicCtx(sz,iptr); -+ im2 = gdImageCreateFromGifCtx(ctx); -+ -+ CompareImages("GD->GIF ptr->GD", ref, im2); -+ -+ gdImageDestroy(im2); -+ ctx->gd_free(ctx); - - /* */ - /* Send to PNG File then Ptr */ -@@ -268,6 +299,10 @@ - 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); - Index: files/patch-src_bdftogd =================================================================== --- files/patch-src_bdftogd (revision 0) +++ files/patch-src_bdftogd (working copy) @@ -0,0 +1,68 @@ +--- src/bdftogd.orig 2016-07-19 16:06:29 UTC ++++ src/bdftogd +@@ -24,6 +24,9 @@ $gdname = 'gd' . $gdname unless $gdname + my $filename = shift; + $filename = 'gd' . $filename unless $filename =~ /^gd/i; + ++my $gdfunc = $gdname; ++$gdfunc =~ s/(.*Font)(.*)/$1Get$2/; ++ + if (-f "$filename.c") { die "File $filename.c already exists, won't overwrite\n"; } + if (-f "$filename.h") { die "File $filename.h already exists, won't overwrite\n"; } + +@@ -139,6 +142,10 @@ print FILEC <<"EOF"; + + $info + ++#ifdef HAVE_CONFIG_H ++#include "config.h" ++#endif ++ + #include "$filename.h" + + char ${gdname}Data[] = { +@@ -177,28 +184,40 @@ gdFont ${gdname}Rep = { + ${gdname}Data + }; + +-gdFontPtr ${gdname} = &${gdname}Rep; ++BGD_EXPORT_DATA_PROT gdFontPtr ${gdname} = &${gdname}Rep; + +-/* This file has not been truncated. */ ++BGD_DECLARE(gdFontPtr) ++$gdfunc (void) ++{ ++ return $gdname; ++} + ++/* This file has not been truncated. */ + EOF + + + close FILEC; + + print FILEH <<"EOF"; +- + #ifndef $capdef + #define $capdef 1 + ++#ifdef __cplusplus ++extern "C" { ++#endif ++ + $info + + #include "gd.h" + +-extern gdFontPtr $gdname; ++extern BGD_EXPORT_DATA_PROT gdFontPtr $gdname; ++BGD_DECLARE(gdFontPtr) $gdfunc(void); + ++#ifdef __cplusplus ++} + #endif + ++#endif + EOF + + 1; Property changes on: files/patch-src_bdftogd ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-src_gd__png.c =================================================================== --- files/patch-src_gd__png.c (revision 0) +++ files/patch-src_gd__png.c (working copy) @@ -0,0 +1,17 @@ +--- src/gd_png.c.orig 2016-06-20 02:20:00 UTC ++++ src/gd_png.c +@@ -269,6 +269,14 @@ BGD_DECLARE(gdImagePtr) gdImageCreateFro + 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); ++ ++ if (overflow2(sizeof (int), width)) { ++ return NULL; ++ } ++ if (overflow2(sizeof (int) * width, height)) { ++ return NULL; ++ } ++ + if ((color_type == PNG_COLOR_TYPE_RGB) || (color_type == PNG_COLOR_TYPE_RGB_ALPHA) + || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) { + im = gdImageCreateTrueColor ((int) width, (int) height); Property changes on: files/patch-src_gd__png.c ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-src_gd__tga.c =================================================================== --- files/patch-src_gd__tga.c (revision 0) +++ files/patch-src_gd__tga.c (working copy) @@ -0,0 +1,87 @@ +--- src/gd_tga.c.orig 2016-06-03 08:34:39 UTC ++++ src/gd_tga.c +@@ -99,7 +99,7 @@ BGD_DECLARE(gdImagePtr) gdImageCreateFro + if (tga->bits == TGA_BPP_24) { + *tpix = gdTrueColor(tga->bitmap[bitmap_caret + 2], tga->bitmap[bitmap_caret + 1], tga->bitmap[bitmap_caret]); + bitmap_caret += 3; +- } else if (tga->bits == TGA_BPP_32 || tga->alphabits) { ++ } else if (tga->bits == TGA_BPP_32 && tga->alphabits) { + register int a = tga->bitmap[bitmap_caret + 3]; + + *tpix = gdTrueColorAlpha(tga->bitmap[bitmap_caret + 2], tga->bitmap[bitmap_caret + 1], tga->bitmap[bitmap_caret], gdAlphaMax - (a >> 1)); +@@ -159,16 +159,13 @@ int read_header_tga(gdIOCtx *ctx, oTga * + printf("wxh: %i %i\n", tga->width, tga->height); + #endif + +- switch(tga->bits) { +- case 8: +- case 16: +- case 24: +- case 32: +- break; +- default: +- gd_error("bps %i not supported", tga->bits); ++ if (!((tga->bits == TGA_BPP_24 && tga->alphabits == 0) ++ || (tga->bits == TGA_BPP_32 && tga->alphabits == 8))) ++ { ++ gd_error_ex(GD_WARNING, "gd-tga: %u bits per pixel with %u alpha bits not supported\n", ++ tga->bits, tga->alphabits); ++ + return -1; +- break; + } + + tga->ident = NULL; +@@ -273,14 +270,23 @@ int read_image_tga( gdIOCtx *ctx, oTga * + buffer_caret = 0; + + while( bitmap_caret < image_block_size ) { +- ++ + if ((decompression_buffer[buffer_caret] & TGA_RLE_FLAG) == TGA_RLE_FLAG) { + encoded_pixels = ( ( decompression_buffer[ buffer_caret ] & 127 ) + 1 ); + buffer_caret++; + +- for (i = 0; i < encoded_pixels; i++) { +- for (j = 0; j < pixel_block_size; j++, bitmap_caret++) { +- tga->bitmap[ bitmap_caret ] = decompression_buffer[ buffer_caret + j ]; ++ if (encoded_pixels != 0) { ++ ++ if (!((buffer_caret + (encoded_pixels * pixel_block_size)) < image_block_size)) { ++ gdFree( decompression_buffer ); ++ gdFree( conversion_buffer ); ++ return -1; ++ } ++ ++ for (i = 0; i < encoded_pixels; i++) { ++ for (j = 0; j < pixel_block_size; j++, bitmap_caret++) { ++ tga->bitmap[ bitmap_caret ] = decompression_buffer[ buffer_caret + j ]; ++ } + } + } + buffer_caret += pixel_block_size; +@@ -288,11 +294,20 @@ int read_image_tga( gdIOCtx *ctx, oTga * + encoded_pixels = decompression_buffer[ buffer_caret ] + 1; + buffer_caret++; + +- for (i = 0; i < encoded_pixels; i++) { +- for( j = 0; j < pixel_block_size; j++, bitmap_caret++ ) { +- tga->bitmap[ bitmap_caret ] = decompression_buffer[ buffer_caret + j ]; ++ if (encoded_pixels != 0) { ++ ++ if (!((buffer_caret + (encoded_pixels * pixel_block_size)) < image_block_size)) { ++ gdFree( decompression_buffer ); ++ gdFree( conversion_buffer ); ++ return -1; ++ } ++ ++ for (i = 0; i < encoded_pixels; i++) { ++ for( j = 0; j < pixel_block_size; j++, bitmap_caret++ ) { ++ tga->bitmap[ bitmap_caret ] = decompression_buffer[ buffer_caret + j ]; ++ } ++ buffer_caret += pixel_block_size; + } +- buffer_caret += pixel_block_size; + } + } + } Property changes on: files/patch-src_gd__tga.c ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-src_gdtest.c =================================================================== --- files/patch-src_gdtest.c (revision 0) +++ files/patch-src_gdtest.c (working copy) @@ -0,0 +1,58 @@ +--- src/gdtest.c.orig 2016-06-03 08:34:39 UTC ++++ src/gdtest.c +@@ -35,6 +35,8 @@ main (int argc, char **argv) + gdSink imgsnk; + int foreground; + int i; ++ gdIOCtx *ctx; ++ + if (argc != 2) { + fprintf(stderr, "Usage: gdtest filename.png\n"); + exit (1); +@@ -63,6 +65,35 @@ main (int argc, char **argv) + + CompareImages ("Initial Versions", ref, im); + ++ /* */ ++ /* Send to GIF File then Ptr */ ++ /* */ ++ sprintf(of, "%s.gif", argv[1]); ++ out = fopen(of, "wb"); ++ gdImageGif(im, out); ++ fclose(out); ++ ++ in = fopen(of, "rb"); ++ if (!in) { ++ fprintf(stderr, "GIF Output file does not exist!\n"); ++ exit(1); ++ } ++ im2 = gdImageCreateFromGif(in); ++ fclose(in); ++ ++ CompareImages("GD->GIF File->GD", ref, im2); ++ ++ unlink(of); ++ gdImageDestroy(im2); ++ ++ iptr = gdImageGifPtr(im,&sz); ++ ctx = gdNewDynamicCtx(sz,iptr); ++ im2 = gdImageCreateFromGifCtx(ctx); ++ ++ CompareImages("GD->GIF ptr->GD", ref, im2); ++ ++ gdImageDestroy(im2); ++ ctx->gd_free(ctx); + + /* */ + /* Send to PNG File then Ptr */ +@@ -334,6 +365,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); + Property changes on: files/patch-src_gdtest.c ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-webpimg.c =================================================================== --- files/patch-webpimg.c (revision 418638) +++ files/patch-webpimg.c (working copy) @@ -1,29 +0,0 @@ -Adjust to libvpx 1.4.0 until the code is removed. - -https://chromium.googlesource.com/webm/libvpx/+/9cdaa3d%5E!/ -https://bitbucket.org/libgd/gd-libgd/commits/824a3aa - ---- src/webpimg.c.orig 2013-06-25 09:58:23 UTC -+++ src/webpimg.c -@@ -711,14 +711,14 @@ static WebPResult VPXEncode(const uint8* - codec_ctl(&enc, VP8E_SET_STATIC_THRESHOLD, 0); - codec_ctl(&enc, VP8E_SET_TOKEN_PARTITIONS, 2); - -- vpx_img_wrap(&img, IMG_FMT_I420, -+ vpx_img_wrap(&img, VPX_IMG_FMT_I420, - y_width, y_height, 16, (uint8*)(Y)); -- img.planes[PLANE_Y] = (uint8*)(Y); -- img.planes[PLANE_U] = (uint8*)(U); -- img.planes[PLANE_V] = (uint8*)(V); -- img.stride[PLANE_Y] = y_stride; -- img.stride[PLANE_U] = uv_stride; -- img.stride[PLANE_V] = uv_stride; -+ img.planes[VPX_PLANE_Y] = (uint8*)(Y); -+ img.planes[VPX_PLANE_U] = (uint8*)(U); -+ img.planes[VPX_PLANE_V] = (uint8*)(V); -+ img.stride[VPX_PLANE_Y] = y_stride; -+ img.stride[VPX_PLANE_U] = uv_stride; -+ img.stride[VPX_PLANE_V] = uv_stride; - - res = vpx_codec_encode(&enc, &img, 0, 1, 0, VPX_DL_BEST_QUALITY); - Index: pkg-plist =================================================================== --- pkg-plist (revision 418638) +++ pkg-plist (working copy) @@ -28,6 +28,6 @@ lib/libgd.a lib/libgd.la lib/libgd.so -lib/libgd.so.5 -lib/libgd.so.5.0.0 +lib/libgd.so.6 +lib/libgd.so.6.0.20202 libdata/pkgconfig/gdlib.pc