File ImageMagick.spec of Package ImageMagick.19146

#
# spec file for package ImageMagick
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define debug_build   0
%define asan_build    0
%define maj           7
%define mfr_version   %{maj}.0.7
%define mfr_revision  34
%define quantum_depth 16
%define source_version %{mfr_version}-%{mfr_revision}
%define clibver   6
%define cwandver  6
%define cxxlibver 4
%define libspec -%{maj}_Q%{quantum_depth}HDRI
%define config_dir     ImageMagick-7
%define config_spec    config-7
# bsc#1088463
%define urw_base35_fonts 0

Name:           ImageMagick
Version:        %{mfr_version}.%{mfr_revision}
Release:        2
Summary:        Viewer and Converter for Images
License:        ImageMagick
Group:          Productivity/Graphics/Other
URL:            http://www.imagemagick.org
Source0:        http://www.imagemagick.org/download/ImageMagick-%{mfr_version}-%{mfr_revision}.tar.bz2
Source1:        baselibs.conf
Source2:        http://www.imagemagick.org/download/ImageMagick-%{mfr_version}-%{mfr_revision}.tar.bz2.asc
Source3:        ImageMagick.keyring
# suse specific patches
Patch0:         ImageMagick-configuration-SUSE.patch
# workaround, see https://github.com/ImageMagick/ImageMagick/issues/439
#%%ifarch i586
#%%if %%{?suse_version} == 1500
Patch1:         ImageMagick-relax-filter.t.patch
#%%endif
#%%endif
Patch2:         ImageMagick-library-installable-in-parallel.patch
#%%ifarch s390x s390 ppc64 ppc
Patch3:         ImageMagick-s390-disable-tests.patch
#%%endif
# https://github.com/ImageMagick/ImageMagick/issues/1019
#%%ifarch i586
Patch5:         ImageMagick-tests.tap-attributes.patch
#%%endif
Patch6:         ImageMagick-gamma-issues.patch
Patch7:         ImageMagick-CVE-2018-11624.patch
Patch8:         ImageMagick-CVE-2018-11625.patch
Patch9:         ImageMagick-CVE-2018-10805.patch
Patch10:        ImageMagick-CVE-2018-12600.patch
Patch11:        ImageMagick-CVE-2018-12599.patch
Patch12:        ImageMagick-fix-Clear-method.patch
Patch13:        ImageMagick-CVE-2018-14434.patch
Patch14:        ImageMagick-CVE-2018-14437.patch
Patch15:        ImageMagick-CVE-2018-14436.patch
Patch16:        ImageMagick-CVE-2018-14435.patch
Patch17:        ImageMagick-CVE-2018-16323.patch
Patch18:        ImageMagick-CVE-2018-16328.patch
Patch19:        ImageMagick-CVE-2018-16329.patch
Patch20:        ImageMagick-CVE-2018-16412,16413.patch
Patch21:        ImageMagick-CVE-2018-16645.patch
Patch22:        ImageMagick-CVE-2018-16644.patch
Patch23:        ImageMagick-CVE-2018-16643.patch
Patch24:        ImageMagick-CVE-2018-16641.patch
Patch25:        ImageMagick-CVE-2018-16640.patch
Patch26:        ImageMagick-CVE-2018-16642.patch
Patch27:        ImageMagick-morphology-EdgeIn.patch
Patch28:        ImageMagick-CVE-2018-17966.patch
Patch29:        ImageMagick-WritePCXImage-page_table-memory-leak.patch
Patch30:        ImageMagick-CVE-2018-18024.patch
Patch31:        ImageMagick-memory-corruption-in-MVG-paths.patch
Patch32:        ImageMagick-CVE-2018-18544.patch
Patch33:        ImageMagick-CVE-2018-20467.patch
Patch34:        ImageMagick-clamp-after-edge.patch
Patch35:        ImageMagick-CVE-2019-7398.patch
Patch36:        ImageMagick-CVE-2019-7396.patch
Patch37:        ImageMagick-CVE-2019-7395.patch
Patch38:        ImageMagick-CVE-2019-7397.patch
# CVE-2019-7175 [bsc#1128649]
Patch39:        ImageMagick-CVE-2019-7175.patch
# CVE-2019-9956 [bsc#1130330]
Patch40:        ImageMagick-CVE-2019-9956.patch
# CVE-2019-10650 [bsc#1131317]
Patch41:        ImageMagick-CVE-2019-10650.patch
# CVE-2019-11008 [bsc#1132054], CVE-2019-11472 [bsc#1133204]
Patch42:        ImageMagick-xwd.c-update.patch
# CVE-2019-11007 [bsc#1132060]
Patch43:        ImageMagick-CVE-2019-11007.patch
# CVE-2019-11505 [bsc#1133501]
Patch44:        ImageMagick-CVE-2019-11505.patch
# CVE-2019-11506 [bsc#1133498]
Patch45:        ImageMagick-CVE-2019-11506.patch
# CVE-2019-11470 [bsc#1133205]
Patch46:        ImageMagick-CVE-2019-11470.patch
# CVE-2019-11598 [bsc#1136732]
Patch47:        ImageMagick-CVE-2019-11598.patch
# CVE-2019-11597 [bsc#1138464]
Patch48:        ImageMagick-CVE-2019-11597.patch
# CVE-2019-13136 [bsc#1140104] (tiff.c)
Patch49:        ImageMagick-CVE-2019-13136.patch
# CVE-2019-13137 [bsc#1140105] (ps.c)
Patch50:        ImageMagick-CVE-2019-13137.patch
# CVE-2019-12976 [bsc#1140110] (pcl.c)
Patch51:        ImageMagick-CVE-2019-12976.patch
# CVE-2019-13133 [bsc#1140100], CVE-2019-13134 [bsc#1140102] (bmp.c,viff.c)
Patch52:        ImageMagick-CVE-2019-13133,13134.patch
# CVE-2019-13304 [bsc#1140547], CVE-2019-13305 [bsc#1140545], CVE-2019-13306 [bsc#1140543] (pnm.c)
Patch53:        ImageMagick-CVE-2019-13304,13305,13306.patch
# CVE-2019-12974 [bsc#1140111] (pango.c)
Patch54:        ImageMagick-CVE-2019-12974.patch
# CVE-2019-12978 [bsc#1139885] (pango.c)
Patch55:        ImageMagick-CVE-2019-12978.patch
# CVE-2019-13135 [bsc#1140103] (cut.c)
Patch56:        ImageMagick-CVE-2019-13135.patch
# CVE-2019-12975 [bsc#1140106] (dpx.c)
Patch57:        ImageMagick-CVE-2019-12975.patch
# CVE-2019-12977 [bsc#1139884] (jp2.c)
Patch58:        ImageMagick-CVE-2019-12977.patch
# CVE-2019-13300 [bsc#1140669] (core)
Patch59:        ImageMagick-CVE-2019-13300.patch
# CVE-2019-13307 [bsc#1140538] (core)
Patch60:        ImageMagick-CVE-2019-13307.patch
# CVE-2019-13298 [bsc#1140667] (core)
Patch61:        ImageMagick-CVE-2019-13298.patch
# CVE-2019-13391 [bsc#1140673], CVE-2019-13308 [bsc#1140534], CVE-2019-13302 [bsc#1140552] (core, gif.c)
Patch62:        ImageMagick-CVE-2019-13391,13308,13302.patch
# CVE-2019-12979 [bsc#1139886] (core)
Patch63:        ImageMagick-CVE-2019-12979.patch
# CVE-2019-13295 [bsc#1140664], CVE-2019-13297 [bsc#1140666] (core)
Patch64:        ImageMagick-CVE-2019-13295,13297.patch
# CVE-2019-13299 [bsc#1140668] (core)
Patch65:        ImageMagick-CVE-2019-13299.patch
# CVE-2019-13454 [bsc#1141171] (core)
Patch66:        ImageMagick-CVE-2019-13454.patch
# CVE-2019-13296 [bsc#1140665] (wand)
Patch67:        ImageMagick-CVE-2019-13296.patch
# CVE-2019-13303 [bsc#1140549] (core)
Patch68:        ImageMagick-CVE-2019-13303.patch
# CVE-2019-13310 [bsc#1140501] (wand)
Patch69:        ImageMagick-CVE-2019-13310.patch
# CVE-2019-13309 [bsc#1140520] (wand)
Patch70:        ImageMagick-CVE-2019-13309.patch
# CVE-2019-13311 [bsc#1140513] (wand)
Patch71:        ImageMagick-CVE-2019-13311.patch
# CVE-2019-13301 [bsc#1140554] (core)
Patch72:        ImageMagick-CVE-2019-13301.patch
# CVE-2019-14981 [bsc#1146065]
Patch73:        ImageMagick-CVE-2019-14981.patch
# CVE-2019-14980 [bsc#1146068]
Patch74:        ImageMagick-CVE-2019-14980.patch
# CVE-2019-15141 [bsc#1146211]
Patch75:        ImageMagick-CVE-2019-15141.patch
# CVE-2019-15140 [bsc#1146212]
Patch76:        ImageMagick-CVE-2019-15140.patch
# CVE-2019-15139 [bsc#1146213]
Patch77:        ImageMagick-CVE-2019-15139.patch
# CVE-2019-16708 [bsc#1151781], CVE-2019-16709 [bsc#1151782]
Patch78:        ImageMagick-CVE-2019-16708,16709.patch
# CVE-2019-16710 [bsc#1151783]
Patch79:        ImageMagick-CVE-2019-16710.patch
# CVE-2019-16711 [bsc#1151784]
Patch80:        ImageMagick-CVE-2019-16711.patch
# CVE-2019-16712 [bsc#1151785]
Patch81:        ImageMagick-CVE-2019-16712.patch
# CVE-2019-16713 [bsc#1151786]
Patch82:        ImageMagick-CVE-2019-16713.patch
# CVE-2019-19948 [bsc#1159861]
Patch83:        ImageMagick-CVE-2019-19948.patch
# CVE-2019-19949 [bsc#1160369]
Patch84:        ImageMagick-CVE-2019-19949.patch
# bsc#1161194, https://github.com/ImageMagick/ImageMagick/issues/1428
Patch85:        ImageMagick-convert-tiff-resize-png.patch
# https://github.com/ImageMagick/ImageMagick/commit/029fb3425ecf82e8b30c060e38a135d1d3e76bb3
Patch86:        ImageMagick-set-correct-colorspace.patch
# CVE-2020-27560 [bsc#1178067], division by zero in OptimizeLayerFrames function in MagickCore/layer.c
Patch87:        ImageMagick-CVE-2020-27560.patch
# CVE-2020-19667 [bsc#1179103], Stack buffer overflow in XPM coder could result in a crash
Patch88:        ImageMagick-CVE-2020-19667.patch
# CVE-2020-27750 [bsc#1179260], division by zero in MagickCore/colorspace-private.h
Patch89:        ImageMagick-CVE-2020-27750.patch
# CVE-2020-27760 [bsc#1179281], division by zero at MagickCore/enhance.c
Patch90:        ImageMagick-CVE-2020-27760.patch
# CVE-2020-25665 [bsc#1179208], heap-based buffer overflow in WritePALMImage
Patch91:        ImageMagick-CVE-2020-25665.patch
# CVE-2020-27766 [bsc#1179361], outside the range of representable values of type 'unsigned long' at MagickCore/statistic.c|CVE-2020-27776 [bsc#1179362], ImageMagick: outside the range of representable values of type 'unsigned long' at MagickCore/statistic.c|CVE-2020-27774 [bsc#1179333], integer overflow at MagickCore/statistic.c
Patch92:        ImageMagick-CVE-2020-27774,27766,27776.patch
# CVE-2020-25676 [bsc#1179244], outside the range of representable values of type 'long' and integer overflow at MagickCore/pixel.c
Patch93:        ImageMagick-CVE-2020-25676.patch
# CVE-2020-27761 [bsc#1179315], outside the range of representable values of type 'unsigned long' at coders/palm.c
Patch94:        ImageMagick-CVE-2020-27761.patch
# CVE-2020-27764 [bsc#1179317], outside the range of representable values of type 'unsigned long' at MagickCore/statistic.c
Patch95:        ImageMagick-CVE-2020-27764.patch
# CVE-2020-27771 [bsc#1179327], outside the range of representable values of type 'unsigned char' at coders/pdf.c
Patch96:        ImageMagick-CVE-2020-27771.patch
# CVE-2020-27759 [bsc#1179313], outside the range of representable values of type 'int' at MagickCore/quantize.c|CVE-2020-27769 [bsc#1179321], outside the range of representable values of type 'float' at MagickCore/quantize.c|CVE-2020-27754 [bsc#1179336], outside the range of representable values of type 'long' and signed integer overflow at MagickCore/quantize.c
Patch97:        ImageMagick-CVE-2020-27759,27769,27754.patch
# CVE-2020-27763 [bsc#1179312], division by zero at MagickCore/resize.c
Patch98:        ImageMagick-CVE-2020-27763.patch
# CVE-2020-27772 [bsc#1179347], outside the range of representable values of type 'unsigned int' at coders/bmp.c
Patch99:        ImageMagick-CVE-2020-27772.patch
# CVE-2020-25666 [bsc#1179212], outside the range of representable values of type 'int' and signed integer overflow
Patch100:       ImageMagick-CVE-2020-25666.patch
# CVE-2020-25674 [bsc#1179223], heap-based buffer overflow in WriteOnePNGImage
Patch101:       ImageMagick-CVE-2020-25674.patch
# CVE-2020-25664 [bsc#1179202], heap-based buffer overflow in PopShortPixel
Patch102:       ImageMagick-CVE-2020-25664.patch
# CVE-2020-27752 [bsc#1179346], heap-based buffer overflow in PopShortPixel in MagickCore/quantum-private.h
Patch103:       ImageMagick-CVE-2020-27752.patch
# CVE-2020-27775 [bsc#1179338], outside the range of representable values of type 'unsigned char' at MagickCore/quantum.h
Patch104:       ImageMagick-CVE-2020-27775.patch
# CVE-2020-27758 [bsc#1179276], outside the range of representable values of type 'unsigned long long'
Patch105:       ImageMagick-CVE-2020-27758.patch
# CVE-2020-27765 [bsc#1179311], division by zero at MagickCore/segment.c
Patch106:       ImageMagick-CVE-2020-27765.patch
# CVE-2020-27755 [bsc#1179345], memory leaks in ResizeMagickMemory function in ImageMagick/MagickCore/memory.c
Patch107:       ImageMagick-CVE-2020-27755.patch
# CVE-2020-27762 [bsc#1179278], outside the range of representable values of type 'unsigned char'
Patch108:       ImageMagick-CVE-2020-27762.patch
# CVE-2020-27773 [bsc#1179285], division by zero at MagickCore/gem-private.h
Patch109:       ImageMagick-CVE-2020-27773.patch
# CVE-2020-27756 [bsc#1179221], division by zero at MagickCore/geometry.c
Patch110:       ImageMagick-CVE-2020-27756.patch
# CVE-2020-25675 [bsc#1179240], outside the range of representable values of type 'long' and integer overflow
Patch111:       ImageMagick-CVE-2020-25675.patch
# CVE-2020-27770 [bsc#1179343], unsigned offset overflowed at MagickCore/string.c
Patch112:       ImageMagick-CVE-2020-27770.patch
# CVE-2020-27753 [bsc#1179397], memory leaks in AcquireMagickMemory function
Patch113:       ImageMagick-CVE-2020-27753.patch
# CVE-2020-29599 [bsc#1179753], shell command injection in -authenticate
Patch114:       ImageMagick-CVE-2020-29599.patch
# CVE-2020-27767 [bsc#1179322], outside the range of representable values of type 'float' at MagickCore/quantum.h|CVE-2020-27768 [bsc#1179339], outside the range of representable values of type 'unsigned int' at MagickCore/quantum-private.h|CVE-2020-27751 [bsc#1179269], integer overflow in MagickCore/quantum-export.c|CVE-2020-27752 [bsc#1179346], heap-based buffer overflow in PopShortPixel in MagickCore/quantum-private.h|CVE-2020-27757 [bsc#1179268], outside the range of representable values of type 'unsigned long long' at 
Patch115:       ImageMagick-CVE-2020-27767,27768,27751,27752,27757.patch
# IM upstream issue #1184
Patch116:       ImageMagick-silent-disturbing-warnings.patch
# CVE-2021-20241 [bsc#1182335], Division by zero in WriteJP2Image() in coders/jp2.c
Patch117:       ImageMagick-CVE-2021-20241.patch
# CVE-2021-20243 [bsc#1182336], Division by zero in GetResizeFilterWeight in MagickCore/resize.c
Patch118:       ImageMagick-CVE-2021-20243.patch
# CVE-2021-20244 [bsc#1182325], Division by zero in ImplodeImage in MagickCore/visual-effects.c
Patch119:       ImageMagick-CVE-2021-20244.patch
# CVE-2021-20246 [bsc#1182337], Division by zero in ScaleResampleFilter in MagickCore/resample.c
Patch120:       ImageMagick-CVE-2021-20246.patch
# CVE-2021-20309 [bsc#1184624], Division by zero in WaveImage() of MagickCore/visual-effects.c
Patch121:       ImageMagick-CVE-2021-20309.patch
# CVE-2021-20311 [bsc#1184626], Division by zero in sRGBTransformImage() in MagickCore/colorspace.c
Patch122:       ImageMagick-CVE-2021-20311.patch
# CVE-2021-20312 [bsc#1184627], Integer overflow in WriteTHUMBNAILImage of coders/thumbnail.c
Patch123:       ImageMagick-CVE-2021-20312.patch
# CVE-2021-20313 [bsc#1184628], Cipher leak when the calculating signatures in TransformSignatureof MagickCore/signature.c
Patch124:       ImageMagick-CVE-2021-20313.patch
BuildRequires:  chrpath
BuildRequires:  dos2unix
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  libjasper-devel
BuildRequires:  libjpeg-devel
BuildRequires:  libtool
BuildRequires:  libwmf-devel
BuildRequires:  lzma-devel
BuildRequires:  xdg-utils
BuildRequires:  zip
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} >= 1315
BuildRequires:  dejavu-fonts
%endif
%if 0%{?suse_version} >= 1315
BuildRequires:  libjbig-devel
%endif
%if 0%{?suse_version} >= 1315
BuildRequires:  p7zip
BuildRequires:  pkgconfig
%endif
%if 0%{?suse_version} >= 1315
BuildRequires:  pkgconfig(OpenEXR)
BuildRequires:  pkgconfig(bzip2)
BuildRequires:  pkgconfig(ddjvuapi)
BuildRequires:  pkgconfig(fftw3)
BuildRequires:  pkgconfig(freetype2)
BuildRequires:  pkgconfig(lcms2)
BuildRequires:  pkgconfig(libexif)
BuildRequires:  pkgconfig(librsvg-2.0)
BuildRequires:  pkgconfig(libtiff-4) >= 4.0.3
BuildRequires:  pkgconfig(libwebp)
BuildRequires:  pkgconfig(libwebpmux)
BuildRequires:  pkgconfig(libxml-2.0)
BuildRequires:  pkgconfig(pango)
%if 0%{?suse_version} > 1315
BuildRequires:  pkgconfig(ijs)
# bsc#1088463
%if %{urw_base35_fonts}
BuildRequires:  urw-base35-fonts
%else
BuildRequires:  ghostscript-fonts-other
BuildRequires:  ghostscript-fonts-std
%endif
%else
BuildRequires:  ghostscript-fonts-other
BuildRequires:  ghostscript-fonts-std
BuildRequires:  ghostscript-library
%endif
%if 0%{?suse_version} > 1315
BuildRequires:  pkgconfig(libopenjp2) >= 2.1.0
%endif
%if 0%{?suse_version} > 1315
BuildRequires:  pkgconfig(lqr-1)
%endif
%else
BuildRequires:  OpenEXR-devel
BuildRequires:  fftw3-devel
BuildRequires:  freetype2-devel
BuildRequires:  ghostscript-fonts-other
BuildRequires:  ghostscript-fonts-std
BuildRequires:  ghostscript-library
BuildRequires:  libbz2-devel
BuildRequires:  libdjvulibre-devel
BuildRequires:  libexif-devel
BuildRequires:  librsvg-devel
BuildRequires:  libtiff-devel
BuildRequires:  libxml-devel
BuildRequires:  perl-parent
BuildRequires:  pkgconfig(cairo)
BuildRequires:  pkgconfig(fontconfig)
BuildRequires:  pkgconfig(libpng)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xext)
BuildRequires:  pkgconfig(zlib)
%endif

