]> git.imager.perl.org - imager.git/blobdiff - Makefile.PL
bump to Imager 1.010
[imager.git] / Makefile.PL
index 786069de8b7aad3751cbf0456e53b7a3f684d727..80ceb9944c332bd473cff3b5d8733607c0145921 100644 (file)
@@ -41,6 +41,16 @@ if (grep $_ =~ /^--?v(?:erbose)?$/, @ARGV) {
   $VERBOSE = 1;
 }
 
+# modules/features bundled with Imager that can be enabled/disabled
+# withs --enable/--disable
+my @bundled = qw(FT1 FT2 GIF JPEG PNG T1 TIFF W32);
+
+# extra modules bundled with Imager not available on CPAN
+my @extras = qw(CountColor DynTest ICO SGI Mandelbrot Flines);
+
+# alternate names for modules
+my %bundled_names = qw(win32 w32 tt ft1);
+
 getenv();     # get environment variables
 
 my $lext=$Config{'so'};   # Get extensions of libraries
@@ -110,20 +120,20 @@ my @libs; # all the places to look for libraries
 init();       # initialize global data
 pathcheck();  # Check if directories exist
 
+my @enabled_bundled;
 if (exists $ENV{IM_ENABLE}) {
-  my %en = map { $_, 1 } split ' ', $ENV{IM_ENABLE};
-  for my $key (keys %formats) {
-    delete $formats{$key} unless $en{$key};
-  }
+  push @enable, split ' ', $ENV{IM_ENABLE};
 }
 if (@enable) {
-  my %en = map { $_ => 1 } map { split /,/ } @enable;
-  for my $key (keys %formats) {
-    delete $formats{$key} unless $en{$key};
-  }
+  my %en = map { lc $_ => 1 } map_bundled(@enable);
+  @enabled_bundled = grep $en{lc $_}, @bundled;
 }
 elsif (@disable) {
-  delete @formats{map { split /,/ } @disable};
+  my %dis = map { lc $_ => 1 } map_bundled(@disable);
+  @enabled_bundled = grep !$dis{lc $_}, @bundled;
+}
+else {
+  @enabled_bundled = @bundled;
 }
 
 # Pick what libraries are used
@@ -140,7 +150,7 @@ my @objs = qw(Imager.o context.o draw.o polygon.o image.o io.o iolayer.o
               map.o tags.o palimg.o maskimg.o img8.o img16.o rotate.o
               bmp.o tga.o color.o fills.o imgdouble.o limits.o hlines.o
               imext.o scale.o rubthru.o render.o paste.o compose.o flip.o
-             perlio.o);
+             perlio.o imexif.o);
 
 my $lib_define = '';
 my $lib_inc = '';
