Sync from SUSE:SLFO:Main tiff revision c99753aac2e0dba2894fbabb3233306e

This commit is contained in:
Adrian Schröter 2025-02-25 19:09:31 +01:00
parent 5fbd1a3ba0
commit bec1c8f245
10 changed files with 414 additions and 107 deletions

3
_multibuild Normal file
View File

@ -0,0 +1,3 @@
<multibuild>
<package>man</package>
</multibuild>

BIN
tiff-4.6.0.tar.xz (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,167 @@
From ea6f6bd7bccbe9a80327810993b8aae5587e1307 Mon Sep 17 00:00:00 2001
From: Su Laus <sulau@freenet.de>
Date: Tue, 19 Nov 2024 18:34:02 +0000
Subject: [PATCH] Update test/test_directory.c not to fail on big-endian
machines. Fix memory leaks
Closes #652 et #656
---
test/test_directory.c | 67 ++++++++++++++++++++++++++++++++++++-------
1 file changed, 56 insertions(+), 11 deletions(-)
diff --git a/test/test_directory.c b/test/test_directory.c
index 0556da1ec..8cc376958 100644
--- a/test/test_directory.c
+++ b/test/test_directory.c
@@ -1365,6 +1365,7 @@ int test_rewrite_lastdir_offset(unsigned int openMode)
filename, N_DIRECTORIES, count);
goto failure;
}
+ /* hint: file was closed by count_directories() */
unlink(filename);
return 0;
@@ -1511,6 +1512,8 @@ int test_lastdir_offset(unsigned int openMode)
}
}
}
+ /* hint: files are always closed by count_directories() and
+ * get_dir_offsets() */
unlink(filename_optimized);
unlink(filename_non_optimized);
return 0;
@@ -1977,8 +1980,8 @@ int test_current_dirnum_incrementing(int testcase, unsigned int openMode)
TIFFSetSubDirectory(tif, 0);
CHECKCURDIRNUM_M(tif, (tdir_t)(-1), __LINE__);
-/*-- Patch offset of IFD2 to not existing IFD3 without entries.
- * Thus TIFFFetchDirectory() will fail. --*/
+ /*-- Patch offset of IFD2 to not existing IFD3 without entries.
+ * Thus TIFFFetchDirectory() will fail. --*/
#define TIFFReadFile_M(tif, buf, size) \
((*TIFFGetReadProc(tif))(TIFFClientdata(tif), (buf), (size)));
#define TIFFWriteFile_M(tif, buf, size) \
@@ -1986,51 +1989,90 @@ int test_current_dirnum_incrementing(int testcase, unsigned int openMode)
#define TIFFSeekFile_M(tif, off, whence) \
((*TIFFGetSeekProc(tif))(TIFFClientdata(tif), (off), (whence)));
- /* Code below does only handle Classic-TIFF without swapping". */
- if (!(TIFFIsByteSwapped(tif) || TIFFIsBigTIFF(tif)))
- {
+ /* ---------------------------------------------------------------------
+ * Test IFD index incrementing in case the functions return with certain
+ * errors. To provoke that errors, the file is patched by writing bytes
+ * directly into the file. Therefore, code below does only handle
+ * Classic-TIFF and little-endian files.
+ * The code works also on big endian machines, which have to swap some
+ * directly read/written values.
+ * --------------------------------------------------------------------- */
+ if (!(TIFFIsBigEndian(tif) || TIFFIsBigTIFF(tif)))
+ {
+ /* Patch nextIFDOffset of IFD2, which is 0, with offset to itself.
+ * This generates an IFD3 without any elements at the end of file.
+ * Reading IFD3 should provoke reading error. */
uint64_t ss = TIFFSeekFile_M(tif, offsetBase[2], 0);
uint16_t cnt = 0;
uint64_t rr = TIFFReadFile_M(tif, &cnt, 2);
+ if (TIFFIsByteSwapped(tif))
+ TIFFSwabShort(&cnt);
ss = TIFFSeekFile_M(tif, offsetBase[2] + cnt * 12 + 2, 0);
uint32_t wt = (uint32_t)ss;
+ if (TIFFIsByteSwapped(tif))
+ TIFFSwabLong(&wt);
rr = TIFFWriteFile_M(tif, &wt, 4);
(void)rr;
/* Now there are offsets to four IFDs in the file, where the last one is
- * not existing and has a non-valid dircount and entries behind EOF. */
+ * not existing and has a non-valid dircount and entries behind EOF.
+ * (dircount is 458 (as offset) */
fprintf(stderr, "----- Expect error messages about 'Error fetching "
"directory link.' -----\n");
- /* TIFFNumberOfDirectories() returns 3 */
+ /* TIFFNumberOfDirectories() returns 3 and omits the invalid fourth IFD.
+ */
lastdir = TIFFNumberOfDirectories(tif);
TIFFSetDirectory(tif, 0);
CHECKCURDIRNUM_M(tif, 0, __LINE__);
+
+ /* TIFFSetDirectory(3) fails with error messages:
+ * TIFFFetchDirectory: test_current_dirnum_incrementing_wl.tif:
+ * Can not read TIFF directory.
+ * TIFFReadDirectory: Failed to read directory at offset 458. */
fprintf(stderr, "----- Expect error messages about 'Cannot read TIFF "
"directory.' -----\n");
if (TIFFSetDirectory(tif, 3))
{
fprintf(stderr,
- "TIFFSetDirectory(3) for IFD4 was expected to fail but "
+ "TIFFSetDirectory(3) for IFD3 was expected to fail but "
"succeeded for %s "
"at %d\n",
filename, __LINE__);
goto failure;
}
+
/* Fails in 4.6.0 */
+ /* Reading invalid IFD 3 leads to an error and was not read in.
+ * Therefore, curdir shall be 65535 (non-existing directory) */
CHECKCURDIRNUM_M(tif, (tdir_t)(-1), __LINE__);
offsetBase[3] = TIFFCurrentDirOffset(tif);
- /* Point IFD3 to a location within the file, where it has now a
- * non-valid dircount=0. */
+ /* Point IFD3 to a location within the file, where it has now for
+ * little-endian TIFF files a non-valid dircount=0, which leads also to
+ * an error and the IFD is not read in. */
ss = TIFFSeekFile_M(tif, offsetBase[2] + cnt * 12 + 2, 0);
wt = (uint32_t)(offsetBase[1] + 8);
+ // wt = (uint32_t)(ss + 400);
+ if (TIFFIsByteSwapped(tif))
+ TIFFSwabLong(&wt);
rr = TIFFWriteFile_M(tif, &wt, 4);
+
fprintf(stderr, "----- Expect error messages about 'Error fetching "
"directory link.' -----\n");
- /* TIFFNumberOfDirectories() returns now 4 */
+ /* TIFFNumberOfDirectories() returns now 4, because for an IFD linked
+ * list dircount=0 is not treated as an error and there is an offset
+ * (=1) to a next IFD. Then, at the fifth IFD a link error occurs. */
lastdir = TIFFNumberOfDirectories(tif);
TIFFSetDirectory(tif, 0);
CHECKCURDIRNUM_M(tif, 0, __LINE__);
+
+ /* TIFFSetDirectory(3) fails with error messages:
+ * test_current_dirnum_incrementing_wl.tif: Failed to allocate
+ * memory for to read TIFF directory (0 elements of 12 bytes each).
+ * TIFFReadDirectory: Failed to read directory at offset 178.
+ * The IFD 3 is not read in and curdir is set to 65535 (non-existing
+ * directory).
+ */
fprintf(stderr,
"----- Expect error messages about 'Failed to allocate "
"memory for to read TIFF directory.' AND 'Failed to read "
@@ -2044,10 +2086,12 @@ int test_current_dirnum_incrementing(int testcase, unsigned int openMode)
filename, __LINE__);
goto failure;
}
+
/* Fails in 4.6.0 */
CHECKCURDIRNUM_M(tif, (tdir_t)(-1), __LINE__);
}
+ TIFFClose(tif);
unlink(filename);
return 0;
@@ -2136,6 +2180,7 @@ int test_curdircount_setting(unsigned int openMode)
CHECKCURDIRNUM_M(tif, (tdir_t)(-1), __LINE__);
}
+ TIFFClose(tif);
unlink(filename);
return 0;
--
GitLab

