]> git.imager.perl.org - imager.git/blobdiff - FT2/Makefile.PL
Change note for strerror() fix
[imager.git] / FT2 / Makefile.PL
index fc191364a37760febfb0fd9015dee3a3ba86a6ef..b2925be5cf3b1b3b00fdc164bfcb8fbd06541143 100644 (file)
@@ -1,6 +1,6 @@
 #!perl -w
 use strict;
-use ExtUtils::MakeMaker qw(WriteMakefile WriteEmptyMakefile);
+use ExtUtils::MakeMaker;
 use Getopt::Long;
 use Config;
 
@@ -13,8 +13,7 @@ GetOptions("incpath=s", \@incpaths,
            "verbose|v" => \$verbose);
 
 our $BUILDING_IMAGER;
-
-$DB::single = 1;
+our %IMAGER_LIBS;
 
 my $MM_ver = eval $ExtUtils::MakeMaker::VERSION;
 
@@ -39,7 +38,7 @@ else {
   $opts{TYPEMAPS} = [ Imager::ExtUtils->typemap ];
 
   # Imager required configure through use
-  my @Imager_req = ( Imager => "0.77" );
+  my @Imager_req = ( Imager => "0.95" );
   if ($MM_ver >= 6.46) {
     $opts{META_MERGE} =
       {
@@ -55,17 +54,15 @@ else {
        resources =>
        {
        homepage => "http://imager.perl.org/",
-       repository =>
-       {
-        url => "http://imager.perl.org/svn/trunk/Imager-Font-FT2",
-        web => "http://imager.perl.org/svnweb/public/browse/trunk/Imager-Font-FT2",
-        type => "svn",
-       },
+       repository => "git://git.imager.perl.org/imager.git",
+       bugtracker => "http://rt.cpan.org/NoAuth/Bugs.html?Dist=Imager",
        },
       };
     $opts{PREREQ_PM} =
       {
        @Imager_req,
+       'Scalar::Util' => 1.00,
+       XSLoader => 0,
       };
   }
 }
@@ -81,8 +78,9 @@ my %probe =
    libbase => "freetype",
    testcode => _ft2_test_code(),
    testcodeheaders => [ "stdio.h", "string.h", "ft2build.h" ],
-   incpath => join($Config{path_sep}, @incpaths),
-   libpath => join($Config{path_sep}, @libpaths),
+   testcodeprologue => _ft2_test_code_prologue(),
+   incpath => \@incpaths,
+   libpath => \@libpaths,
    alternatives =>
    [
     {
@@ -92,25 +90,32 @@ my %probe =
      incsuffix => "freetype",
     },
    ],
+   verbose => $verbose,
   );
 
 my $probe_res = Imager::Probe->probe(\%probe);
 if ($probe_res) {
+  $IMAGER_LIBS{FT2} = 1;
+
   push @inc, $probe_res->{INC};
   $opts{LIBS} = $probe_res->{LIBS};
-
+  $opts{DEFINE} = $probe_res->{DEFINE};
   $opts{INC} = "@inc";
+  $opts{LDDLFLAGS} = $probe_res->{LDDLFLAGS}
+    if $probe_res->{LDDLFLAGS};
 
   if ($MM_ver > 6.06) {
-    $opts{AUTHOR} = 'Tony Cook <tony@imager.perl.org>';
+    $opts{AUTHOR} = 'Tony Cook <tonyc@cpan.org>';
     $opts{ABSTRACT} = 'FreeType 2 font driver for Imager';
   }
   
   WriteMakefile(%opts);
 }
 else {
+  $IMAGER_LIBS{FT2} = 0;
+
   if ($BUILDING_IMAGER) {
-    WriteEmptyMakefile(%opts);
+    ExtUtils::MakeMaker::WriteEmptyMakefile(%opts);
   }
   else {
     # fail in good way
@@ -120,10 +125,30 @@ else {
 
 sub _ft2_test_code {
   return <<'CODE';
+FT_Library library = 0;
+FT_Face face = 0;
+FT_Error error;
+error = FT_Init_FreeType(&library);
+if (error) {
+  fprintf(stderr, "FreeType 2: cannot initialize library: %d\n", error);
+  return 1;
+}
+error = FT_New_Face(library, "fontfiles/dodge.ttf", 0, &face);
+if (error) {
+  fprintf(stderr, "FreeType 2: cannot load font: %d\n", error);
+  return 1;
+}
 return 0;
 CODE
 }
 
+sub _ft2_test_code_prologue {
+  return <<'CODE';
+#include FT_FREETYPE_H
+
+CODE
+}
+
 sub is_exe {
   my ($name) = @_;
 
@@ -131,10 +156,13 @@ sub is_exe {
   if ($^O eq 'MSWin32') {
     push @exe_suffix, qw/.bat .cmd/;
   }
+  elsif ($^O eq 'cygwin') {
+    push @exe_suffix, "";
+  }
 
   for my $dir (File::Spec->path) {
     for my $suffix (@exe_suffix) {
-      -x catfile($dir, "$name$suffix")
+      -x File::Spec->catfile($dir, "$name$suffix")
        and return 1;
     }
   }