%package -n perl-PerlMagick
Summary:        Perl interface for ImageMagick
Group:          Development/Libraries/Perl
Requires:       ImageMagick = %{version}
Requires:       libMagickCore%{libspec}%{clibver} = %{version}
Requires:       perl = %{perl_version}

%package devel
Summary:        Development files for ImageMagick's C interface
Group:          Development/Libraries/C and C++
Requires:       ImageMagick = %{version}
Requires:       glibc-devel
Requires:       libMagickCore%{libspec}%{clibver} = %{version}
Requires:       libMagickWand%{libspec}%{cwandver} = %{version}
# bnc#741947:
%if 0%{?suse_version} >= 1315
Requires:       pkgconfig(bzip2)
%else
Requires:       libbz2-devel
%endif

%if !%{debug_build}
%package extra
Summary:        Extra codecs for the ImageMagick image viewer/converter
Group:          Productivity/Graphics/Other
Requires:       ImageMagick = %{version}
Requires:       libMagickCore%{libspec}%{clibver} = %{version}
Recommends:     autotrace
Recommends:     dcraw
Recommends:     hp2xx
Recommends:     libwmf
Recommends:     netpbm
Recommends:     transfig
%endif

%package -n libMagickCore%{libspec}%{clibver}
Summary:        C runtime library for ImageMagick
Group:          Productivity/Graphics/Other
Recommends:     ghostscript
Suggests:       ImageMagick-extra = %{version}
Requires:       imagick-%{config_spec} = %{version}
Recommends:     %{name}-config-SUSE = %{version}