BIN
tiff-4.7.0.tar.xz (Stored with Git LFS) Normal file

Binary file not shown.

BIN
tiff-4.7.0.tar.xz.sig Normal file

Binary file not shown.

View File

@ -1,33 +0,0 @@
Index: tiff-4.6.0/libtiff/tif_getimage.c
===================================================================
--- tiff-4.6.0.orig/libtiff/tif_getimage.c
+++ tiff-4.6.0/libtiff/tif_getimage.c
@@ -3224,6 +3224,13 @@ int TIFFReadRGBAStripExt(TIFF *tif, uint
if (TIFFRGBAImageOK(tif, emsg) &&
TIFFRGBAImageBegin(&img, tif, stop_on_error, emsg))
{
+ if (row >= img.height)
+ {
+ TIFFErrorExtR(tif, TIFFFileName(tif),
+ "Invalid row passed to TIFFReadRGBAStrip().");
+ TIFFRGBAImageEnd(&img);
+ return (0);
+ }
img.row_offset = row;
img.col_offset = 0;
@@ -3301,6 +3308,14 @@ int TIFFReadRGBATileExt(TIFF *tif, uint3
return (0);
}
+ if (col >= img.width || row >= img.height)
+ {
+ TIFFErrorExtR(tif, TIFFFileName(tif),
+ "Invalid row/col passed to TIFFReadRGBATile().");
+ TIFFRGBAImageEnd(&img);
+ return (0);
+ }
+
/*
* The TIFFRGBAImageGet() function doesn't allow us to get off the
* edge of the image, even to fill an otherwise valid tile. So we

View File

@ -1,49 +0,0 @@
Upstream:
3705f82b6483c7906cf08cd6b9dcdcd59c61d779
Index: tiff-4.6.0/libtiff/tif_dirinfo.c
===================================================================
--- tiff-4.6.0.orig/libtiff/tif_dirinfo.c
+++ tiff-4.6.0/libtiff/tif_dirinfo.c
@@ -887,7 +887,7 @@ const TIFFField *_TIFFFindOrRegisterFiel
if (fld == NULL)
{
fld = _TIFFCreateAnonField(tif, tag, dt);
- if (!_TIFFMergeFields(tif, fld, 1))
+ if (fld == NULL || !_TIFFMergeFields(tif, fld, 1))
return NULL;
}
Index: tiff-4.6.0/libtiff/tif_dirread.c
===================================================================
--- tiff-4.6.0.orig/libtiff/tif_dirread.c
+++ tiff-4.6.0/libtiff/tif_dirread.c
@@ -4260,11 +4260,9 @@ int TIFFReadDirectory(TIFF *tif)
dp->tdir_tag, dp->tdir_tag);
/* the following knowingly leaks the
anonymous field structure */
- if (!_TIFFMergeFields(
- tif,
- _TIFFCreateAnonField(tif, dp->tdir_tag,
- (TIFFDataType)dp->tdir_type),
- 1))
+ const TIFFField *fld = _TIFFCreateAnonField(
+ tif, dp->tdir_tag, (TIFFDataType)dp->tdir_type);
+ if (fld == NULL || !_TIFFMergeFields(tif, fld, 1))
{
TIFFWarningExtR(
tif, module,
@@ -5138,11 +5136,9 @@ int TIFFReadCustomDirectory(TIFF *tif, t
"Unknown field with tag %" PRIu16 " (0x%" PRIx16
") encountered",
dp->tdir_tag, dp->tdir_tag);
- if (!_TIFFMergeFields(
- tif,
- _TIFFCreateAnonField(tif, dp->tdir_tag,
- (TIFFDataType)dp->tdir_type),
- 1))
+ const TIFFField *fld = _TIFFCreateAnonField(
+ tif, dp->tdir_tag, (TIFFDataType)dp->tdir_type);
+ if (fld == NULL || !_TIFFMergeFields(tif, fld, 1))
{
TIFFWarningExtR(tif, module,
"Registering anonymous field with tag %" PRIu16

View File

@ -1,3 +1,168 @@
-------------------------------------------------------------------
Wed Feb 5 16:26:35 UTC 2025 - Lubos Kocman <lubos.kocman@suse.com>
- Update test/test_directory.c not to fail on big-endian machines.
* Add tiff-4.7.0-test_directory.patch
Fix memory leaks (fixes issue #652)
* Resolves bsc#1236834
fix build fail on s390x
-------------------------------------------------------------------
Mon Jan 13 10:51:52 UTC 2025 - Sarah Kriesch <sarah.kriesch@opensuse.org>
- Fix versioning of tiff-docs under Recommends
-------------------------------------------------------------------
Tue Nov 12 14:40:24 UTC 2024 - Marcus Rueckert <mrueckert@suse.de>
- make doc packages noarch. no need to have those per arch
- ensure that the src rpms are named per build flavor:
You might now ask why. Good question:
1. the spec file during the build get patched. `@BUILD_FLAVOR@`
gets replaced with the value. which means the src rpm between
build flavor builds is not identical. Also the last built
src.rpm will be published. with different content and runtime
requires (aka our BuildRequires).
2. for historical reasons the internal dependency tracking goes
via the src.rpm package. So without having differently named
src.rpms the build cycle we were trying to solve was not
actually solved. So we append a suffix to the Name attribute
in the preamble now.
-------------------------------------------------------------------
Mon Nov 11 17:34:34 UTC 2024 - Marcus Rueckert <mrueckert@suse.de>
- In the previous change to enable the cmake based build
we also needed python3-Sphinx to build the man pages, as unlike
the autotools based build, the cmake based build does not fall
back to the pre-built man pages.
This causes build cycle. Split out the documentation building to
break the cycle. The Tumbleweed release managers preferred this
solution over a mini package.
-------------------------------------------------------------------
Sat Nov 9 22:56:55 UTC 2024 - Marcus Rueckert <mrueckert@suse.de>
- switch build to cmake for the webp build - we need the cmake
finder code
-------------------------------------------------------------------
Wed Sep 18 08:02:11 UTC 2024 - Michael Vetter <mvetter@suse.com>
- Update to 4.7.0:
* This version restores in the default build the availability of
the tools that had been dropped in v4.6.0
See https://libtiff.gitlab.io/libtiff/rfcs/rfc2_restoring_needed_tools.html#rfc2-restoring-needed-tools
* Software configuration changes:
+ autoconf build: configure.ac: avoid -Werror passed to CFLAGS to interfere with feature detection
+ autoconf build: fix error when running make clean (fixes issue #630)
+ autoconf build: back off the minimum required automake version to 1.11
+ autoconf.ac: fix detection of windows.h for mingw (fixes issue #605)
+ libtiff-4.pc: Fix Requires.private missing Lerc. It provides a .pc file
starting from version 4 (in autoconf builds, we assume that liblerc is at least version 4)
+ CMake: Fix TIFF_INCLUDE_DIRS
+ CMake: MinGW compilers don't need a .def file for shared library
+ CMake: move libdeflate and Lerc to Requires.private
+ CMake: enable resource compilation on all Windows.
* Library changes:
+ Add TIFFOpenOptionsSetMaxCumulatedMemAlloc(). This function complements
TIFFOpenOptionsSetMaxSingleMemAlloc() to define the maximum cumulated memory
allocations in byte, for a given TIFF handle, that libtiff internal memory
allocation functions are allowed.
+ TIFFWriteDirectory(): Avoid overwriting following data if an IFD is enlarged.
+ TIFFXYZToRGB: avoid integer overflow (fixes issue #644)
+ uv_decode() and uv_encode(): avoid potential out-of-bounds array index (fixes issue #645)
+ Fix cases where tif_curdir is set incorrectly. Fix cases where the current directory number (tif_curdir)
is set inconsistently or incorrectly, depending on the previous history.
+ TIFFRead[Scanline/EncodedStrip/EncodeTile]: 0-initialize output buffer if setupdecode fails ;
most codecs: zero-initialize (not-yet-written parts of) output buffer if failure (fixes issue #375)
+ OJPEG: reset subsampling_convert_state=0 in OJPEGPreDecode (fixes issue #183)
+ ThunderRLE: fix failure when decoding last run. Bug seen with GhostPDL
+ LERC codec: deal with issues with multi-band PlanarConfig=Contig and NaN values
+ tif_fax3.c: error out after a number of times end-of-file has been reached (fixes issue #583)
+ LZW: avoid warning about misaligned address with UBSAN (fixes issue #616)
+ TIFFReadRGBAStrip/TIFFReadRGBATile: add more validation of col/row (fixes issue #622, CVE-2023-52356)
+ tif_dirread.c: only issue TIFFGetFileSize() for large enough RAM requests
+ Avoid FPEs (division by zero) in tif_getimage.c.
+ Avoiding FPE (division by zero) for TIFFhowmany_32() and TIFFhowmany_64() macros by checking for
denominator not zero before macros are executed. (fixes issue #628)
+ Add non-zero check before division in TIFFComputeStrip()
+ Fix wrong return of TIFFIsBigTIFF() in case byte-swapping is active
+ Setting the TIFFFieldInfo field set_field_type should consider field_writecount not field_readcount
+ Avoid memory leaks when using TIFFCreateDirectory() by releasing the allocated memory in the tif-structure.
+ For non-terminated ASCII arrays, the buffer is first enlarged before a NULL is set at the end to
avoid deleting the last character. (fixes issue #579)
+ Check return value of _TIFFCreateAnonField(). (fixes issue #624, CVE-2024-7006)
+ Prevent some out-of-memory attacks (https://gitlab.com/libtiff/libtiff/-/issues/614#note_1602683857)
+ Ensure absolute seeking is forced independent of TIFFReadDirectory success. (fixes issue #618)
+ tif_dirinfo.c: re-enable TIFFTAG_EP_CFAREPEATPATTERNDIM and TIFFTAG_EP_CFAPATTERN tags (fixes issue #608)
+ Fix warnings with GCC 14
+ tif_dir.c: Log source file, line number, and input tif for directory count error (fixes issue #627)
+ Last usage of get_field_type of TIFFField structure at TIFFWriteDirectorySec() changed to using set_field_type.
+ tif_jpeg.c/tif_ojpeg.c: remove likely ifdef tricks related to old compilers or unusual setups
+ Remove _TIFFUInt64ToFloat() and _TIFFUInt64ToDouble()
+ Remove support for _MSC_VER < 1500.
+ Use #ifdef _WIN32 to test for Windows, and tiffio.h: remove definition of __WIN32__
* Documentation:
+ Amend manpages for changes in current directory index behaviour
+ Note on using TIFFFlush() before TIFFClose() to check that the data has been successfully written to the file. (fixes issue #506)
+ Update TIFF documentation about TIFFOpenOptions.rst and TIFFOpenOptionsSetMaxSingleMemAlloc() usage and some other small fixes (relates to CVE-2024-7006)
* Re-added tools:
+ fax2ps
+ fax2tiff
+ pal2rgb
+ ppm2tiff
+ raw2tiff
+ rgb2ycbcr (not installed)
+ thumbnail (not installed)
+ tiff2bw
+ tiff2rgba
+ tiffcmp
+ tiffcrop
+ tiffdither
+ tiffgt
+ tiffmedian
+ tiff2ps
+ tiff2pdf
* New/improved functionality:
+ tiff2rgba: Add background gradient option for alpha compositing
+ tiffcp: -i flag restored
* Bug fixes for tools:
+ tiffcrop: address Coverity scan issues 1605444, 1605445, and 16054
+ tiffcrop: Apply "Fix heap-buffer-overflow in function extractImageSection"
+ tiffcrop: fix buffer overflows, use after free (fixes issue #542, issue #550, issue #552)
+ tiff2pdf: address Coverity scan issues
+ tiff2pdf: fix inconsistent PLANARCONFIG value for the input and output TIFF
+ tiff2pdf: fix issue with JPEG restart-interval marker when converting from JPEG-compressed files (fixes issue #539)
+ tiff2pdf: red and blue were being swapped for RGBA decoding (fixes issue #253)
+ tiff2pdf: fixes issue #596
+ thumbnail: address Coverity scan issues
+ tiffcp: Add check for limitMalloc return to fix Coverity 1603334
+ tiffcp: preserve TIFFTAG_REFERENCEBLACKWHITE when doing YCbCr JPEG -> YCbCr JPEG
+ tiffcp: replace PHOTOMETRIC_YCBCR with PHOTOMETRIC_RGB when outputing to compression != JPEG (refs issue #571)
+ tiffcp: do not copy tags YCBCRCOEFFICIENTS, YCBCRSUBSAMPLING, YCBCRPOSITIONING, REFERENCEBLACKWHITE. Only set YCBCRSUBSAMPLING when generating YCbCr JPEG
+ tiffcp: Check also codec of input image, not only from output image (fixes issue #606)
+ Add some basic sanity checks for tiffcp and tiffcrop RGB->YCbCr JPEG conversions.
+ fax2ps and fax2tiff: memory leak fixes (fixes issue #476)
+ tiffmedian: memory leak fixes (fixes issue #599)
+ fax2tiff: fix EOFB interpretation (fixes issue #191)
+ fax2tiff: fix issue with unreasonable width input (fixes issue #249)
+ tiffcp and tiffcrop: fixes issue #228
+ tiff2rgba: fixes issue #469
+ tiffdither: fixes issue #473
+ tiffdump: fix wrong printf formatter in error message (Coverity 1472932)
+ tiffset: avoid false positive Coverity Scan warning on 64-bit builds (Coverity 1518997)
+ tifcp/tiffset: use correct format specifiers
* Changes to contributed and unsupported tools
+ contrib/addtiffo: validate return of TIFFWriteEncodedXXXX() calls (Coverity 1024680)
- Remove patches contained in upstream:
* tiff-CVE-2023-52356.patch
* tiff-CVE-2024-7006.patch
- Tools are not built for now due to test failure: `FAIL: tiffcp-32bpp-None-jpeg.sh`
-------------------------------------------------------------------
Mon Aug 19 06:30:27 UTC 2024 - Michael Vetter <mvetter@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package tiff
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -16,10 +16,24 @@
#
%global build_flavor @BUILD_FLAVOR@%{nil}
%if "%{?build_flavor}" == "man"
%bcond_without tiff_manpages
%else
%bcond_with tiff_manpages
%endif
%define asan_build 0
%define debug_build 0
%define pkg_name tiff
%if "%{build_flavor}" == ""
Name: tiff
Version: 4.6.0
%else
Name: tiff-%{build_flavor}
%endif
Version: 4.7.0
Release: 0
Summary: Tools for Converting from and to the Tagged Image File Format
License: HPND
@ -31,8 +45,12 @@ Source2: README.SUSE
Source3: baselibs.conf
Source99: tiff.keyring
Patch0: tiff-4.0.3-seek.patch
Patch1: tiff-CVE-2023-52356.patch
Patch2: tiff-CVE-2024-7006.patch
# PATCH-FIX-UPSTREAM tiff-4.7.0-test_directory.patch based on commit ea6f6bd7bccb bsc#1236834
Patch1: tiff-4.7.0-test_directory.patch
%if %{with tiff_manpages}
BuildRequires: %{primary_python}-Sphinx
%endif
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: libjbig-devel
BuildRequires: libjpeg-devel
@ -41,6 +59,7 @@ BuildRequires: lzma-devel
BuildRequires: pkgconfig
BuildRequires: pkgconfig(libzstd)
BuildRequires: pkgconfig(zlib)
Recommends: tiff-docs = %{version}
%description
This package contains the library and support programs for the TIFF
@ -62,55 +81,89 @@ Group: Development/Libraries/C and C++
Requires: glibc-devel
Requires: libstdc++-devel
Requires: libtiff6 = %{version}
Recommends: libtiff-devel-docs = %{version}
%description -n libtiff-devel
This package contains the header files and static libraries for
developing programs which will manipulate TIFF format image files using
the libtiff library.
%if %{with tiff_manpages}
%package -n tiff-docs
Summary: Development Tools for Programs which will use the libtiff Library
Group: Productivity/Graphics/Convertors
Requires: tiff = %{version}
BuildArch: noarch
%description -n tiff-docs
This package contains the header files and static libraries for
developing programs which will manipulate TIFF format image files using
the libtiff library.
This package holds the man pages for the command lint tools.
%package -n libtiff-devel-docs
Summary: Development Documentation for Programs which will use the libtiff Library
Group: Development/Libraries/C and C++
Requires: libtiff-devel = %{version}
BuildArch: noarch
%description -n libtiff-devel-docs
This package contains the header files and static libraries for
developing programs which will manipulate TIFF format image files using
the libtiff library.
This package holds the development man pages.
%endif
%prep
%autosetup -p1
%autosetup -p1 -n %{pkg_name}-%{version}
%build
CFLAGS="%{optflags} -fPIE"
CFLAGS="%{optflags} -fPIC"
%if %{debug_build}
CFLAGS="$CFLAGS -O0"
%endif
%configure --disable-static
# tools are not enabled for now due to test failure `FAIL: tiffcp-32bpp-None-jpeg.sh`
%cmake
%if %{asan_build}
find -name Makefile | xargs sed -i 's/\(^CFLAGS.*\)/\1 -fsanitize=address/'
%endif
%make_build LDFLAGS="-pie"
%cmake_build
%install
mkdir -p %{buildroot}/{%{_mandir}/{man1,man3},usr/{bin,lib,include}}
%make_install
for f in `find %{buildroot}/%{_mandir} -type f -print ` ; do
if [ `wc -l <$f` -eq 1 ] && grep -q "^\.so " $f ; then
linkto=`sed -e "s|^\.so ||" $f`
[ -f "`dirname $f`/$linkto" ] && ln -sf "$linkto" $f
fi
done
%cmake_install
cp %{SOURCE2} .
rm -rf %{buildroot}%{_datadir}/doc/tiff*
rm -rf %{buildroot}%{_datadir}/doc/{,packages/}tiff*
find %{buildroot} -type f -name "*.la" -delete -print
%if %{with tiff_manpages}
rm -rv \
%{buildroot}%{_bindir} \
%{buildroot}%{_libdir} \
%{buildroot}%{_includedir}
%files -n tiff-docs
%{_mandir}/man1/*
%files -n libtiff-devel-docs
%{_mandir}/man3/*
%else
%check
%if %{asan_build}
# ASAN needs /proc to be mounted
exit 0
%endif
for i in tools test; do
(cd $i && make %{?_smp_mflags} check)
done
%ctest
%ldconfig_scriptlets -n libtiff6
%files
%{_bindir}/*
%doc README.md VERSION ChangeLog TODO RELEASE-DATE
%{_mandir}/man1/*
%files -n libtiff6
%license LICENSE.md
@ -121,6 +174,7 @@ done
%{_includedir}/*
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc
%{_mandir}/man3/*
%{_libdir}/cmake/tiff/
%endif
%changelog