Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 742 lines (615 sloc) 18.728 kb
ea9e6c3f » Tony Cook
2004-08-08 - the Win32 font driver now uses DEFAULT_CHARSET rather than
1 #!perl -w
714cf158 » Tony Cook
2006-02-09 - check $Config{ldflags} and $Config{ccflags} for places to search for
2 use strict;
02d1d628 » Arnar Mar Hrafnkelsson
2001-03-25 Initial revision
3 use ExtUtils::MakeMaker;
4 use Cwd;
5 use Config;
07ea6c21 » Tony Cook
2005-01-01 - Makefile.PL now attempts to use freetype-config to configure freety…
6 use File::Spec;
37959076 » Tony Cook
2005-01-24 - Makefile.PL now accepts command-line options to set include and lib…
7 use Getopt::Long;
92bda632 » Tony Cook
2006-01-10 - start of external Imager API access:
8 use ExtUtils::Manifest qw(maniread);
10b85929 » Tony Cook
2010-08-03 when probing for TIFF, set LD_RUN_PATH just as the Makefile does so
9 use ExtUtils::Liblist;
714cf158 » Tony Cook
2006-02-09 - check $Config{ldflags} and $Config{ccflags} for places to search for
10 use vars qw(%formats $VERBOSE $INCPATH $LIBPATH $NOLOG $DEBUG_MALLOC $MANUAL $CFLAGS $LFLAGS $DFLAGS);
812ae05c » Tony Cook
2009-09-01 extract the installed tifflib version and don't use tifflib if it's
11 use lib 'inc';
12 use Devel::CheckLib;
02d1d628 » Arnar Mar Hrafnkelsson
2001-03-25 Initial revision
13
1d7e3124 » Tony Cook
2010-08-06 merge PNG branch and some clean-up
14 # EU::MM runs Makefile.PL all in the same process, so sub-modules will
15 # see this
16 our $BUILDING_IMAGER = 1;
17
d97c8dbd »
2011-03-14 [RT #9675] add the library detection summary back in and improve it
18 # used to display a summary after we've probed the world
19 our %IMAGER_LIBS;
20
02d1d628 » Arnar Mar Hrafnkelsson
2001-03-25 Initial revision
21 #
22 # IM_INCPATH colon seperated list of paths to extra include paths
23 # IM_LIBPATH colon seperated list of paths to extra library paths
24 #
25 # IM_VERBOSE turns on verbose mode for the library finding and such
26 # IM_MANUAL to manually select which libraries are used and which not
27 # IM_ENABLE to programmatically select which libraries are used
28 # and which are not
29 # IM_NOLOG if true logging will not be compiled into the module
30 # IM_DEBUG_MALLOC if true malloc debbuging will be compiled into the module
31 # do not use IM_DEBUG_MALLOC in production - this slows
32 # everything down by alot
33 # IM_CFLAGS Extra flags to pass to the compiler
34 # IM_LFLAGS Extra flags to pass to the linker
35 # IM_DFLAGS Extra flags to pass to the preprocessor
36
812ae05c » Tony Cook
2009-09-01 extract the installed tifflib version and don't use tifflib if it's
37 my $KEEP_FILES = $ENV{IMAGER_KEEP_FILES};
38
855c5808 » Tony Cook
2005-11-25 - fixes to verbose mode in Makefile.PL, also added a -v switch so you
39 getenv(); # get environment variables
40
714cf158 » Tony Cook
2006-02-09 - check $Config{ldflags} and $Config{ccflags} for places to search for
41 my $lext=$Config{'so'}; # Get extensions of libraries
42 my $aext=$Config{'_a'};
43
44 my $help; # display help if set
45 my @enable; # list of drivers to enable
46 my @disable; # or list of drivers to disable
47 my @incpaths; # places to look for headers
48 my @libpaths; # places to look for libraries
1ef586b1 » Tony Cook
2007-01-28 simpler creation of coverage reports
49 my $coverage; # build for coverage testing
b3afeed5 » Tony Cook
2009-09-17 - an integer division meant that preview scaling to below 1 pixel
50 my $assert; # build with assertions
37959076 » Tony Cook
2005-01-24 - Makefile.PL now accepts command-line options to set include and lib…
51 GetOptions("help" => \$help,
52 "enable=s" => \@enable,
53 "disable=s" => \@disable,
54 "incpath=s", \@incpaths,
55 "libpath=s" => \@libpaths,
274cd32b » Tony Cook
2005-11-29 - check the correct directory when adding the cygwin Win32 API include
56 "verbose|v" => \$VERBOSE,
f7450478 » Tony Cook
2005-12-07 - added experimental EXIF decoding when reading JPEG files.
57 "nolog" => \$NOLOG,
b3afeed5 » Tony Cook
2009-09-17 - an integer division meant that preview scaling to below 1 pixel
58 'coverage' => \$coverage,
59 "assert|a" => \$assert);
60
1d7e3124 » Tony Cook
2010-08-06 merge PNG branch and some clean-up
61 setenv();
62
b3afeed5 » Tony Cook
2009-09-17 - an integer division meant that preview scaling to below 1 pixel
63 if ($ENV{AUTOMATED_TESTING}) {
64 $assert = 1;
65 }
855c5808 » Tony Cook
2005-11-25 - fixes to verbose mode in Makefile.PL, also added a -v switch so you
66
67 if ($VERBOSE) {
68 print "Verbose mode\n";
69 require Data::Dumper;
70 import Data::Dumper qw(Dumper);
71 }
37959076 » Tony Cook
2005-01-24 - Makefile.PL now accepts command-line options to set include and lib…
72
73 if ($help) {
74 usage();
75 }
76
f7450478 » Tony Cook
2005-12-07 - added experimental EXIF decoding when reading JPEG files.
77 my @defines;
78
274cd32b » Tony Cook
2005-11-29 - check the correct directory when adding the cygwin Win32 API include
79 if ($NOLOG) { print "Logging not compiled into module\n"; }
80 else {
81 push @defines, [ IMAGER_LOG => 1, "Logging system" ];
82 }
83
b3afeed5 » Tony Cook
2009-09-17 - an integer division meant that preview scaling to below 1 pixel
84 if ($assert) {
85 push @defines, [ IM_ASSERT => 1, "im_assert() are effective" ];
86 }
87
274cd32b » Tony Cook
2005-11-29 - check the correct directory when adding the cygwin Win32 API include
88 if ($DEBUG_MALLOC) {
89 push @defines, [ IMAGER_DEBUG_MALLOC => 1, "Use Imager's DEBUG malloc()" ];
90 print "Malloc debugging enabled\n";
91 }
92
37959076 » Tony Cook
2005-01-24 - Makefile.PL now accepts command-line options to set include and lib…
93 if (@enable && @disable) {
94 print STDERR "Only --enable or --disable can be used, not both, try --help\n";
95 exit 1;
96 }
02d1d628 » Arnar Mar Hrafnkelsson
2001-03-25 Initial revision
97
714cf158 » Tony Cook
2006-02-09 - check $Config{ldflags} and $Config{ccflags} for places to search for
98 my %definc;
99 my %deflib;
100 my @incs; # all the places to look for headers
101 my @libs; # all the places to look for libraries
102
02d1d628 » Arnar Mar Hrafnkelsson
2001-03-25 Initial revision
103 init(); # initialize global data
104 pathcheck(); # Check if directories exist
105
37959076 » Tony Cook
2005-01-24 - Makefile.PL now accepts command-line options to set include and lib…
106 if (exists $ENV{IM_ENABLE}) {
107 my %en = map { $_, 1 } split ' ', $ENV{IM_ENABLE};
108 for my $key (keys %formats) {
109 delete $formats{$key} unless $en{$key};
110 }
111 }
112 if (@enable) {
113 my %en = map { $_ => 1 } map { split /,/ } @enable;
114 for my $key (keys %formats) {
115 delete $formats{$key} unless $en{$key};
116 }
117 }
118 elsif (@disable) {
119 delete @formats{map { split /,/ } @disable};
120 }
121
02d1d628 » Arnar Mar Hrafnkelsson
2001-03-25 Initial revision
122 # Pick what libraries are used
123 if ($MANUAL) {
124 manual();
125 } else {
126 automatic();
127 }
128
07ea6c21 » Tony Cook
2005-01-01 - Makefile.PL now attempts to use freetype-config to configure freety…
129 my $lib_cflags = '';
a8395b42 » Tony Cook
2006-07-07 move linker flags from freetype-config/pkg-config up to the front to
130 my $lib_lflags = '';
80c15fc7 » Tony Cook
2005-05-17 - prevent warnings from Makefile.PL when there's no libraries found
131 my $F_LIBS = '';
132 my $F_OBJECT = '';
714cf158 » Tony Cook
2006-02-09 - check $Config{ldflags} and $Config{ccflags} for places to search for
133 for my $frmkey (sort { $formats{$a}{order} <=> $formats{$b}{order} } keys %formats) {
e11d297f » Tony Cook
2005-01-06 - Makefile.PL now builds imconfig.h with #defines for libraries
134 my $frm = $formats{$frmkey};
135 push @defines, [ $frm->{def}, 1, "$frmkey available" ];
02d1d628 » Arnar Mar Hrafnkelsson
2001-03-25 Initial revision
136 $F_OBJECT .= ' ' .$frm->{objfiles};
714cf158 » Tony Cook
2006-02-09 - check $Config{ldflags} and $Config{ccflags} for places to search for
137 if ($frm->{cflags}) {
138 $lib_cflags .= ' ' .$frm->{cflags};
139 ++$definc{$_} for map { /^-I(.*)$/ ? ($1) : () }
140 grep /^-I./, split ' ', $frm->{cflags};
141 }
a8395b42 » Tony Cook
2006-07-07 move linker flags from freetype-config/pkg-config up to the front to
142 if ($frm->{lflags}) {
143 $lib_lflags .= ' ' . $frm->{lflags};
144 }
145 else {
146 $F_LIBS .= ' ' .$frm->{libfiles};
147 }
148
02d1d628 » Arnar Mar Hrafnkelsson
2001-03-25 Initial revision
149 }
714cf158 » Tony Cook
2006-02-09 - check $Config{ldflags} and $Config{ccflags} for places to search for
150
151 my $F_INC = join ' ', map "-I$_", map / / ? qq{"$_"} : $_,
152 grep !$definc{$_}, @incs;
153 $F_LIBS = join(' ',map "-L$_", map / / ? qq{"$_"} : $_,
154 grep !$deflib{$_}++, @libs) . $F_LIBS;
02d1d628 » Arnar Mar Hrafnkelsson
2001-03-25 Initial revision
155
714cf158 » Tony Cook
2006-02-09 - check $Config{ldflags} and $Config{ccflags} for places to search for
156 my $OSLIBS = '';
157 my $OSDEF = "-DOS_$^O";
02d1d628 » Arnar Mar Hrafnkelsson
2001-03-25 Initial revision
158
159 if ($^O eq 'hpux') { $OSLIBS .= ' -ldld'; }
160 if (defined $Config{'d_dlsymun'}) { $OSDEF .= ' -DDLSYMUN'; }
161
714cf158 » Tony Cook
2006-02-09 - check $Config{ldflags} and $Config{ccflags} for places to search for
162 my @objs = qw(Imager.o draw.o polygon.o image.o io.o iolayer.o
b47464c1 » Tony Cook
2010-10-31 add the combine method
163 log.o gaussian.o conv.o pnm.o raw.o feat.o font.o combine.o
714cf158 » Tony Cook
2006-02-09 - check $Config{ldflags} and $Config{ccflags} for places to search for
164 filters.o dynaload.o stackmach.o datatypes.o
165 regmach.o trans2.o quant.o error.o convert.o
a2f9a61c »
2011-05-25 split 8-bit image implementation out of the megafile image.c
166 map.o tags.o palimg.o maskimg.o img8.o img16.o rotate.o
d5477d3d » Tony Cook
2007-07-31 - Finished/rewrote Arnar's old SGI RGB file format support, so Imager
167 bmp.o tga.o color.o fills.o imgdouble.o limits.o hlines.o
e41cfe8f » Tony Cook
2009-11-24 - use scanline oriented operations to flip images instead of pixel
168 imext.o scale.o rubthru.o render.o paste.o compose.o flip.o);
92bda632 » Tony Cook
2006-01-10 - start of external Imager API access:
169
714cf158 » Tony Cook
2006-02-09 - check $Config{ldflags} and $Config{ccflags} for places to search for
170 my %opts=(
171 'NAME' => 'Imager',
172 'VERSION_FROM' => 'Imager.pm',
a8395b42 » Tony Cook
2006-07-07 move linker flags from freetype-config/pkg-config up to the front to
173 'LIBS' => "$LFLAGS -lm $lib_lflags $OSLIBS $F_LIBS",
714cf158 » Tony Cook
2006-02-09 - check $Config{ldflags} and $Config{ccflags} for places to search for
174 'DEFINE' => "$OSDEF $CFLAGS",
175 'INC' => "$lib_cflags $DFLAGS $F_INC",
176 'OBJECT' => join(' ', @objs, $F_OBJECT),
f45b774f » Tony Cook
2009-08-31 - use the new EU::MM META_MERGE facility instead of generating
177 clean => { FILES=>'testout rubthru.c scale.c conv.c filters.c gaussian.c render.c rubthru.c' },
714cf158 » Tony Cook
2006-02-09 - check $Config{ldflags} and $Config{ccflags} for places to search for
178 PM => gen_PM(),
867acf5b » Tony Cook
2006-12-15 Test::More is now a pre-requisite for Imager, so remove it from the
179 PREREQ_PM => { 'Test::More' => 0.47 },
714cf158 » Tony Cook
2006-02-09 - check $Config{ldflags} and $Config{ccflags} for places to search for
180 );
02d1d628 » Arnar Mar Hrafnkelsson
2001-03-25 Initial revision
181
1ef586b1 » Tony Cook
2007-01-28 simpler creation of coverage reports
182 if ($coverage) {
183 if ($Config{gccversion}) {
184 push @ARGV, 'OPTIMIZE=-ftest-coverage -fprofile-arcs';
185 #$opts{dynamic_lib} = { OTHERLDFLAGS => '-ftest-coverage -fprofile-arcs' };
186 }
187 else {
188 die "Don't know the coverage C flags for your compiler\n";
189 }
190 }
191
c52cbef2 » Tony Cook
2006-08-29 comparisons against $ExtUtils::MakeMaker::VERSION were warning when
192 # eval to prevent warnings about versions with _ in them
193 my $MM_ver = eval $ExtUtils::MakeMaker::VERSION;
194 if ($MM_ver > 6.06) {
5b480b14 »
2011-06-08 replace (imager|tony)@imager.perl.org with tonyc@cpan.org
195 $opts{AUTHOR} = 'Tony Cook <tonyc@cpan.org>, Arnar M. Hrafnkelsson';
ca508100 » Tony Cook
2001-05-07 add the extra attributes that PPDs want
196 $opts{ABSTRACT} = 'Perl extension for Generating 24 bit Images';
197 }
f45b774f » Tony Cook
2009-08-31 - use the new EU::MM META_MERGE facility instead of generating
198
199 if ($MM_ver >= 6.46) {
200 $opts{META_MERGE} =
201 {
202 recommends =>
203 {
204 "Parse::RecDescent" => 0
205 },
206 license => "perl",
207 dynamic_config => 1,
43452432 » Tony Cook
2010-08-11 update META.yml so PNG isn't indexed, and add some resources
208 no_index =>
209 {
210 directory =>
211 [
212 "PNG",
ec6d8908 » Tony Cook
2010-08-23 move the GIF file handling code into a sub-module
213 "GIF",
797a9f9c » Tony Cook
2010-08-31 move JPEG into it's own module
214 "TIFF",
215 "JPEG",
bd7c1b36 » Tony Cook
2010-09-16 don't index W32
216 "W32",
d7ca2089 » Tony Cook
2010-09-26 don't index FT2/
217 "FT2",
85702fbd »
2011-08-16 basic clean up of Makefile.PL
218 "T1",
43452432 » Tony Cook
2010-08-11 update META.yml so PNG isn't indexed, and add some resources
219 ],
220 },
221 resources =>
222 {
223 homepage => "http://imager.perl.org/",
4989229f »
2011-05-23 re-work META.yml validation and fix the detected errors
224 repository => "git://git.imager.perl.org/imager.git",
225 bugtracker => "http://rt.cpan.org/NoAuth/Bugs.html?Dist=Imager",
43452432 » Tony Cook
2010-08-11 update META.yml so PNG isn't indexed, and add some resources
226 },
f45b774f » Tony Cook
2009-08-31 - use the new EU::MM META_MERGE facility instead of generating
227 };
135d30e3 » Tony Cook
2006-02-21 - fix/simplify META.yml generation - we now generate META.yml at
228 }
ca508100 » Tony Cook
2001-05-07 add the extra attributes that PPDs want
229
e11d297f » Tony Cook
2005-01-06 - Makefile.PL now builds imconfig.h with #defines for libraries
230 make_imconfig(\@defines);
231
02d1d628 » Arnar Mar Hrafnkelsson
2001-03-25 Initial revision
232 if ($VERBOSE) { print Dumper(\%opts); }
233 mkdir('testout',0777); # since we cannot include it in the archive.
135d30e3 » Tony Cook
2006-02-21 - fix/simplify META.yml generation - we now generate META.yml at
234
812ae05c » Tony Cook
2009-09-01 extract the installed tifflib version and don't use tifflib if it's
235 -d "probe" and rmdir "probe";
236
02d1d628 » Arnar Mar Hrafnkelsson
2001-03-25 Initial revision
237 WriteMakefile(%opts);
4dce694d » Arnar Mar Hrafnkelsson
2001-05-14 Made Makefile.PL run $Config{make} lib/Imager/Regops.pm so it exists
238
d97c8dbd »
2011-03-14 [RT #9675] add the library detection summary back in and improve it
239 my @good;
240 my @bad;
241 for my $name (sort { lc $a cmp lc $b } keys %IMAGER_LIBS) {
242 if ($IMAGER_LIBS{$name}) {
243 push @good, $name;
244 }
245 else {
246 push @bad, $name;
247 }
248 }
249
250 print "\n";
251 print "Libraries found:\n" if @good;
252 print " $_\n" for @good;
253 print "Libraries *not* found:\n" if @bad;
254 print " $_\n" for @bad;
255
02d1d628 » Arnar Mar Hrafnkelsson
2001-03-25 Initial revision
256 exit;
257
258
259 sub MY::postamble {
5a7e62b6 » Tony Cook
2006-01-13 - minor changes for older perl/ExtUtils::MM
260 my $self = shift;
261 my $perl = $self->{PERLRUN} ? '$(PERLRUN)' : '$(PERL)';
fe415ad2 » Tony Cook
2006-08-29 the rubthrough() method now supports destination images with an alpha
262 my $mani = maniread;
263
264 my @ims = grep /\.im$/, keys %$mani;
02d1d628 » Arnar Mar Hrafnkelsson
2001-03-25 Initial revision
265 '
faa9b3e7 » Tony Cook
2001-08-13 Egads
266 dyntest.$(MYEXTLIB) : dynfilt/Makefile
02d1d628 » Arnar Mar Hrafnkelsson
2001-03-25 Initial revision
267 cd dynfilt && $(MAKE) $(PASTHRU)
268
269 lib/Imager/Regops.pm : regmach.h regops.perl
270 $(PERL) regops.perl regmach.h lib/Imager/Regops.pm
e11d297f » Tony Cook
2005-01-06 - Makefile.PL now builds imconfig.h with #defines for libraries
271
92bda632 » Tony Cook
2006-01-10 - start of external Imager API access:
272 imconfig.h : Makefile.PL
e11d297f » Tony Cook
2005-01-06 - Makefile.PL now builds imconfig.h with #defines for libraries
273 $(ECHO) "imconfig.h out-of-date with respect to $?"
274 $(PERLRUN) Makefile.PL
275 $(ECHO) "==> Your Makefile has been rebuilt - re-run your make command <=="
5a7e62b6 » Tony Cook
2006-01-13 - minor changes for older perl/ExtUtils::MM
276 '.qq!
6cfee9d1 » Tony Cook
2009-09-07 API documentation (mostly)
277 lib/Imager/APIRef.pod : \$(C_FILES) \$(H_FILES) apidocs.perl
2a69ed21 » Tony Cook
2006-05-22 rename APIRef.pm, API.pm to *.pod since they contain no code
278 $perl apidocs.perl lib/Imager/APIRef.pod
92bda632 » Tony Cook
2006-01-10 - start of external Imager API access:
279
fe415ad2 » Tony Cook
2006-08-29 the rubthrough() method now supports destination images with an alpha
280 !.join('', map _im_rule($perl, $_), @ims)
281
282 }
283
284 sub _im_rule {
285 my ($perl, $im) = @_;
286
287 (my $c = $im) =~ s/\.im$/.c/;
288 return <<MAKE;
289
9b1ec2b8 » Tony Cook
2008-03-25 commit changes from draw branch
290 $c: $im lib/Imager/Preprocess.pm
291 $perl -Ilib -MImager::Preprocess -epreprocess $im $c
fe415ad2 » Tony Cook
2006-08-29 the rubthrough() method now supports destination images with an alpha
292
293 MAKE
02d1d628 » Arnar Mar Hrafnkelsson
2001-03-25 Initial revision
294
55932d2a » Tony Cook
2005-04-06 - Makefile.PL now adds rules to generate a suitable META.yml to the
295 }
296
02d1d628 » Arnar Mar Hrafnkelsson
2001-03-25 Initial revision
297 # manual configuration of helper libraries
298
299 sub manual {
300 print <<EOF;
301
302 Please answer the following questions about
303 which formats are avaliable on your computer
304
305 press <return> to continue
306 EOF
307
308 <STDIN>; # eat one return
309
2646b26c » Tony Cook
2004-12-23 - Makefile.PL now checks the directories specified by $Config{locincpth}
310 for my $frm(sort { $formats{$b}{order} <=> $formats{$a}{order} } keys %formats) {
02d1d628 » Arnar Mar Hrafnkelsson
2001-03-25 Initial revision
311 SWX:
312 if ($formats{$frm}{docs}) { print "\n",$formats{$frm}{docs},"\n\n"; }
313 print "Enable $frm support: ";
714cf158 » Tony Cook
2006-02-09 - check $Config{ldflags} and $Config{ccflags} for places to search for
314 my $gz = <STDIN>;
02d1d628 » Arnar Mar Hrafnkelsson
2001-03-25 Initial revision
315 chomp($gz);
316 if ($gz =~ m/^(y|yes|n|no)/i) {
317 $gz=substr(lc($gz),0,1);
318 if ($gz eq 'n') {
319 delete $formats{$frm};
320 }
321 } else { goto SWX; }
322 }
323 }
324
325
326 # automatic configuration of helper libraries
327
328 sub automatic {
714cf158 » Tony Cook
2006-02-09 - check $Config{ldflags} and $Config{ccflags} for places to search for
329 print "Automatic probing:\n" if $VERBOSE;
330 for my $frm (sort { $formats{$a}{order} <=> $formats{$b}{order} } keys %formats) {
02d1d628 » Arnar Mar Hrafnkelsson
2001-03-25 Initial revision
331 delete $formats{$frm} if !checkformat($frm);
332 }
333 }
334
c6e870ae » Tony Cook
2007-05-10 removed --noprobe option, since probing is now required to scan
335 sub grep_directory {
336 my($path, $chk)=@_;
02d1d628 » Arnar Mar Hrafnkelsson
2001-03-25 Initial revision
337
338 # print "checking path $path\n";
339 if ( !opendir(DH,$path) ) {
340 warn "Cannot open dir $path: $!\n";
341 return;
342 }
343 my @l=grep { $chk->($_) } readdir(DH);
344 # print @l;
345 close(DH);
346 return map $path, @l;
347 }
348
812ae05c » Tony Cook
2009-09-01 extract the installed tifflib version and don't use tifflib if it's
349 sub _probe_default {
350 my ($format, $frm) = @_;
07ea6c21 » Tony Cook
2005-01-01 - Makefile.PL now attempts to use freetype-config to configure freety…
351
c6e870ae » Tony Cook
2007-05-10 removed --noprobe option, since probing is now required to scan
352 my $lib_check=$formats{$frm}{'libcheck'};
353 my $inc_check=$formats{$frm}{'inccheck'};
02d1d628 » Arnar Mar Hrafnkelsson
2001-03-25 Initial revision
354
c6e870ae » Tony Cook
2007-05-10 removed --noprobe option, since probing is now required to scan
355 if ($lib_check) {
356 my @l;
357 for my $lp (@libs) {
358 push(@l, grep_directory($lp,$lib_check));
359 }
360
361 my @i;
362 for my $ip (@incs) {
363 push(@i, $ip) if $inc_check->($ip,$frm);
364 }
365
366 printf("%10s: includes %s - libraries %s\n",$frm,(@i?'found':'not found'),(@l?'found':'not found'));
367 $formats{$frm}{incdir} = \@i;
368 $formats{$frm}{libdir} = \@l;
369 return 1 if scalar(@i && @l);
02d1d628 » Arnar Mar Hrafnkelsson
2001-03-25 Initial revision
370 }
c6e870ae » Tony Cook
2007-05-10 removed --noprobe option, since probing is now required to scan
371 else {
372 printf("%10s: not available\n", $frm);
02d1d628 » Arnar Mar Hrafnkelsson
2001-03-25 Initial revision
373 }
374
c6e870ae » Tony Cook
2007-05-10 removed --noprobe option, since probing is now required to scan
375 return 0;
02d1d628 » Arnar Mar Hrafnkelsson
2001-03-25 Initial revision
376 }
377
812ae05c » Tony Cook
2009-09-01 extract the installed tifflib version and don't use tifflib if it's
378 sub checkformat {
379 my $frm=shift;
380
381 print " checkformat($frm)\n" if $VERBOSE;
382
383 my $format = $formats{$frm};
384
385 my @probes;
386 if (my $code = $format->{'code'}) {
387 if (ref $code eq 'ARRAY') {
388 push @probes, @$code;
389 }
390 else {
391 push @probes, $code;
392 }
393 }
394 push @probes, \&_probe_default;
395
396 print " Calling probe function\n" if $VERBOSE;
397 my $found;
398 for my $func (@probes) {
399 if ($func->($format, $frm)) {
400 ++$found;
401 last;
402 }
403 }
404
405 $found or return;
406
407 if ($format->{postcheck}) {
408 print " Calling postcheck function\n" if $VERBOSE;
409 $format->{postcheck}->($format, $frm)
410 or return;
411 }
412
413 return 1;
414 }
415
02d1d628 » Arnar Mar Hrafnkelsson
2001-03-25 Initial revision
416
417 sub pathcheck {
418 if ($VERBOSE) {
419 print "pathcheck\n";
420 print " Include paths:\n";
421 for (@incs) { print $_,"\n"; }
422 }
3a6bb91b » Arnar Mar Hrafnkelsson
2004-01-04 All the little fixup changes for the 0.42 release.
423 @incs=grep { -d $_ && -r _ && -x _ or ( print(" $_ doesnt exist or is unaccessible - removed.\n"),0) } @incs;
02d1d628 » Arnar Mar Hrafnkelsson
2001-03-25 Initial revision
424
425 if ($VERBOSE) {
426 print "\nLibrary paths:\n";
855c5808 » Tony Cook
2005-11-25 - fixes to verbose mode in Makefile.PL, also added a -v switch so you
427 for (@libs) { print $_,"\n"; }
02d1d628 » Arnar Mar Hrafnkelsson
2001-03-25 Initial revision
428 }
3a6bb91b » Arnar Mar Hrafnkelsson
2004-01-04 All the little fixup changes for the 0.42 release.
429 @libs=grep { -d $_ && -r _ && -x _ or ( print(" $_ doesnt exist or is unaccessible - removed.\n"),0) } @libs;
02d1d628 » Arnar Mar Hrafnkelsson
2001-03-25 Initial revision
430 print "\ndone.\n";
431 }
432
433
434 # Format data initialization
435
436 # format definition is:
437 # defines needed
438 # default include path
439 # files needed for include (boolean perl code)
440 # default lib path
441 # libs needed
442 # files needed for link (boolean perl code)
443 # object files needed for the format
444
445
446 sub init {
447
714cf158 » Tony Cook
2006-02-09 - check $Config{ldflags} and $Config{ccflags} for places to search for
448 my @definc = qw(/usr/include);
449 @definc{@definc}=(1) x @definc;
d8e0c3ba » Tony Cook
2007-12-06 rearrange dynaload code to avoid some OS X issues
450 @incs=
451 (
452 split(/\Q$Config{path_sep}/, $INCPATH),
453 map _tilde_expand($_), map { split /\Q$Config{path_sep}/ } @incpaths
454 );
2646b26c » Tony Cook
2004-12-23 - Makefile.PL now checks the directories specified by $Config{locincpth}
455 if ($Config{locincpth}) {
6552acfe » Tony Cook
2005-01-06 - avoid complaining about include/lib directories we pull from
456 push @incs, grep -d, split ' ', $Config{locincpth};
2646b26c » Tony Cook
2004-12-23 - Makefile.PL now checks the directories specified by $Config{locincpth}
457 }
88a763e2 » Tony Cook
2001-04-02 libpng support for Win32
458 if ($^O =~ /win32/i && $Config{cc} =~ /\bcl\b/i) {
459 push(@incs, split /;/, $ENV{INCLUDE}) if exists $ENV{INCLUDE};
2646b26c » Tony Cook
2004-12-23 - Makefile.PL now checks the directories specified by $Config{locincpth}
460 }
16cf4610 » Tony Cook
2006-12-15 search $Config{incpath} for headers too, why this was left out I don'…
461 if ($Config{incpath}) {
462 push @incs, grep -d, split /\Q$Config{path_sep}/, $Config{incpath};
463 }
6552acfe » Tony Cook
2005-01-06 - avoid complaining about include/lib directories we pull from
464 push @incs, grep -d,
2646b26c » Tony Cook
2004-12-23 - Makefile.PL now checks the directories specified by $Config{locincpth}
465 qw(/sw/include
466 /usr/include/freetype2
467 /usr/local/include/freetype2
468 /usr/local/include/freetype1/freetype
37959076 » Tony Cook
2005-01-24 - Makefile.PL now accepts command-line options to set include and lib…
469 /usr/include /usr/local/include /usr/include/freetype
2646b26c » Tony Cook
2004-12-23 - Makefile.PL now checks the directories specified by $Config{locincpth}
470 /usr/local/include/freetype);
714cf158 » Tony Cook
2006-02-09 - check $Config{ldflags} and $Config{ccflags} for places to search for
471 if ($Config{ccflags}) {
472 my @hidden = map { /^-I(.*)$/ ? ($1) : () } split ' ', $Config{ccflags};
473 push @incs, @hidden;
474 @definc{@hidden} = (1) x @hidden;
475 }
2646b26c » Tony Cook
2004-12-23 - Makefile.PL now checks the directories specified by $Config{locincpth}
476
37959076 » Tony Cook
2005-01-24 - Makefile.PL now accepts command-line options to set include and lib…
477 @libs= ( split(/\Q$Config{path_sep}/,$LIBPATH),
d8e0c3ba » Tony Cook
2007-12-06 rearrange dynaload code to avoid some OS X issues
478 map _tilde_expand($_), map { split /\Q$Config{path_sep}/} @libpaths );
2646b26c » Tony Cook
2004-12-23 - Makefile.PL now checks the directories specified by $Config{locincpth}
479 if ($Config{loclibpth}) {
6552acfe » Tony Cook
2005-01-06 - avoid complaining about include/lib directories we pull from
480 push @libs, grep -d, split ' ', $Config{loclibpth};
2646b26c » Tony Cook
2004-12-23 - Makefile.PL now checks the directories specified by $Config{locincpth}
481 }
714cf158 » Tony Cook
2006-02-09 - check $Config{ldflags} and $Config{ccflags} for places to search for
482
6552acfe » Tony Cook
2005-01-06 - avoid complaining about include/lib directories we pull from
483 push @libs, grep -d, qw(/sw/lib), split(/ /, $Config{'libpth'});
714cf158 » Tony Cook
2006-02-09 - check $Config{ldflags} and $Config{ccflags} for places to search for
484 push @libs, grep -d, split / /, $Config{libspath} if $Config{libspath};
2646b26c » Tony Cook
2004-12-23 - Makefile.PL now checks the directories specified by $Config{locincpth}
485 if ($^O =~ /win32/i && $Config{cc} =~ /\bcl\b/i) {
88a763e2 » Tony Cook
2001-04-02 libpng support for Win32
486 push(@libs, split /;/, $ENV{LIB}) if exists $ENV{LIB};
487 }
faa9b3e7 » Tony Cook
2001-08-13 Egads
488 if ($^O eq 'cygwin') {
489 push(@libs, '/usr/lib/w32api') if -d '/usr/lib/w32api';
274cd32b » Tony Cook
2005-11-29 - check the correct directory when adding the cygwin Win32 API include
490 push(@incs, '/usr/include/w32api') if -d '/usr/include/w32api';
faa9b3e7 » Tony Cook
2001-08-13 Egads
491 }
714cf158 » Tony Cook
2006-02-09 - check $Config{ldflags} and $Config{ccflags} for places to search for
492 if ($Config{ldflags}) {
493 # some builds of perl put -Ldir into ldflags without putting it in
494 # loclibpth, let's extract them
495 my @hidden = grep -d, map { /^-L(.*)$/ ? ($1) : () }
496 split ' ', $Config{ldflags};
497 push @libs, @hidden;
498 # don't mark them as seen - EU::MM will remove any libraries
499 # it can't find and it doesn't look for -L in ldflags
500 #@deflib{@hidden} = @hidden;
501 }
ed28c9cc » Tony Cook
2006-07-05 we search /usr/local/include by default but we weren't searching
502 push @libs, grep -d, qw(/usr/local/lib);
2646b26c » Tony Cook
2004-12-23 - Makefile.PL now checks the directories specified by $Config{locincpth}
503
f8e9bc07 » Tony Cook
2005-01-24 - scanning for required include files is now down by directory rather
504 $formats{'TT-fonts'}=
505 {
506 order=>'31',
507 def=>'HAVE_LIBTT',
508 inccheck=>sub { -e catfile($_[0], 'freetype.h')
509 && !-e catfile($_[0], 'fterrors.h') },
510 libcheck=>sub { $_[0] eq "libttf$aext" or $_[0] eq "libttf.$lext" },
511 libfiles=>'-lttf',
512 objfiles=>'',
714cf158 » Tony Cook
2006-02-09 - check $Config{ldflags} and $Config{ccflags} for places to search for
513 code => \&freetype1_probe,
f8e9bc07 » Tony Cook
2005-01-24 - scanning for required include files is now down by directory rather
514 docs=>q{
515 Truetype fonts are scalable fonts. They can include
516 kerning and hinting information and generally yield good
517 visual quality esp on low resultions. The freetype library is
518 used to rasterize for us. The only drawback is that there
519 are alot of badly designed fonts out there.}
02d1d628 » Arnar Mar Hrafnkelsson
2001-03-25 Initial revision
520 };
521 # Make fix indent
522 for (keys %formats) { $formats{$_}->{docs} =~ s/^\s+/ /mg; }
523 }
524
525
526
527 sub gen {
528 my $V = $ENV{$_[0]};
529 defined($V) ? $V : "";
530 }
531
532
533 # Get information from environment variables
534
535 sub getenv {
536
537 ($VERBOSE,
538 $INCPATH,
539 $LIBPATH,
540 $NOLOG,
541 $DEBUG_MALLOC,
542 $MANUAL,
543 $CFLAGS,
544 $LFLAGS,
545 $DFLAGS) = map { gen $_ } qw(IM_VERBOSE
546 IM_INCPATH
547 IM_LIBPATH
548 IM_NOLOG
549 IM_DEBUG_MALLOC
550 IM_MANUAL
551 IM_CFLAGS
552 IM_LFLAGS
553 IM_DFLAGS);
554
555 }
07ea6c21 » Tony Cook
2005-01-01 - Makefile.PL now attempts to use freetype-config to configure freety…
556
1d7e3124 » Tony Cook
2010-08-06 merge PNG branch and some clean-up
557 # populate the environment so that sub-modules get the same info
558 sub setenv {
559 $ENV{IM_VERBOSE} = 1 if $VERBOSE;
560 $ENV{IM_INCPATH} = join $Config{path_sep}, @incpaths if @incpaths;
561 $ENV{IM_LIBPATH} = join $Config{path_sep}, @libpaths if @libpaths;
562 }
563
e11d297f » Tony Cook
2005-01-06 - Makefile.PL now builds imconfig.h with #defines for libraries
564 sub make_imconfig {
565 my ($defines) = @_;
566
567 open CONFIG, "> imconfig.h"
568 or die "Cannot create imconfig.h: $!\n";
569 print CONFIG <<EOS;
570 /* This file is automatically generated by Makefile.PL.
571 Don't edit this file, since any changes will be lost */
572
573 #ifndef IMAGER_IMCONFIG_H
574 #define IMAGER_IMCONFIG_H
575 EOS
576 for my $define (@$defines) {
577 if ($define->[2]) {
578 print CONFIG "\n/*\n $define->[2]\n*/\n\n";
579 }
580 print CONFIG "#define $define->[0] $define->[1]\n";
581 }
53ea6b6f »
2011-08-08 avoid warning about gccversion being non-numeric
582 if ($Config{gccversion} && $Config{gccversion} =~ /^([0-9]+)/ && $1 > 3) {
8d14daab »
2011-06-14 switch to using size_t and i_img_dim strictly
583 print CONFIG <<EOS;
584 /*
585
586 Compiler supports the GCC __attribute__((format...)) syntax.
587
588 */
589
590 #define IMAGER_FORMAT_ATTR 1
53ea6b6f »
2011-08-08 avoid warning about gccversion being non-numeric
591
8d14daab »
2011-06-14 switch to using size_t and i_img_dim strictly
592 EOS
593 }
594
595 print CONFIG <<EOS;
596 /*
597 Type and format code for formatted output as with printf.
598
599 This is intended for formatting i_img_dim values.
600 */
601 typedef $Config{ivtype} i_dim_format_t;
602 #define i_DF $Config{ivdformat}
603 EOS
604
e11d297f » Tony Cook
2005-01-06 - Makefile.PL now builds imconfig.h with #defines for libraries
605 print CONFIG "\n#endif\n";
606 close CONFIG;
607 }
608
714cf158 » Tony Cook
2006-02-09 - check $Config{ldflags} and $Config{ccflags} for places to search for
609 # probes for freetype1 by scanning @incs for the includes and
610 # @libs for the libs. This is done separately because freetype's headers
611 # are stored in a freetype or freetype1 directory under PREFIX/include.
612 #
613 # we could find the files with the existing mechanism, but it won't set
614 # -I flags correctly.
615 #
616 # This could be extended to freetype2 too, but freetype-config catches
617 # that
618 sub freetype1_probe {
619 my ($frm, $frmkey) = @_;
620
621 my $found_inc;
622 INCS:
623 for my $inc (@incs) {
624 for my $subdir (qw/freetype freetype1/) {
625 my $path = File::Spec->catfile($inc, $subdir, 'freetype.h');
626 -e $path or next;
627 $path = File::Spec->catfile($inc, $subdir, 'fterrors.h');
628 -e $path and next;
629
630 $found_inc = File::Spec->catdir($inc, $subdir);
631 last INCS;
632 }
633 }
634
635 my $found_lib;
636 LIBS:
637 for my $lib (@libs) {
638 my $a_path = File::Spec->catfile($lib, "libttf$aext");
639 my $l_path = File::Spec->catfile($lib, "libttf.$lext");
640 if (-e $a_path || -e $l_path) {
641 $found_lib = $lib;
642 last LIBS;
643 }
644 }
645
89d37182 » Tony Cook
2006-02-17 prevent duplicate probe messages for freetype 1.x probing
646 return unless $found_inc && $found_lib;
714cf158 » Tony Cook
2006-02-09 - check $Config{ldflags} and $Config{ccflags} for places to search for
647 printf("%10s: includes %s - libraries %s\n", $frmkey,
648 ($found_inc ? 'found' : 'not found'),
649 ($found_lib ? 'found' : 'not found'));
650
651 $frm->{cflags} = "-I$found_inc";
652 $frm->{libfiles} = "-lttf";
653
654 return 1;
655 }
656
07ea6c21 » Tony Cook
2005-01-01 - Makefile.PL now attempts to use freetype-config to configure freety…
657 sub catfile {
658 return File::Spec->catfile(@_);
659 }
660
37959076 » Tony Cook
2005-01-24 - Makefile.PL now accepts command-line options to set include and lib…
661 sub usage {
662 print STDERR <<EOS;
274cd32b » Tony Cook
2005-11-29 - check the correct directory when adding the cygwin Win32 API include
663 Usage: $0 [--enable feature1,feature2,...] [other options]
664 $0 [--disable feature1,feature2,...] [other options]
37959076 » Tony Cook
2005-01-24 - Makefile.PL now accepts command-line options to set include and lib…
665 $0 --help
666 Possible feature names are:
85702fbd »
2011-08-16 basic clean up of Makefile.PL
667 T1-fonts
274cd32b » Tony Cook
2005-11-29 - check the correct directory when adding the cygwin Win32 API include
668 Other options:
669 --verbose | -v
670 Verbose library probing (or set IM_VERBOSE in the environment)
671 --nolog
672 Disable logging (or set IM_NOLOG in the environment)
673 --incpath dir
674 Add to the include search path
675 --libpath dir
676 Add to the library search path
35a15603 » Tony Cook
2009-11-10 document some undocumented Makefile.PL parameters
677 --coverage
678 Build for coverage testing.
679 --assert
680 Build with assertions active.
37959076 » Tony Cook
2005-01-24 - Makefile.PL now accepts command-line options to set include and lib…
681 EOS
682 exit 1;
683
684 }
92bda632 » Tony Cook
2006-01-10 - start of external Imager API access:
685
686 # generate the PM MM argument
687 # I'd prefer to modify the public version, but there doesn't seem to be
688 # a public API to do that
689 sub gen_PM {
690 my %pm;
691 my $instbase = '$(INST_LIBDIR)';
692
693 # first the basics, .pm and .pod files
694 $pm{"Imager.pm"} = "$instbase/Imager.pm";
695
696 my $mani = maniread();
697
698 for my $filename (keys %$mani) {
699 if ($filename =~ m!^lib/! && $filename =~ /\.(pm|pod)$/) {
700 (my $work = $filename) =~ s/^lib//;
701 $pm{$filename} = $instbase . $work;
702 }
703 }
704
705 # need the typemap
706 $pm{typemap} = $instbase . '/Imager/typemap';
707
708 # and the core headers
709 for my $filename (keys %$mani) {
710 if ($filename =~ /^\w+\.h$/) {
711 $pm{$filename} = $instbase . '/Imager/include/' . $filename;
712 }
713 }
714
715 # and the generated header
716 $pm{"imconfig.h"} = $instbase . '/Imager/include/imconfig.h';
717
718 \%pm;
719 }
135d30e3 » Tony Cook
2006-02-21 - fix/simplify META.yml generation - we now generate META.yml at
720
d8e0c3ba » Tony Cook
2007-12-06 rearrange dynaload code to avoid some OS X issues
721 my $home;
722 sub _tilde_expand {
723 my ($path) = @_;
724
725 if ($path =~ m!^~[/\\]!) {
726 defined $home or $home = $ENV{HOME};
727 if (!defined $home && $^O eq 'MSWin32'
728 && defined $ENV{HOMEDRIVE} && defined $ENV{HOMEPATH}) {
729 $home = $ENV{HOMEDRIVE} . $ENV{HOMEPATH};
730 }
731 unless (defined $home) {
732 $home = eval { (getpwuid($<))[7] };
733 }
734 defined $home or die "You supplied $path, but I can't find your home directory\n";
735 $path =~ s/^~//;
736 $path = File::Spec->catdir($home, $path);
737 }
738
739 $path;
740 }
741
678a9a65 » Tony Cook
2007-12-03 - work around Module::Depends::Intrusive bug #21229
742 1;
Something went wrong with that request. Please try again.