%package -n libMagickWand%{libspec}%{cwandver}
Summary:        C runtime library for ImageMagick
Group:          Productivity/Graphics/Other

%package -n libMagick++%{libspec}%{cxxlibver}
Summary:        C++ interface runtime library for ImageMagick
Group:          Development/Libraries/C and C++
Requires:       ImageMagick

%package -n libMagick++-devel
Summary:        Development files for ImageMagick's C++ interface
Group:          Development/Libraries/C and C++
Requires:       libMagick++%{libspec}%{cxxlibver} = %{version}
Requires:       libstdc++-devel
%if 0%{?suse_version} >= 1315
Requires:       pkgconfig(ImageMagick) = %{mfr_version}
%else
Requires:       ImageMagick-devel = %{version}
%endif

%package doc
Summary:        Document Files for ImageMagick Library
Group:          Documentation/HTML
%if 0%{?suse_version} >= 1315
BuildArch:      noarch
%endif

%package %{config_spec}-upstream
Summary:        Upstream Configuration Files
Group:          Development/Libraries/C and C++
Provides:       imagick-%{config_spec}
Requires(post): update-alternatives
Requires(postun): update-alternatives

%package %{config_spec}-SUSE
Summary:        Upstream Configuration Files
Group:          Development/Libraries/C and C++
Provides:       imagick-%{config_spec}
Requires(post): update-alternatives
Requires(postun): update-alternatives

