#!perl -w
use strict;
-use ExtUtils::MakeMaker qw(WriteMakefile WriteEmptyMakefile);
+use ExtUtils::MakeMaker;
use Getopt::Long;
use Config;
"verbose|v" => \$verbose);
our $BUILDING_IMAGER;
-
-$DB::single = 1;
+our %IMAGER_LIBS;
my $MM_ver = eval $ExtUtils::MakeMaker::VERSION;
$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} =
{
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,
};
}
}
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 =>
[
{
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
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) = @_;
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;
}
}