Name:           libtiff
Version:        4.3.0
Release:        20
Summary:        TIFF Library and Utilities
License:        libtiff
URL:            https://www.simplesystems.org/libtiff/
Source0:        https://download.osgeo.org/libtiff/tiff-%{version}.tar.gz

Patch6000:	backport-CVE-2022-0561.patch
Patch6001:	backport-CVE-2022-0562.patch
Patch6002:	backport-0001-CVE-2022-22844.patch
Patch6003:	backport-0002-CVE-2022-22844.patch
Patch6004:	backport-0003-CVE-2022-22844.patch
Patch6005:	backport-CVE-2022-0891.patch
Patch6006:      backport-CVE-2022-0907.patch
Patch6007:      backport-CVE-2022-0908.patch
Patch6008:      backport-CVE-2022-0865.patch
Patch6009:      backport-CVE-2022-0909.patch
Patch6010:      backport-CVE-2022-0924.patch
Patch6011:	backport-CVE-2022-1355.patch
Patch6012:	backport-0001-CVE-2022-1622-CVE-2022-1623.patch
Patch6013:	backport-0002-CVE-2022-1622-CVE-2022-1623.patch
Patch6014:	backport-CVE-2022-1354.patch
Patch6015:	backport-CVE-2022-2867-CVE-2022-2868-CVE-2022-2869.patch
Patch6016:	backport-0001-CVE-2022-2953-CVE-2022-2519-CVE-2022-2520-CVE-2022-2521.patch
Patch6017:	backport-0002-CVE-2022-2953-CVE-2022-2519-CVE-2022-2520-CVE-2022-2521.patch
Patch6018:	backport-CVE-2022-2056-CVE-2022-2057-CVE-2022-2058.patch
Patch6019:      backport-CVE-2022-3597-CVE-2022-3626-CVE-2022-3627.patch
Patch6020:      backport-0001-CVE-2022-3570-CVE-2022-3598.patch
Patch6021:      backport-0002-CVE-2022-3570-CVE-2022-3598.patch
Patch6022:      backport-0003-CVE-2022-3570-CVE-2022-3598.patch
Patch6023:      backport-CVE-2022-3599.patch
Patch6024:      backport-CVE-2022-3970.patch
Patch6025:      backport-CVE-2022-48281.patch
Patch6026:      backport-0001-CVE-2023-0795-0796-0797-0798-0799.patch
Patch6027:      backport-0002-CVE-2023-0795-0796-0797-0798-0799.patch
Patch6028:      backport-CVE-2023-0800-0801-0802-0803-0804.patch
Patch6029:      backport-CVE-2023-2731.patch
Patch6030:      backport-CVE-2023-26965.patch
Patch6031:      backport-CVE-2023-3316.patch
Patch6032:      backport-CVE-2023-25433.patch
Patch6033:      backport-CVE-2023-26966.patch
Patch6034:      backport-CVE-2023-2908.patch
Patch6035:      backport-CVE-2023-3576.patch
Patch6036:      backport-CVE-2023-38288.patch
Patch6037:      backport-CVE-2023-38289.patch
Patch6038:      backport-CVE-2023-3618.patch
Patch6039:      backport-CVE-2022-40090.patch
Patch6040:      backport-CVE-2022-34526.patch
Patch6041:      backport-CVE-2023-6228.patch

Patch9000:	fix-raw2tiff-floating-point-exception.patch

BuildRequires:  gcc gcc-c++ zlib-devel libjpeg-devel jbigkit-devel
BuildRequires:  libtool automake autoconf pkgconfig 

%description
This %{name} provides support for the Tag Image File Format (TIFF), a widely
used format for storing image data. The latest version of the TIFF specification
is available on-line in several different formats.And contains command-line programs
for manipulating TIFF format image files using the libtiff library.

%package	devel
Summary:        Development files for %{name} library
Requires:	%{name} = %{version}-%{release} pkgconfig

%description devel
This package contains the header files and documentation necessary for developing programs
which will manipulate TIFF format image files using the libtiff library.

%package_help

%prep
%autosetup -n tiff-%{version} -p1

libtoolize --force  --copy
aclocal -I . -I m4
automake --add-missing --copy
autoconf
autoheader

%build
export CFLAGS="%{optflags} -fno-strict-aliasing"
%configure --enable-ld-version-script
%make_build

%install
%make_install
%delete_la

rm -rf %{buildroot}/%{_datadir}/doc/
rm -f  %{buildroot}/%{_bindir}/tiffgt

case `uname -i` in
    x86_64 )
         wordsize="64"
    ;;
    *)
         wordsize=""
    ;;