%description
ImageMagick is a robust collection of tools and libraries to read,
write, and manipulate an image in many image formats, including popular
formats like TIFF, JPEG, PNG, PDF, PhotoCD, and GIF. With ImageMagick,
you can create images dynamically, making it suitable for Web
applications. You can also resize, rotate, sharpen, color-reduce, or
add special effects to an image and save your completed work in many
different image formats. Image processing operations are available from
the command line as well as through C, C++, and Perl-based programming
interfaces.

%description devel
ImageMagick is a robust collection of tools and libraries to read,
write, and manipulate an image in many image formats, including popular
formats like TIFF, JPEG, PNG, PDF, PhotoCD, and GIF. With ImageMagick,
you can create images dynamically, making it suitable for Web
applications. You can also resize, rotate, sharpen, color-reduce, or
add special effects to an image and save your completed work in many
different image formats. Image processing operations are available from
the command line as well as through C, C++, and Perl-based programming
interfaces.

%if !%{debug_build}
%description extra
This package adds support for djvu, wmf and jpeg2000 formats and
installs optional helper applications.

ImageMagick is a robust collection of tools and libraries to read,
write, and manipulate an image in many image formats, including popular
formats like TIFF, JPEG, PNG, PDF, PhotoCD, and GIF. With ImageMagick,
you can create images dynamically, making it suitable for Web
applications. You can also resize, rotate, sharpen, color-reduce, or
add special effects to an image and save your completed work in many
different image formats. Image processing operations are available from
the command line as well as through C, C++, and Perl-based programming
interfaces.
%endif

