1 =for stopwords freetype MinGW dfont Redhat SDK IFD GDI TTF preprocessor Redhat-like
5 Imager::Install - installation notes for Imager
16 Assuming you have all of your required libraries in the places Imager
17 looks, you should be able to use the standard mantra:
26 If you've installed libraries in places Imager doesn't look, you can
27 supply extra locations either with command-line options:
29 perl Makefile.PL --libpath=/home/tony/local/lib --incpath=/home/tony/local/include
31 or with environment variables:
33 export IM_LIBPATH=/home/tony/local/lib IM_INCPATH=/home/tony/local/include
36 Imager's F<Makefile.PL> produces an epilogue indicating which
37 libraries have and haven't been found, for example:
46 Libraries *not* found:
49 If a library you expect to be found isn't on this list, use the
50 C<--verbose> or C<-v> option to produce way too much information from
51 Imager's search for the libraries:
55 If you can't resolve this, then run
59 and include the (large) generated F<report.txt> in your email to:
61 bug-Imager@rt.cpan.org
63 There are other options used to configure how Imager is built:
69 build Imager without logging support. This will speed up Imager a
70 little. You can also remove logging by setting the C<IMAGER_NOLOG>
71 environment variable to a true value.
75 used to build Imager for C<gcov> coverage testing. This is intended
76 for development and also requires options supplied to C<make>.
80 build Imager with assertions enabled.
82 =item C<--tracecontext>
84 build Imager to trace context object management to C<stderr> for
89 =head2 Build time environment variables
90 X<build time environment variables>
96 X<< C<IMAGER_NOLOG> >>C<IMAGER_NOLOG> - build Imager with logging disabled.
100 X<< C<IMAGER_DEBUG_MALLOC> >>C<IMAGER_DEBUG_MALLOC> - build Imager with it's
101 debug malloc wrappers. This is I<not> compatible with threaded code.
105 X<< C<IM_INCPATH> >>C<IM_INCPATH> - equivalent to C<--incpath>.
109 X<< C<IM_LIBPATH> >>C<IM_LIBPATH> - equivalent to C<--libpath>.
113 X<< C<IM_VERBOSE> >>C<IM_VERBOSE> - equivalent to C<--verbose>
117 X<< C<IM_CFLAGS> >>C<IM_CFLAGS> - extra C compiler flags.
121 X<< C<IM_LFLAGS> >>C<IM_LFLAGS> - extra linker flags.
125 X<< C<IM_DFLAGS> >>C<IM_DFLAGS> - extra preprocessor flags.
129 =head1 EXTERNAL LIBRARIES
131 Some of the file format and font modules included with Imager use
132 external libraries, which should be installed before you try to
133 install Imager itself.
135 If you don't have the libraries installed then Imager itself will
136 install successfully, but the file format or font support module won't
139 Preferably the latest version of each library should be used, simple
140 because it has the latest security fixes.
142 =head2 PNG - C<libpng>
144 X<< C<libpng> >>L<Imager::File::PNG> uses L<< C<libpng>
145 |http://www.libpng.org/pub/png/libpng.html >> for PNG image file
148 Debian package: C<libpng-dev>
150 Redhat package: C<libpng-devel>
152 Cygwin: C<libpng-devel>
154 =head2 TIFF - C<libtiff>
156 X<< C<libtiff> >>L<Imager::File::TIFF> uses
157 L<< C<libtiff> |http://www.remotesensing.org/libtiff/ >> for GIF image file
160 Version 3.6.0 or later is required to avoid an exploit with infinite
161 IFD loops, though it's possible some distributions have applied the
162 fix to older versions as a security fix.
164 Version 3.9.0 is rejected during the probe process due to a serious
167 Debian package: C<libtiff4-dev>
169 Redhat package: C<libtiff-devel>
171 Cygwin: C<libtiff-devel>
173 =head2 GIF - C<libgif>
175 X<< C<libgif> >>L<Imager::File::GIF> uses
176 L<< C<libgif> |http://sourceforge.net/projects/giflib/ >> for GIF image file
179 C<libgif> releases 4.2.0 and 5.0.0 are specifically not supported, due
180 to bugs in those versions.
182 Release 4.1.4 or later should be used.
184 C<giflib> 3 is no longer supported.
186 C<libungif> is no longer supported as an alternative.
188 Debian package: C<libgif-dev>
190 Redhat package: C<giflib-devel>
192 Cygwin: C<libgif-devel>
194 =head2 JPEG - C<libjpeg>
196 L<Imager::File::JPEG> uses L<< C<libjpeg> |http://www.ijg.org/ >> for JPEG
200 L<< C<libjpeg-turbo> |http://sourceforge.net/projects/libjpeg-turbo/ >>.
202 To install older releases of C<libjpeg> from source, you'll need to
207 to install the libraries. C<make install> only installs the program
210 Redhat package: C<libjpeg-devel>
212 Debian package: C<libjpeg-dev>
214 Cygwin: C<libjpeg-devel>
216 =head2 Freetype 2.x - C<libfreetype>
218 L<Imager::Font::FT2> uses L<< Freetype 2
219 (C<libfreetype>)|http://www.freetype.org/ >> for font support, supporting
220 too many font formats to mention here.
222 This is the recommended library to use for font support.
224 Debian package: C<libfreetype6-dev>
226 Redhat package: C<freetype-devel>
228 Cygwin: C<libfreetype-devel>
230 =head2 Win32 GDI fonts
232 L<Imager::Font::W32> uses L<Win32
233 GDI|http://msdn.microsoft.com/en-us/library/dd145203%28v=vs.85%29.aspx>
234 to render text using installed Windows fonts.
236 This requires Win32 SDK headers and libraries, and is only expected to
237 work on native Win32 or Cygwin.
239 For this to work under Cygwin, install the C<w32api-headers> and
240 C<w32api-runtime> packages.
244 L<Imager::Font::T1> uses L<< C<t1lib> |http://www.t1lib.org/ >> for
245 font support, supporting Postscript Type 1 fonts only.
247 T1Lib is abandonware, the latest released version has several bugs
248 that reliably crash on 64-bit systems.
250 Expect C<Imager::Font::T1> to be unbundled from the Imager
251 distribution at some point.
253 Debian package: C<libt1-dev>
255 Redhat package: C<t1lib-devel>
257 =head2 Freetype 1.x - C<libttf>
259 Imager uses L<< Freetype 1 (C<libttf>)|http://www.freetype.org/ >> if
260 available for font support, supporting TTF fonts only.
262 Freetype 1.x is essentially unsupported and shouldn't be used for new
265 Expect Freetype 1 support to be removed from Imager at some point.
267 =head1 PLATFORM SPECIFICS
271 Several distributions include an Imager package, but they are
272 typically several releases behind due to the nature of release cycles.
274 Imager typically supports the external libraries as packaged with any
275 supported release of Linux.
279 To install the libraries used by Imager under Debian (or Ubuntu), run
280 as root (or with sudo):
282 apt-get install libgif-dev libjpeg8-dev libtiff4-dev libpng12-dev libfreetype6-dev
284 You may also need to install development tools:
286 apt-get install build-essential
290 To install the libraries used by Imager under Redhat and related Linux
291 distributions, run as root (or sudo):
293 yum install giflib-devel libjpeg-devel libtiff-devel libpng-devel freetype-devel
295 To install the development tools needed:
299 (which appears to be enough on a base Redhat-like install) or the more
300 commonly recommended recipe:
302 yum groupinstall "Development Tools"
304 which is massive overkill.
308 =head3 Building libraries
310 The default perl build in Snow Leopard and Lion is a fat binary, and
311 default builds of C<giflib>, C<libpng> and C<libjpeg> (and maybe other
312 libraries) will produce link failures.
314 To avoid this you need to supply a C<CFLAGS> parameter to the
315 library's configure script, but since the C<-arch> flag conflicts with
316 the options used to build the dependency files, you need to supply
317 another flag to disable dependency tracking.
319 Snow Leopard fat binaries include C<i386>, C<x86_64> and C<PPC>
320 objects, hence you would run configure like:
322 ./configure --disable-dependency-tracking CFLAGS='-arch x86_64 -arch i386 -arch ppc'
324 Lion doesn't support C<PPC>, so there you run configure like:
326 ./configure --disable-dependency-tracking CFLAGS='-arch x86_64 -arch i386'
328 For C<libgif> you might also want to supply the C<--without-x> option:
330 ./configure --disable-dependency-tracking --without-x CFLAGS='-arch x86_64 -arch i386'
332 If you copy library files into place manually, you may need to run
333 C<ranlib> on them in their new location:
335 ranlib /usr/local/lib/libgif.a
337 =head3 Macintosh C<dfont> and suitcase font support
339 Through Freetype 2.1, Imager can use Macintosh C<DFON> (C<.dfont>)
340 fonts and suitcase font files.
342 If you want to be able to use more than just the first face in the
343 font file though, you will need to configure C<freetype2> with the
344 --with-old-mac-fonts option:
346 ./configure --with-old-mac-fonts
348 You can use the index option to get to the other font faces in the
351 # get the second face from $file
352 my $font = Imager::Font->new(file=>$file, index=>1)
353 or die Imager->errstr;
355 If you're using a suitcase font, you will also need to force the use
356 of Freetype 2 with the type argument:
358 my $font = Imager::Font->new(file=>$suitcase, type=>'ft2', index=>$index)
359 or die Imager->errstr;
361 =head2 Microsoft Windows
363 The simplest way to install the libraries used by Imager is to install
364 L<Strawberry perl|http://strawberryperl.com/>.
366 You can then use either the bundled Imager, or install from CPAN.
368 If you get errors from your make tool, make sure you're using the same
369 make that was used to build your perl - C<nmake> for Visual C/C++ and
370 C<dmake> for MinGW, run:
374 to see which make was used to build your perl.
378 To build Imager with as much library support as possible on Cygwin,
379 install the following packages:
381 libjpeg-devel libpng-devel libgif-devel libtiff-devel
382 libfreetype-devel t1lib-devel w32api-headers w32api-runtime
384 If you see an error under cygwin during testing along the lines of:
386 C:\cygwin\bin\perl.exe: *** unable to remap C:\cygwin\...some dll to the
387 same address as parent (0x...) != 0x....
389 you will need to install the cygwin C<rebase> package and run:
397 will fix the problem. 64-bit Cygwin significantly reduces occurrences
402 =head2 Freetype 1.x vs Freetype 2.x
404 Freetype 1.x is no longer recommended, is no longer supported
405 upstream, and receives only limited updates in Imager.
407 These two libraries have some conflicting include file names, but as
408 long as you don't put the Freetype 2.x F<freetype.h> directory in the
409 include path it should all work.
411 Put the directory containing F<ft2build.h> in the include path, but
412 not the directory containing the freetype 2.x F<freetype.h>.
414 If you see compilation errors from font.c you've probably made the
415 mistake of putting the Freetype 2.x F<freetype.h> directory into the
418 To see which directories should be in the include path, try:
420 freetype-config --cflags
422 Ideally, C<freetype-config> should be in the PATH when building Imager
423 with freetype 2.x support, in which case L<Imager::Font::FT2> can
428 Tony Cook <tonyc@cpan.org>, Arnar M. Hrafnkelsson