@@ -200,17 +210,18 @@ if (-d "xt" && scalar(() = glob("xt/*.t"))) {
 
 my %opts=
   (
-   'NAME'         => 'Imager',
-   'VERSION_FROM' => 'Imager.pm',
-   'LIBS'         => "$LFLAGS -lm $lib_libs $OSLIBS",
-   'DEFINE'       => "$OSDEF $lib_define $CFLAGS",
-   'INC'          => "$lib_inc $DFLAGS",
-   'OBJECT'       => join(' ', @objs),
+   NAME         => 'Imager',
+   VERSION_FROM => 'Imager.pm',
+   LIBS         => "$LFLAGS -lm $lib_libs $OSLIBS",
+   DEFINE       => "$OSDEF $lib_define $CFLAGS",
+   INC          => "$lib_inc $DFLAGS",
+   OBJECT       => join(' ', @objs),
+   DIR          => [ sort grep -d, @enabled_bundled, @extras ],
    clean          => { FILES=>'testout rubthru.c scale.c conv.c  filters.c gaussian.c render.c rubthru.c' },
    PM             => gen_PM(),
    PREREQ_PM      =>
    { 
-    'Test::More' => 0.47,
+    'Test::More' => 0.99,
     'Scalar::Util' => 1.00,
     'XSLoader'    => 0,
    },
@@ -228,22 +239,50 @@ if ($coverage) {
     }
 }
 
-# eval to prevent warnings about versions with _ in them
-my $MM_ver = eval $ExtUtils::MakeMaker::VERSION;
-if ($MM_ver > 6.06) {
+if (eval { ExtUtils::MakeMaker->VERSION('6.06'); 1 }) {
   $opts{AUTHOR} = 'Tony Cook <tonyc@cpan.org>, Arnar M. Hrafnkelsson';
   $opts{ABSTRACT} = 'Perl extension for Generating 24 bit Images';
 }
 
-if ($MM_ver >= 6.46) {
+if (eval { ExtUtils::MakeMaker->VERSION('6.46'); 1 }) {
+  $opts{LICENSE} = "perl_5";
   $opts{META_MERGE} =
     {
-     recommends =>
+     'meta-spec' =>
      {
-      "Parse::RecDescent" => 0
+      version => "2",
+      url => "https://metacpan.org/pod/CPAN::Meta::Spec",
+     },
+     prereqs =>
+     {
+      runtime =>
+      {
+       recommends =>
+       {
+        "Parse::RecDescent" => 0
+       },
+       requires =>
+       {
+       'Scalar::Util' => "1.00",
+       XSLoader => 0,
+       },
+      },
+      build =>
+      {
+       requires =>
+       {
+       XSLoader => 0,
+       },
+      },
+      test =>
+      {
+       requires =>
+       {
+       'Test::More' => "0.99",
+       },
+      },
      },
-     license => "perl",
-     dynamic_config => 1,
+     dynamic_config => 0,
      no_index =>
      {
       directory =>
@@ -260,8 +299,17 @@ if ($MM_ver >= 6.46) {
      resources =>
      {
       homepage => "http://imager.perl.org/",
-      repository => "git://git.imager.perl.org/imager.git",
-      bugtracker => "http://rt.cpan.org/NoAuth/Bugs.html?Dist=Imager",
+      repository =>
+      {
+       url => "git://git.imager.perl.org/imager.git",
+       web => "http://git.imager.perl.org/imager.git",
+       type => "git",
+      },
+      bugtracker =>
+      {
+       web => "https://rt.cpan.org/Dist/Display.html?Name=Imager",
+       mailto => 'bug-Imager@rt.cpan.org',
+      },
      },
     };
 }
@@ -371,29 +419,31 @@ EOF
 sub automatic {
   print "Automatic probing:\n" if $VERBOSE;
 
-  my %probe =
-    (
-      name => "FT1",
-      inccheck => sub { -e File::Spec->catfile($_[0], "ftnameid.h") },
-      libbase => "ttf",
-      testcode => _ft1_test_code(),
-      testcodeheaders => [ "freetype.h", "stdio.h" ],
-      incpaths => \@incpaths,
-      libpaths => \@libpaths,
-      alternatives =>
-      [
-       {
-       incsuffix => "freetype",
-       }
-      ],
-      verbose => $VERBOSE,
-    );
-  my $probe_res = Imager::Probe->probe(\%probe);
-  $IMAGER_LIBS{FT1} = defined $probe_res;
-  if ($probe_res) {
-    $formats{FT1}{enabled} = 1;
-    @{$formats{FT1}}{qw/DEFINE INC LIBS/} =
-      @$probe_res{qw/DEFINE INC LIBS/};
+  if (grep $_ eq "FT1", @enabled_bundled) {
+    my %probe =
+      (
+       name => "FT1",
+       inccheck => sub { -e File::Spec->catfile($_[0], "ftnameid.h") },
+       libbase => "ttf",
+       testcode => _ft1_test_code(),
+       testcodeheaders => [ "freetype.h", "stdio.h" ],
+       incpaths => \@incpaths,
+       libpaths => \@libpaths,
+       alternatives =>
+       [
+       {
+        incsuffix => "freetype",
+       }
+       ],
+       verbose => $VERBOSE,
+      );
+    my $probe_res = Imager::Probe->probe(\%probe);
+    $IMAGER_LIBS{FT1} = defined $probe_res;
+    if ($probe_res) {
+      $formats{FT1}{enabled} = 1;
+      @{$formats{FT1}}{qw/DEFINE INC LIBS/} =
+       @$probe_res{qw/DEFINE INC LIBS/};
+    }
   }
 }
 
@@ -699,4 +749,19 @@ return 0;
 CODE
 }
 
+sub map_bundled {
+  my (@names) = @_;
+
+  @names = map { split /,/ } @names;
+
+  my @outnames;
+  for my $name (@names) {
+    push @outnames, $name;
+    push @outnames, $bundled_names{$name}
+      if $bundled_names{$name};
+  }
+
+  @outnames;
+}
+
 1;