%description -n libMagickCore%{libspec}%{clibver}
ImageMagick is a robust collection of tools and libraries to read,
write, and manipulate an image in many image formats, including popular
formats like TIFF, JPEG, PNG, PDF, PhotoCD, and GIF. With ImageMagick,
you can create images dynamically, making it suitable for Web
applications. You can also resize, rotate, sharpen, color-reduce, or
add special effects to an image and save your completed work in many
different image formats. Image processing operations are available from
the command line as well as through C, C++, and Perl-based programming
interfaces.

%description -n libMagickWand%{libspec}%{cwandver}
ImageMagick is a robust collection of tools and libraries to read,
write, and manipulate an image in many image formats, including popular
formats like TIFF, JPEG, PNG, PDF, PhotoCD, and GIF. With ImageMagick,
you can create images dynamically, making it suitable for Web
applications. You can also resize, rotate, sharpen, color-reduce, or
add special effects to an image and save your completed work in many
different image formats. Image processing operations are available from
the command line as well as through C, C++, and Perl-based programming
interfaces.

%description -n perl-PerlMagick
PerlMagick is an objected-oriented Perl interface to ImageMagick. Use
the module to read, manipulate, or write an image or image sequence
from within a Perl script. This makes it suitable for Web CGI scripts.

%description -n libMagick++%{libspec}%{cxxlibver}
This is Magick++, the object-oriented C++ API for the ImageMagick
image-processing library.

