On 2019-11-27, Stuart Henderson <[email protected]> wrote:

> Wondering whether it's worth adding this to the port, or whether it's
> uncommon enough that we might as well just wait and pick it up with the
> next upstream release:
> https://gitlab.com/libtiff/libtiff/commit/0356ea76bac908c61160d735f078437ace953bd3

Makes sense to add it now.

New combined diff:

Index: Makefile
===================================================================
RCS file: /cvs/ports/graphics/tiff/Makefile,v
retrieving revision 1.89
diff -u -p -r1.89 Makefile
--- Makefile    12 Jul 2019 20:47:10 -0000      1.89
+++ Makefile    28 Nov 2019 18:09:05 -0000
@@ -2,28 +2,28 @@
 
 COMMENT=       tools and library routines for working with TIFF images
 
-DISTNAME=      tiff-4.0.10
-SHARED_LIBS=   tiff    40.3    # 9.0
-SHARED_LIBS+=  tiffxx  40.2    # 9.0
+DISTNAME=      tiff-4.1.0
+SHARED_LIBS=   tiff    40.4    # 10.0
+SHARED_LIBS+=  tiffxx  40.2    # 10.0
 CATEGORIES=    graphics
 
 MASTER_SITES=  https://download.osgeo.org/libtiff/
 
 HOMEPAGE=      http://www.simplesystems.org/libtiff/
 
-LIB_DEPENDS=   graphics/jpeg
-WANTLIB=       c m ${COMPILER_LIBCXX} z jpeg
+LIB_DEPENDS=   graphics/jpeg \
+               archivers/xz \
+               archivers/zstd
+WANTLIB=       c ${COMPILER_LIBCXX} jpeg lzma m z zstd
 
-COMPILER =             base-clang ports-gcc base-gcc
+COMPILER =     base-clang ports-gcc base-gcc
 
 # BSD
 PERMIT_PACKAGE=        Yes
 
 CONFIGURE_STYLE=gnu
 CONFIGURE_ARGS=        --disable-jbig \
-               --disable-lzma \
                --disable-webp \
-               --disable-zstd \
                --with-docdir="${PREFIX}/share/doc/tiff" \
                --with-jpeg-include-dir="${LOCALBASE}/include" \
                --with-jpeg-lib-dir="${LOCALBASE}/lib" \
Index: distinfo
===================================================================
RCS file: /cvs/ports/graphics/tiff/distinfo,v
retrieving revision 1.22
diff -u -p -r1.22 distinfo
--- distinfo    5 Dec 2018 20:35:25 -0000       1.22
+++ distinfo    28 Nov 2019 18:09:05 -0000
@@ -1,2 +1,2 @@
-SHA256 (tiff-4.0.10.tar.gz) = LFLRHMr3Z0V9sMRnldnH0ajY929osLgAo9/kV4a5luQ=
-SIZE (tiff-4.0.10.tar.gz) = 2402867
+SHA256 (tiff-4.1.0.tar.gz) = XSnzJRfa22280SVepbvJOitUuU+/g2U7TWXH1ndbhjQ=
+SIZE (tiff-4.1.0.tar.gz) = 2421581
Index: patches/patch-libtiff_tif_luv_c
===================================================================
RCS file: /cvs/ports/graphics/tiff/patches/patch-libtiff_tif_luv_c,v
retrieving revision 1.8
diff -u -p -r1.8 patch-libtiff_tif_luv_c
--- patches/patch-libtiff_tif_luv_c     26 May 2017 20:50:57 -0000      1.8
+++ patches/patch-libtiff_tif_luv_c     28 Nov 2019 18:09:05 -0000
@@ -2,12 +2,12 @@ $OpenBSD: patch-libtiff_tif_luv_c,v 1.8 
 Index: libtiff/tif_luv.c
 --- libtiff/tif_luv.c.orig
 +++ libtiff/tif_luv.c
