]> git.imager.perl.org - imager.git/blobdiff - Makefile.PL
Adds reading capabilities for certain variants of targa, writer code has not been
[imager.git] / Makefile.PL
index b0c06b62aed49b0ee83ce0d061d565ba832def3b..b4d2817c9beb23611c5e9004c8563b2e5c3bf2f1 100644 (file)
@@ -61,7 +61,9 @@ if (defined $Config{'d_dlsymun'}) { $OSDEF  .= ' -DDLSYMUN'; }
 @objs = qw(Imager.o draw.o image.o io.o iolayer.o log.o
           gaussian.o conv.o pnm.o raw.o feat.o font.o
           filters.o dynaload.o stackmach.o datatypes.o
-          regmach.o trans2.o quant.o error.o convert.o);
+          regmach.o trans2.o quant.o error.o convert.o
+          map.o tags.o palimg.o maskimg.o img16.o rotate.o
+           bmp.o tga.o color.o fills.o);
 
 %opts=(
        'NAME'         => 'Imager',
@@ -69,7 +71,8 @@ if (defined $Config{'d_dlsymun'}) { $OSDEF  .= ' -DDLSYMUN'; }
        'LIBS'         => "$LFLAGS -lm $OSLIBS $F_LIBS",
        'DEFINE'       => "$F_DEFINE $EXTDEF $OSDEF $CFLAGS",
        'INC'          => "$DFLAGS $F_INC",
-       'OBJECT'       => join(' ', @objs, $F_OBJECT)
+       'OBJECT'       => join(' ', @objs, $F_OBJECT),
+       clean          => { FILES=>'testout' },
       );
 
 if ($] ge '5.005') {
@@ -80,12 +83,13 @@ if ($] ge '5.005') {
 if ($VERBOSE) { print Dumper(\%opts); }
 mkdir('testout',0777); # since we cannot include it in the archive.
 WriteMakefile(%opts);
+
 exit;
 
 
 sub MY::postamble {
 '
-dyntest.(MYEXTLIB) : dynfilt/Makefile
+dyntest.$(MYEXTLIB) : dynfilt/Makefile
        cd dynfilt && $(MAKE) $(PASTHRU)
 
 lib/Imager/Regops.pm : regmach.h regops.perl
@@ -110,7 +114,7 @@ EOF
   SWX:
     if ($formats{$frm}{docs}) { print "\n",$formats{$frm}{docs},"\n\n"; }
     print "Enable $frm support: ";
-    $gz=<STDIN>;
+    $gz = <STDIN>;
     chomp($gz);
     if ($gz =~ m/^(y|yes|n|no)/i) {
       $gz=substr(lc($gz),0,1);
@@ -132,10 +136,35 @@ sub automatic {
 
 
 sub gifcheck {
-  if ($formats{'gif'} and $formats{'ungif'}) { 
+  if ($formats{'gif'} and $formats{'ungif'}) {
     print "ungif and gif can not coexist - removing ungif support\n";
     delete $formats{'ungif'};
   }
+
+ RETR:
+  if ($formats{'gif'} or $formats{'ungif'}) {
+    print <<EOFF;
+
+You have libgif or libungif installed.  They are both known to have
+bugs.  Imager can crash or display other strange behaviour after
+reading or writing gif images.  Some of the gif tests can even fail
+since they stress some parts of the buggy code.
+
+Do you want to remove gif support? [Y/n]
+EOFF
+    my $resp = <STDIN>;
+    chomp($resp);
+    if ($resp ne "n") {
+      delete $formats{'gif'};
+      delete $formats{'ungif'};
+      return;
+    }
+  }
+
+  for my $frm (qw(gif ungif)) {
+    checkformat($frm) if ($MANUAL and $formats{$frm});
+  }
+
   my @dirs;
   for my $frm (grep $formats{$_}, qw(gif ungif)) {
     push(@dirs, @{$formats{$frm}{incdir}}) if $formats{$frm}{incdir};
@@ -157,7 +186,7 @@ sub gifcheck {
   }
 
   # we need the version in a #ifdefable form
-  
+
   $F_DEFINE .= "-DIM_GIFMAJOR=$major -DIM_GIFMINOR=$minor";
 }
 
@@ -233,12 +262,16 @@ sub pathcheck {
 sub init {
 
   @definc{'/usr/include'}=();
-  @incs=(qw(/usr/include /usr/local/include /usr/include/freetype /usr/local/include/freetype), split /:/, $INCPATH );
+  @incs=(qw(/usr/include /usr/local/include /usr/include/freetype /usr/local/include/freetype /usr/include/freetype2 /usr/local/include/freetype2), split /:/, $INCPATH );
   @libs=(split(/ /, $Config{'libpth'}), split(/:/, $LIBPATH) );
   if ($^O =~ /win32/i && $Config{cc} =~ /\bcl\b/i) {
     push(@incs, split /;/, $ENV{INCLUDE}) if exists $ENV{INCLUDE};
     push(@libs, split /;/, $ENV{LIB}) if exists $ENV{LIB};
   }
+  if ($^O eq 'cygwin') {
+    push(@libs, '/usr/lib/w32api') if -d '/usr/lib/w32api';
+    push(@incs, '/usr/include/w32api') if -d '/usr/lib/w32api';
+  }
 
   $formats{'jpeg'}={
                    order=>'21',
@@ -310,7 +343,7 @@ sub init {
                        order=>'30',
                        def=>'HAVE_LIBT1',
                        inccheck=>sub { $_[0] eq 't1lib.h' },
-                       libcheck=>sub { $_[0] eq 'libt1.a' or $_[0] eq "libt1.$lext" },
+                       libcheck=>sub { $_[0] eq "libt1$aext" or $_[0] eq "libt1.$lext" },
                        libfiles=>'-lt1',
                        objfiles=>'',
                        docs=>q{
@@ -324,7 +357,7 @@ sub init {
                        order=>'31',
                        def=>'HAVE_LIBTT',
                        inccheck=>sub { $_[0] eq 'freetype.h' },
-                       libcheck=>sub { $_[0] eq 'libttf.a' or $_[0] eq "libttf.$lext" },
+                       libcheck=>sub { $_[0] eq "libttf$aext" or $_[0] eq "libttf.$lext" },
                        libfiles=>'-lttf',
                        objfiles=>'',
                        docs=>q{
@@ -334,6 +367,32 @@ sub init {
                                used to rasterize for us. The only drawback is that there
                                are alot of badly designed fonts out there.}
                       };
+  $formats{'w32'} = {
+                    order=>40,
+                    def=>'HAVE_WIN32',
+                    inccheck=>sub { lc $_[0] eq 'windows.h' },
+                    libcheck=>sub { lc $_[0] eq 'gdi32.lib' 
+                                      || lc $_[0] eq 'libgdi32.a' },
+                    libfiles=>$^O eq 'cygwin' ? '-lgdi32' : '',
+                    objfiles=>'win32.o',
+                    docs => <<DOCS
+Uses the Win32 GDI for rendering text.
+
+This currently only works on under normal Win32 and cygwin.
+DOCS
+                   };
+  $formats{'freetype2'} = {
+                           order=>'29',
+                           def=>'HAVE_FT2',
+                           inccheck=>sub { lc $_[0] eq 'ft2build.h' },
+                           libcheck=>sub { $_[0] eq "libfreetype$aext" or $_[0] eq "libfreetype.$lext" },
+                           libfiles=>'-lfreetype',
+                           objfiles=>'freetyp2.o',
+                           docs=><<DOCS
+Freetype 2 supports both Truetype and Type 1 fonts, both of which are
+scalable.
+DOCS
+                          };
   # Make fix indent
   for (keys %formats) { $formats{$_}->{docs} =~ s/^\s+/  /mg; }
 }