Magick++ supports an object model inspired by PerlMagick. Magick++
should be faster than PerlMagick since it is written in a compiled
language which is not parsed at run-time. This makes it suitable for
Web CGI programs. Images support implicit reference counting so that
copy constructors and assignment incur almost no cost. The cost of
actually copying an image (if necessary) is done just before
modification and this copy is managed automatically by Magick++.
De-referenced copies are automatically deleted. The image objects
support value (rather than pointer) semantics so it is trivial to
support multiple generations of an image in memory at one time.

%description -n libMagick++-devel
This is Magick++, the object-oriented C++ API for the ImageMagick
image-processing library.

Magick++ supports an object model inspired by PerlMagick. Magick++
should be faster than PerlMagick since it is written in a compiled
language which is not parsed at run-time. This makes it suitable for
Web CGI programs. Images support implicit reference counting so that
copy constructors and assignment incur almost no cost. The cost of
actually copying an image (if necessary) is done just before
modification and this copy is managed automatically by Magick++.
De-referenced copies are automatically deleted. The image objects
support value (rather than pointer) semantics so it is trivial to
support multiple generations of an image in memory at one time.

%description doc
HTML documentation for ImageMagick library and scene examples.

%description %{config_spec}-upstream
ImageMagick configuration as supplied by upstream. It does not
provide any security restrictions. ImageMagick will be vulnerable
for example by ImageTragick or PS/PDF coder issues. It should
be used in trusted environment. Version or maintenance updates
will not overwrite user changes in system configuration.

%description %{config_spec}-SUSE
ImageMagick configuration as provide by SUSE. It is more security
aware than config-upstream variant. It does disable some coders, 
that are insecure by design to prevent user to use them
inadvertently. Configuration can be subject of change by future
version and maintenance updates and system changes will not be
preserved.

%prep
%setup -q -n ImageMagick-%{source_version}
%ifarch i586
%if %{?suse_version} == 1500
%patch1 -p1
%endif
%endif
%patch2 -p1
%ifarch s390x s390 ppc ppc64
%patch3 -p1
%endif
%ifarch i586
%patch5 -p1
%endif
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch35 -p1
%patch36 -p1
%patch37 -p1
%patch38 -p1
%patch39 -p1
%patch40 -p1
%patch41 -p1
%patch42 -p1
%patch43 -p1
%patch44 -p1
%patch45 -p1
%patch46 -p1
%patch47 -p1
%patch48 -p1
%patch49 -p1
%patch50 -p1
%patch51 -p1
%patch52 -p1
%patch53 -p1
%patch54 -p1
%patch55 -p1
%patch56 -p1
%patch57 -p1
%patch58 -p1
%patch59 -p1
%patch60 -p1
%patch61 -p1
%patch62 -p1
%patch63 -p1
%patch64 -p1
%patch65 -p1
%patch66 -p1
%patch67 -p1
%patch68 -p1
%patch69 -p1
%patch70 -p1
%patch71 -p1
%patch72 -p1
%patch73 -p1
%patch74 -p1
%patch75 -p1
%patch76 -p1
%patch77 -p1
%patch78 -p1
%patch79 -p1
%patch80 -p1
%patch81 -p1
%patch82 -p1
%patch83 -p1
%patch84 -p1
%patch85 -p1
%patch86 -p1
%patch87 -p1
%patch88 -p1
%patch89 -p1
%patch90 -p1
%patch91 -p1
%patch92 -p1
%patch93 -p1
%patch94 -p1
%patch95 -p1
%patch96 -p1
%patch97 -p1
%patch98 -p1
%patch99 -p1
%patch100 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1
%patch104 -p1
%patch105 -p1
%patch106 -p1
%patch107 -p1
%patch108 -p1
%patch109 -p1
%patch110 -p1
%patch111 -p1
%patch112 -p1
%patch113 -p1
%patch114 -p1
%patch115 -p1
%patch116 -p1
%patch117 -p1
%patch118 -p1
%patch119 -p1
%patch120 -p1
%patch121 -p1
%patch122 -p1
%patch123 -p1
%patch124 -p1

%build
# bsc#1088463
%if %{urw_base35_fonts}
sed -i 's:type1:otf:'      config/type-urw-base35.xml.in
sed -i 's:metrics=[^ ]*::' config/type-urw-base35.xml.in
sed -i 's:\.t1:.otf:'      config/type-urw-base35.xml.in
%endif
# make library binary package parallel installable
export MODULES_DIRNAME="modules%{libspec}%{clibver}"
export SHAREARCH_DIRNAME="config%{libspec}%{clibver}"
%if %{debug_build}
export CFLAGS="%{optflags} -O0"
export CXXFLAGS="%{optflags} -O0"
%endif
%configure \
  --disable-silent-rules \
  --enable-shared \
  --without-frozenpaths \
  --with-magick_plus_plus \
%if !%{debug_build}
  --with-modules \
%else
  --without-modules \
%endif
  --with-threads \
%if %{urw_base35_fonts}
  --with-urw-base35-font-dir=/usr/share/fonts/truetype \
%else
  --with-gs-font-dir=/usr/share/fonts/ghostscript \
%endif
  --with-perl \
  --with-perl-options="INSTALLDIRS=vendor %{?perl_prefix} CC='gcc -L$PWD/magick/.libs' LDDLFLAGS='-shared -L$PWD/magick/.libs'" \
  --disable-static \
  --with-gvc \
  --with-djvu \
  --with-lcms \
  --with-jbig \
