1%global VERSION  @PACKAGE_VERSION@
2%global Patchlevel  @PACKAGE_RELEASE@
3
4
5Name:           @PACKAGE_NAME@
6Version:        %{VERSION}
7Release:        %{Patchlevel}
8Summary:        Use ImageMagick to convert, edit, or compose bitmap images in a variety of formats.  In addition resize, rotate, shear, distort and transform images.
9Group:          Applications/Multimedia
10License:        http://www.imagemagick.org/script/license.php
11Url:            http://www.imagemagick.org/
12Source0:        http://www.imagemagick.org/download/%{name}/%{name}-%{VERSION}-%{Patchlevel}.tar.bz2
13
14Requires:       %{name}-libs = %{version}-%{release}
15
16BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
17BuildRequires:  bzip2-devel, freetype-devel, libjpeg-devel, libpng-devel
18BuildRequires:  libtiff-devel, giflib-devel, zlib-devel, perl-devel >= 5.8.1
19BuildRequires:  ghostscript-devel, djvulibre-devel
20BuildRequires:  libwmf-devel, jasper-devel, libtool-ltdl-devel
21BuildRequires:  libX11-devel, libXext-devel, libXt-devel
22BuildRequires:  lcms2-devel, libxml2-devel, librsvg2-devel, OpenEXR-devel
23BuildRequires:  fftw-devel, OpenEXR-devel, libwebp-devel
24BuildRequires:  jbigkit-devel
25BuildRequires:  openjpeg2-devel >= 2.1.0
26
27%description
28ImageMagick® is a software suite to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 200) including PNG, JPEG, JPEG-2000, GIF, TIFF, DPX, EXR, WebP, Postscript, PDF, and SVG. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.
29
30The functionality of ImageMagick is typically utilized from the command-line or you can use the features from programs written in your favorite language. Choose from these interfaces: G2F (Ada), MagickCore (C), MagickWand (C), ChMagick (Ch), ImageMagickObject (COM+), Magick++ (C++), JMagick (Java), L-Magick (Lisp), Lua (LuaJIT), NMagick (Neko/haXe), Magick.NET (.NET), PascalMagick (Pascal), PerlMagick (Perl), MagickWand for PHP (PHP), IMagick (PHP), PythonMagick (Python), RMagick (Ruby), or TclMagick (Tcl/TK). With a language interface, use ImageMagick to modify or create images dynamically and automagically.
31
32ImageMagick utilizes multiple computational threads to increase performance and can read, process, or write mega-, giga-, or tera-pixel image sizes.
33
34ImageMagick is free software delivered as a ready-to-run binary distribution or as source code that you may use, copy, modify, and distribute in both open and proprietary applications. It is distributed under the Apache 2.0 license.
35
36The ImageMagick development process ensures a stable API and ABI. Before each ImageMagick release, we perform a comprehensive security assessment that includes memory error and thread data race detection to prevent security vulnerabilities.
37
38The authoritative ImageMagick web site is http://www.imagemagick.org. The authoritative source code repository is http://git.imagemagick.org/repos/ImageMagick. We maintain a source code mirror at GitHub.
39
40%package devel
41Summary: Library links and header files for ImageMagick application development
42Group: Development/Libraries
43Requires: %{name} = %{version}-%{release}
44Requires: libX11-devel, libXext-devel, libXt-devel, ghostscript-devel
45Requires: bzip2-devel, freetype-devel, libtiff-devel, libjpeg-devel, lcms2-devel
46Requires: libwebp-devel, OpenEXR-devel, jasper-devel, pkgconfig
47Requires: %{name}-libs = %{version}-%{release}
48
49%description devel
50ImageMagick-devel contains the library links and header files you'll
51need to develop ImageMagick applications. ImageMagick is an image
52manipulation program.
53
54If you want to create applications that will use ImageMagick code or
55APIs, you need to install ImageMagick-devel as well as ImageMagick.
56You do not need to install it if you just want to use ImageMagick,
57however.
58
59%package libs
60Summary: ImageMagick libraries to link with
61Group: Applications/Multimedia
62
63%description libs
64This packages contains a shared libraries to use within other applications.
65
66%package djvu
67Summary: DjVu plugin for ImageMagick
68Group: Applications/Multimedia
69Requires: %{name} = %{version}-%{release}
70
71%description djvu
72This packages contains a plugin for ImageMagick which makes it possible to
73save and load DjvU files from ImageMagick and libMagickCore using applications.
74
75
76%package doc
77Summary: ImageMagick HTML documentation
78Group: Documentation
79
80%description doc
81ImageMagick documentation, this package contains usage (for the
82commandline tools) and API (for the libraries) documentation in HTML format.
83Note this documentation can also be found on the ImageMagick website:
84http://www.imagemagick.org/.
85
86
87%package perl
88Summary: ImageMagick perl bindings
89Group: System Environment/Libraries
90Requires: %{name} = %{version}-%{release}
91Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
92
93
94%description perl
95Perl bindings to ImageMagick.
96
97Install ImageMagick-perl if you want to use any perl scripts that use
98ImageMagick.
99
100
101%package c++
102Summary: ImageMagick Magick++ library (C++ bindings)
103Group: System Environment/Libraries
104Requires: %{name} = %{version}-%{release}
105
106%description c++
107This package contains the Magick++ library, a C++ binding to the ImageMagick
108graphics manipulation library.
109
110Install ImageMagick-c++ if you want to use any applications that use Magick++.
111
112
113%package c++-devel
114Summary: C++ bindings for the ImageMagick library
115Group: Development/Libraries
116Requires: %{name}-c++ = %{version}-%{release}
117Requires: %{name}-devel = %{version}-%{release}
118
119%description c++-devel
120ImageMagick-devel contains the static libraries and header files you'll
121need to develop ImageMagick applications using the Magick++ C++ bindings.
122ImageMagick is an image manipulation program.
123
124If you want to create applications that will use Magick++ code
125or APIs, you'll need to install ImageMagick-c++-devel, ImageMagick-devel and
126ImageMagick.
127
128You don't need to install it if you just want to use ImageMagick, or if you
129want to develop/compile applications using the ImageMagick C interface,
130however.
131
132
133%prep
134%setup -q -n %{name}-%{VERSION}-%{Patchlevel}
135
136# for %%doc
137mkdir Magick++/examples
138cp -p Magick++/demo/*.cpp Magick++/demo/*.miff Magick++/examples
139
140%build
141%configure --enable-shared \
142        --disable-static \
143        --with-modules \
144        --with-perl \
145        --with-x \
146        --with-threads \
147        --with-magick_plus_plus \
148        --with-gslib \
149        --with-wmf \
150        --with-webp \
151        --with-openexr \
152        --with-rsvg \
153        --with-xml \
154        --with-perl-options="INSTALLDIRS=vendor %{?perl_prefix} CC='%__cc -L$PWD/MagickCore/.libs' LDDLFLAGS='-shared -L$PWD/MagickCore/.libs'" \
155        --without-dps  \
156        --without-gcc-arch \
157        --with-jbig \
158        --with-openjp2
159
160# Do *NOT* use %%{?_smp_mflags}, this causes PerlMagick to be silently misbuild
161make
162
163
164%install
165make %{?_smp_mflags} install DESTDIR=%{buildroot} INSTALL="install -p"
166cp -a www/source %{buildroot}%{_datadir}/doc/%{name}-%{VERSION}
167rm %{buildroot}%{_libdir}/*.la
168
169# fix weird perl Magick.so permissions
170chmod 755 %{buildroot}%{perl_vendorarch}/auto/Image/Magick/*/*.so
171
172# perlmagick: fix perl path of demo files
173%{__perl} -MExtUtils::MakeMaker -e 'MY->fixin(@ARGV)' PerlMagick/demo/*.pl
174
175# perlmagick: cleanup various perl tempfiles from the build which get installed
176find %{buildroot} -name "*.bs" |xargs rm -f
177find %{buildroot} -name ".packlist" |xargs rm -f
178find %{buildroot} -name "perllocal.pod" |xargs rm -f
179
180# perlmagick: build files list
181echo "%defattr(-,root,root,-)" > perl-pkg-files
182find %{buildroot}/%{_libdir}/perl* -type f -print \
183        | sed "s@^%{buildroot}@@g" > perl-pkg-files
184find %{buildroot}%{perl_vendorarch} -type d -print \
185        | sed "s@^%{buildroot}@%dir @g" \
186        | grep -v '^%dir %{perl_vendorarch}$' \
187        | grep -v '/auto$' >> perl-pkg-files
188if [ -z perl-pkg-files ] ; then
189    echo "ERROR: EMPTY FILE LIST"
190    exit -1
191fi
192
193# fix multilib issues: Rename provided file with platform-bits in name.
194# Create platform independant file inplace of provided and conditionally include required.
195# $1 - filename.h to process.
196function multilibFileVersions(){
197mv $1 ${1%%.h}-%{__isa_bits}.h
198
199local basename=$(basename $1)
200
201cat >$1 <<EOF
202#include <bits/wordsize.h>
203
204#if __WORDSIZE == 32
205# include "${basename%%.h}-32.h"
206#elif __WORDSIZE == 64
207# include "${basename%%.h}-64.h"
208#else
209# error "unexpected value for __WORDSIZE macro"
210#endif
211EOF
212}
213
214multilibFileVersions %{buildroot}%{_includedir}/%{name}-7/MagickCore/magick-config.h
215multilibFileVersions %{buildroot}%{_includedir}/%{name}-7/MagickCore/magick-baseconfig.h
216multilibFileVersions %{buildroot}%{_includedir}/%{name}-7/MagickCore/version.h
217
218
219%check
220export LD_LIBRARY_PATH=%{buildroot}/%{_libdir}
221make %{?_smp_mflags} check
222
223%post libs -p /sbin/ldconfig
224
225%post c++ -p /sbin/ldconfig
226
227%postun libs -p /sbin/ldconfig
228
229%postun c++ -p /sbin/ldconfig
230
231%files
232%doc README.txt LICENSE NOTICE AUTHORS.txt NEWS.txt ChangeLog Platforms.txt
233%{_bindir}/[a-z]*
234%{_mandir}/man[145]/[a-z]*
235%{_mandir}/man1/%{name}.*
236
237%files libs
238%doc LICENSE NOTICE AUTHORS.txt QuickStart.txt
239%{_libdir}/libMagickCore-7.Q16HDRI.so.*
240%{_libdir}/libMagickWand-7.Q16HDRI.so.*
241%{_libdir}/%{name}-%{VERSION}
242%{_datadir}/%{name}-7
243%exclude %{_libdir}/%{name}-%{VERSION}/modules-Q16HDRI/coders/djvu.*
244%{_sysconfdir}/%{name}-7
245
246%files devel
247%{_bindir}/MagickCore-config
248%{_bindir}/MagickWand-config
249%{_libdir}/libMagickCore-7.Q16HDRI.so
250%{_libdir}/libMagickWand-7.Q16HDRI.so
251%{_libdir}/pkgconfig/MagickCore.pc
252%{_libdir}/pkgconfig/MagickCore-7.Q16HDRI.pc
253%{_libdir}/pkgconfig/ImageMagick.pc
254%{_libdir}/pkgconfig/ImageMagick-7.Q16HDRI.pc
255%{_libdir}/pkgconfig/MagickWand.pc
256%{_libdir}/pkgconfig/MagickWand-7.Q16HDRI.pc
257%dir %{_includedir}/%{name}-7
258%{_includedir}/%{name}-7/MagickCore
259%{_includedir}/%{name}-7/MagickWand
260%{_mandir}/man1/MagickCore-config.*
261%{_mandir}/man1/MagickWand-config.*
262
263%files djvu
264%{_libdir}/%{name}-%{VERSION}/modules-Q16HDRI/coders/djvu.*
265
266%files doc
267%doc %{_datadir}/doc/%{name}-7
268%doc %{_datadir}/doc/%{name}-%{VERSION}
269%doc LICENSE
270
271%files c++
272%doc Magick++/AUTHORS Magick++/ChangeLog Magick++/NEWS Magick++/README
273%doc www/Magick++/COPYING
274%{_libdir}/libMagick++-7.Q16HDRI.so.*
275
276%files c++-devel
277%doc Magick++/examples
278%{_bindir}/Magick++-config
279%{_includedir}/%{name}-7/Magick++
280%{_includedir}/%{name}-7/Magick++.h
281%{_libdir}/libMagick++-7.Q16HDRI.so
282%{_libdir}/pkgconfig/Magick++.pc
283%{_libdir}/pkgconfig/Magick++-7.Q16HDRI.pc
284%{_mandir}/man1/Magick++-config.*
285
286%files perl -f perl-pkg-files
287%{_mandir}/man3/*
288%doc PerlMagick/demo/ PerlMagick/Changelog PerlMagick/README.txt
289
290%changelog
291* Sun May 01 2005 Cristy <cristy@mystic.es.dupont.com> 1.0-0
292-  Port of Redhat's RPM script to support ImageMagick.
293