| 1 |
=for stopwords freetype MinGW dfont Redhat SDK IFD GDI TTF preprocessor Redhat-like |
| 2 |
|
| 3 |
=head1 NAME |
| 4 |
|
| 5 |
Imager::Install - installation notes for Imager |
| 6 |
|
| 7 |
=head1 SYNOPSIS |
| 8 |
|
| 9 |
perl Makefile.PL |
| 10 |
make |
| 11 |
make test |
| 12 |
make install |
| 13 |
|
| 14 |
=head1 DESCRIPTION |
| 15 |
|
| 16 |
Assuming you have all of your required libraries in the places Imager |
| 17 |
looks, you should be able to use the standard mantra: |
| 18 |
|
| 19 |
perl Makefile.PL |
| 20 |
make |
| 21 |
make test |
| 22 |
make install |
| 23 |
|
| 24 |
to install Imager. |
| 25 |
|
| 26 |
If you've installed libraries in places Imager doesn't look, you can |
| 27 |
supply extra locations either with command-line options: |
| 28 |
|
| 29 |
perl Makefile.PL --libpath=/home/tony/local/lib --incpath=/home/tony/local/include |
| 30 |
|
| 31 |
or with environment variables: |
| 32 |
|
| 33 |
export IM_LIBPATH=/home/tony/local/lib IM_INCPATH=/home/tony/local/include |
| 34 |
perl Makefile.PL |
| 35 |
|
| 36 |
Imager's F<Makefile.PL> produces an epilogue indicating which |
| 37 |
libraries have and haven't been found, for example: |
| 38 |
|
| 39 |
Libraries found: |
| 40 |
FT2 |
| 41 |
GIF |
| 42 |
JPEG |
| 43 |
PNG |
| 44 |
T1 |
| 45 |
TIFF |
| 46 |
Libraries *not* found: |
| 47 |
Win32 |
| 48 |
|
| 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: |
| 52 |
|
| 53 |
perl Makefile.PL -v |
| 54 |
|
| 55 |
If you can't resolve this, then run |
| 56 |
|
| 57 |
perl errep.perl |
| 58 |
|
| 59 |
and include the (large) generated F<report.txt> in your report at: |
| 60 |
|
| 61 |
https://github.com/tonycoz/imager/issues |
| 62 |
|
| 63 |
There are other options used to configure how Imager is built: |
| 64 |
|
| 65 |
=over |
| 66 |
|
| 67 |
=item C<--nolog> |
| 68 |
|
| 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. |
| 72 |
|
| 73 |
=item C<--coverage> |
| 74 |
|
| 75 |
used to build Imager for C<gcov> coverage testing. This is intended |
| 76 |
for development and also requires options supplied to C<make>. |
| 77 |
|
| 78 |
=item C<--assert> |
| 79 |
|
| 80 |
build Imager with assertions enabled. |
| 81 |
|
| 82 |
=item C<--tracecontext> |
| 83 |
|
| 84 |
build Imager to trace context object management to C<stderr> for |
| 85 |
debugging. |
| 86 |
|
| 87 |
=item C<--enable=feature>I<< C<,feature> ... >> |
| 88 |
|
| 89 |
=item C<--disable=feature>I<< C<,feature> ... >> |
| 90 |
|
| 91 |
Enable or disable attempting to build bundled modules. This only has |
| 92 |
an effect on modules are also available on CPAN that are bundled with |
| 93 |
Imager for historical reasons. |
| 94 |
|
| 95 |
You can use C<--enable=none> to prevent attempting to install any of |
| 96 |
the bundled modules. |
| 97 |
|
| 98 |
You can use either of C<--enable> or C<--disable> but not both. |
| 99 |
|
| 100 |
=back |
| 101 |
|
| 102 |
=head2 Build time environment variables |
| 103 |
X<build time environment variables> |
| 104 |
|
| 105 |
=over |
| 106 |
|
| 107 |
=item * |
| 108 |
|
| 109 |
X<< C<IM_ENABLE> >>C<IM_ENABLE> - if set, a comma separated list of |
| 110 |
bundled modules to try to build. This can be set to C<none> to build |
| 111 |
none of them. There is no environment variable corresponding to |
| 112 |
C<--disable>. |
| 113 |
|
| 114 |
=item * |
| 115 |
|
| 116 |
X<< C<IMAGER_NOLOG> >>C<IMAGER_NOLOG> - build Imager with logging disabled. |
| 117 |
|
| 118 |
=item * |
| 119 |
|
| 120 |
X<< C<IMAGER_DEBUG_MALLOC> >>C<IMAGER_DEBUG_MALLOC> - build Imager with it's |
| 121 |
debug malloc wrappers. This is I<not> compatible with threaded code. |
| 122 |
|
| 123 |
=item * |
| 124 |
|
| 125 |
X<< C<IM_INCPATH> >>C<IM_INCPATH> - equivalent to C<--incpath>. |
| 126 |
|
| 127 |
=item * |
| 128 |
|
| 129 |
X<< C<IM_LIBPATH> >>C<IM_LIBPATH> - equivalent to C<--libpath>. |
| 130 |
|
| 131 |
=item * |
| 132 |
|
| 133 |
X<< C<IM_VERBOSE> >>C<IM_VERBOSE> - equivalent to C<--verbose> |
| 134 |
|
| 135 |
=item * |
| 136 |
|
| 137 |
X<< C<IM_CFLAGS> >>C<IM_CFLAGS> - extra C compiler flags. |
| 138 |
|
| 139 |
=item * |
| 140 |
|
| 141 |
X<< C<IM_LFLAGS> >>C<IM_LFLAGS> - extra linker flags. |
| 142 |
|
| 143 |
=item * |
| 144 |
|
| 145 |
X<< C<IM_DFLAGS> >>C<IM_DFLAGS> - extra preprocessor flags. |
| 146 |
|
| 147 |
=back |
| 148 |
|
| 149 |
=head1 EXTERNAL LIBRARIES |
| 150 |
|
| 151 |
Some of the file format and font modules included with Imager use |
| 152 |
external libraries, which should be installed before you try to |
| 153 |
install Imager itself. |
| 154 |
|
| 155 |
If you don't have the libraries installed then Imager itself will |
| 156 |
install successfully, but the file format or font support module won't |
| 157 |
be. |
| 158 |
|
| 159 |
Preferably the latest version of each library should be used, simple |
| 160 |
because it has the latest security fixes. |
| 161 |
|
| 162 |
=head2 PNG - C<libpng> |
| 163 |
|
| 164 |
X<< C<libpng> >>L<Imager::File::PNG> uses L<< C<libpng> |
| 165 |
|http://www.libpng.org/pub/png/libpng.html >> for PNG image file |
| 166 |
support. |
| 167 |
|
| 168 |
Debian package: C<libpng-dev> |
| 169 |
|
| 170 |
Redhat package: C<libpng-devel> |
| 171 |
|
| 172 |
Cygwin: C<libpng-devel> |
| 173 |
|
| 174 |
=head2 TIFF - C<libtiff> |
| 175 |
|
| 176 |
X<< C<libtiff> >>L<Imager::File::TIFF> uses |
| 177 |
L<< C<libtiff> |http://www.remotesensing.org/libtiff/ >> for GIF image file |
| 178 |
support. |
| 179 |
|
| 180 |
Version 3.6.0 or later is required to avoid an exploit with infinite |
| 181 |
IFD loops, though it's possible some distributions have applied the |
| 182 |
fix to older versions as a security fix. |
| 183 |
|
| 184 |
Version 3.9.0 is rejected during the probe process due to a serious |
| 185 |
bug, fixed in 3.9.1. |
| 186 |
|
| 187 |
Debian package: C<libtiff4-dev> |
| 188 |
|
| 189 |
Redhat package: C<libtiff-devel> |
| 190 |
|
| 191 |
Cygwin: C<libtiff-devel> |
| 192 |
|
| 193 |
=head2 GIF - C<libgif> |
| 194 |
|
| 195 |
X<< C<libgif> >>L<Imager::File::GIF> uses |
| 196 |
L<< C<libgif> |http://sourceforge.net/projects/giflib/ >> for GIF image file |
| 197 |
support. |
| 198 |
|
| 199 |
C<libgif> releases 4.2.0 and 5.0.0 are specifically not supported, due |
| 200 |
to bugs in those versions. |
| 201 |
|
| 202 |
Release 4.1.4 or later should be used. |
| 203 |
|
| 204 |
C<giflib> 3 is no longer supported. |
| 205 |
|
| 206 |
C<libungif> is no longer supported as an alternative. |
| 207 |
|
| 208 |
Debian package: C<libgif-dev> |
| 209 |
|
| 210 |
Redhat package: C<giflib-devel> |
| 211 |
|
| 212 |
Cygwin: C<libgif-devel> |
| 213 |
|
| 214 |
=head2 JPEG - C<libjpeg> |
| 215 |
|
| 216 |
L<Imager::File::JPEG> uses L<< C<libjpeg> |http://www.ijg.org/ >> for JPEG |
| 217 |
image file support. |
| 218 |
|
| 219 |
You may also use L<< C<libjpeg-turbo> |
| 220 |
|http://sourceforge.net/projects/libjpeg-turbo/ >> or L<< C<mozjpeg> |
| 221 |
|https://github.com/mozilla/mozjpeg >> by setting the installed |
| 222 |
library's F<pkgconfig/> directory in `PKG_CONFIG_PATH`, eg: |
| 223 |
|
| 224 |
PKG_CONFIG_PATH=/home/tony/local/mozjpeg-3.0git/lib/pkgconfig/ perl Makefile.PL |
| 225 |
PKG_CONFIG_PATH=/home/tony/local/jpeg-turbo-2.0.4git/lib/pkgconfig/ perl Makefile.PL |
| 226 |
|
| 227 |
To install older releases of C<libjpeg> from source, you'll need to |
| 228 |
run: |
| 229 |
|
| 230 |
make install-lib |
| 231 |
|
| 232 |
to install the libraries. C<make install> only installs the program |
| 233 |
binaries. |
| 234 |
|
| 235 |
Redhat package: C<libjpeg-devel> |
| 236 |
|
| 237 |
Debian package: C<libjpeg-dev> |
| 238 |
|
| 239 |
Cygwin: C<libjpeg-devel> |
| 240 |
|
| 241 |
=head2 Freetype 2.x - C<libfreetype> |
| 242 |
|
| 243 |
L<Imager::Font::FT2> uses L<< Freetype 2 |
| 244 |
(C<libfreetype>)|http://www.freetype.org/ >> for font support, supporting |
| 245 |
too many font formats to mention here. |
| 246 |
|
| 247 |
This is the recommended library to use for font support. |
| 248 |
|
| 249 |
Debian package: C<libfreetype6-dev> |
| 250 |
|
| 251 |
Redhat package: C<freetype-devel> |
| 252 |
|
| 253 |
Cygwin: C<libfreetype-devel> |
| 254 |
|
| 255 |
=head2 Win32 GDI fonts |
| 256 |
|
| 257 |
L<Imager::Font::W32> uses L<Win32 |
| 258 |
GDI|http://msdn.microsoft.com/en-us/library/dd145203%28v=vs.85%29.aspx> |
| 259 |
to render text using installed Windows fonts. |
| 260 |
|
| 261 |
This requires Win32 SDK headers and libraries, and is only expected to |
| 262 |
work on native Win32 or Cygwin. |
| 263 |
|
| 264 |
For this to work under Cygwin, install the C<w32api-headers> and |
| 265 |
C<w32api-runtime> packages. |
| 266 |
|
| 267 |
=head2 C<t1lib> |
| 268 |
|
| 269 |
L<Imager::Font::T1> uses L<< C<t1lib> |http://www.t1lib.org/ >> for |
| 270 |
font support, supporting Postscript Type 1 fonts only. |
| 271 |
|
| 272 |
=for stopwords |
| 273 |
abandonware |
| 274 |
|
| 275 |
T1Lib is abandonware, the latest released version has several bugs |
| 276 |
that reliably crash on 64-bit systems. |
| 277 |
|
| 278 |
Expect C<Imager::Font::T1> to be unbundled from the Imager |
| 279 |
distribution at some point. |
| 280 |
|
| 281 |
Debian package: C<libt1-dev> |
| 282 |
|
| 283 |
Redhat package: C<t1lib-devel> |
| 284 |
|
| 285 |
=head2 Freetype 1.x - C<libttf> |
| 286 |
|
| 287 |
Imager uses L<< Freetype 1 (C<libttf>)|http://www.freetype.org/ >> if |
| 288 |
available for font support, supporting TTF fonts only. |
| 289 |
|
| 290 |
Freetype 1.x is essentially unsupported and shouldn't be used for new |
| 291 |
code. |
| 292 |
|
| 293 |
Expect Freetype 1 support to be removed from Imager at some point. |
| 294 |
|
| 295 |
=head1 PLATFORM SPECIFICS |
| 296 |
|
| 297 |
=head2 Linux |
| 298 |
|
| 299 |
Several distributions include an Imager package, but they are |
| 300 |
typically several releases behind due to the nature of release cycles. |
| 301 |
|
| 302 |
Imager typically supports the external libraries as packaged with any |
| 303 |
supported release of Linux. |
| 304 |
|
| 305 |
=head3 Debian |
| 306 |
|
| 307 |
To install the libraries used by Imager under Debian (or Ubuntu), run |
| 308 |
as root (or with sudo): |
| 309 |
|
| 310 |
apt-get install libgif-dev libjpeg8-dev libtiff4-dev libpng12-dev libfreetype6-dev |
| 311 |
|
| 312 |
You may also need to install development tools: |
| 313 |
|
| 314 |
apt-get install build-essential |
| 315 |
|
| 316 |
=head3 Redhat |
| 317 |
|
| 318 |
To install the libraries used by Imager under Redhat and related Linux |
| 319 |
distributions, run as root (or sudo): |
| 320 |
|
| 321 |
yum install giflib-devel libjpeg-devel libtiff-devel libpng-devel freetype-devel |
| 322 |
|
| 323 |
To install the development tools needed: |
| 324 |
|
| 325 |
yum install gcc |
| 326 |
|
| 327 |
(which appears to be enough on a base Redhat-like install) or the more |
| 328 |
commonly recommended recipe: |
| 329 |
|
| 330 |
yum groupinstall "Development Tools" |
| 331 |
|
| 332 |
which is massive overkill. |
| 333 |
|
| 334 |
=head2 Mac OS X |
| 335 |
|
| 336 |
=head3 Building libraries |
| 337 |
|
| 338 |
The default perl build in Snow Leopard and Lion is a fat binary, and |
| 339 |
default builds of C<giflib>, C<libpng> and C<libjpeg> (and maybe other |
| 340 |
libraries) will produce link failures. |
| 341 |
|
| 342 |
To avoid this you need to supply a C<CFLAGS> parameter to the |
| 343 |
library's configure script, but since the C<-arch> flag conflicts with |
| 344 |
the options used to build the dependency files, you need to supply |
| 345 |
another flag to disable dependency tracking. |
| 346 |
|
| 347 |
Snow Leopard fat binaries include C<i386>, C<x86_64> and C<PPC> |
| 348 |
objects, hence you would run configure like: |
| 349 |
|
| 350 |
./configure --disable-dependency-tracking CFLAGS='-arch x86_64 -arch i386 -arch ppc' |
| 351 |
|
| 352 |
Lion doesn't support C<PPC>, so there you run configure like: |
| 353 |
|
| 354 |
./configure --disable-dependency-tracking CFLAGS='-arch x86_64 -arch i386' |
| 355 |
|
| 356 |
For C<libgif> you might also want to supply the C<--without-x> option: |
| 357 |
|
| 358 |
./configure --disable-dependency-tracking --without-x CFLAGS='-arch x86_64 -arch i386' |
| 359 |
|
| 360 |
If you copy library files into place manually, you may need to run |
| 361 |
C<ranlib> on them in their new location: |
| 362 |
|
| 363 |
ranlib /usr/local/lib/libgif.a |
| 364 |
|
| 365 |
=head3 Macintosh C<dfont> and suitcase font support |
| 366 |
|
| 367 |
Through Freetype 2.1, Imager can use Macintosh C<DFON> (C<.dfont>) |
| 368 |
fonts and suitcase font files. |
| 369 |
|
| 370 |
If you want to be able to use more than just the first face in the |
| 371 |
font file though, you will need to configure C<freetype2> with the |
| 372 |
--with-old-mac-fonts option: |
| 373 |
|
| 374 |
./configure --with-old-mac-fonts |
| 375 |
|
| 376 |
You can use the index option to get to the other font faces in the |
| 377 |
file: |
| 378 |
|
| 379 |
# get the second face from $file |
| 380 |
my $font = Imager::Font->new(file=>$file, index=>1) |
| 381 |
or die Imager->errstr; |
| 382 |
|
| 383 |
If you're using a suitcase font, you will also need to force the use |
| 384 |
of Freetype 2 with the type argument: |
| 385 |
|
| 386 |
my $font = Imager::Font->new(file=>$suitcase, type=>'ft2', index=>$index) |
| 387 |
or die Imager->errstr; |
| 388 |
|
| 389 |
=head2 Microsoft Windows |
| 390 |
|
| 391 |
The simplest way to install the libraries used by Imager is to install |
| 392 |
L<Strawberry perl|http://strawberryperl.com/>. |
| 393 |
|
| 394 |
You can then use either the bundled Imager, or install from CPAN. |
| 395 |
|
| 396 |
If you get errors from your make tool, make sure you're using the same |
| 397 |
make that was used to build your perl - C<nmake> for Visual C/C++ and |
| 398 |
C<dmake> for MinGW, run: |
| 399 |
|
| 400 |
perl -V:make |
| 401 |
|
| 402 |
to see which make was used to build your perl. |
| 403 |
|
| 404 |
=head2 Cygwin |
| 405 |
|
| 406 |
To build Imager with as much library support as possible on Cygwin, |
| 407 |
install the following packages: |
| 408 |
|
| 409 |
libjpeg-devel libpng-devel libgif-devel libtiff-devel |
| 410 |
libfreetype-devel t1lib-devel w32api-headers w32api-runtime |
| 411 |
|
| 412 |
If you see an error under cygwin during testing along the lines of: |
| 413 |
|
| 414 |
C:\cygwin\bin\perl.exe: *** unable to remap C:\cygwin\...some dll to the |
| 415 |
same address as parent (0x...) != 0x.... |
| 416 |
|
| 417 |
you will need to install the cygwin C<rebase> package and run: |
| 418 |
|
| 419 |
$ rebaseall -v |
| 420 |
|
| 421 |
or possibly, just: |
| 422 |
|
| 423 |
$ perlrebase |
| 424 |
|
| 425 |
will fix the problem. 64-bit Cygwin significantly reduces occurrences |
| 426 |
of this problem. |
| 427 |
|
| 428 |
=head1 Other issues |
| 429 |
|
| 430 |
=head2 Freetype 1.x vs Freetype 2.x |
| 431 |
|
| 432 |
Freetype 1.x is no longer recommended, is no longer supported |
| 433 |
upstream, and receives only limited updates in Imager. |
| 434 |
|
| 435 |
These two libraries have some conflicting include file names, but as |
| 436 |
long as you don't put the Freetype 2.x F<freetype.h> directory in the |
| 437 |
include path it should all work. |
| 438 |
|
| 439 |
Put the directory containing F<ft2build.h> in the include path, but |
| 440 |
not the directory containing the freetype 2.x F<freetype.h>. |
| 441 |
|
| 442 |
If you see compilation errors from font.c you've probably made the |
| 443 |
mistake of putting the Freetype 2.x F<freetype.h> directory into the |
| 444 |
include path. |
| 445 |
|
| 446 |
To see which directories should be in the include path, try: |
| 447 |
|
| 448 |
freetype-config --cflags |
| 449 |
|
| 450 |
Ideally, C<freetype-config> should be in the PATH when building Imager |
| 451 |
with freetype 2.x support, in which case L<Imager::Font::FT2> can |
| 452 |
configure itself. |
| 453 |
|
| 454 |
=head1 AUTHOR |
| 455 |
|
| 456 |
Tony Cook <[email protected]>, Arnar M. Hrafnkelsson |
| 457 |
|
| 458 |
=cut |