%if 0%{?suse_version} > 1315
  --with-openjp2 \
%endif
  --with-openexr \
  --with-rsvg \
  --with-webp \
  --with-wmf \
  --with-quantum-depth=%{quantum_depth} \
  --without-gcc-arch \
  --enable-pipes=no \
  --enable-reproducible-build=yes \
  --disable-openmp
%if %{asan_build}
sed -i -e 's/\(^CFLAGS.*\)/\1 -fsanitize=address/' \
       -e 's/\(^LIBS =.*\)/\1 -lasan/' \
       Makefile
%endif
# don't build together, PerlMagick could be miscompiled when using parallel build[1]
# [1] http://pkgs.fedoraproject.org/cgit/ImageMagick.git/tree/ImageMagick.spec
make %{?_smp_mflags} all
make -j1 perl-build
# mostly because */demo is used later with %check
# polutting dir with .libs etc.
cp -r Magick++/demo Magick++/examples
%if 0%{?suse_version} < 1315
rm -r Magick++/examples/.deps
%endif
cp -r PerlMagick/demo PerlMagick/examples
# other improvements
dos2unix www/api/*.php
chmod -x PerlMagick/demo/*.pl

%check
%if %{debug_build}
# testsuite does not succeed with -O0 for some reason,
# research TODO
exit 0
%endif
%if %{asan_build}
# ASAN needs /proc to be mounted
exit 0
%endif
%ifarch i586
# do not run tests on i586 at all
# https://github.com/ImageMagick/ImageMagick/issues/1019
# https://github.com/ImageMagick/ImageMagick/issues/1058
# https://github.com/ImageMagick/ImageMagick/issues/1059
# (but keep patches for a while before giving up completely)
exit 0
# https://github.com/ImageMagick/ImageMagick/issues/1059
rm PerlMagick/t/montage.t
%endif
make %{?_smp_mflags} check
export MAGICK_CODER_MODULE_PATH=$PWD/coders/.libs
export MAGICK_CODER_FILTER_PATH=$PWD/filters/.libs
export MAGICK_CONFIGURE_PATH=$PWD/config
cd PerlMagick
%if 0%{?suse_version} >= 1315
sed -i 's:\(TEST_VERBOSE=\)0:\11:' Makefile
make %{?_smp_mflags} test
%else
make test_dynamic
%endif
cd ..

%install
%if 0%{?suse_version} >= 1315
%make_install pkgdocdir=%{_defaultdocdir}/%{name}-%{maj}/
%else
make install \
     DESTDIR=%{buildroot} \
     pkgdocdir=%{_defaultdocdir}/%{name}-%{maj}/
%endif

# configuration magic
mv -t %{buildroot}%{_sysconfdir}/%{name}* %{buildroot}%{_datadir}/%{name}*/*.xml
mv %{buildroot}%{_sysconfdir}/%{config_dir}{,-upstream}
cp -r %{buildroot}%{_sysconfdir}/%{config_dir}{-upstream,-SUSE}
patch --dir %{buildroot}%{_sysconfdir}/%{config_dir}-SUSE < %{PATCH0}
mkdir -p  %{buildroot}%{_sysconfdir}/alternatives/
ln -sf %{_sysconfdir}/alternatives/%{config_dir} %{buildroot}%{_sysconfdir}/%{config_dir}
# symlink header file relative to /usr/include/ImageMagick-7/
# so that inclusions like wand/*.h and magick/*.h work
ln -s ./MagickCore %{buildroot}%{_includedir}/%{name}-%{maj}/magick
ln -s ./MagickWand %{buildroot}%{_includedir}/%{name}-%{maj}/wand
# these will be included via %doc
rm -r %{buildroot}%{_datadir}/doc/%{name}-%{maj}/
rm %{buildroot}%{_libdir}/*.la
# remove RPATH from perl module
perl_module=$(find %{buildroot}%{_prefix}/lib/perl5 -name '*.so')
chmod 755 $perl_module
chrpath -d $perl_module
chmod 555 $perl_module
# remove %%{buildroot} from distributed file
sed -i 's:%{buildroot}::' %{buildroot}/%{_libdir}/ImageMagick-%{mfr_version}/config%{libspec}%{clibver}/configure.xml
#remove duplicates
%fdupes -s %{buildroot}%{_defaultdocdir}/%{name}-%{maj}
%fdupes -s %{buildroot}%{_includedir}/%{name}-%{maj}
%fdupes -s %{buildroot}%{_libdir}/pkgconfig
%perl_process_packlist

%post -n libMagickCore%{libspec}%{clibver} -p /sbin/ldconfig
%postun -n libMagickCore%{libspec}%{clibver} -p /sbin/ldconfig
%post -n libMagickWand%{libspec}%{cwandver} -p /sbin/ldconfig
%postun -n libMagickWand%{libspec}%{cwandver} -p /sbin/ldconfig
%post -n libMagick++%{libspec}%{cxxlibver} -p /sbin/ldconfig
%postun -n libMagick++%{libspec}%{cxxlibver} -p /sbin/ldconfig

%post %{config_spec}-upstream
%{_sbindir}/update-alternatives --install %{_sysconfdir}/%{config_dir}  %{config_dir}   %{_sysconfdir}/%{config_dir}-upstream  1

%postun %{config_spec}-upstream
if [ ! -d %{_sysconfdir}/%{config_dir}-upstream ] ; then
    %{_sbindir}/update-alternatives --remove %{config_dir}  %{_sysconfdir}/%{config_dir}-upstream
fi

%post %{config_spec}-SUSE
%{_sbindir}/update-alternatives --install %{_sysconfdir}/%{config_dir}  %{config_dir}   %{_sysconfdir}/%{config_dir}-SUSE      10

%postun %{config_spec}-SUSE
if [ ! -d %{_sysconfdir}/%{config_dir}-SUSE ] ; then
    %{_sbindir}/update-alternatives --remove %{config_dir}  %{_sysconfdir}/%{config_dir}-SUSE
fi

%files
%if 0%{?suse_version} < 1315
%defattr(-,root,root)
%endif
%license LICENSE
%doc ChangeLog NEWS.txt
%{_bindir}/[^MW]*
%{_mandir}/man1/*
%exclude %{_mandir}/man1/*-config.1%{ext_man}

%files -n libMagickCore%{libspec}%{clibver}
%if 0%{?suse_version} < 1315
%defattr(-,root,root)
%endif
%license LICENSE
%doc ChangeLog NEWS.txt
%{_libdir}/libMagickCore*.so.%{clibver}*
%dir %{_libdir}/ImageMagick*
%if !%{debug_build}
%dir %{_libdir}/ImageMagick*/modules*
%dir %{_libdir}/ImageMagick*/modules*/*
%exclude %{_libdir}/ImageMagick*/modules*/*/wmf.*
%if 0%{?suse_version} > 1315
%exclude %{_libdir}/ImageMagick*/modules*/*/jp2.*
%endif
%exclude %{_libdir}/ImageMagick*/modules*/*/djvu.*
%{_libdir}/ImageMagick*/modules*/*/*.so
# don't remove la files, see bnc#579798
%{_libdir}/ImageMagick*/modules*/*/*.la
%endif
%{_libdir}/ImageMagick*/config*