esac

if test -n "$wordsize"
then
   mv %{buildroot}/%{_includedir}/tiffconf.h  %{buildroot}/%{_includedir}/tiffconf-$wordsize.h
   cat >%{buildroot}/%{_includedir}/tiffconf.h <<EOF
#ifndef TIFFCONF_H_MULTILIB
#define TIFFCONF_H_MULTILIB

#include <bits/wordsize.h>

#if __WORDSIZE == 32
# include "tiffconf-32.h"
#elif __WORDSIZE == 64
# include "tiffconf-64.h"
#else
# error "unexpected value for __WORDSIZE macro"
#endif

#endif
EOF
fi

%ldconfig_scriptlets

%check
make check
find html -name 'Makefile*' | xargs rm

%files
%defattr(-,root,root)
%license COPYRIGHT
%doc README.md
%{_bindir}/*
%{_libdir}/*.so.*

%files devel
%defattr(-,root,root)
%{_includedir}/*
%{_libdir}/*.a
%{_libdir}/*.so
%{_libdir}/pkgconfig/

%files help
%defattr(-,root,root)
%{_mandir}/man*
%doc RELEASE-DATE VERSION
%doc TODO ChangeLog html
%exclude %{_mandir}/man1/*
%exclude %{_datadir}/html/man/tiffgt.1.html

%changelog
* Tue Nov 21 2023 liningjie <liningjie@xfusion.com> - 4.3.0-20
- fix CVE-2023-6228

* Thu Sep 07 2023 zhangpan <zhangpan103@h-partners.com> - 4.3.0-19
- fix CVE-2022-34526

* Fri Sep 01 2023 zhangpan <zhangpan103@h-partners.com> - 4.3.0-18
- fix CVE-2022-40090

* Wed Aug 16 2023 liningjie <liningjie@xfusion.com> - 4.3.0-17
- fix CVE-2023-3618

* Fri Jul 28 2023 zhangpan <zhangpan103@h-partners.com> - 4.3.0-16
- fix CVE-2023-38288 CVE-2023-38289

* Thu Jul 13 2023 zhangpan <zhangpan103@h-partners.com> - 4.3.0-15
- fix CVE-2023-3576

* Tue Jul 04 2023 zhangpan <zhangpan103@h-partners.com> - 4.3.0-14
- fix CVE-2023-25433 CVE-2023-26966 CVE-2023-2908

* Sun Jun 25 2023 zhangpan <zhangpan103@h-partners.com> - 4.3.0-13
- fix CVE-2023-3316

* Thu Jun 15 2023 zhangpan <zhangpan103@h-partners.com> - 4.3.0-12
- fix CVE-2023-26965

* Wed May 24 2023 zhangpan <zhangpan103@h-partners.com> - 4.3.0-11
- fix CVE-2023-2731

* Mon Feb 20 2023 zhouwenpei <zhouwenpei1@h-partners.com> - 4.3.0-10
- modified backport-CVE-2022-48281.patch

* Thu Feb 16 2023 zhouwenpei <zhouwenpei1@h-partners.com> - 4.3.0-9
- fix CVE-2023-0795,CVE-2023-0796,CVE-2023-0797,CVE-2023-0798,CVE-2023-0799,
- fix CVE-2023-0800,CVE-2023-0801,CVE-2023-0802,CVE-2023-0803,CVE-2023-0804

* Sun Jan 29 2023 zhouwenpei <zhouwenpei1@h-partners.com> - 4.3.0-8
- Type:cve
- ID:CVE-2022-48281
- SUG:NA
- DESC:fix CVE-2022-48281

* Thu Nov 17 2022 qisen <qisen@huawei.com> - 4.3.0-7
- Type:cve
- ID:CVE-2022-3970
- SUG:NA
- DESC:fix CVE-2022-3970

* Tue Oct 25 2022 zhouwenpei <zhouwenpei1@h-partners.com> - 4.3.0-6
- fix CVE-2022-3570,CVE-2022-3597,CVE-2022-3598,CVE-2022-3599,CVE-2022-3626,CVE-2022-3627

* Mon Oct 17 2022 zhouwenpei <zhouwenpei1@h-partners.com> - 4.3.0-5
- fix CVE-2022-2056,CVE-2022-2057,CVE-2022-2058

* Tue Sep 13 2022 zhouwenpei <zhouwenpei1@h-partners.com> - 4.3.0-4
- fix CVE-2022-2953,CVE-2022-2519,CVE-2022-2520,CVE-2022-2521

* Tue Aug 23 2022 zhouwenpei <zhouwenpei1@h-partners.com> - 4.3.0-3
- fix CVE-2022-2867,CVE-2022-2868,CVE-2022-2869

* Tue Jul 05 2022 zhouwenpei <zhouwenpei1@h-partners.com> - 4.3.0-2
- fix CVE-2022-1354

* Thu Jun 23 2022 wuchaochao <wuchaochao4@h-partners.com> - 4.3.0-1
- update to 4.3.0 for fix CVE-2022-1622,CVE-2022-1623

* Wed May 18 2022 liuyumeng <liuyumeng5@h-partners.com> - 4.1.0-11
- fix CVE-2022-1355

* Sat Apr 02 2022 dongyuzhen <dongyuzhen@h-partners.com> - 4.1.0-10
- fix CVE-2022-0909,CVE-2022-0924

* Tue Mar 29 2022 yangcheng <yangcheng87@h-partners.com> - 4.1.0-9
- fix CVE-2022-0865

* Tue Mar 28 2022 yangcheng <yangcheng87@h-partners.com> - 4.1.0-8
- fix CVE-2022-0907

* Tue Mar 22 2022 yangcheng <yangcheng87@h-partners.com> - 4.1.0-7
- Type:cve
- ID:CVE-2022-0908
- SUG:NA
- DESC:fix CVE-2022-0908 and modify CVE-2022-0891 patch

* Thu Mar 17 2022 wangkerong <wangkerong@h-partners.com> - 4.1.0-6
- Type:cve
- ID:CVE-2022-0891
- SUG:NA
- DESC:fix CVE-2022-0891

* Thu Mar 10 2022 dongyuzhen <dongyuzhen@h-partners.com> - 4.1.0-5
- Type:cves
- ID:CVE-2022-22844
- SUG:NA
- DESC:fix CVE-2022-22844

* Wed Feb 23 2022 liuyumeng <liuyumeng5@h-partners.com> -4.1.0-4
- Type:cves
- ID:CVE-2022-0561 CVE-2022-0562
- SUG:NA
- DESC: fix CVE-2022-0561 CVE-2022-0562

* Mon Mar 22 2021 wangye <wangye70@huawei.com> - 4.1.0-3
- Type:cves
- ID:CVE-2020-35523 CVE-2020-35524
- SUG:NA
- DESC: fix CVE-2020-35523 CVE-2020-35524

* Thu Mar 18 2021 wangye <wangye70@huawei.com> - 4.1.0-2
- Type:cves
- ID:CVE-2020-35521 CVE-2020-35522
- SUG:NA
- DESC: fix CVE-2020-35521 CVE-2020-35522

* Tue Jan 7 2020 openEuler Buildteam <buildteam@openeuler.org> - 4.1.0-1
- update to 4.1.0

* Mon Oct 21 2019 openEuler Buildteam <buildteam@openeuler.org> - 4.0.10-2
- Type:enhancement
- Id:NA
- SUG:NA
- DESC:modify the location of COPYRIGHT

* Fri Sep 06 2019 openEuler Buildteam <buildteam@openeuler.org> - 4.0.10-1
- Type:Enhance
- ID:NA
- SUG:NA
- DESC: openEuler Debranding

* Mon Aug 19 2019 cangyi<cangyi@huawei.com> - 4.0.9-11.h6
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:format patches

* Fri Aug 09 2019 zhangyujing<zhangyujing1@huawei.com> - 4.0.9-11.h5
- Type:cves
- ID:CVE-2018-10779
- SUG:NA
- DESC:fix CVE-2018-10779

* Wed Jul 31 2019 shenyangyang<shenyangyang4@huawei.com> - 4.0.9-11.h4
- Type:NA
- ID:NA
- SUG:NA
- DESC:openEuler Debrading

* Mon Jul 15 2019 wangchan<wangchan9@huawei.com> - 4.0.9-11.h3
- Type:cves
- ID:CVE-2017-17095
- SUG:NA
- DESC:fix CVE-2017-17095

* Mon Apr 29 2019 yuejiayan<yuejiayan@huawei.com> - 4.0.9-11.h2
- Type:cves
- ID:CVE-2018-19210 CVE-2019-6128
- SUG:NA
- DESC:fix above cves

* Sun Apr 07 2019 wenjun<wenjun8@huawei.com> - 4.0.9-11.h1
- Type:cves
- ID:CVE-2018-18557 CVE-2018-17101 CVE-2018-17100 CVE-2018-12900 CVE-2018-18661
- SUG:NA
- DESC:fix above cves

* Fri Jul 13 2018 shenyangyang<shenyangyang4@huawei.com> - 4.0.9-11
- Package Initialization