-@@ -744,7 +744,7 @@ LogLuvEncodeTile(TIFF* tif, uint8* bp, tmsize_t cc, ui
- 
- #define itrunc(x,m)   ((m)==SGILOGENCODE_NODITHER ? \
-                               (int)(x) : \
--                              (int)((x) + rand()*(1./RAND_MAX) - .5))
-+                              (int)((x) + arc4random()*(1./UINT_MAX) - .5))
+@@ -748,7 +748,7 @@ static int itrunc(double x, int m)
+         return (int)x;
+     /* Silence CoverityScan warning about bad crypto function */
+     /* coverity[dont_call] */
+-    return (int)(x + rand()*(1./RAND_MAX) - .5);
++    return (int)(x + arc4random()*(1./UINT_MAX) - .5);
+ }
  
  #if !LOGLUV_PUBLIC
- static
Index: patches/patch-libtiff_tif_ojpeg_c
===================================================================
RCS file: patches/patch-libtiff_tif_ojpeg_c
diff -N patches/patch-libtiff_tif_ojpeg_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-libtiff_tif_ojpeg_c   28 Nov 2019 18:09:05 -0000
@@ -0,0 +1,75 @@
+$OpenBSD$
+
+OJPEG: fix broken sanity check added in 4.1.0
+https://gitlab.com/libtiff/libtiff/commit/0356ea76bac908c61160d735f078437ace953bd3
+
+Index: libtiff/tif_ojpeg.c
+--- libtiff/tif_ojpeg.c.orig
++++ libtiff/tif_ojpeg.c
+@@ -837,36 +837,6 @@ OJPEGDecodeRaw(TIFF* tif, uint8* buf, tmsize_t cc)
+       {
+               if (sp->subsampling_convert_state==0)
+               {
+-                      const jpeg_decompress_struct* cinfo = 
&sp->libjpeg_jpeg_decompress_struct;
+-                      int width = 0;
+-                      int last_col_width = 0;
+-                      int jpeg_bytes;
+-                      int expected_bytes;
+-                      int i;
+-                      if (cinfo->MCUs_per_row == 0)
+-                      {
+-                              sp->error_in_raw_data_decoding = 1;
+-                              return 0;
+-                      }
+-                      for (i = 0; i < cinfo->comps_in_scan; ++i)
+-                      {
+-                              const jpeg_component_info* info = 
cinfo->cur_comp_info[i];
+-#if JPEG_LIB_VERSION >= 70
+-                              width += info->MCU_width * 
info->DCT_h_scaled_size;
+-                              last_col_width += info->last_col_width * 
info->DCT_h_scaled_size;
+-#else
+-                              width += info->MCU_width * 
info->DCT_scaled_size;
+-                              last_col_width += info->last_col_width * 
info->DCT_scaled_size;
+-#endif
+-                      }
+-                      jpeg_bytes = (cinfo->MCUs_per_row - 1) * width + 
last_col_width;
+-                      expected_bytes = sp->subsampling_convert_clinelenout * 
sp->subsampling_ver * sp->subsampling_hor;
+-                      if (jpeg_bytes != expected_bytes)
+-                      {
+-                              
TIFFErrorExt(tif->tif_clientdata,module,"Inconsistent number of MCU in 
codestream");
+-                              sp->error_in_raw_data_decoding = 1;
+-                              return(0);
+-                      }
+                       if 
(jpeg_read_raw_data_encap(sp,&(sp->libjpeg_jpeg_decompress_struct),sp->subsampling_convert_ycbcrimage,sp->subsampling_ver*8)==0)
+                       {
+                               sp->error_in_raw_data_decoding = 1;
+@@ -1291,6 +1261,29 @@ OJPEGWriteHeaderInfo(TIFF* tif)
+       }
+       if 
(jpeg_start_decompress_encap(sp,&(sp->libjpeg_jpeg_decompress_struct))==0)
+               return(0);
++        if(sp->libjpeg_jpeg_decompress_struct.image_width != sp->strile_width 
||
++           sp->libjpeg_jpeg_decompress_struct.image_height < 
sp->strile_length) {
++            TIFFErrorExt(tif->tif_clientdata,module,
++                         "jpeg_start_decompress() returned image_width = %d "
++                         "and image_height = %d, expected %d and %d",
++                         sp->libjpeg_jpeg_decompress_struct.image_width,
++                         sp->libjpeg_jpeg_decompress_struct.image_height,
++                         sp->strile_width,
++                         sp->strile_length);
++            return 0;
++        }
++        if(sp->libjpeg_jpeg_decompress_struct.max_h_samp_factor != 
sp->subsampling_hor ||
++           sp->libjpeg_jpeg_decompress_struct.max_v_samp_factor != 
sp->subsampling_ver) {
++            TIFFErrorExt(tif->tif_clientdata,module,
++                         "jpeg_start_decompress() returned max_h_samp_factor 
= %d "
++                         "and max_v_samp_factor = %d, expected %d and %d",
++                         sp->libjpeg_jpeg_decompress_struct.max_h_samp_factor,
++                         sp->libjpeg_jpeg_decompress_struct.max_v_samp_factor,
++                         sp->subsampling_hor,
++                         sp->subsampling_ver);
++            return 0;
++        }
++
+       sp->writeheader_done=1;
+       return(1);
+ }
Index: patches/patch-test_Makefile_in
===================================================================
RCS file: /cvs/ports/graphics/tiff/patches/patch-test_Makefile_in,v
retrieving revision 1.11
diff -u -p -r1.11 patch-test_Makefile_in
--- patches/patch-test_Makefile_in      5 Dec 2018 20:35:25 -0000       1.11
+++ patches/patch-test_Makefile_in      28 Nov 2019 18:09:05 -0000
@@ -5,7 +5,7 @@ Avoid picking up an old libtiff in ${LOC
 Index: test/Makefile.in
 --- test/Makefile.in.orig
 +++ test/Makefile.in
-@@ -532,10 +532,10 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
+@@ -549,10 +549,10 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
  INSTALL_SCRIPT = @INSTALL_SCRIPT@
  INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
  LD = @LD@
Index: patches/patch-test_tiff2ps-EPS1_sh
===================================================================
RCS file: patches/patch-test_tiff2ps-EPS1_sh
diff -N patches/patch-test_tiff2ps-EPS1_sh
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-test_tiff2ps-EPS1_sh  28 Nov 2019 18:09:05 -0000
@@ -0,0 +1,11 @@
+$OpenBSD$
+
+Index: test/tiff2ps-EPS1.sh
+--- test/tiff2ps-EPS1.sh.orig
++++ test/tiff2ps-EPS1.sh
+@@ -5,4 +5,4 @@
+ PSFILE=o-tiff2ps-EPS1.ps
+ . ${srcdir:-.}/common.sh
+ f_test_stdout "${TIFF2PS} -e -1" "${IMG_MINISWHITE_1C_1B}" "${PSFILE}"
+-diff -I '%%\(CreationDate\|Title\):*' -u "${REFS}/${PSFILE}" "${PSFILE}" || 
exit 1
++diff -I '%%(CreationDate|Title):*' -u "${REFS}/${PSFILE}" "${PSFILE}" || exit 
1
Index: patches/patch-test_tiff2ps-PS1_sh
===================================================================
RCS file: patches/patch-test_tiff2ps-PS1_sh
diff -N patches/patch-test_tiff2ps-PS1_sh
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-test_tiff2ps-PS1_sh   28 Nov 2019 18:09:05 -0000
@@ -0,0 +1,11 @@
+$OpenBSD$
+
+Index: test/tiff2ps-PS1.sh
+--- test/tiff2ps-PS1.sh.orig
++++ test/tiff2ps-PS1.sh
+@@ -5,4 +5,4 @@
+ PSFILE="o-tiff2ps-PS1.ps"
+ . ${srcdir:-.}/common.sh
+ f_test_stdout "${TIFF2PS} -a -p -1" "${IMG_MINISWHITE_1C_1B}" "${PSFILE}"
+-diff -I '%%\(CreationDate\|Title\):*' -u "${REFS}/${PSFILE}" "${PSFILE}" || 
exit 1
++diff -I '%%(CreationDate|Title):*' -u "${REFS}/${PSFILE}" "${PSFILE}" || exit 
1
Index: patches/patch-test_tiff2ps-PS2_sh
===================================================================
RCS file: patches/patch-test_tiff2ps-PS2_sh
diff -N patches/patch-test_tiff2ps-PS2_sh
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-test_tiff2ps-PS2_sh   28 Nov 2019 18:09:05 -0000
@@ -0,0 +1,11 @@
+$OpenBSD$
+
+Index: test/tiff2ps-PS2.sh
+--- test/tiff2ps-PS2.sh.orig
++++ test/tiff2ps-PS2.sh
+@@ -5,4 +5,4 @@
+ PSFILE=o-tiff2ps-PS2.ps
+ . ${srcdir:-.}/common.sh
+ f_test_stdout "${TIFF2PS} -a -p -2" "${IMG_MINISWHITE_1C_1B}" "${PSFILE}"
+-diff -I '%%\(CreationDate\|Title\):*' -u "${REFS}/${PSFILE}" "${PSFILE}" || 
exit 1
++diff -I '%%(CreationDate|Title):*' -u "${REFS}/${PSFILE}" "${PSFILE}" || exit 
1
Index: patches/patch-test_tiff2ps-PS3_sh
===================================================================
RCS file: patches/patch-test_tiff2ps-PS3_sh
diff -N patches/patch-test_tiff2ps-PS3_sh
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-test_tiff2ps-PS3_sh   28 Nov 2019 18:09:05 -0000
@@ -0,0 +1,11 @@
+$OpenBSD$
+
+Index: test/tiff2ps-PS3.sh
+--- test/tiff2ps-PS3.sh.orig
++++ test/tiff2ps-PS3.sh
+@@ -5,4 +5,4 @@
+ PSFILE=o-tiff2ps-PS3.ps
+ . ${srcdir:-.}/common.sh
+ f_test_stdout "${TIFF2PS} -a -p -3" "${IMG_MINISWHITE_1C_1B}" "${PSFILE}"
+-diff -I '%%\(CreationDate\|Title\):*' -u "${REFS}/${PSFILE}" "${PSFILE}" || 
exit 1
++diff -I '%%(CreationDate|Title):*' -u "${REFS}/${PSFILE}" "${PSFILE}" || exit 
1
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/graphics/tiff/pkg/PLIST,v
retrieving revision 1.27
diff -u -p -r1.27 PLIST
--- pkg/PLIST   5 Dec 2018 20:35:25 -0000       1.27
+++ pkg/PLIST   28 Nov 2019 18:09:05 -0000
@@ -22,10 +22,10 @@ include/tiffconf.h
 include/tiffio.h
 include/tiffio.hxx
 include/tiffvers.h
-lib/libtiff.a
+@static-lib lib/libtiff.a
 lib/libtiff.la
 @lib lib/libtiff.so.${LIBtiff_VERSION}
-lib/libtiffxx.a
+@static-lib lib/libtiffxx.a
 lib/libtiffxx.la
 @lib lib/libtiffxx.so.${LIBtiffxx_VERSION}
 lib/pkgconfig/libtiff-4.pc
@@ -242,3 +242,4 @@ share/doc/tiff/v4.0.6.html
 share/doc/tiff/v4.0.7.html
 share/doc/tiff/v4.0.8.html
 share/doc/tiff/v4.0.9.html
+share/doc/tiff/v4.1.0.html
-- 
Christian "naddy" Weisgerber                          [email protected]

Reply via email to