%files -n libMagickWand%{libspec}%{cwandver}
%if 0%{?suse_version} < 1315
%defattr(-,root,root)
%endif
%{_libdir}/libMagickWand*.so.%{cwandver}*

%if !%{debug_build}
%files extra
%if 0%{?suse_version} < 1315
%defattr(-,root,root)
%endif
%{_libdir}/ImageMagick*/modules*/*/wmf.so
# don't remove la files, see bnc#579798
%if 0%{?suse_version} > 1315
%{_libdir}/ImageMagick*/modules*/*/jp2.so
%{_libdir}/ImageMagick*/modules*/*/jp2.la
%endif
%{_libdir}/ImageMagick*/modules*/*/djvu.so
%{_libdir}/ImageMagick*/modules*/*/djvu.la
%endif

%files devel
%if 0%{?suse_version} < 1315
%defattr(-,root,root)
%endif
%{_libdir}/libMagickCore*.so
%{_libdir}/libMagickWand*.so
%dir %{_includedir}/ImageMagick*
%{_includedir}/ImageMagick*/MagickCore
%{_includedir}/ImageMagick*/MagickWand
%{_includedir}/ImageMagick*/magick
%{_includedir}/ImageMagick*/wand
%{_bindir}/MagickCore-config
%{_bindir}/MagickWand-config
%{_libdir}/pkgconfig/MagickCore*.pc
%{_libdir}/pkgconfig/ImageMagick*.pc
%{_libdir}/pkgconfig/MagickWand*.pc
%{_mandir}/man1/*-config.1%{ext_man}
%exclude %{_mandir}/man1/Magick++-config.1%{ext_man}

%files -n perl-PerlMagick
%if 0%{?suse_version} < 1315
%defattr(-,root,root)
%endif
%doc PerlMagick/README.txt
%doc PerlMagick/examples
%{_mandir}/man3/*
%{perl_vendorarch}/auto/Image
%{perl_vendorarch}/Image
%if 0%{?suse_version} < 1315
%{_localstatedir}/adm/perl-modules/ImageMagick
%endif

%files -n libMagick++%{libspec}%{cxxlibver}
%if 0%{?suse_version} < 1315
%defattr(-,root,root)
%endif
%{_libdir}/libMagick++*.so.%{cxxlibver}*

%files -n libMagick++-devel
%if 0%{?suse_version} < 1315
%defattr(-,root,root)
%endif
%doc Magick++/examples
%doc Magick++/NEWS Magick++/README Magick++/AUTHORS
%{_libdir}/libMagick++*.so
%{_includedir}/ImageMagick*/Magick++.h
%{_includedir}/ImageMagick*/Magick++
%{_bindir}/Magick++-config
%{_libdir}/pkgconfig/Magick++*.pc
%{_mandir}/man1/Magick++-config.1%{ext_man}

%files doc
%if 0%{?suse_version} < 1315
%defattr(-,root,root)
%endif
%{_defaultdocdir}/%{name}-%{maj}

%files %{config_spec}-upstream
%dir %{_sysconfdir}/ImageMagick*-upstream/
%config(noreplace) %{_sysconfdir}/ImageMagick*-upstream/*
%{_sysconfdir}/%{config_dir}
%ghost %{_sysconfdir}/alternatives/%{config_dir}

%files %{config_spec}-SUSE
%dir %{_sysconfdir}/ImageMagick*-SUSE/
%config %{_sysconfdir}/ImageMagick*-SUSE/*
%{_sysconfdir}/%{config_dir}
%ghost %{_sysconfdir}/alternatives/%{config_dir}

%changelog
openSUSE Build Service is sponsored by